binary

How to get nth bit (from right) in a binary equivalent of an integer in PHP?

Suppose I want to find 2nd bit in binary equivalent of 13 (binary : 1101). It should return 0. ...

How to tell binary from text files in linux

The linux file command does a very good job in recognising file types and gives very fine-grained results. The diff tool is able to tell binary files from text files, producing a different output. Is there a way to tell binary files form text files? All I want is a yes/no answer whether a given file is binary. Because it's difficult to ...

binary protocols v. text protocols

does anyone have a good definition for what a binary protocol is? and what is a text protocol actually? how do these compare to each other in terms of bits sent on the wire? here's what wikipedia says about binary protocols: A binary protocol is a protocol which is intended or expected to be read by a machine rather than a human being...

Reading Binary data from a Serial Port.

I previously have been reading NMEA data from a GPS via a serial port using C#. Now I'm doing something similar, but instead of GPS from a serial. I'm attempting to read a KISS Statement from a TNC. I'm using this event handler. comport.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived); Here is port_DataReceived. ...

Insert hex string value to sql server image field is appending extra 0

Have an image field and want to insert into this from a hex string: insert into imageTable(imageField) values(convert(image, 0x3C3F78...)) however when I run select the value is return with an extra 0 as 0x03C3F78... This extra 0 is causing a problem in another application, I dont want it. How to stop the extra 0 being added? The ...

Convert 2 bytes to a number

I have a control that has a byte array in it. Every now and then there are two bytes that tell me some info about number of future items in the array. So as an example I could have: ... ... Item [4] = 7 Item [5] = 0 ... ... The value of this is clearly 7. But what about this? ... ... Item [4] = 0 Item [5] = 7 ... ... Any idea on...

decompile an app binary to get back to source code

Hi, Is their anyway to take a binary - even signed by yourself, and get back to the code? Im trying to recover something that I deleted a while ago... but have the binary here. Any ideas? Cheers Guys Sam ...

Converting binary to hexadecimal??

Hey guys, Just wondering on how I would go about converting binary to hexadecimal?? Would I first have to convert the binary to decimal and then to hexadecimal?? For example, 101101001.101110101010011 How would I go about converting a complex binary such as the above to hexadecimal? Thanks in advance ...

How to convert an 8-bit integer into a binary string in xquery?

At work today, we threw together this attempt: xquery version "1.0"; declare option saxon:output "omit-xml-declaration=yes"; declare variable $x := 99; string-join( for $b in (128,64,32,16,8,4,2,1) let $xm := $x mod ($b*2) return if ( $xm >= $b ) then "1" else "0" , "") Do you have a better way? Takin...

Send binary file to server using post with Qt

In Qt I need to send a sqlite file (binary file) up to a website using post. So what I do is that I open the file and try to read the content of it into a QByteArray that I with help of QNetworkRequest can send to the server. I can handle the request as the file is sent to the server but the file is just empty. Am I reading the content o...

Convert 64bit Binary to Long equivalent

How can we convert the following 64 bit binary into the long equivalent; 01111101 10100011 01001111 11111111 11111111 11111111 11111111 11000000 equals 7D A3 4F FF FF FF FF C0 HEX equals 9053167636875050944 << this is the value we want in a C# variable EDIT: The large binary number is currently stored as a String. So its a st...

Appropriate high level language to deal with binary data

Hi, I need to write a small tool that parses a textual input and generates some binary encoded data. I would prefer to stay away from C and the like, in favour of a higher level, (optionally) safer, more expressive and faster to develop language. My language of choice for this kind of tasks usually is Python, but for this case dealing ...

Write to file. (Binary Search Tree)

I can't figure out how to write a Binary Search Tree to file recursively. I open a BufferWriter with the file to wrtie too, in the Tree class. I then send the BufferWriter to the Node class to traverse the tree inorder and write to file. But it doesn't work. public void write(String filePath) { if(root != null) { try { Buffe...

How can I add complete binaries to a Mercurial patch?

I want to use Mercurial to capture changes made to the vanilla installation of a piece of software we use. Everytime we upgrade the software, we need to manually edit the various configuration files and add 3rd party libraries that we use in the current version of the software. Creating patches for the configuration files changes are fin...

Execute a dll function in ASP.Net Bin not working, II7.

I am developing a remote control application where a client (aspx page in a browser) can request a server to "launch a notepad" (for testing purpose, for real life, turning off a light bulb, etc). So I created a dll with a simple function for launching the notepad (on the server side) and dropped this dll in the root bin folder. It wor...

How to add add node in binary tree

(5)Root (3)-------^--------(7) (2)---^----(5) ^-----(8) i want to add node with data 5 in this binray tree....Please help.....i really stuck in it ...

VB6: Slow Binary Write?

Wondering why a particular binary write operation in VB is so slow. The function reads a Byte array from memory and dumps it into a file like this: Open Destination For Binary Access Write As #1 Dim startP, endP As Long startP = BinaryStart endP = UBound(ReadBuf) - 1 Dim i as Integer For i = startP To endP DoEvents Put #1, (i...

Binary Addition. Is it overflow?

Binary values are in 2s Complement form. If I am to add 110001 (-15) and 101110 (-18), and the answer has to be stored in a 6-bit integer, is this an underflow/overflow. ...

Need a quick way to mass update PropertyValuesBinary field for all users

Hello, we are using the asp.net profiles provider in our app and I need to update one particular property for most of our users. Does anyone have a console app or sample code written? We are not storing the properties in string format. This binary stream is in the aspnet_Profile table. thanks, hp ...

What kind of string is this? What can I do in php to read it?

This is a string (see below, after the dashed line) in a database.inf file for a free program I downloaded that lists some websites. The file is plain text as you can see , but there is a string after it that looks base64 encoded (due to the end chars of ==). But b64_decoding it gives giberish. I wanted to decode it so I could add to t...