binary

Silverlight to Javascript interop UTF encoding/decoding

How do I get both alerts, one invoked from silverlight and the other invoked from javascript, to show the same data in the same way. eg. ���� != ýÿýÿý System.Windows.Browser.HtmlPage.Window.Alert( data ); alert(parameters); Silverlight3 code, sending data to javascript function: System.Windows.Browser.HtmlPage.Window....

I never really understood: what is Application Binary Interface (ABI)?

I never clearly understood what is an ABI. I'm sorry for such a lengthy question. I just want to clearly understand things. Please don't point me to wiki article, If could understand it, I wouldn't be here posting such a lengthy post. This is my mindset about different interfaces: TV remote is an interface between user and TV. It is an...

PHP - What encoding does mcrypt use on an encrypted string?

Using PHP I'm trying to convert the cipher text generated by mcrypt into binary but when I try and convert it back to the cipher text it doesnt get converted back properly so it cant be decrypted. I'm assuming my encodings are getting messed up somewhere but I dont know where to start to figure it out. Here is a link to the site http://d...

Binary 0000 to FFFF using C

I am trying to program using C to write binary data to a .bin file and just iterate through to write from 0000 to FFFF. I figured I would use fopen with a 'wb' tag and then be able to write binary data but I'm unsure how to iterate from 0000 to FFFF using C. Thanks for any help. Here's my code now: #include <stdio.h> #include <stdlib.h...

Changing .bin file's data in C

Hello, I have a lot of data stored in bin format as a sequence of structs. I want to be able to read randomly any of the structs and modify it in C. I am trying with the following code but it doesn't work. Can someone fix it for me please? Also, would it be possible to delete an intermediate struct from the file in between? The code i...

Reading characters on a bit level

I would like to be able to enter a character from the keyboard and display the binary code for said key in the format 00000001 for example. Furthermore i would also like to read the bits in a way that allows me to output if they are true or false. e.g. 01010101 = false,true,false,true,false,true,false,true I would post an idea of ho...

Can you encode to less bits when you don't need to preserve order?

Say you have a List of 32-bit Integers and the same collection of 32-bit Integers in a Multiset (a set that allows duplicate members) Since Sets don't preserve order but List do, does this mean we can encode a Multiset in less bits than the List? If so how would you encode the Multiset? If this is true what other examples are there wh...

C Programming - Convert an integer to binary

Hi guys - i was hopefully after some tips opposed to solutions as this is homework and i want to solve it myself I am firstly very new to C. In fact i have never done any before, though i have previous java experience from modules at university. I am trying to write a programme that converts a single integer in to binary. I am only al...

PHP: Split string into chunks of 8, how do I do this?

I have binary basically, say it's 300 in length. How would I split (much like using explode) it into 8 bit chunks? I look at chunk_split() but it only seems to have an 'end' parameter, not an option to put it into an array.. Or can it be socketed into an array? The end 8 digits can be below 8 (in case a miscopy from someone, and it's 4)...

How to make SVN ADD ignore binaries

Binaries (under Linux) don't have an extension so I cannot exclude them using patterns. Thus when I use SVN add to add a directory I will get something like $ svn add recursion_vector/ A recursion_vector A recursion_vector/rec_vec.cxx A recursion_vector/rec_vec.h A (bin) recursion_vector/rec_vec Here rec_vec ...

Is there a better way to convert from decimal to binary in python?

I need to convert from an integer to a list of size 8 that is the binary representation of that number (number <= 255) and back. Currently I am using these lines list(bin(my_num)[2:].rjust(8,'0')) int("".join(my_list),2) I did some googling, but had a hard time finding relevant information. I'm just curious if there is a faster, or ...

Refactor for Speed: Convert To a Date

Hello, I work for myself, I am a self-employed coder and as a result I don't have the luxury of code reviews or the ability to improve based upon peer programming. I am going to use this as an exercise to see if the StackOverflow community might help to review a simple method which i've written; internal static DateTime CONVERT_To_D...

Are files dumped with fwrite portable across different systems?

Can I assume a file generated with fwrite and read using fread is portable across different systems. 32bit/64bit windows,osx,linux. //dumping FILE *of =fopen("dumped.bin","w"); double *var=new double[10]; fwrite(var, sizeof(double), 10,FILE); //reading file *fo=fopen() double *var=new double[10]; fread(var,sizeof(double),10,of); And w...

How can I get Riak to store images or binary data?

Can Riak be used to store images or binary data? It seems to only be able to store JSON documents, is this a correct assumption? ...

reading binary code of a file...in PHP

How can I read the binary code(to get the 1s and 0s) of a file. $filename = "something.mp3"; $handle = fopen($filename, "rb"); $contents = fread($handle, filesize($filename)); fclose($handle); I tried this but it shows some strange characters... i presume that this is the formated binary...? I was hoping to get the 1's and 0's instead...

Converting float or negative integer to hexadecimal in Borland Delphi

Ive written a program that communicate with some hardware using a serial connection. It sends a lot of hexadecimal values my way (sensor readings) and every once in a while it sends a negative value. ex. i receive a hexadecimal value : FFFFF5D6 and i have to convert it into : -2602 another problem i have is that i can't convert a float ...

PHP popen and proc_open not returning binary output

When using popen or proc_open to run the following command to list the contents of a windows share: smbclient -N -U 'username%password' -O 'TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192' -O 'TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192' -d 0 '//server/sharename' -c 'dir "dirpath\*"' 2>/...

Does anyone know how I can store large binary values in Riak?

Does anyone know how I can store large binary values in Riak? ...

Name me a Binary Parser. A parser for binary data.

So, I'm getting this data. From the network socket, or out of a file. I'm cobbling together code that will interpret the data. Read some bytes, check some flags, and some bytes indicate how much data follows. Read in that much data, rinse, repeat. This task reminds me much to parsing source code. I'm comfy with lex/yacc and antlr, bu...

Binary to character matrix help

FYI: This is a practice homework exercise. I've been working on it, but now I'm stuck. Any tips/help would be appreciated. I've been staring at it a while and no progress has been made. Summarized question: Nine coins are place in a 3x3 matrix with some face up and some face down. Heads = 0 and tails = 1. Each state can also be represen...