Convert a alpha-numeric string into a gibberish barcode? - string

A container is identified with the label JA1234. This container should always go to destination A.
Another container is identified with the label 1234. The vast majority of containers are labeled this way and these always go to destination B.
(Note: The pool of containers constantly fluctates so we can't maintain a master list.)
The users can either scan/key in the container identifier. Many of the containers aren't barcoded so they need to type in the number. When it gets typed in the prefix 'JA' gets ignored and suddenly the programs error checks fail (allowing wrong destinations).
To prevent entry and to force barcoding I would like to require the program to scan a barcode. The only way to get the users to scan the barcode consistently is the provide a barcode in a gibberish (ie hexadecimal) format.
Is there a any built-in .NET framework feature that would convert the readable string into something unreadable that would require scanning? It would need to be reversible.

It sounds like you want the users to input the whole string always and you users are ignoring part of the string. To solve this you want the users to just use the barcode scanner.
But you really have three choices.
Only print out the barcode. They can't type what they can't see. However this is bad because if a barcode is damaged you won't be able to fallback to user entry
Encode it using something like System.Convert.ToBase64String. This is bad because then you'll have to print values like SkExMjM0 and MTIzNA== for JA1234 and 1234 which is easy to mistype when the users needs to type.
Use a check digit and append it to the string. You can then reject codes incorrectly entered or incorrectly read by the barcode scanner. The downside is there's nothing built in that can directly convert "JA2134" and you have to create your own check digit function.

Related

Cache and Read Files in Specific Order

I'm creating an application in which users can create notes that are displayed in a grid. When a note is created, a corresponding text file is also created. When a user opens the application, the application reads the directory of note files, retrieves the content of each note file, and then displays it in the grid.
The idea is to make the grid of notes rearrangeable via drag-and-drop.
I've never done anything this before, so I'm struggling to devise an efficient way to cache or remember the order in which the user has arranged the notes. I thought of storing the position of each note in the filename itself.
1_note3.txt
2_note7.txt
3_note4.txt
4_note2.txt
5_note6.txt
6_note8.txt
7_note5.txt
8_note1.txt
This doesn't seem like a good approach since, anytime the the notes are rearranged, I'll have to rename a bunch of the files. For example, say the user creates a new note — which would be inserted as the first child of the grid for the sake of user experience — all of the filenames would have to be renamed.
1_note9.txt
2_note3.txt
3_note7.txt
4_note4.txt
5_note2.txt
6_note6.txt
7_note8.txt
8_note5.txt
9_note1.txt
Further, say a user now rearranges the notes by moving the first note to the fourth position in the top row. I'd now have to rename that file and all of the following files.
2_note3.txt
3_note7.txt
4_note4.txt
5_note9.txt
6_note2.txt
7_note6.txt
8_note8.txt
9_note5.txt
10_note1.txt
I could also store the order or arrangement in a separate file, and exclusively manipulate the content of this file instead of the actual filenames.
arrangement.txt
note3.txt
note7.txt
note4.txt
...
Although this may be superior to the last approach, it also doesn't seem that great since there is still additional overhead. For instance, when the application is launched, I'll first have to read that file in order to obtain the user arrangement before sorting files accordingly.
Does anybody have any experience implementing something like this? Is there a better way to go about it?
You may like to maintain state of your note grid in a key-value map data structure. you can cache this map in-memory or persist it in a separate file. This key-value map will store note grid data where "Key" will have position order in the grid and "Value" will have name of the corresponding text file. In case notes are rearranged you only need to update value of two keys.

How to convert Notes document link to HTML link

I am charged with maintaining some old code, in which we are extracting a Notes link from a message, and turning it into a link that can be called from HTML on a local machine (on which Notes is installed). We have a situation where one link works, and another one does not.
I am struggling to understand what exactly this code is doing, and why it even works in the first place. Basically, we are looking at the property "$Links" in an email message. The value of this property, for example, when viewed in Notes, is something like:
RFC2257F23:004852B9
VFA5208C4C:6552DA01-VN422569FB:003AAC2D
NF6D24A297:6579B8E3-NNC225805D:004D8678
What our code does is get the binary value of this property, using NSFItemInfo and OSLockBlock. It then starts at offset 11, and works backwards 8 bytes, converting each byte to a 2 digit hex value. Then it does the same thing 3 more times, but moving the offset 8 bytes forward from the original 11. A '/' character is inserted after the 1st and 3rd of these 8 byte segments. Then the whole thing is appended to "notes:///". At the end, the link generated looks like this:
Notes:///C2257F23004852B9/A5208C4C6552DA01422569FB003AAC2D/6D24A2976579B8E3C225805D004D8678
I'm guessing that this value represents the Notes UNID of the document link, and that when clicked on, Notes
starts up, and goes directly to the document. So does anyone have an idea as to why one link would work, and
the other fail? Our customer claims that the Notes links database is intact, and can be viewed successfully
from within Notes itself.
Notes- Links consist of the protocol, a server part, a database part and the element within the database.
A normal example would be:
notes://server/path/database.nsf/view/keytodocumentinview
Every part (except the server) can be replaced by an internal ID.
path/database.nsf --> Replica ID (C2257F23004852B9 in your example)
view --> Universal ID of the design element of the view (A5208C4C6552DA01422569FB003AAC2D)
keytodocumentinview --> Universal ID of the document (6D24A2976579B8E3C225805D004D8678)
If there is no server in the link, then the notes client tries to "guess" the right server. It checks:
Is there an icon in the desktop for the Replica- ID requested. If yes: take the server of the last used replica (on the top if replicas are stacked)
Can I find a catalog.nsf (either on catalog- server from location document or on mail- home- server. If yes: Is the replica- id in there? If yes: Take the server from there...
Ask user for server (not sure about that part, as it not always seems to happen)
So the answer to your question is:
If the client can not find any reference to the server the link will not work.
So it is always better to add the right server to the link (if you know it).
Just to explain, how to get from one form to the other, here is some more explanation:
Some times these IDs are represented differently as found in the $Links- Item:
The first letter stands for the "Type" of ID:
R = Replica ID
V = View Universal ID
N = Note Universal ID
All 32Bit values are separated in 2 halfs of 16 bit, prepended by another Character telling "First" (F) or "Second" (=Next, N) value.
The rest is divided in chunks of 8 letters, the first and third octet separated with colons, and the first half and second half split by a minus sign.
Like that you can easily see:
RFC2257F23:004852B9 translates into FC2257F23004852B9
VFA5208C4C:6552DA01-VN422569FB:003AAC2D translates into A5208C4C 6552DA01 422569FB 003AAC2D
and
NF6D24A297:6579B8E3-NNC225805D:004D8678 translates into 6D24A297 6579B8E3 C225805D 004D8678

Saving textbox value from a test execution in Ranorex

I am automating Sharepoint list testing, filling up some field with values,
and like to save data I supplied to the field after.
Is there a way to automate saving the field value in a excel or csv?
In order to keep it simple, I would create two recordings and write to a text file (csv).
The first one would get the text values from the desired fields and return them in bound variables using Ranorex GetValue action.
The second recording would write the content of the bound variables to a text file, separating fields with ',' (or any other character that is suitable for the kind of data that is present in the fields) in a user code function.
If you have no idea how to write to a file in .NET, take a look at System.IO.File.AppendAllLines or similar functions.
You could also combine the 2 recordings in one, but then, re-useability would be limited the scope of the SharePoint page you are testing.
Do not forget that since Ranorex is using the .NET framework, you have access to all the functions provided by the framework in user code. With Ranorex, the usual question is not ask if something is possible. The real question is "how can it be done" and is the solution simple enough for testers to be able to use it!
Hope this helps!

One tag two different codes

Is anyone familiar with RFID readers? I have two different RFID reader. If I scan same tag one gives me a code:
0023151773[CR] and second gives : [02]MM2C010161449D30[08][03]
Tag ID is same in both outputs but however I need that longer code to my app. I need few more readers so how can I find a correct reader?
Converting the decimal number 0023151773 to hexadecimal gives you 0161449D. Looking at the output from the second reader, this seems to be part of that output: MM2C010161449D30. Thus, both readers do provide the same tag ID value (0161449D).

Designing a one EVERYTHING search box (date+address+keywords)

I'm storing information about local "events". They are described by 3 things - address, date, keywords(tags). I want to have only one search box for at least address and keywords. The date might go to a separate field. I'm assuming that most people will search for events that are taking place "today" so this filter won't get that much traffic.
I need those addresses to be correct (because I'm geocoding them afterwards) so I need to validate them before submitting the form and display a list of "did you mean" if a user made a typo there. I can't do life search here. I can do a live search on keywords. Keep in mind that a user can make a typo there too and I want to catch that.
Is there a clever way to design the input's parser in this case to guess which is supposed to be address and which keywords?
OR
Is there a way to actually parse it as user is entering his query? Maybe I should show autocomplete hints for keywords, after 3 first characters are entered, and if user denies to use them then to assume that it's a part of an address he's typing.
What do You think?
Take a look at Document Cloud's Visual search
http://documentcloud.github.com/visualsearch/#demo

Resources