binary

Binary operations on Erlang binaries?

What's best way to do the following? Binary -> list -> binary seems unnecessary. binary_and(A, B) -> A2 = binary_to_list(A), B2 = binary_to_list(B), list_to_binary([U band V || {U, V} <- lists:zip(A2, B2)]). ...

Delete multiple nodes from a binary search tree

Hello, I have a binary search tree created in c. The problem is I can't find a efficient way to delete all the nodes with e.g. id>5. When I traverse the tree, if I delete a node, the recursion is getting error, because the structure is not the same. Is there any way, instead of using a helping stack to keep the data before delete them...

NSInteger to binary (string) value in 8bit format

Hi Jarret Hardie (thanks !) post this code yesterday to convert a NSinteget to binary, and works perfectly, but i need in 8bit format: 4 -> 00000100 any ideas to modify this code? // Original author Adam Rosenfield... SO Question 655792 NSInteger theNumber = 56; NSMutableString *str = [NSMutableString string]; for(NSInteger numberCop...

Erlang list comprehension with two lists in sequence?

Is it possible to use list comprehension on two lists, item by item, in sequence? Given A = [1,2,3], B = [4,5,6], get some C = [f(1, 4), f(2, 5), f(3, 6)]. In other words, a more direct/efficient way to do [f(U, V) || {U, V} = lists:zip(A, B)]. Similar question goes to binaries, if given A = <<1,2,3>> and B = <<4,5,6>>. This would be ve...

Binary Java 7 for Mac

Is there any binary release of Java 7 (using the Mac/BSD-port project) anywhere? Some blogs (e.g. Building Java 7 on Mac OS X) have a detailed instructions to build the jdk from source, but I was hoping that someone have a binary of it available for download. The problem with the instructions is that it's quite annoying to get all the ...

Passing array of bytes from ActiveX to javascript and vice versa

Hi all, I need to pass data (byte array, i.e char*) from ActiveX object (using Visual C++ with ATL) to my javascript code (and vice versa). I've digged the Web for such problem and tried lots of solutions but have not succeeded. I've tried the followings: Converting char* to BSTR and pass it to javascript (JS), but my result in JS is ...

How to REALLY strip a binary in MacOs

MacOs 10.6, if I have a file "unwanted.c" which contains: class secret_thing { public: secret_thing() {} void revealing_method_name() {} }; main() { secret_thing obj; obj.revealing_method_name(); } Now I do: $ g++ unwanted.c -o unwanted $ strip unwanted $ nm unwanted | grep secret 0000000100000eb8 T __ZN12secret_thing21revea...

Is it possible to make a webHttpBinding WCF service to answer binary?

I implemented this contract [OperationContract] [WebGet(UriTemplate = "{parameter}", BodyStyle= WebMessageBodyStyle.Bare)] byte[] Operation(string parameter); But, when I called the implementation, all I got was something like this: <base64Binary xmlns="http://schemas.microsoft.com/2003/10/Serialization/"&gt;dGVzdA==&lt;/base64Binary...

What is the difference between plain binary format (.bin) and Windows Executable (.exe)?

What is the difference between plain binary format (.bin) and Windows Executable (.exe)? ...

Determine if an executable (or library) is 32 -or 64-bits (on OSX)

Hello, (sorry, i -almost- stoled the title from someone else). Is it possible to get information about any binary on Snow Leopard, to determine if it's a 32 bits or 64 bits binary ? I played with the 'otool' command but can't find this kind of information. Thanks. ...

How do I create binary patches?

What's the best way to go about making a patch for a binary file? I want it to be simple for users to apply(a simple patch application would be nice). Running diff on the file just gives Binary files [...] differ ...

Mono ASM Generation

I want to try write a simple kernel in C# like cosmos, just for learning. Is it possible to generate x86 or x86-64 ASM from a Mono assembly? because mono --full-aot generates an executable... After the generation of the ASM I need to compile it with NASM. Any ideas? ...

Emulating Linux binaries under Mac OS X

How do I run Linux binaries under Mac OS X? Googling around I found a couple of emulators but none for running Linux binaries on a Mac. There are quite a few posts about running Mac OS X on Linux and that kind of stuff - but that's the opposite of what I want to do. Update: Thanks for all the answers! I am fully aware of MacPorts and ...

Insert binary data into SQL from c# without a stored procedure

Does anyone know whether if its possible to insert binary data into an SQL field from c# without using a stored procedure? For example - convert a byte array into base64 or something like that and then use a text command like the following... String.Format("update A set B = {0} where C = D", Convert.ToBase64String(b)); where b is a b...

How to print integer literals in binary or hex in haskell?

How to print integer literals in binary or hex in haskell? printBinary 5 => "0101" printHex 5 => "05" Which libraries/functions allow this? I came across the Numeric module and its showIntAtBase function but have been unable to use it correctly. > :t showIntAtBase showIntAtBase :: (Integral a) => a -> (Int -> Char) -> a -> String...

Accessing binary data from SQL reporting services

Hi, ive had some experience working with SQL server and reporting services for standard data types however i am now trying to develop a report that contains binary data. Example - i have a table with approximately 5 fields and the last field is a binary data field that contains a pdf inside it. I want to have a report that shows the fi...

Traversing a binary tree in C

I'm trying to traverse a binary tree in C. My tree contains an AST node (abstract syntax tree node for compiler). ASTnode reserves nodetype which specifies given node's type (i.e INT OP or CHAR and TYPE we don't need to concern other types), the other members are left and right pointers, and finally we store. Here is code for traversing...

Reading and parsing the width/height property of a bitmap

I'm trying to write a bitmap (.bmp) parser/reader by reading raw bytes from the file and simply checking their values, and I've come across something I simply cannot wrap my mind around. The image I'm trying to read is 512x512 pixels, and when I look at the width property (at 0x12 and 4 bytes onward) it says 00 02 00 00 (when viewed in ...

Check if a binary number has a '0' or a '1' at a specific position

Hi I'd like to check if a binary number has a '0' or a '1' at a specific position. example: if the binary number is: 101000100 checking at position zero (that is at the rightmost '0') should result in '0'. checking at position 2 should result in '1'. checking at position 3 should result in '0'. checking at position 6 should result i...

Binary search, from java to Actionscript

Hi I am trying to convert the following java binary search routine to as3. I assume that 'compareTo' is a built in java method and that '>>>' s a type of bitwise operation. Can anyone familiar with both actionscript 3 and Java help with this? package binary; public class Finder { public static int find( String[ ] keys, String targe...