hex

Doing math with colors like SASS but in Ruby

In SASS I can do !pink = #ff43a7 !darker_pink = !pink - #333333 I'd like to the same in ruby. ...

VS 2008 debugger displays integers in hex

Hi Guys, For some reason my Visual Studio debugger has started to show me my integers in Hex. I am programming ASP.net using C#. Does anyone have an idea how can I convince the debugger to display integers in decimal again? Thanks a lot, Assaf. ...

[C++] instantiating bitset using hex character.

Hey, I'm trying to figure out how to instantiate a 4 bit bitset based on a hex character. For instance, If I have a character with value 'F', I want to create a bitset of size 4 initialized to 1111 or if it is A, i want to initialize it to 1010. I could use a bunch of if statements like so: fn(char c) { bitset<4> temp; if(c == 'F')...

How to get the MD5 hex hash for a file using VBA?

How can I get the MD5 hex hash for a file using VBA? I need a version that works for a file. Something as simple as this Python code: import hashlib def md5_for_file(fileLocation, block_size=2**20): f = open(fileLocation) md5 = hashlib.md5() while True: data = f.read(block_size) if not data: br...

C converts HEX value from emacs into the incorrect value

in a file, i have used m-x ucs-insert to insert a hex character 9e (which in emacs shows up as \236). however, when this is read in by the C program, 9e is becoming 0x9ec2. Where is this c2 coming from and how do i get rid of it?? ...

Objective-C Decimal to Base 16 Hex conversion

Does anyone have a code snippet or a class that will take a long long and turn it into a 16 byte Hex string? I'm looking to turn data like this long long decimalRepresentation = 1719886131591410351; and turn it into this //Base 16 Hex Output: 17DE435307A07300 The %x operator doesn't want to work for me NSLog(@"Hex: %x",decimalRep...

Loop through hex variable in C

I have the following code in a project that write's the ascii representation of packet to a unix tty: int written = 0; int start_of_data = 3; //write data to fifo while (length) { if ((written = write(fifo_fd, &packet[start_of_data], length)) == -1) { printf("Error writing to FIFO\n"); } else { ...

How to change HEX value to EBCDIC char

What is the simplest way to convert HEX value to ebcdic char type in Java e.g. The example below will return at sign but I would like to get ebcidic equivalent i.e. space char.. String hex = "40"; char c = (char) Integer.parseInt(hex, 16); ...

Representing a number in a byte array (java programming)

I'm trying to represent the port number 9876 (or 0x2694 in hex) in a two byte array: class foo { public static void main (String args[]) { byte[] sendData = new byte[1]; sendData[0] = 0x26; sendData[1] = 0x94; } } But I get a warning about possible loss of precision: foo.java:5: possible loss of precision found ...

Convert opacity to hex in Javascript

What would be the preferred way to convert opacity (0 - 1) to hex (00 - ff) in Javascript? My thoughts are to use an if statement to check if opacity is between 1 and 0.95 then use ff. Work my way down to 0. ...

ActionScript 3.0 Color Output Error?

I'm employing color in a current AS3 project, and have come across what appears to be an error in the Flash Player (version 10). it might also be an error with Apple's DigitalColor Meter (version 3.7.2), which is what i'm using to sample the displayed colors on Mac OS X Snow Leopard (version 10.6.3). //Primary, secondary, and tertiary ...

Python: Seeing all files in Hex.

I am writing a python script which looks at common computer files and examines them for similar bytes, words, double word's. Though I need/want to see the files in Hex, ande cannot really seem to get python to open a simple file in python. I have tried codecs.open with hex as the encoding, but when I operate on the file descriptor it a...

Does style="color: #FFF;" render as #F0F0F0 or #FFFFFF?

When defining colors using "shorthand hexidecimal" (style="color: #FFF;"), is there a defined method for expanding the shorthand? (style="color: #F0F0F0;" or style="color: #FFFFFF;") Do all browsers use the same expansion method? Is this behavior by specification (if so, where is it defined)? Does the expansion method perhaps vary betwe...

Hex characters in varchar() is actually ascii. Need to decode it.

This is such an edge-case of a question, I'd be surprised if there is an easy way to do this. I have a MS SQL DB with a field of type varchar(255). It contains a hex string which is actually a Guid when you decode it using an ascii decoder. I know that sounds REALLY weird but here's an example: The contents of the field: "38353334373...

Hex to bin after logical operations

I want: 111 || 100 ---> 111, not 1 100 && 100 ---> 100, not 1 101 && 010 ---> 000, not 0 Broken code #include <stdio.h> main(void){ string hexa = 0xff; strig hexa2 = 0xf1; // CONVERT TO INT??? cast int hexa3 = hexa || hexa2; int hexa4 = hexa && hexa2; puts(hexa3); puts(...

Can any of the .NET Parse methods handle a hex string prefixed with "0x"?

I tried parsing a number with .NET Int64.Parse method, and it won't accept a string like "0x3039", even though that's how you write the constant in C#. The documentation specifically disallows the string to have a "0x" prefix, and a trailing "h" doesn't seem to work either. To parse a hexadecimal number, I must have to use the System.G...

Python: Mat-File into hex-values

filename = r"C:\Dokumente und Einstellungen\sschnei1\Desktop\a.mat" print open(filename, "r").read().encode("hex") The code above only work for text files. But I want to read out the hex-values of mat-files. EDIT: my little hex-editor from textwrap import fill filename = r"C:\a.mat" hexvalues = open(filename, "rb").read().encode("hex...

How to convert a String to a Hex Byte Array ?

Possible Duplicate: How do you convert Byte Array to Hexadecimal String, and vice versa, in C#? For testing my encryption algorithm I have being provided keys, plain text and their resulting cipher text. The keys and plaintext are in strings How do i convert it to a hex byte array?? Something like this : E8E9EAEBEDEEEFF0F2...

Hex Pair to Hex Shorthand

I have a bunch of Color objects (.Net). I want to convert them to Hex, which is simple enough with something like: Dim clr As Color = Color.FromArgb(255, 0, 0) Dim clrString = ColorTranslator.ToHtml(clr) Is there a way in .Net or through RegEx (or some other way) that I can determine if Hex shorthand (like #F00) is available for the s...

BigInteger.Parse() on hexadecimal number gives negative numbers.

I've started using .NET 4 System.Numerics.BigInteger Structure and I've encountered a problem. I'm trying to parse a string that contains a hexadecimal number with no sign (positive). I'm getting a negative number. For example, I do the following two asserts: Assert.IsTrue(System.Int64.Parse("8", NumberStyles.HexNumber, CultureInfo.In...