We (i advised them to go with someone bigger and not some local nobody one man show) recently hired a local guy to create a basic inventory system for us. Long story short, barcode labels come from our customer with a "P" Prefix on part number barcodes and a Q prefix on quantity barcodes. So, if a barcode containing P70P3001 is scanned, the actual part number the system needs to use the part number 70P3001. Q20 means quantity is 20.. pretty simple.My question is this: All I want him to make the scanner software do is drop/ignore the first letter of the part number if the first letter is a P. I can not comprehend how this can be that hard to do. I know I could have done it after the first java class I had years ago. He has repeatedly sent us updates to accomplish this, none of which have worked. Is there anything hard about this? Would anyone care to write out the basics of the code that is needed to do this? He's given us probably 6 updates at this point, none of which have fixed the problem.. on the last one he claims "We had to do some crazy stuff with the scanner SDK to get the prefix removed." Also, we have no part numbers that begin with a P, so that is not a possible problem to be considered.Personally I think he got in over his head and just won't admit he doesn't have a clue what he's doing but I wanted to be sure before I called him out on it.Thanks!
8/27/2008 8:30:38 AM
it would be somewhat silly to do it during the scan process. I dont know how the code is structured but all you need to do is scan the barcode and dump the string (p564654654q567) and then parse the string into its proper tokens. you could make an array of inventory objects, each having a name/number string var and a quantity int var or just dump it all in a simple database. however you do it, I would definitely do it in 2 parts. one for scanning and just dumping raw strings to a text file and another component (script, java, a million ways to do it effectively here) to put it into a format you actually want. if you just want an excel sheet, a 3 line perl script or python script could do it.
8/27/2008 8:41:56 AM
This should be ridiculously simple. The fact that this required updates at all, or messing with the SDK (wtf?) should tell you something.
8/27/2008 8:47:13 AM
i think pics might help..is the layout of the app right now. when i scan a barcode whatever is in that barcode should go wherever the cursor is..no parsing or anything during the scanning process. now when i hit submit, if the first letter of the barcode is a P, i want the P ignored and the rest of the barcode used[Edited on August 27, 2008 at 8:47 AM. Reason : ^i agree 100%, but need more than "I think he's an idiot" when I call him out on it][Edited on August 27, 2008 at 8:48 AM. Reason : ignore the red box around simple view]
$code=preg_replace("/^P/i", "", $code);
8/27/2008 8:48:11 AM
how bout one I understand a little bit.. like VB
8/27/2008 8:52:48 AM
i would if i knew vb http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.replace(VS.71).aspx maybe?[Edited on August 27, 2008 at 8:59 AM. Reason : damn you autolinker][Edited on August 27, 2008 at 9:00 AM. Reason : /^P/i is the regular expression bit, it says to find a P at the start of a string, case-insensitive]
8/27/2008 8:58:49 AM
String barcodeType = scannedCode.substring(0,1);String parsedCode = scannedCode.substring(1);b/c im lazy
8/27/2008 9:07:19 AM
How does that check if there's a P as the first character? Some barcodes don't have a P prefix..can't just chop the first letter off of everything
8/27/2008 10:29:24 AM
this is extremely easy - if he can't accomplish this then he's worthless - most barcode scanners just read the barcode and output the text to the field selected and nothing more
8/27/2008 10:42:26 AM
that is correct. it's basically just the same as typing in with the keyboard.. no processing of what's scanned happens at that stageand i wonder if i can decompile this app and find someone to fix it for a little cash just so i can say here's all it took to fix it..
8/27/2008 10:45:10 AM
there have been some code fixed posted alreadywhat language was it written in
8/27/2008 10:49:52 AM
either VB or C#the few things i've seen his code from were in VB so that's my guess[Edited on August 27, 2008 at 10:52 AM. Reason : asdf]
8/27/2008 10:52:40 AM
if(barcodeType.equalsignorecase("p") || barcodeType.equalisignorecase("q"))do stuffelsetack it back on to the original codeThere are better ways to do it for sure, but thats 2 minutes worth of writing code that does what you want.This took me about 5 minute to figure out the regexString pMatch="^[pP].*";String qMatch="^[qQ].*";if(scannedCode.matches(pMatch)handle pmatchif(scannedCode.matches(qMatch)handle qmatchelsehandle no match
8/27/2008 10:56:06 AM
yeah, the "do stuff" and "handle pmatch" parts are what I actually needbut yea, good to see everyone agrees this should be an easy as hell thing to do to any real programmer
8/27/2008 11:02:10 AM
PM me b, i'll help you out
8/27/2008 12:47:19 PM
PM sent, b
8/27/2008 1:06:18 PM