How to send and read binary data in TinyXML? - tinyxml

I need to send file data (picture,text, word,excel etc) in xml. I need to send file data as binary data. I read some article about this but couldnt get how to achieve in TinyXml. Please read below post:
http://www.techrepublic.com/article/send-binary-data-in-xml/1050529
Above post has mentioned three approaches. Now let me know what approach is possible in tinyXML. If possible send me some sample code to send and read binary data in tinyXML. I searched a lot but couldnt get any way of doing this.
If sample code is not possible then please list down API I need to use so I will try that and update here my status.

Related

Python structure for working with variable log messages in a large file

I am trying to get data out of debug log messages created by a certain piece of open source software. It has many lines describing what it is doing during stages. It does not have a specific structure, i.e. some data covers multiple lines with different indents and no separator so does not import nicely into a pandas data frame, which would be my go-to usually.
Is there a good way to structure a python script that parses this data and one that can be used in the future for the same function, and also be extendable to extract different data? I have to do a bunch of different steps to extract the data. The other complication is that the file is much too big to store in memory (10^6 lines) so i need to iterate through the lines.
Please could anyone give me some tips on how to do this, is it best to move to do each step and save to a new file? Or my idea is to create a data object and store relevant line numbers as attributes in lists, that are generated in different method. Then each subsequent method only loads the lines from that list.
Or alternatively, maybe I am totally using the wrong tool and I need to learn awk or regex commands to do it? I just know python already so have a preference for it. Not looking for a specific answer necessarily, some tips and pointers would also be very useful!
(--details--) I am trying to trace on a freeradius server the difference between log messages of requests, accepts and rejects of a mac address to see if I can find out why it is sometimes accepted and other times rejected, seemingly randomly.
There are a lot of plugins running on the server setup before I got to dealing with it so the debug is a massive wall of text, labelling each request with a number. I can split it into requests by that number, find the request that mentions the mac, split those requests into different files, then run want to filter out all the boilerplate info that comes with each message and get to the things that are different between them. (--details--)

How can I send plain text data/ JSON data instead of binary (opcode2) in secure websocket message of opentok

I have a query, Is it possible to send plane text data instead of binary (opcode 2) in https://opentokdemo.tokbox.com.
I am trying to understand the call flow of opentokdemo.tokbox.com , I am not able to read the websocket frame as it is in binary format. I tried with fiddler and wireshark as well but not decode properly .
Now I think if I make it possible, somehow i send the plain data over secure websocket by changing in opentok.js file.
IS there a way to do like this please suggest me any idea.
Thank you
Adam here from TokBox. There is no way that I know of to do that. The binary protocol is expected on the other end so even if you didn't send binary the other side would fail.
Perhaps I can help you though with what you're trying to do? Why are you trying to read the websocket messages?

Youtube API response data

Youtube's API documentation seems to me to be complete rubbish, I've spent hours reading through it and can't seem to figure out how to display a simple thumbnail of a video even by just test-copy-and-pasting the code they give in a few examples. Could someone maybe explain or point me in the direction of an at least half decent tutorial of how to retrieve data from a video search query? Using JSON by the way
In the past I've disregarded the youtube api and just made my own thumbnails using imagemagick with node, but it doesn't sound like you're using node.
If you paste the JSON response into this JSON to CSV converter, you can open the CSV file in a spreadsheet. Within the spreadsheet you will have lots of tools to help you parse the data.

Inserting Image in Wordml generated from a xsl

I need some tips and examples for the following task:
I have a image data somewhere on my disk ... this data can be of type .svg/.bmp/.gif/.png ... lets say for the moment that all of them are of type .svg.
My task is to insert several of these image data in soecific places of the WordML that I am generating.
The generation of WordML is working superbly, but as I have NEVER before read or heard about inserting image data in wordML data ... I am kinda lost.
I am going forward with <maml:medialink> and <maml:image>.
Would be really nice of you, if anyone can give me a little introduction and support with this new venture of mine.
Thank you.
Jasmin

Buffered Multipart Form Posts in Ruby

I am currently using Net::HTTP in a Ruby script to post files to a website via a multipart form post. It works great for small files, but I frequently have to send very large files using this script, and HTTP#post only seems to accept post data as a String object, which means that the file I'm sending has to be read into memory before anything can be sent. This script is running on a busy production server, so it's unacceptable to gobble up hundreds of megabytes of RAM just to send a file.
Ideally, there'd be a method that could be given a buffer size and an IO object, and would send off buffer-sized chunks of data, reading from the IO object only as required. What would be the best way to make this happen? Did I miss something relevant in Net::HTTP?
Update: Net::HTTP#body_stream(input) looks good, though the documentation is rather... sparse. Anyone able to point me to a good example of this in action?
Actually I managed to upload a file using body_stream. The full source code is here:
http://stanislavvitvitskiy.blogspot.com/2008/12/multipart-post-in-ruby.html
Use Net::HTTP#body_stream(input)
Example for multipart post without streaming:

Resources