I'm looking to write a pair of utilities that read in a newline separated list of integers on stdin and output their binary (4 byte) equivalent to stdout, and vice versa.
My first thought was a simple bash/linux command that would do this, but I was unable to find one. My second thought was to do this in C++, but I can't figure out how...
I want to find the fastest way to get the index of the lowest order bit of a long long. ie:
00101001001000 -> 3
Solutions involving looping and shifting are too slow. ie:
int i;
if(bits == 0ULL) {
i = 64;
} else {
for(i = 0;!(bits & 1ULL);i++)
bits >>= 1;
}
EDIT: Info on usage
The function that uses ffsll can't really re...
Hey guys,
I'm working on a c++ program and I need to take in a binary number from 0-255, inclusive, as a string(it has to be a string). What can I write in a while(input invalid) loop to check that the string is between 00000000 to 11111111, inclusive. Thanks so much
...
I have a list of objects that I would like to store in a file as small as possible for later retrieval. I have been carefully reading this tutorial, and am beginning (I think) to understand, but have several questions. Here is the snippet I am working with:
static bool writeHistory(string fileName)
{
fstream historyFile;
historyFi...
I've read that ZIP files start with the following bytes:
50 4B 03 04
Reference: http://www.garykessler.net/library/file_sigs.html
Question: Is there a certain sequence of bytes that indicate a ZIP file has been password-protected?
...
We currently use SAS to import a binary file and run queries on its data. To do this we use the techniques shown on the SAS website.
As an example, this is how we read the data:
data work.binary_data;
infile "&ifName" lrecl=8 recfm=f;
input @1 a PIB1.
@2 b PIB1.
@3 c PIB1.
@4 d PIB1.
@5 e PIB1.
@6 f PIB1...
Is there an unofficial spec anywhere that explains how to reverse engineer a Flash .FLA file?
I'm specifically interested in creating an application that can "auto-scene plan" a Flash document programmatically, pulling in content from other files, arranging that content into layers, without needing the Flash IDE open. Animators would t...
I want a user to choose an image to upload for his avatar.
So in my form, I'm asking his username, password, DOB, etc...
I'm making an object[] array and rounding up every field, and then pass that array to my method that saves the information to my Database. How can I "get" the binary information from the selected image (the DB field ...
I am trying to serialize an extended UIComponent (com.esri.ags.layers.GraphicsLayer) to send and store in a MSSQL Server database using WebOrb.
Apparently, these types of objects aren't meant to be serialized, and I haven't had much serializing/deserializing using the flash byteArray. I have also tried several other libraries(FlexXB,as...
I have a storage class that has events on adding items to it. My form class handles the event. When I try to serialize it, formatter complains about form class not marked as serializable. Of course, I don't want to serialize it, however, i can't mark event as [NonSerialize] since it is not field...
What to do?
EDIT: Aditional info:
...
I'm trying to use the BN_* functions in OpenSSL. Specifically, I have the following code:
#import <openssl/bn.h>
BIGNUM * num = BN_new();
BN_set_word(num, 42);
char * buffer = malloc((BN_num_bytes(num)+1) * sizeof(char));
buffer[BN_num_bytes(num)] = '\0';
int len = BN_bn2bin(num, buffer);
printf("42 in binary is %s\n", buffer);
Howev...
I have a site where a user can download a file. Some files are extremely large (the largest being 323 MB). When I test it to try and download this file I get an out of memory exception. The only way I know to download the file is below. The reason I'm using the code below is because the URL is encoded and I can't let the user link di...
I understand how code is compiled to assembly, and that assembly is a 1:1 replacement with binary codes. Can somebody help me understand how binary is connected to the hardware? How is the binary physically read and run? How does an if statement work in the hardware?
From google searches I'm thinking that maybe my question title should ...
I am trying to build a fixed length packet in python for an ATSC PSIP generator. This is probably very simple but so far I can't seem to get it to work. I am trying to build a packet with fields similar to the following:
table_id = 0xCB
syntax = 0b1
reserved = 0b11
table_ext = 0xFF
the end goal would be the following in binary
'110...
I just finished porting an application from Windows into Linux.
I have to create an installer of the application.
The application is not open source => I should distribute the application's binaries (executable file, couple .so files, help files and images).
I found several methods to do it:
- RPM and DEB packages;
- installer in .sh fi...
How can I add, subtract, and compare binary numbers in Python without converting to decimal?
...
How do you write binary data to a file? I want to write floats to a file, raw, and then read them back as floats. How do you do that?
...
Have you ever seen a good reason to create a custom binary rest protocol instead of using the basic http rest implementation?
I am currently working on a service oriented architecture framework in .Net responsible for hosting and consuming services. I don't want to be based on an existing framework like Remoting or WCF, because I want t...
I'm trying to convert an image (jpg) loaded via cfhttp to binary data. I can't use cffile action="readBinary" as it is not a local file.
...
I am trying to model entity's attachments in REST. Let's say a defect entity can have multiple attachments attached to it. Every attachment has a description and some other properties (last modified, file size...) . The attachment itself is a file in any format (jpeg, doc ...)
I was wondering how should I model it RESTfully
I thought a...