Rectangle 27 178

The browser is trying to convert chucknorris into hex colour code, because it's not a valid value.

  • In chucknorris, everything except c is not a valid hex value.
c00c00000000
  • Which becomes #c00000, a shade of red.

This seems to be an issue primarily with InternetExplorer and Opera (12) as both Chrome (31) and Firefox (26) just ignore this.

On a lighter note

Why does HTML think “chucknorris” is a color? - Stack Overflow

html background-color
Rectangle 27 178

The browser is trying to convert chucknorris into hex colour code, because it's not a valid value.

  • In chucknorris, everything except c is not a valid hex value.
c00c00000000
  • Which becomes #c00000, a shade of red.

This seems to be an issue primarily with InternetExplorer and Opera (12) as both Chrome (31) and Firefox (26) just ignore this.

On a lighter note

Why does HTML think “chucknorris” is a color? - Stack Overflow

html background-color
Rectangle 27 178

The browser is trying to convert chucknorris into hex colour code, because it's not a valid value.

  • In chucknorris, everything except c is not a valid hex value.
c00c00000000
  • Which becomes #c00000, a shade of red.

This seems to be an issue primarily with InternetExplorer and Opera (12) as both Chrome (31) and Firefox (26) just ignore this.

On a lighter note

Why does HTML think “chucknorris” is a color? - Stack Overflow

html background-color
Rectangle 27 178

The browser is trying to convert chucknorris into hex colour code, because it's not a valid value.

  • In chucknorris, everything except c is not a valid hex value.
c00c00000000
  • Which becomes #c00000, a shade of red.

This seems to be an issue primarily with InternetExplorer and Opera (12) as both Chrome (31) and Firefox (26) just ignore this.

On a lighter note

Why does HTML think “chucknorris” is a color? - Stack Overflow

html background-color
Rectangle 27 177

The browser is trying to convert chucknorris into hex colour code, because it's not a valid value.

  • In chucknorris, everything except c is not a valid hex value.
c00c00000000
  • Which becomes #c00000, a shade of red.

This seems to be an issue primarily with InternetExplorer and Opera (12) as both Chrome (31) and Firefox (26) just ignore this.

On a lighter note

Why does HTML think “chucknorris” is a color? - Stack Overflow

html background-color
Rectangle 27 40

Every class file starts with the hex value 0xCAFEBABE to identify it as valid JVM bytecode.

Hardly a feature :)

Hidden Features of Java - Stack Overflow

java
Rectangle 27 40

Every class file starts with the hex value 0xCAFEBABE to identify it as valid JVM bytecode.

Hardly a feature :)

Hidden Features of Java - Stack Overflow

java
Rectangle 27 40

Every class file starts with the hex value 0xCAFEBABE to identify it as valid JVM bytecode.

Hardly a feature :)

Hidden Features of Java - Stack Overflow

java
Rectangle 27 11

Adding to Dan's answer above: if you supply the int() function with a hex string, you will have to specify the base as 16 or it will not think you gave it a valid value. Specifying base 16 is unnecessary for hex numbers not contained in strings.

print int(0xdeadbeef) # valid

myHex = "0xdeadbeef"
print int(myHex) # invalid, raises ValueError
print int(myHex , 16) # valid

Convert hex string to int in Python - Stack Overflow

python string hex
Rectangle 27 11

Adding to Dan's answer above: if you supply the int() function with a hex string, you will have to specify the base as 16 or it will not think you gave it a valid value. Specifying base 16 is unnecessary for hex numbers not contained in strings.

print int(0xdeadbeef) # valid

myHex = "0xdeadbeef"
print int(myHex) # invalid, raises ValueError
print int(myHex , 16) # valid

Convert hex string to int in Python - Stack Overflow

python string hex
Rectangle 27 11

Adding to Dan's answer above: if you supply the int() function with a hex string, you will have to specify the base as 16 or it will not think you gave it a valid value. Specifying base 16 is unnecessary for hex numbers not contained in strings.

print int(0xdeadbeef) # valid

myHex = "0xdeadbeef"
print int(myHex) # invalid, raises ValueError
print int(myHex , 16) # valid

Convert hex string to int in Python - Stack Overflow

python string hex
Rectangle 27 3

Almost all of the previous short hand methods are generating invalid hex codes (five digits). I came across a similar technique only without that issue here:

"#"+("000"+(Math.random()*(1<<24)|0).toString(16)).substr(-6)
for(i = 0; i < 200; i++) {
    console.log("#" + ("000" + (Math.random()*(1<<24)|0).toString(16)).substr(-6));
}

I made a for-loop that ran this code 20000 times and only printed to the console if the length was less than 7, and I did find a case where the string was less than 6 characters. Also, one problem with this code is that it only pads the entire 6-digit string, not the individual 2-digit color codes, which means you're more likely to have zeroes in the red value than in the green or blue values.

javascript - Random color generator - Stack Overflow

javascript random colors
Rectangle 27 20

Out of all the combinations you tried, %ld and %lu are the only ones which are valid printf format specifiers at all. %lu (long unsigned decimal), %lx or %lX (long hex with lowercase or uppercase letters), and %lo (long octal) are the only valid format specifiers for a variable of type unsigned long (of course you can add field width, precision, etc modifiers between the % and the l).

%ld will work fine till the value of std::numeric_limits<unsigned long>::max()/2. Above that %ld will print wrong value(negative value).

@KaushikAcharya: No, above that it's UB. And it's arguably even UB before that, since printf is specified to require the exact correct argument types without the allowances that va_arg would have.

How to printf "unsigned long" in C? - Stack Overflow

c printf long-integer unsigned format-specifiers
Rectangle 27 372

This is something people trip over all the time, even when they know about it. :-) You're seeing this for the same reason parseInt("1abc") returns 1: parseInt stops at the first invalid character and returns whatever it has at that point. If there are no valid characters to parse, it returns NaN.

parseInt(8, 3) means "parse "8" in base 3" (note that it converts the number 8 to a string; details in the spec). But in base 3, the single-digit numbers are just 0, 1, and 2. It's like asking it to parse "9" in octal. Since there were no valid characters, you got NaN.

parseInt(16, 3) is asking it to parse "16" in base 3. Since it can parse the 1, it does, and then it stops at the 6 because it can't parse it. So it returns 1.

Since this question is getting a lot of attention and might rank highly in search results, here's a rundown of options for converting strings to numbers in JavaScript, with their various idiosyncracies and applications (lifted from another answer of mine here on SO):

So parseInt first uses toString on the first argument? That would make sense.

parseInt

I suppose 123e-2 gives 1 since it turns into 1.23 first, and then parsing stops at the decimal point?

"This is something people trip over all the time, even when they know about it" -> am I the only one that thinks this should be a bug? Doing the same in Java for example will give you a NumberFormatException each time.

@SvenMarnach: That part of parseInt (coercing the first argument to string) makes sense. The purpose of parseInt is to parse a string to a whole number. So if you give it something that isn't a string, getting the string representation of it to start with makes sense. What it does after that is a whole 'nother story...

javascript - Why is it that parseInt(8,3) == NaN and parseInt(16,3) ==...

javascript numbers parseint radix
Rectangle 27 5

In formatted text fields FT your number 2 is the valid solution.

A different approach e.g. in reports or observation is to put every line in TX fields in a single segment and repeat the segments or to repeat the data fields with ~ .

In binary encapsulated data fields ED you have to use the relevant encoding e.g. Hex or Base64.

This does not exclude that you will see different ways may they be valid or not

From the version 2.3.1 HL7 standard: "..The escape character is whatever display ASCII character is specified in the Escape Character component of MSH-2-encoding characters..", you can read more in compressed form at hermetechnz.com/Documentation/sqlschema/

character encoding - Using carriage return in a HL7 message - Sta...

character-encoding hl7 hl7-v2
Rectangle 27 5

The encrypted data will not be a valid UTF-8 string as it should be indistinguishable from random bits. If you need it in a string form you need to do something like base64 encode it or write out the hex values of the bytes.

NSData
base64EncodedDataWithOptions

Thanks for the answer, the code now works like a charm.

ios - Swift AES encryption using CommonCrypto - Stack Overflow

ios swift encryption commoncrypto swift2.1
Rectangle 27 5

The encrypted data will not be a valid UTF-8 string as it should be indistinguishable from random bits. If you need it in a string form you need to do something like base64 encode it or write out the hex values of the bytes.

NSData
base64EncodedDataWithOptions

Thanks for the answer, the code now works like a charm.

ios - Swift AES encryption using CommonCrypto - Stack Overflow

ios swift encryption commoncrypto swift2.1
Rectangle 27 1

The code given in the question is not valid JSON.

In order to be valid JSON, it would be required to have the field named in quotes. There are no quotes around the e variable name, or any of the others.

This is what the JSON decoder is complaining about: It is expecting to see "e", not e.

In addition, JSON does not accept the \x escaping format (character reference in hex); it can only use the \u format (unicode character reference in decimal). The code you've provided includes escaped characters in both formats.

The question is, are you using an official Google API? Because they're usually pretty good at providing valid JSON. This isn't valid JSON, so it may be that you're not using the correct API. Another clue is that the variable names aren't very meaningful; offical APIs would normally give more meaningful variable names. If it is the correct API, you should try raising a ticket with Google to fix it; broken JSON is not good, but it should be pretty trivial for them to fix.

Assuming you can't get them to fix it and we can't find an alternative API location that does give valid data, how do we deal with what we've got?

While this code may not be valid JSON, it is valid as a Javascript object (the JSON rules are stricter that those of plain Javascript). It could therefore be run in a Javascript interpreter using eval(), if you trusted it enough for that.

The only other alternativate is to fix the string prior to parsing it so that the variable names are quoted. That's a bit of a pain, but would be do-able if the output was consistent. You'll have problems though if it ever changes (and again, if it's an unofficial API, that could happen at any time without warning).

php - Trouble decoding Json from Google - Stack Overflow

php json
Rectangle 27 4

2D25 is a hex value. See http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.information.isnumeric.aspx, in particular: "IsNumeric returns True if Expression is a string that contains a valid hexadecimal or octal number." RegEx is probably your best bet.

In Classic ASP, the D is used to signal double precision.

I figured it was something like this, however the documentation you provided is for .Net, not applicable for classic asp.

Ah -- you are right. The 'D' in classic ASP was once used to signal 'double' precision. It sounds like that is what you are seeing. I'll add another link for Classic ASP to the answer as a reference... You have to scroll about 1/2 way down the page to the VBScript section.

Classic ASP IsNumeric weirdness? - Stack Overflow

asp-classic isnumeric
Rectangle 27 12

The SHA-2 algorithms (SHA-256, SHA-512) are valid choices; however they require more storage. To store the hex digits for SHA-256, for example, you need a CHAR(64) field. There have been some questions about whether SHA-1 is "broken" Schneier discussed it and NIST commented. If those concern you, then it might be better to use one of the SHA-2 functions.

And if you want to increase the cost of a brute force attack, you might also consider adding some iterations using an algorithm such as PBKDF2. Someone posted an example here in the comments.

"To store the hex digits for SHA-256, for example, you need a CHAR(64) field." Can you explain this? Thanks.

@JDelage: I was just referring to the number of hex digits required to store it. The output is 256 bits => 32 bytes => 64 hex digits. If storage were an issue, it could be stored in some kind of raw/binary field type in 32 bytes.

Storing hashed passwords in MySQL - Stack Overflow

mysql passwords hash