Auto Digit grouping with two decimal places in JavaFx - javafx

How to Automatically Format User Input on a text field that will do grouping digit with two decimal place automated when user type on that text field.
what is the best way to do this.
Example like you type in Windows Calculator When Digit Groping activated.
Like in this picture
Digit Groping
in the picture shows automatic digit groping when user type number.
Thank's

Related

Determine Phone number country code given just the phone number

As I type this question, I am skeptical there may be no answer?
I am building a flutter app using firebase as the backend. There is a feature in my app that allows a user to add friends to the app from their contact list.
Now I am struggling because firebase phone numbers must be stored in this format -- +17653371230.
However, when a user stores a phone number in their phone, they don't always add the country code.
Essentially, a user can have phone numbers in their contact book in these formats:
9142240145,
510-725-1331,
(404) 988-3125
If I want to check if any of these phone numbers exist in my database, I will get a result saying they don't, even if they could but in a different format.
The first step to solving this problem is pretty simple: trim all parentheses and spaces in the phone number string.
However it gets difficult and it brings me to my real question:
Give a phone number like so: 9143646532, how can I determine that it is a US number so that I may add the +1?
Or given a number like 08027323457, how can I determine that it is a Nigerian number so that I may remove the leading 0 and add a +234?
I want to be able to do this for all countries. Is there a flutter package that handles this? Or is there a publicly known algorithm that sorts this out? Because I doubt I am the first person trying to build this capability using firebase as a backend.
The first step is to normalize these numbers into a format of your choice.
The second step involves finding out the country of residence of the current user. Then determine the country's prefix and add said prefix to the numbers provided by the current user. But check if these numbers already have an international prefix beforehand.
Do you have the complete phone number of the current user with country prefix? Then use that. You could also force the current user to provide or confirm this prefix, if missing.
If not, use a geo-location-service to determine the country of residence of the current user and then select the phone prefix accordingly.
What types of geo-location-service are available to you depends on the framework you use. Some are depending on IPs, some on GPS.
There are also external services:
https://medium.com/mop-developers/free-ip-based-geolocation-with-google-cloud-functions-f92e20d47651
How phone numbers are constructed:
https://www.tipard.com/mobile/international-phone-number-format.html

How do number based permission systems work?

This is NOT a question about Discord, but about how a feature on Discord was implemented.
Discord has a system in place where a set of numbers added together can represent a set of selected permissions. I spent some time looking around the internet and playing with Discord's link generator to form an understanding of what is happening but I haven't been successful.
In the following image, it can be seen that I have selected a set of permissions for a small bot and in the generated URL a number is provided under the permissions parameter:
What I don't understand is, how are the numbers (for each permission) assigned such that when any combination of numbers is added together there are no conflicting/ambiguous results?
Also, once a number is generated, how are the numbers interpreted and converted back to their original meanings?
Every individual tickbox corresponds to one bit position. The final number is the binary number obtained by writing "1" at every ticked position and "0" at every non-ticked position.
For instance, "Manage channels" is 0b00010000 = 16 and "View audit log" is 0b10000000 = 128, hence if you tick both "Manage channels" and "View audit log" and nothing else, you'll get 0b10010000 = 144.
Source: https://discordapi.com/permissions.html#144

design issue when no textbox delimiter is present

I Got a design question pertaining to just my issue. My client asked me to have just 1 big text box in a pop up.Beneath it i have labels that user can see(Equipname,(LL,BB,PA),ClientName,Personnel). So he has to enter equipment name,either of(LL,BB,PA) ,cname,pname. An example row can look like "75 LL XYZCompany John". There is no delimiter between the entries. How can I make sure he is entering the corresponding values correctly. I mean instead of entering "XYZCompanyname" , he enters "John" and for john he enters xyzcompanyname..what then?I gave them multiple textboxes first,but they did not want it. any idea how to proceed?
I see no way of validating or ensuring the integrity of what is entered by only using one textbox for multiple fields, especially without some kind delimiter.
From experience with non-technical clients who sometimes want odd implementations like this, my suggestion would be to stick to your guns and provide proper input fields that you can validate and explain clearly to them the consequences that having invalid data can have.
Not to mention that when implementing it the way the customer wants it now and when it inevitably falls apart, the fingers are going to be pointed at you for 'not doing your job' correctly.

Slider bar with text values

I'm doing a permissions screen that could use a slider bar- for each section of the site, I want to be able to give users permissions easily, using a horizontal slider bar that has text values defining the different levels of permissions, meaning what they can do in each section of the site, increasing in permissions to include abilities like reading data, writing, deleting items, adding them etc. Every level includes the previous levels, so a slider bar seems the logical choice to show that's what's going on.
Unfortunately, looking around, the only slider bar with good ASP integration (this is part of an ASP web form) is the AJAX one, SliderExtender, but that only uses numbers as values. Is there a way to use text values as the labels for this control, or is there another (free) one that I can use for this purpose?
Thanks in advance for the help.
Why not just use numeric values and handle convert the numbers to text values in your code?
1 = Admin
2 = Power User
3 = User
4 = Other User
Hope this helps

How often do the first four numbers of a credit card change?

Right now I detect the credit card type based upon the first four numbers of it.
How often do these first four digits change? Is there a service which can interface with ASP.NET that will keep an up to date list of these first four digits and their corresponding institutions?
According to the Wikipedia article on this, the last significant change to this list was in 2007. Keeping your software up to date shouldn't be too challenging, even if you do hard code this.
Sorry to disagree with the other answerers, but the first six digits (not four) of a card number are known as the issuer identifier range. New ranges are FREQUENTLY added or removed to this list. You would typically need to be on a mailing list from the card issuers to even attempt to keep up to date
This document from Barclays (UK) for example shows a number of revisions in the last few months, such as the addition of a 6440-6599 range for Diners card. http://www.barclaycard.co.uk/business/documents/pdfs/bin_rules.pdf
Basically, attempting to identify card from the IIN is tricky at best. It's not clear why you want to identify a card from the IIN, but it typically isnt necessary if you are performing authorization through a payment gateway
At risk of answering your question without answering it, have you seen this? How do you detect Credit card type based on number?

Resources