binary

Fat Binary on Windows?

Hello, I know that on Mac OS X, you can combine multiple binaries that target different architectures into a single binary using lipo. I am wondering if there is a similar solution on the Windows side. Thank you. ...

Need Linux cmd-line app to compare binary files and exit on 1st mis-match...

Is there a Linux command-line app which will compare two binary files and exit on the first mis-match? cmp doesn't seem to have the quit opition. ...

Java recursive binary search throwing out of bounds exception?

Hey, I have been asked to write a recursive binary search for my data structure class in university, but i'm having a slight problem. When i search for a number that is out of bounds (over 10 in this case) it throws an out of bounds exception. I understand why it's doing it, due to the array not having >10 spaces, but i don't know how to...

Sanity of appending data to an executable binary

Is it generally sane to append some random data to an executable binary file? What measures should be taken to ensure safe operation of the resulting executable, like padding before appended data or whatever? A typical C example would be: gcc -o main.o -c main.c gcc -o main main.o -lfoo cat bar.txt >> main The target system is broadl...

ANTLR: problem differntiating unary and binary operators (e.g. minus sign)

Hi guys, i'm using ANTLR (3.2) to parse some rather simple grammar. Unfortunately, I came across a little problem. Take the follwoing rule: exp : NUM | '(' expression OPERATOR expression ')' -> expression+ | '(' (MINUS | '!') expression ')' -> expression ; OPERATOR contains the same minus sign ('-') as is defined with MINUS. Now ...

mysql binary comparison doesnt use index

I have the following query: EXPLAIN EXTENDED SELECT * FROM ( `photo_data` ) LEFT JOIN `deleted_photos` ON `deleted_photos`.`photo_id` = `photo_data`.`photo_id` WHERE photo_data.photo_id = 'UKNn' AND `deleted_photos`.`photo_id` IS NULL I unfortunately have to use binary to compare this photo_id (which is being handed to me from a diffe...

How do you decode a binary encoded mail message in Python?

I'm writing a Google App engine app that processes incoming mail, and here's the code I'm currently using to process mail messages: for content_type, body in email_bodies: #8bit bug in mail messages - see bug report here #http://code.google.com/p/googleappengine/issues/detail?id=2383 if body.encoding == '8bit': body.encoding = '7bit...

Saving a Dictionary<String, Int32> in C# - Serialization?

Good morning, I am writing a C# application that needs to read about 130,000 (String, Int32) pairs at startup to a Dictionary. The pairs are stored in a .txt file, and are thus easily modifiable by anyone, which is something dangerous in the context. I would like to ask if there is a way to save this dictionary so that the information c...

erlang - checksum

Godd Morning, I am trying to perform a check sum on the following function Data = [<<"9">>,"81", <<1>>, <<"52=">>, [[50,48,49,48,49,48,50,54,45,49,53,":",52,53,":",52,52]], <<1>>, <<1>>, [<<"9">>,<<"0">>,<<1>>], [<<"5">>,<<"4">>,<<1>>]] Using: checksum(Data) -> checksum(Data, 0). checksum([...

Saving create / modify dates of file when writing / restoring a binary filestream

Is it possible to save a file's original create / modify dates when saving a file to a db (via filestream & BinaryReader) and then have those dates attached to the file when recreating the file, again via filestream & BinaryWriter, from the db? If possible, how do I do it? My inital research leads me to believe only the file contents ar...

How are the values stored in the C unsigned shorts?

I'm trying to read a binary file into a C# struct. The file was created from C and the following code creates 2 bytes out of the 50+ byte rows. unsigned short nDayTimeBitStuffed = atoi( LPCTSTR( strInput) ); unsigned short nDayOfYear = (0x01FF & nDayTimeBitStuffed); unsigned short nTimeOfDay = (0x01F & (nDayTimeBitStuff...

Post binary data to a RESTful application

Hi, I'm working on a RESTful web application (Django+Piston). The POST request sends data encoded with Json to the web application. This works fine for all my text only database tables but I also have a table which stores text and binary files. What is the best way to post text and binary data to a RESTful application? ...

Binary vs Integer - as primary key?

I was wondering if there are any obvious pros and cons one should be aware about, while choosing to use a Binary type as a primary key, while being RANDOMIZED. Which means, new inserts will have random 4 bytes as their PK - versus having a sequence of type Integer? I'm using MySQL/MyISAM. Thanks, Doori Bar ...

Netbeans Debugging Extension for Binary Data

I am writing a program that uses a binary protocol using Netbeans and I am finding its debugging tool irritating to use. When I bring up the visualizer for an array of bytes, it gives me each byte, individually, as a signed integer. I would love something like ghex, or any other nice hex editor. For the time being I've written a utili...

[PHP CURL] Is it possible do only download a portion of a binary file

Hi! A small question concerning downloading xml files from a remote server. I am using curl to achieve this. The information I need in those xml files are located in the first couple of lines of code. Now my question is : Is it possible to download only a portion ( or a defined amount of bytes ) from these xml files , so I only have t...

few simple questions about binary search algorithm

(1) consider the SelectionSorter method sort. Which of the following statements is true at the beginning of each iteration of the loop? explain a. for all j, such that 0 <= j < i, 0 <= a[j] <= a[i]. b. for all j, such that 0 <= j < i, a[j] is in its final position in the sorted array. c. for all j, such that 0 <= j < i, a[0...

How to convert decimal number to binary number with fixed bits.

I want to convert numbers from 0 to 15 like that 0000 0001 0010 0011 . . . 1111 Problem is that when we convert 2 to binary number it gives only 10 in binary, but i want to convert 2 to 4 bit binary number 0010. ...

Is there a better way to find lowest common ancestor in a binary search tree?

I know similar questions have been asked before, but I think my solution is far simpler. Especially compared to [http://en.wikipedia.org/wiki/Tarjan's_off-line_least_common_ancestors_algorithm]. Please prove me wrong! If you have a tree with nodes that have the given data structure: struct node { node * left; node * right; ...

faster than binary search for ordered list

is there an algorithm that is faster than binary search, for searching in sorted values of array? in my case, I have a sorted values (could be any type values) in an A array, I need to return n if the value I was looking is in range of A[n] and A[n+1] ...

captcha image coming back a binary data? How to display this?

I am retrieving a captcha image from the Java based package "SimpleCaptcha" On the front end I just put the following in my page and I get a captcha image: <img src="stickyImg" /> I want to reload this captcha image onclick using javascript. I tried: $("#theclickhandler").click(function(){ $("#stickyImg").load('stickyImg', fu...