Form hangs while waiting on input - winforms

I have written a custom point of sale system for our company. I have everything working, but found a small bug. After all the items have been added to the sale when they hit the "Credit" button it opens a credit card processing corm and has a function that listens for a card swipe. After it is swiped it fills in all the fields and asks for the CVV number then they hit process button and it's over.
The issue is say they "Accidentally" hit credit. The program freezes waiting for a card swipe. The close window button and everything doesn't respond to input. I am wanting a way to have the function that listens for the card run, but lets everything else proceed as well. My listener method is below.
Private Sub LoadCardReader()
Timer1.Stop()
If IsNothing(_Device) Then
_Device = HidDevices.Enumerate(2049, 2).FirstOrDefault()
End If
_Device.OpenDevice()
_Device.MonitorDeviceEvents = True
Dim report As HidReport = _Device.ReadReport() 'This is where it hangs'
ParseReport(report)
End Sub
I approached this from another avenue and have it working. I wrote a windows application that I call when the POS starts. It does nothing but listen for a card swipe then writes it to a text file. Then I put a timer on the POS that looks to see if the text file exists. If it does it reads the data parses it then deletes the file so it will not pick it up again. Anyone see an issue with that?

Related

validation if there is any error is present in form then can not go to next page in react

In my form if i enter numbers rather than text and it will give an error then after clicking on next button it should not be redirected to next page.
how to prevent this.
The clicking on the next button will execute a validation function, and based on the result, you will decide whether to navigate to the other page or display an error and stay on the same page.
Even better (and assuming that you have multiple fields in the form): check the value of every field when the user leaves the field (onBlur) and notify the user about the error immediately then. This is not instead of running validation on 'Next' or on 'Submit', since the user may click on the button without visiting that field.
Long time ago (as a test for me, during my study of react), I created a small project that implements a form. It is far from perfect, but you might find it useful: https://github.com/rahamin1/reactstrap-form

Sencha touch mainView push/pop strange behaviour after pushing 5 forms

I'm building account system using sencha touch (architect) and now I have an issue where the code executed but the this.getMainView().pop(); NOT and the view states on current one !
my views:
Login scrn--> cstmrs list--> cstmr details--> rceipt--> checks
When I get to receipt view (without checks) the code executed and auto returned to customer's details view.
But soon I click to add a check to the receipt (only displaying the form without any code) the check view injected to mainview after that I click back button to return to receipt window, but now when I click save button the receipt is saved and the data arrives server side ok, but the big problem the this.getMainView().pop(); doesn't work or doesn't executed !!
Is there any wrong with my code? it works without displaying the 'checks' form !
Nothing in firebug/chrome debugger
I use this code to show forms:
var mainView=this.getMainView();
mainView.push({xtype: "frmChcks",title:'new check'});
And this code for getting back:
this.getMainView().pop();
Thank you in advice
Ahhhh it was because I used a hidden field called 'id', don't use 'id' for you components :-)

AngularJS & Firebase app paging feature not working

I'm following a tutorial that shows one how to make a chat app with a paging feature but for some reason the code responsible for the Prev page and Next page paging buttons do not work as expected.
Here is the app in a Plunker:
http://embed.plnkr.co/zxp9wcKaMcfM2U0vAJhG/preview
Every time one clicks the Next button, one is supposed to see the next 10 message in the Firebase message object starting from the first one. Keep in mind I have 28 messages in the messages object. So when you click the Next button once, you will see the next 10 messages as expected but when you click it a second time the message list goes blank.
So when I tried to debug this manually I decided to run console.log(lastItem.name) since this seemed to be the critical parameter to get this function to work. So you can see in the console that the first time you click Next, you will see the Firebase ID of -JX7ZlaB0QTa0Z47eu28 logged. That makes sense since it is the name/ID of the last message object in the first 10 that are returned to the page on page load. When you click Next again, we expect to see a similar looking message object name/ID but instead we just see the string messages logged to the console.
So it seems like the pageNext function is jumping up the data tree, from an individual message object to the whole entire messages object. And then when we press Next again we see this error
TypeError: Cannot read property 'name' of undefined
at h.$scope.pageNext (http://run.plnkr.co/plunks/zxp9wcKaMcfM2U0vAJhG/main.js:32:24)
So it looks like it jumps to the root of the data tree I guess which contains nothing. Any idea why this is happening and how to fix it?
Your messages only have a user and text property.
In the pageNextand pageBack methods, where you're getting the error, you're getting the last message and trying to read the name property which doesn't 'exist.
I'm guessing you meant to read the user from the last message?
In your pageNext and pageBack method you're referring to the wrong snapshot.
When I fix that, the plunker works:
messageRef.startAt(null, name).limit(numberOfItems).once('value', function(snapshot) {
snapshot.forEach(function(snapItem) {
var itemVal = snapItem.val();
itemVal.name = snapItem.name(); // was snapshot.name()
messages.push(itemVal);
});
deferred.resolve(messages);
});

Handling Browser compatibilties with ADF

I am trying to capture keypress event for "ENTER" key for input box inside ADF editable table. I have added client listener and server listener and have the JavaScript code for the input box inside af:resource tag.
The requirement is as follows -
I have a editable table with total of 6 columns but only first and last columns are editable. So when user enters a value in first column and hits enter I need to populate some data from some other business component and fill the other columns.
I am able to capture the enter keypress event, but when I am using chrome after the server side method is called the row focus is automatically moved to next row in the table.
Can someone tell me how to stop this on the table. This happens only in chrome. The code works fine in firefox and IE.
You could set focus on the field you need through javascript on request. But you need to know the client Id of the component to set focus on.
Call this in your event handler:
String clientId = ...
String script = "AdfPage.PAGE.findComponent('" + clientId + "').focus();";
FacesContext context = FacesContext.getCurrentInstance();
Service.getRenderKitService(context,
ExtendedRenderKitService.class).addScript(context, script);
script will be called on the client when response is handled.

Wait before Server Side Event kicks for telrik controls

I am using Telerik Combobox with EnableLoadONLoad = True i.e. Every time end user type a letter, server side event kicks in to pull records for that word. For example, In the dropdown box, if I type America then the system will search for A then AM then AME and so on... and brings results that matches those letters. So, in the case above, the system will ick server side event 7 times. Now the problem is search functionality takes a while (anywhere from 5 - 10 seconds to pull records.. beyond my control :( ) What I want is when end user type something , I want to wait for a second to see if user is still typing. After a second, I want the system to go for search. Hoping that within a second, end user will type whatever they need to. Now I can force the user to type minimum 5 letters and so on but end user can search with a single letter or multiple letters. They don't want to be restricted with no. of letters due to business requirements.
You can just specify an 'ItemRequestTimeout' in milliseconds of 1000 which will tell the combobox to wait 1 second before firing to the server.
The itemRequestTimeout on their comboboxes is 300 by default which is 3 tenths of a second. doing what Brian Suggested would work, but I have found that the default is usually enough time before it causes the postback.
Also if you incorporate MarkFirstMatch="true" for the ComboBoxes it will automatically go to the item that matches the text if it exists.
http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx
This should give you some other options as well.
But as far as forcing the user to enter 5 letters before the postback occurs, You would probably need to do onkeyup and onkeydown javascript events to check if they have entered 5 characters and then you could cause the postback.
Or you could use the OnClientkeyPressing property of the Telerik comboboxes to do the check.
function OnClientKeyPressing(comboBox, args)
{
if (comboBox.get_text().length > 4) {
//Do postback here
}
}
Something like that would do what you want I believe.

Resources