Click Stream with image pixel - clickstream

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

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.

Tcl Tk to show images in Scilab

I want to show images and videos in Scilab using a GUI made in Tcl/Tk.
Scilab has support for Tcl/Tk :- https://help.scilab.org/docs/6.0.0/en_US/section_a10b99d9dda4c3d65d29c2a48e58fd88.html.
I have made a tcl script which displays an image when run from the terminal.
image create photo img -file <filepath>
pack [label .mylabel]
.mylabel configure -image img
However when I write the following .sci file in scilab, it executes successfully but no image window is shown.
function sampletry()
TCL_EvalFile(<path_to_tcl_file>);
endfunction
I do know that the code executed successfully because when I execute the same function again in scilab, I get an error saying that the label .mylabel already exists in the parent window.
Is there any way that I can show images/videos in Scilab using this method or any other method in Scilab? I'm using OpenCV to read the image and return it back to Scilab through the Scilab Api in a list.
The problem is that you're not servicing the event loop from your Scilab code, without which the flurry of messages from the OS to do with actually putting the window on the screen never get through and handled. Assuming you want your code to stop and wait for the viewing to be done, you can just change the Tcl/Tk code to be:
image create photo img -file <filepath>
if {![winfo exists .mylabel]} {
pack [label .mylabel]
}
.mylabel configure -image img
wm deiconify .
# Wait for the user to ask for the window to be closed
wm protocol . WM_DELETE_WINDOW {set done 1}
vwait done
# Process the close immediately
wm withdraw .
update
There's nothing very special about the done variable. We're just waiting for it to be set in the callback. I've added a bit of extra code to allow you to call this twice (i.e., conditionally creating the widget, ensuring that . is displayed and then hiding it at the end).
The simplest technique if you don't want to keep everything in the same process is to run your original script as a separate program, effectively doing:
wish <path_to_tcl_file>
I don't know what the easiest way to do that from Scilab is.

XE5 RestClient Library issues

I have created a FMX Windows app that connects to a web server to obtain REST data. I have been using the REST Client, Response, Request and ResponseDataAdapter and have connected that to a Client Data Set. I have then connected the Datasets to a string grid through live bindings. I have done this for 2 different string grids with no problems at all, And then I come to the very last request I want to make and I am getting some very strange behaviour. I set everything up in a data module and did an execute of the RestRequest in the IDE and got the content I expected in the RESTResponse. I then activated the RESTResponseAdapter and ClientDataset. The clientdata set was populated and I was able to add the fielddefs through the ide by just going to add fields.
I have a timer setup on the app to update the string grids etc,,, Works fine for two string grids. However on the last one all I ever get on the StringGrid is the data that I originally fetched while in the IDE. I assumed this could be due to some caching on the clientdataset so I put a memo on the form and after each request execute I posted the response content to the memo.... The bizarre thing is that I occasionally get the response the server is currently sending back (Verified by going to the webserver through Chrome) but sometimes the Response Content is the data that I originally requested when I set it up in the IDE. So I went back to the IDE and cleared the response data from the Rest Response. Tried again and get the same... I get the expected result sometimes and other times I get the response that I originally got in the IDE yesterday. So then I thought perhaps the webserver was sending it back. So have run the same REST request through the webserver and never get back the data that the restresponse is showing...
The code below fires on my timer. The top two sets of code are working fine the last one is the buggy one.
restDataModule.adapterOperators.ClearDataSet;
restDataModule.cdsOperators.Close;
restDataModule.responseOperators.Content.Empty;
restDataModule.reqOnlineOperators.ClearBody;
restDataModule.reqOnlineOperators.Execute;
restDataModule.cdsOperators.Open;
restDataModule.adapterStats.ClearDataSet;
restDataModule.cdsStats.Close;
restDataModule.responseOperatorStats.Content.Empty;
restDataModule.reqOperatorStats.ClearBody;
restDataModule.reqOperatorStats.Execute;
restDataModule.cdsStats.Open;
try
restDataModule.adapterChats.ClearDataSet;
restDataModule.cdsChats.Close;
restDataModule.responseChats.Content.Empty;
restDataModule.reqChats.ClearBody;
restDataModule.reqChats.Execute;
restDataModule.cdsChats.Open;
except on E: Exception do
// ignore
memo1.Lines.Add('Failed!')
end;
memo1.Lines.Add(restDataModule.responseChats.Content);
Any suggestions welcome.
Ok the solution was to add a Parameter to the RestClient with the following settings:-
Kind = pkHTTPHEADER
Name = Cache-Control
Value = no-cache
Simple but elusive

Google Translate Save to Phrasebook Import - GET/POST Hack

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.

VB6, ActiveReports, and Ricoh printers: Rotating the Page?

I have a BEAST of a program written in VB6. It uses ActiveReports to generate letters.
The reports are processed in a loop; with verbage-building loops and (a whole lotta) nested 'if' and 'case' statements. Fugly!
The reports are sent to the printer like such:
Function PrintIt(ltrobj as Object)
Set ltrobj = MyARdocument '(.Dsr file)
ltrobj.txtfield1 = strVerbage 'This string was populated somewhere else
ltrobj.Printer.DisplayProgressDialog = False
ltrobj.PrintReport False
End Function
Now here's the weird part: The pages physically come out of the printer rotated 90 degrees each iteration of the loop. What's even weirder -- this only happens for my VB6 application -- other Word documents, reports, batch jobs, whatever come out normal.
So the first page comes out like normal, the header first (pointing North). The second page comes out sideways (header pointing West). The third comes out of the printer like the first, the fourth comes out like the second, and on and on...
The printer: A Ricoh Aficio MP5000
I cannot find a setting on the printer, or a property in ActiveReports that controls this.
Any ideas, help, or a general direction would be greatly appreciated!
Thanks,
Jason
There is no "rotation" setting in ActiveReports. The closest things that might impact this would be the page size and orientation, but at worst I would expect them to flip back and forth not actually rotate the page. I would try to do a few things:
Trace the printer & page settings related to orientation and page size as report prints.
Try printing to another printer to see if it happens on all printers or just this one.
Preview the reports on screen and see if they're rotated in the preview or not (or export them to PDF with report.Export(...) ad see if they're rotated there).
To trace page settings you should do it in a couple places. One on the printer, and another on each page (or Canvas) in the report. There is also the ActiveReport.PrintWidth (the width of the report, not the pages) that may also be relevant. So just before printing each report try tracing out the following values:
report.PrintWidth
' the default settings for the report
report.PageSettings.TopMargin
report.PageSettings.RightMargin
report.PageSettings.BottomMargin
report.PageSettings.LeftMargin
' actual printer's current settings:
report.Printer.PaperSize
report.Printer.PaperHeight
report.Printer.PaperWidth
report.Printer.Orientation
' settings for a specific page:
for each page in report.Pages:
report.Pages(...).Width
report.Pages(...).Height
report.Pages(...).Orientation
BTW: ActiveReports COM Help is here.
If the preview/PDF test seems okay then I'd focus on the printer itself. Same for the print to another printer obviously. Otherwise, focus on ActiveReports settings.
Hope this helps
Scott Willeke
GrapeCity

Resources