Google Translate Save to Phrasebook Import - GET/POST Hack - post

I have bunch of words saved in plain text file and a I would like to import them to Google Translate somehow. They should then be visible in new Google Translate feature, Phrasebook. So what I did so far is that I've opened Google Translate page with enabled FireBug and enter word "feuds". The results are following:
GET /translate/releases/twsfe_w_20130506_RC02/r/js/desktop_module_lazy.js
GET /translate/releases/twsfe_w_20130506_RC02/r/js/desktop_module_lazy.js
GET /translate_a/t?client=t&hl=en&sl=auto&tl=sk&ie=UTF-8&oe=UTF-8&multires=1&ssel=0&tsel=0&uptl=sk&sc=1&q=feuds
POST https://plus.google.com/u/0/_/n/gcosuc?origin=http%3A%2F%2Ftranslate.google.com
200 OK
103ms
>>>
################################################
### AFTER PRESSING SAVE TO PHRASEBOOK BUTTON ###
################################################
POST /translate_a/sg?client=t&cm=a&sl=en&tl=sk&ql=5&hl=en&xt=ALkJrhgAAAAAUZvTtWm7IqJAYJpay1AU8x-VoS_AM0J0
client t
cm a
hl en
ql 5
sl en
tl sk
xt ALkJrhgAAAAAUZvTtWm7IqJAYJpay1AU8x-VoS_AM0J0
200 OK
137ms
>>>
GET /translate_a/sg?client=t&cm=g&tk=8mXp7vd2yN4UVnN8_Bw51LnXE2wqfQI&hl=en&xt=ALkJrhgAAAAAUZvTtWm7IqJAYJpay1AU8x-VoS_AM0J0
client t
cm g
hl en
tk 8mXp7vd2yN4UVnN8_Bw51LnXE2wqfQI
xt ALkJrhgAAAAAUZvTtWm7IqJAYJpay1AU8x-VoS_AM0J0
200 OK
112ms
>>>
You can see that on 3rd GET the word is available "&q=feuds" But what happens when I press "Save to Phrasebook"? It seems that there is sending source language (sl), target language (tl) etc. with some strange string: "ALkJrhgAAAAAUZvTtWm7IqJAYJpay1AU8x-VoS_AM0J0" which might be my "hashed" word. Another idea which comes to my mind is that this strange string did not have to bee "hashed" word necessary, but it might be for example some ID, which refers to word that I have typed in the past (in this case few seconds ago until I hit "Save to Phrasebook" button). Is it possible to somehow "decode" this string?

I have noticed that this "xt" value is received in 1st response from "translate.google.com", look for variable with name "USAGE".
Also I have found that "xt" value appear in all requests related to Phrasebook (example: show phrasebook, add/delete word to/from phrasebook), and in each new google translator page you will have new "xt" value.
Based on this, can assume, that "xt" variable implement function of identification token for Phrasebook.

Related

Quickfixj- Custom FIX msg - 35=F not working for Multileg

I am using quickfixJ 2.3
To parse the FIX message , we have used
MessageUtils.parse(msgFactory,dd,inPutFixMsg, false)
I am able to place the list order ,multileg - 35= AB, AC order.
Now when I want to cancel the multileg order created by AB,
I just replaced 35=F, added 41 tag.
Now I am getting error while parsing in Message.parse : tag 600 appears more than once.
I am interested to know ,the other cancel( new order cancel, future cancel) working fine. Even I have mentioned the dd, then still why m I getting the error?
Or is there any other approach ?
You can't just change the message type (tag 35) and assume all the other tags are going to be compatible!
AB and F messages have different tags in their body. They are totally different messages!
The amount of stuff about FIX that you need to know exceeds what is appropriate for a StackOverflow answer. You really need to read some docs about how FIX messages are structured and decoded.

Print QR-Code with curent EPC-number from RFID label to Printronix T4000

we bought a Printronix RFID printer T4304 with these dates:
FirmwareP301189 V1.21A
Serial NumberT4K431948007
Our wish is
to produce RFID-Labels with an QR-Code which includes the EPC-number
of the label. The QR-Code shall look like this:
http://qr.mycompany.com/epc/E280689123456789012345
We were hoping to use it with the Software Nicelabel. But Nicelabel
is only able to produce a QR-Code with only the EPC-Number but not
with our http://qr.my..../epc/ in front.
I had the idea to save the printjob as file. So I was able to
manipulate the file and send that file as printjob to the Printronix
printer like this:
lpr -S 192.168.1.2 -P raw myprintjob.prn
I found the document PTX_PRM_PGL_P7_253642C.pdf
which describes how the printer language is working. But I cannot
fulfill my destination.
My myprintjob.prn looks like this:
!PTX_SETUP
ENGINE-IMAGE_SHFT_H;0
ENGINE-IMAGE_SHFT_V;0
ENGINE-WIDTH;04146.
PTX_END
~NORMAL
~PIOFF
~DELETE LOGO;*ALL
~PAPER;INTENSITY 8;MEDIA 1;FEED SHIFT 0;CUT 0;PAUSE 0;TYPE 0;LABELS 2;SPEED IPS 6;SLEW IPS 6
~CREATE;FRM;99
SCALE;DOT;300;300
RFRTAG;96;EPC
96;DF511;H
STOP
ISET;0
FONT;FACE 92250
ALPHA
AF511;24;INV;POINT;329;1033;10;10;
STOP
BARCODE
QRCODE;INV;XD9;T2;E0;I1;95;843;
"http://qr.mycompany.com/epc/","EPCCODE"
STOP
END
~EXECUTE;FRM
~REPEAT;1
~AF511;<DF511>
~NORMAL
The result is a QRcode which only includes the first part of the string:
"http://qr.mycompany.com/epc/"
but not the "EPCCODE". I am looking for a hint how to do this.
Maybe I could find out the EPC-code via REST or telnet or so and create a special printjob for every single label?
Thanks for your help,
Richard
Printronix T4000, talk with port 9100 to get info from the printer
Author
Richard Lippmann, Stadt Zirndorf, EDV
Documentinformation
name: talk-with-port9100-to-get-infos-from-printronix-rfid-printer.md
revision: 2021-12-02 - init
What I want to achieve
I want to know the RFID-code from the label which is under the print-head.
With this information I am able to build a printjob with Qrcode which includes
the RFID-EPC.
I was not able to find out how to create a print-job with a qr-code.
I do not want this information in qrcode: ABC1234...567
But I want this information in qrcode: http://qr.mydomain.com/rfid/epc/ABC1234...567
With that I am able to take a picture of the label and go to a web-application
which helps me further with the device the label is on.
Documenation, where to find information
The printer language is described in the document which is easy to google: PTX_PRM_PGL_P7_253642C.pdf
My environment
Printronix T4000 printer with RFID-unit to read the RFID from the current label.
How to get info back from my printer
Usually Port 9100 is used to send a printjob to the Printronix-printer. Send job,
don't receive data. But you can switch the printer to be verbose, to send you
back information over the 9100-connection.
Glossary
EPC = this is the unique number which is in every RFID-label, just like
a MAC-address in a network card
PGL = the printer language. We can send printjobs with it, but also get information
from the printer about Configuration etc.
Human connect to the printer via Linux commandline
ssh me#shell.mydomain.com
export MYPRINTER=192.168.100.3
nc -v $MYPRINTER 9100
Put verbose mode on
The printer usually only receives information, but does not talk back.
You have to switch on the back-communication.
~CONFIG
SNOOP;STATUS
END
Put verbose mode off
I you are programming this interface with a programming
language like python, perl, ... it's a good idea to switch
verbose mode off after you did your job.
~CONFIG
SNOOP;OFF
END
IDENTITY
To see information:
put verbose mode on
send ~IDENTITY command
put verbose mode off
~CONFIG
SNOOP;STATUS
END
~IDENTITY
The result is:
T43040,V1.21A,12,131072KB
STATUS
To see information:
put verbose mode on
send ~IDENTITY command
put verbose mode off
~CONFIG
SNOOP;STATUS
END
~STATUS
The result is:
BUSY;0
PAPER;0
RIBBON;0
PRINT HEAD;0
COUNT;000
GAP;0
HEAD HOT;0
CUT COUNT;000000000
PRINT DIST;000001529
PRCT COMPLETE;000
TOF SYNCED;1
SENSED DIST;00450
END
Read one RFID-EPC-code from current label
These are things mentioned in this command:
~CREATE - start creating a new "form" (or subroutine to execute later)
VERIFY - the name of the subroutine we are creating. Keep it simple,
less than 15 characters, no special signs (see docu PTX_PRM_PGL_P7_253642C
page 60 under "CREATE" and page 29 under "Form Name" for exact informations)
NOMOTION - don't move the label to the next one after executing this job
DF511 = This is a variable-name, there seem to be a lot of variables in the printer
which are called by their numbers: DF1, DF2, ... I don't know which one I am
allowed to use, DF511 seems to work
96 = the RFID-EPC on my labels are 96 Bits long
H = Hexnumbers, the code is 96 Bit long, but I would like to see it like this:
ABC1234...567
VERIFY - a command to send information to the commandline.
~EXECUTE;VERIFY;1 - execute the form 1 time
~CONFIG
SNOOP;STATUS
END
~CREATE;VERIFY;432;NOMOTION
RFRTAG;96;EPC
96;DF511;H
STOP
VERIFY;DF511;H;*STARTEPC=*;*=ENDEPC\n*
END
~EXECUTE;VERIFY;1
~NORMAL
The result is:
STARTEPC=E28068940000501EC931EC87=ENDEPC
Read two RFID-EPC-codes
Reads 2 Barcodes and gives back the EPC-codes. With this command the label get
sent (moved) through the printer.
These are things mentioned in this command:
~CREATE - start creating a new "form" (or subroutine to execute later)
VERIFY - the name of the subroutine we are creating. Keep it simple,
less than 15 characters, no special signs (see docu PTX_PRM_PGL_P7_253642C
page 60 under "CREATE" and page 29 under "Form Name" for exact informations)
NOMOTION - don't move the label to the next one after executing this job
DF511 = This is a variable-name, there seem to be a lot of variables in the printer
which are called by their numbers: DF1, DF2, ... I don't know which one I am
allowed to use, DF511 seems to work
96 = the RFID-EPC on my labels are 96 Bits long
H = Hexnumbers, the code is 96 Bit long, but I would like to see it like this:
ABC1234...567
VERIFY - a command to send information to the commandline.
~EXECUTE;VERIFY;1 - execute the form 1 time
~CONFIG
SNOOP;STATUS
END
~CREATE;VERIFY;432
RFRTAG;96;EPC
96;DF511;H
STOP
VERIFY;DF511;H;*STARTEPC=*;*=ENDEPC\n*
END
~EXECUTE;VERIFY;2
~NORMAL
The result is:
STARTEPC=E28068940000501EC931EC87=ENDEPC
STARTEPC=E28068940000401EC931EC86=ENDEPC

Click Stream with image pixel

I am working with capturing click stream variable on click. For example i want to capture value like size,color, amount once user adds any item to cart.
For this I m using
jQuery("body").append(jQuery('<* img src="https://******/clickstream?text='+JSON.stringify(text)+'" />'));
Here text is a JSON Object with variable captured from clicks like size, color and it invokes a REST API to push the data. However I am getting 400 Bad Request for this.
This works fine in case of
jQuery("body").append(jQuery('<*im g src="https://*****/clickstream?text='+"Some Hard coded stuff"+'" />'));
But fails for JSON.stringify(JSON Object) , gives 400
I have a REST API in JAVA , GET : /clickstream?text=text to capture the variable from clickstream
Can anyone please suggest what i m missing
Thanks in Advance

Why the email I send via the INSTRUCTOR > EMAILS is truncated?

1) Given my email, produced via a mailchimp online editor.
2) I go to my openEdX, log in as administrator of the MOOC. Then got to My MOOC > INSTRUCTOR > EMAILS, in order to send my email. First a test to myself, later to my 2000 mooc students.
3) The email I receive in my inbox is CUT HALF WAY. The bottom part is all missing.
QUESTION : What is going on there ? How to fix this ?
Look into your code for the first paragraph which disapeared. It's likely the buggy part.
For this case, I can see the first disappeared sentence is :
💡 Astuce : Pensez à inviter NudiMooc à suivre votre BLOG
My eyes are catched up by the strange 💡 sign, which is a rare unicode character.
Delete this exotic 💡 sign from your email / html5 code, and it will work again. I tested it by sending to myself. Horray ! The corrected code without the lightbulb was complete !! :D
OpenEdX processing may crash on this string. But because there are some witty security, the previous, valid text is kept.

Ruby - extract info from JSON with variable loop iteration

I have a JSON response which is stored as a string in "BQresponse"
{"kind":"bigquery#queryResponse", "schema":{"fields":[{"name":"Revenue", "type":"INTEGER", "mode":"NULLABLE"}, {"name":"Country", "type":"STRING", "mode":"NULLABLE"}]}, "jobReference":{"projectId":"curious-idea-532", "jobId":"job_S5rTcY2vwEu-amtrxb8NRPWiynU"}, "totalRows":"3", "rows":[{"f":[{"v":"100"}, {"v":"Ireland"}]}, {"f":[{"v":"200"}, {"v":"Netherlands"}]}, {"f":[{"v":"50"}, {"v":"Singapore"}]}], "totalBytesProcessed":"0", "jobComplete":true, "cacheHit":true}
I am trying to convert this into a two line response (for later export to CSV), looking exactly like this:
Country||Sum of Revenue|,Ireland,Netherlands,Singapore
Revenue,100,200,50
So far, I've extracted the first parts, like so:
puts BQresponse[/#{D1_mark1}(.*?)#{D1_mark2}/m, 1]+"||"+BQresponse[/#{M1_mark1}(.*?)#{M1_mark2}/m, 1]
Next I need to extract "Ireland,Netherlands,Singapore". However I cannot use the same approach as I have done above as there may be more or less values as the string is updated (maybe only 2 or 5 countries).
The string included a part that says "totalRows":"3"," - this 3 is the number of expected countries and I suppose could be used in a loop/for-each of some sort. But I'm not sure how to best approach this.
The number values on the second line face the exact same issue (each country has a number). The "Revenue" on the second line is simply a repeat of "Revenue" on the first line, with "Sum_of_" removed.
Appreciate suggestions on what direction to head in.
Also, this is a valid JSON, if I'm completely off track and it would be easier to convert this string into a JSON first, that's okay too.
Thanks!
There's an awesome gem for this, json2csv here that I've had to use before.
To try it out, I'd save down a sample JSON response into a file called sample.json and then in your terminal you can run:
json2csv convert sample.json

Resources