I have a barcode scanner implemented using "Zxing" library. I wanted to know how can I identify the type/format (like if it's UCC / Code 128 or EAN or any other) and extract Lot no. etc from the read string? Is there any algorithm to do it?
IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
Here scanningResult.getFormatName(); gives code format of scanned barcode.
Yes. See the Result object you get from a successful decode. It has the format and contents. I am not sure what "lot no." is but you can parse the result further however you like.
Related
Without thinking too hard about it I created a column of type [UUID] and successfully stored "strings" (as noted in the documentation, and generally referred to as a separate type altogether) returned from DB::generateKey in it.
Feels like I've done something I shouldn't have.
Can anyone share some light on this. Thanks in advance.
Mostly they return different types.
For clarity, DB::generateKey is equivalent to Uuid::generate |> toString
According to the standard library docs, it's the return type.
Uuid::generate() -> UUID
Generate a new UUID v4 according to RFC 4122
DB::generateKey() -> Str
Returns a random key suitable for use as a DB key
I believe the UUID type is a bitstring representation, that is, a specific sequence of bits in memory.
Whereas the Str type is a string representation of a UUID.
I'm wondering, when I try to receive sms text message from a SIM using AT+CMGL, can a message contain OK<CR><LF>? if so how should I know where is the end of the message?
Thanks
This is a good question, and as you have identified if the information text contains a final result code you loose, because there is no way to know.
This is partially covered in V.250 which forbids the modem to introduce false final result codes if it breaks up lines:
Note that the DCE may insert intermediate characters in very long
information text responses, in order to avoid overrunning DTE receive
buffers. If intermediate characters are included, the DCE shall
not include the character sequences "0 " (3/0, 0/13) or "OK"
(4/15, 4/11, 0/13), so that DTE can avoid false detection of the end
of these information text responses.
And also several command (+GMI, +GMM, +GMR, +GSN, +GOI and +GCAP) are explicitly forbidden to produce text that embed the OK final result code (but it does not mention anything about ERROR...).
Similarly for 27.007 it forbids some commands (+CGMI, +CGMM, +CGMR, +CGSN, +CEER and +CLAC) from containing OK (and again no mention of ERROR...).
27.005 does not specify anything regarding embedded final result codes, so to avoid the issue of embedded final result codes for AT+CMGL you need to read the message in PDU mode, there you have a guarantee that the information text will not contain OK, ERROR, etc.
Can I determine if the user entered a phone number that can be safely formatted into E164?
For Germany, this requires that the user started his entry with a local area code. For example, 123456 may be a subscriber number in his city, but it cannot be formatted into E164, because we don't know his local area code. Then I would like to keep the entry as it is. In contrast, the input 089123456 is independent of the area code and could be formatted into E164, because we know he's from Germany and we could convert this into +4989123456.
You can simply convert your number into E164 using libphonenumber
and after conversion checks if both the strings are same or not. If they're same means a number can not be formatted, otherwise the number you'll get from library will be formatted in E164.
Here's how you can convert
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
String formattedNumber = phoneUtil.format(inputNumber, PhoneNumberFormat.E164);
Finally compare formattedNumber with inputNumber
It looks as though you'll need to play with isValidNumber and isPossibleNumber for your case. format is certainly not guaranteed to give you something actually dialable, see the javadocs. This is suggested by the demo as well, where formatting is not displayed when isValidNumber is false.
I also am dealing with this FWIW. In the context of US numbers: The issue is I'd like to parse using isPossibleNumber in order to be as lenient as possible, and store the number in E164. However then we accept, e.g. +15551212. This string itself even passes isPossibleNumber despite clearly (I think) not being dialable anywhere.
I have a list of the following codes and their corresponding codes in format code_128. I want to given a string, be able to generate the corresponging code in CODE_128 format. Based on this list, how could I generate a code_128 number to the string A4Y9387VY34, for example?
code code in code_128
A4Y9387VY34 ????
ADN38Y644YT7 9611019020018632869509
AXCW99QYTD34 9622019021500078083444
A9YQC44W9J3K 9611083009710754539701
AT8V7T3G3874 9622083021255845940154
A7K444N4FKB8 9622083033510467186874
AYCHFW448HTQ 9611005019246067403120
AY63CWBMTDCC 9622005028182439033426
ANY7TF46NGQ3 9622005031345848081170
AYY48TBVQ3FH 9611200003793988696055
AT8Q4CF4DQ9Q 9611200021606968867090
A764WYQFJWTT 9622200022706968919275
AC649ND7N8B6 9622148007265209832185
A4VDPTJ99YN4 9611148013412173923039
AHDYK498BD6T 9622148021309216149530
A4YYYNY7C3DJ 9611017021934363499071
AYG6XWVCCQ89 9622017031009914238743
A68YJHGQKCCM 9622017031138587166053
APMB7XG9XQC9 9611021011608391750002
AGP8C44Y8VYK 9622021021608111646113
A7C68B9T69XB 9622021021958603678086
AJYYWKR6BDGN 9611010022528724015883
AKMNVXDT9PYN 9622010027475034102229
AXPXMK9QMDFD 9622010031475028243694
I read a lot about it, but I didn't come to any solution. Thanks in advance!!
Well, this is a pretty open question, I will give you my suggestions:
If it is a finite list, you can use a Hash or a Dictionary, where
the keys are the Codes and map them to the corresponding value, in
your case, Code_128
Some scanners have software installed that allow you to change what
has been read to a new value, format it, etc.
If you need a bigger insight please, give us more detail about the environment you are using.
Hope that helps,
I decided to create a new answer because now I get your point. Well, if you are talking about a GS1-128 Code (please see www.gs1.org) please do not start without visiting Wikipedia info about it. as you can see, there is a thorough explanation about how to work with that type of code. That code is composed by several application identifiers followed by their corresponding values. There is a better way of encoding them by using special characters as parenthesis. Here is other info that may help you.
Hope it helps,
I'm writing a program (in Python for now) for reading PSD files. I'm using this specification: http://www.fileformat.info/format/psd/egff.htm
Here it says
BYTE Name[]; /* Even-length Pascal-format string, 2 bytes or longer
*/
Um, 2 bytes or longer? How am I supposed to find out how ling it is? I don't know what "Pascal-format string" means either.
Thanks in advance.
EDIT: Heres a direct link to the official PSD specification (pdf): http://forums.adobe.com/servlet/JiveServlet/download/2923119-45984/Photoshop%20File%20Formats.pdf;jsessionid=21F2DBA32AB9E56882065663C10A1EBF.node0
Look in page 9, under "Image Resource Blocks"
Please help.
"Pascal-format string" could mean string that have length encoded on first position IIRC.