I have to do a library Magement System in Java Swing. I had done it well with all your supports. Thank you all. Now this s/w needs to identify book and students by barcode (1d). I couldn't get a perfect logic from any where. I have read in SO and other web. I got some logic. But the vision is not clear.
I know this.
bar-code scanner output to port - listen to key strock- need Interface
My doubt is
What the order of the logic flow. ?
do i have to add any lib/jar files to do it.
how to implement this?
I have read a focused text field is needed. How to know did the scanner end key stocks.
I am totally confused. Sorry for reading poor English. I will make up this
Advanced thanks for all your support .
Read the picture from the reader (depends on the hardware, you might need to use the proprietary API or whatever it requires)
Use a barcode reading library to 'parse' the picture. (like zxing, which maybe can access a camera?)
which will give you the number hidden in the barcode.
Related
I have a bit of a rookie question regarding storage of map data i a java game. I'm making a 2d tile-based game, where each tile has an id (1, 2, 3, 4 and so on...). I currently store the game data in a .txt file, where each number is seperated by a tab. Therefrom i read it via scanners .nextInt.
This method works fine, but it seems to give me a problem:
Since the level file is just a normal .txt file it is easily edited by anyone. This means that the user could just change a few numbers in the file with any kind of text editor and thereby easily cheat.
How would this be avoided? Should i store the map data differently or should i use some form of encryption?
One solution to this would be to store the data in a database, such as derby. Once the game has been exported as a jar file the casual player will never even see the file, and if they do get their hands on it, probably wouldn't know what to do with it.
Here is a nice tutorial on how to set up and connect to a simple derby database.
http://www.vogella.com/tutorials/ApacheDerby/article.html
good luck.
Java has a Serializable interface that can be used to save java objects.
API docs can be found here: http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html
This doesn't make it impossible for people to cheat and change the maps just more difficult.
If you're really worried about it you could use some form of encryption or add a checksum to further prevent tampering.
O community, I'm in the process of writing the pseudocode for an application that extracts song lyrics from a remote host (web-server, not my own) by reading the page's source code.
This is assuming that:
Lyrics are being displayed in plaintext
Portion of source code containing lyrics is readable by Java front-end application
I'm not looking for source code to answer the question, but what is the technical term used for querying a remote webpage for plaintext content?
If I can determine the webpage naming scheme, I could set the pointer of the URL object to the appropriate webpage, right? The only limitations would be irregular capitalization, and would only be effective if the plaintext was found in EXACTLY the same place.
Do you have any suggestions?
I was thinking something like this for "Buck 65", singing "I look good"
URL url = new URL(http://www.elyrics.net/read/b/buck-65-lyrics/i-look-good-lyrics.html);
I could substitute "buck-65-lyrics" & "i-look-good-lyrics" to reflect user input?
Input re-directed to PostgreSQL table
Current objective:
User will request name of {song, artist, album}, Java front-end will query remote webpage
Full source code (containing plaintext) will be extracted with Java front-end
Lyrics will be extracted from source code (somehow)
If song is not currently indexed by PostgreSQL server, will be added to table.
Operations will be made on the plaintext to suit the objectives of the program
I'm only looking for direction. If I'm headed completely in the wrong direction, please let me know. This is only for the pseudocode. I'm not looking for answers, or hand-outs, I need assistance in determining what I need to do. Are there external libraries for extracting plaintext that you know of? What technical names are there for what I'm trying to accomplish?
Thanks, Tyler
This approach is referred to as screen or data scraping. Note that employing it often breaks the target service's terms of service. Usually, this is not a robust approach, which is why API-like services with guarantees about how they operate are preferable.
Your approach sounds like it will work for the most part, but a few things to keep in mind.
If the web service you're interacting with requires a very precise URL scheme, you should not feed your user-provided data directly into it, since it is likely to be muddied by missing words, abbreviations, or misspellings. You might be better off doing some sort of search, first, and using that search's best result.
Reading HTML data is more complicated than you think. Use an existing library like jsoup to assist you.
The technical term to extract content from a site is web scraping, you can google that. There are a lot of online libraries, for java there is jsoup. Though its easy to write your own regex.
1st thing I would do i use curl and get the content from the site just for testing, this will give you a fair idea of what to do.
You will have to use a HTML parser. One of the most popular is jsoup.
Take care abut the legal aspect fo what you you do ;)
I'd like to modify the audio input stream, the stream that would come
from my microphone.
I have looked through the java.sound package API, but did not entirely understand it,
nor how to modify direct sound input.
Does anyone here know how to do that, or know an API that is capable of doing it?
You want a mixture of things:
The Java Sound system: http://www.oracle.com/technetwork/java/index-139508.html
A trail for it: http://docs.oracle.com/javase/tutorial/sound/index.html
Using audio controls: http://docs.oracle.com/javase/1.5.0/docs/guide/sound/programmer_guide/chapter6.html (part of a wider set of documentation)
If you are able to give more information about what you want to do to the audio stream, it's likely we'll be able to give you more specific advice.
I have several devices that install as HID keyboard devices in most any operating system and, when used, send a string of text back, just like a keyboard. Is there any way in a Swing app to listen only to a chosen device, ignoring the standard keyboard, and do it without a TextComponent to capture the data? Thanks!
For anyone who comes across via google, etc, here is the solution I finally found.
(This is a solution to the second part of my question, how to capture input without a TextComponent).
I followed this tutorial and attached a KeyListener to my program. This allowed me to capture and parse input, albeit rather awkwardly. I have yet to find a smoother solution to this.
I may come back and add code to this. Please leave a comment if I have not yet done so and you would find it helpful
I need to implement a program to handle a word correction / suggestion system.
- if input is given as 'freind', it should suggest 'friend'.
For this I have a GUI containing a text area alone!
Suggest to me a way to accomplish this. If not in Java, you can also suggest me in Python, using javascript also because I can use those as well.
Thanx in advance. :)
there are lots of opensource spell checker available
http://spellerpages.sourceforge.net/
http://jazzy.sourceforge.net/