How to Get the "Code39" Barcode Information? - barcode

I have a "code39" barcode. How can I get the information from that bar code: product name, manufacturer, and everything else?
Please help.

Find a bar code scanner that reads code 39 encoding--which is just about all of them, and scan the bar code. That number will normally be a GTIN - Global Trade Item Number. You will have to use that number and query some kind of database or web api to get the rest of the product data.

Related

Number of restaurants with specific cuisine in each country

I am trying to figure out how many restaurants, in each country, there are of a specific cuisine (seafood). I have looked at Google Places Api and TripAdvisor Api, but cannot find these numbers. I don´t need the list of restaurants, only number of restaurants. I found OpenStreetMap which looked very promising. I downloaded data for Norway, but the numbers are not correct (osmium tags-filter norway-latest.osm.pbf cuisine=seafood) = 62, which is way to low.
Any suggestion for how and where I can find what I am looking for?
Extrapolate.
You won't get an accurate answer, how do you even define what a seafood restaurant is?
Find out roughly how many restaurants there are in the area you are interested in and then decide what % of them might be seafood restaurants.
You can use this approach to extract the data from OpenStreetMap:
https://gis.stackexchange.com/questions/363474/aggregate-number-of-features-by-country-in-overpass
You can run the query on http://overpass-turbo.eu/ (go to settings and chose the kumi-systems server).
The query could look like this:
// Define fields for csv output
[out:csv(name, total)][timeout:2500];
//All countries
area["admin_level"=2];
// Count in each area
foreach->.regio(
// Collect all Nodes with highway=milestone in the current area
( node(area.regio)[cuisine=seafood];
way(area.regio)[cuisine=seafood];
rel(area.regio)[cuisine=seafood];);
// assemble the output
make count name = regio.set(t["name:en"]),
total = count(nodes) + count(ways) + count(relations);
out;
);
This query can take a long time (at the time of writing, mine did not yet finish)
You can also run the query via curl in on some server and let the results mailed to you via curl ....... | mail -s "Overpass Result" yourmail#example.com. You get the curl command in the browser network tab by "copy curl"
I also considered Taginfo (https://taginfo.openstreetmap.org/tags/cuisine=seafood) but it cannot filter by tag.

Reading barcode in datawindow (powerbuilder)

I have like a POS application where I work, and I added new code to read barcodes in a datawindow, but been having some problems to use it correctly. The process needs to read the barcode and automatically search for the product, and insert it in another datawindow with the info regarding the product.
The problem is that I have the code in the editchanged event, and that the barcodes have different lenght; so, every time a number of the barcode is read, the search function is called, here is the code for that function:
ll_rtn = dw_search.Retrieve()
If ll_rtn = 1 Then
is_code = dw_search.GetItemString(1,'barcode')
wf_insert(False)
End If
If for example, a product of 10 digits is read and at length 5 the product is found, it's inserted but the editchanged is still running because the barcode is length 10, and depends of the search, might find it again with the last digits and insert it again.
I don't know how to stop reading after I find the product. Hope I explain it right.
Can you check if the barcode scanner can be configured to pass carriage return / Enter, upon scanning the barcode and this way you can move your code to itemchanged event
Bar Code Config
An editchanged event is fired for each keystroke in the control. You probably want to either move the code to the itemchanged event or to a totally separate event which is posted from the itemchanged event.
If you absolutely have to have the code in the editchanged event you need to set a boolean instance variable on the window which is set TRUE once the product is found. If it's true then don't search. Remember to reset the variable to FALSE prior to any new search.

Odoo 8 "message_id" column in "mail_message" table

I was writing an external app in python that uses the message system in odoo.
So, I need to use, the mail_message, and the mail_notification tables.
I tried to put elements individually via INSERT into the table filling the necessary elements to make this work, and it works perfectly, the messages appear in the "inbox" of messages in Odoo and the notification appears correctly.
But checking the rest of the fields in this table, I see that message_id got a tag format (between <>) and a series of numbers (that I haven't found any correlation) followed by "-openerp-'res_id'-'model'-#'company'".
So, I don't know how to fill this field, my proofs determined that is not a necessary field, but in a serious implementation I don't know if left this field empty can cause some issues.
Anyone can explain me the reason of this field and how to fill it?
Thanks
You can check the code in tools/mail.py and do something similar
def generate_tracking_message_id(res_id):
"""Returns a string that can be used in the Message-ID RFC822 header field
Used to track the replies related to a given object thanks to the "In-Reply-To"
or "References" fields that Mail User Agents will set.
"""
try:
rnd = random.SystemRandom().random()
except NotImplementedError:
rnd = random.random()
rndstr = ("%.15f" % rnd)[2:]
return "<%.15f.%s-openerp-%s#%s>" % (time.time(), rndstr, res_id, socket.gethostname())

Character length in single line edit filter PowerBuilder

My SQL code gives me over 10 000 rows, each containing client id, name, address and so forth. In my PowerBuilder 10.5 window I've set my DataWindow in which I'm retrieving my SQL code using id as retrieve argument. I have a Single line Edit (sle_id) in which the user can write an id and search by it. What I've figured out is that all of my clients have id's length of 8 characters and starting with either "46XXXXXXXX" or "7052XXXX". So to optimize my retrieve time I want to write a code in the clicked event of my "Start" button that is located in PowerBuilder window that would first check if the id starts with one of does two options: "46..." or "7052...". I assume I'd need to use length of the characters? For example, this is what I'd want...
IF sle_id.text STARTS with 46 or 7052 THEN retrieve
ELSE MessageBox ("INFO", "Your id must have begin with either 32 or 7052")
END IF;
Of course, I need something better then "Starts with". Much oblige for all the help!
there are some string functions in powerbuilder. I think you need this:
If( left(sle_id.text, 2) = "46" or left(sle_id.text, 4) = "7052" ) then
Best Regards
Gábor
I think you're trying to solve the wrong problem. Your database should have an index on client id. If the client id is unique use a unique index.

Import XML google spreadsheet is not working Properly

find attached link for my Google spreadsheet in which i tried to pull out the data from booking.com.
i retrieved Hotel name in column. it successfully retrieved the hotel name. but not work with every column. Output is like this.
even i referenced the formula correctly. but it automatically changed to like this..=CONTINUE(E1, 2, 1)
red highlighted cell is having problem. look there.
Please find below link for your reference. Thanks in Advance.
https://docs.google.com/spreadsheet/ccc?key=0AtjX3Ttg50IydHJzR1FMSkJyY0U1bHBSeWtrMDRSZ1E
The formula in E1:
=ImportXML(D1,"//div[#id = 'wrap-hotelpage-top']/h1[#class='item']/span")
is returning a 2 x 2 array. To return just the top left-cell and avoid population of the CONTINUE functions (so that you can fill down successfully), use
=INDEX(ImportXML(D1,"//div[#id = 'wrap-hotelpage-top']/h1[#class='item']/span");1;1)

Resources