Barcode scanning into Swing textfield sometimes swaps characters - java

We see an extremly weird behaviour with barcode scanners and a Java Swing application on Windows 7 and jre8. This is a large deployment of more than 1000 PCs and several different barcode models. We scan barcodes that represent strings with 9 characters: H06AVKTI2
Now "sometimes on some installations" some of the later characters appear in the wrong order:
H06AVKTI2
H06AVKI2T
H06AVKTI2
When we scan into notepad or an outlook email, we never see the problem, only in our Swing app.
it only happens with the 3-4 last characters of the string, the first 4-5 are always correct.
It happens with most/all barcode scanner models and PCs, but on some installations never, on others often - no pattern so far...
It is nowhere 100% reproducible - just on some PCs it happens often (more than 50% of scans are wrong)
When we started two instances of our application on the same PC we saw it happen in one instance very often but never in the other.
It does not seem to relate to the specific scanner model, barcode, user or installation
there is no network traffic when we type into this field, hit enter or any other key when this field is focused - we checked with Wireshark.
Any idea is welcome - we are desperate ;-)

We eventually solved this. Turns out that this Java Swing application allows to configure keyboard shortcuts that are available to execute certain business tasks under certain conditions. Somebody had globally configured shift-t and some other shift-_ to be shortcuts for business transactions.
Now even though these business transactions were not available in the context when we scan barcodes, the app seems to interupt for a few milliseconds whenever it receives a shift-t. When the barcode-scanner scans a code containing a "T", it sends one of these shift-t combinations and the software takes a very short time just to determine, that there is nothing to do for this shortcut. In these cases the scanned characters end up being swapped. So this obviously only happend when we scanned a code containing one of the characters we had configured shortcuts for...
Solution was to change the configured shortcuts to ctrl-t instead of shift-t.
Root cause is probably the way the framework developers of the app implemented those global shortcuts, but this has not been verified.

Related

iFogSim: changing the default number of proxies or even any middle layer

I'm working on a simulation scenario where I need to have a certain number of nodes in the middle layers, such as proxies and gateways.
I saw in the refernce article of iFogSim2 that the number of proxies is 12 and the number of gateways is 118 by default.
Actually, I want to change that in order to make different simulation cases.
I tried to search for '118' and '12' in the whole workspace but I don't found the instruction which is responsible of that.
I also looked the config files, but... nothing!
Is there anyone who can help ?

How to speed up the change of language in the Text to Speech?

Suppose I have activity on which there is a list of 10 items. Each element is a text in some language. Suppose each language has a voice output. If I want to make a button, by clicking on which all texts will be read in their own language, I need to change the language before I start reading each text. The problem is that changing the language takes a lot of time (from 2-3 seconds to 5-7) on some phones that I checked. I saw the application where it happens instantly. How can I implement this without creating another object for each language?
Different phones have different speech engines installed on them (Google, Samsung, PICO, etc)...
The delay is going to vary slightly based on which engine is being used... and a lot based on:
1) Whether any voices are previously installed that correspond to the language you're attempting to speak,
2) Whether the voice being used to speak is a "network voice" (utterance is retrieved via network)
So to get zero delay, the voices must be installed and they must not be network voices.

how to record keystrokes in background using java?

I am going to research on which key typed most in which hour in a 24-hour-day?
Later, I would research on which word used most in which hour in a 24-hour-day?
Say in the evening you would find most used word good or bye as people usually ends up their meeting in the evening.
So, I need to record keystrokes on the background using a java application with a time-stamp.
My questions are:
How to run a java program on the background?(Obviously informing the user).
How to record keystrokes which are used in other applications and counted in the java application without affecting its original application?
Note that:
This question does not serve my problem. Though it has an accepted answer, but the answer is not helpful for me because it could not distinguish between uppercase and lowercase letter, it returns same ASCII character. It just gave some sources and some other files. I expect more readable answer and a clear view how the java program launch on the start up and run on the background.
Just a little information to get you moving in the right direction. What you are looking to implement to listen for the keystrokes is KeyListener. I believe the actual function is keyTyped(ActionEvent e) but am not sure.
Other then that to run a program silently in the background will probably require some manipulation of the window + windows properties. You could just have the program run without a UI, or create a very lightweight UI that posts data. If you are looking for an actual "out of sight out of mind" background process, I am not sure how to do this with Java. However I imagine just an un-intrusive GUI would be sufficient for your purposes.

Is it possible to modify the time OSCeleton sends a lost_user event/message?

I'm playing around with OSCeleton and Processing and succesfully got to track skeletons and do stuff.
What I'm wondering is if there's any way to change the delay time a "lost_user" message is sent to Processing.
This is taking so long for what I'm trying to achive, since i need to stop tracking a user as soon as he goes away from the screen, so I can accept another user's interaction. (imagine an installation where a lot of people wants to play with).
any help/tips would be really appreciated.
Jon
As far as I can tell from the OSCeleton's source and with my minimal experience with the kinect(I never used OSCeleton), there is no way to modify that code to do that. It seems to be a thing handled even lower, by the driver or by the kinect its self(?).
Yet you need not bind yourself with that, and I would suggest a couple of ways to bypass the problem if I understand properly.
First, the latest drivers and examples should have multi-user support, meaning you can just arrange who is your main user. From what I can tell from the source you do get an osc message in Processing when a new user is detected as well as an ID number. You can put each new user that arrives, into an arrayList and figure out a way to do things without depending on the latest user.
If you are still going for the user-after-user thing though, or I was mistaken about the multi-user support(which is mentioned nowhere in the README), you can check yourself whether a user has left the area. Although you can not get a definitive answer like that you can check for example, whether a specific joint or all joints of a user have moved in the last 10-20 osc messages received. That probably means storing the position of this joint in an 10-20 item array and continuously updating while also doing a check on whether the items are different. If all items in the array are the same, your user has not moved a bit and thus probably should not be taken to account.
Last but not least you can switch to other solutions. The one I used about a year ago was "Synapse for Kinect" which also seems stale now. The latest you can use is a Processing library called SimpleOpenNI which definitively have multi-user tracking and you won't need any intermediary programs running to give you the joints.
I hope this helps

Parsing IBM 3270 data in java

I was wondering if anyone had experience retrieving data with the 3270 protocol. My understanding so far is:
Connection
I need to connect to an SNA server using telnet, issue a command and then some data will be returned. I'm not sure how this connection is made since I've read that a standard telnet connection won't work. I've also read that IBM have a library to help but not got as far as finding out any more about it.
Parsing
I had assumed that the data being returned would be a string of 1920 characters since the 3278 screen was 80x24 chars. I would simply need to parse these chars into the appropriate fields. The more I read about the 3270 protcol the less this seems to be the case - I read in the documentation provided with a trial of the Jagacy 3270 Java library that attributes were marked in the protocol with the char 'A' before the attribute and my understanding is that there are more chars denoting other factors such as whether fields are editable.
I'm reasonably sure my thinking has been too simplistic. Take an example like a screen containing a list of items - pressing a special key on one of the 24 visible rows drills down into more detailed information regarding that row.
Also it's been suggested to me that print commands can be issued. This has some positive implications - if the format of the string returned is not 1920 since it contains these characters such as 'A' denoting how users interact with the terminal, printing would eradicate these. Also it would stop having to page through lots of data. The flip side is I wouldn't know how to retrieve the data from the print command back to Java.
So..
I currently don't have access to the SNA server but have some screen shots of what the terminal will look like once I get a connection and was therefore going to start work on parsing. With so many assumptions and not a lot of idea on what the data will look like I feel really stumped. Does anyone have any knowledge of these systems that might help me back on track?
You've picked a ripper of a problem there. 3270 is a very complex protocol indeed. I wouldn't bother about trying to implement it, it's a fool's errand, and I'm speaking from painful personal experience. Try to find a TN3270 (Telnet 3270) client API.
This might not specifically answer your question, but...
If you are using Rational Developer for z/OS, your java code should be able to use the integrated HATS product to deal with the 3270 stream. It might not fit your project, but I thought I would mention it if all you are trying to do is some simple screen scraping, it makes things very easy.

Categories