News for hackers. Stuff that matters.
Re:The Code Side Of Color by unwind on Thursday October 04, 2012 @10:58AM (#4612577)
Bleh, it seems they forgot to proof this or have it read by someone who ... I don't know, maybe knows a bit more about how it really works.

When computers name a color, they use a so-called hexidecimal code that most humans gloss over: 24-bit colors. That is, 16,777,216 unique combinations of exactly seven characters made from ten numerals and six letters — preceded by a hash mark.

I mean, "hexidecimal" is hopefully just a typo, but the "explanation" in the second sentence is off by one, it's not seven characters that make up the color, since the hash mark is constant and doesn't contribute. I would object to the "ten numerals and six letters" too, but I guess that's a suitable popular nomenclature.

And I don't even have a lawn ...

Re:The Code Side Of Color by lubutu on Thursday October 04, 2012 @11:29AM (#4612767)
I also have a real problem with them referring to the second digit from the right as the "tens place", considering it's actually base sixteen...
Re:The Code Side Of Color by wickeand000 on Thursday October 04, 2012 @12:18PM (#4613033)
Only if you take 'ten' to be a number in base 10. /s
Re:The Code Side Of Color by TeMPOraL on Thursday October 04, 2012 @12:47PM (#4613162)
Every base is base 10. ;).
Re:The Code Side Of Color by pilsetnieks on Thursday October 04, 2012 @01:13PM (#4613287)
I understand you meant that in jest but base 1 is possible, albeit very cumbersome:

1 = 1

2 = 11

3 = 111

4 = 1111 ...etc.

Re:The Code Side Of Color by vog on Thursday October 04, 2012 @03:23PM (#4613895)
Sorry for the nitpick, but that's not really "base 1".

It is "unary", which is completely different encoding than the "positional notations" such as decimal, octal, binary, etc. The positional notation doesn't work with base 1, as in that notation there would be only 0, and 0, 00, 000, etc., which all mean the same number: zero.

Re:The Code Side Of Color by pilsetnieks on Thursday October 04, 2012 @06:09PM (#4614655)
That I agree on, it is conceptually different (and more primitive); the whole conversation just reminded me of GEB.
Re:The Code Side Of Color by geoffschmidt on Thursday October 04, 2012 @02:25PM (#4613621)
Really? How do I write zero in your system? (as in the number of apples I have if I have none at all)

If octal uses the digits 0-7, and binary uses the digits 0-1, then shouldn't base one use only the digit 0?

Re:The Code Side Of Color by stuffihavemade on Thursday October 04, 2012 @02:28PM (#4613642)
0 = 1

1 = 11

2 = 111

3 = 1111, etc. {1,2,3...} and {0,1,2...} are isomorphic.

Re:The Code Side Of Color by geoffschmidt on Thursday October 04, 2012 @02:39PM (#4613693)
But surely that's not the way it works in any other base. In any other base there is a digit '0' such that:

0 = 00 = 000 = 0000 = the number of apples I have if I don't have any.

Re:The Code Side Of Color by geoffschmidt on Thursday October 04, 2012 @03:00PM (#4613777)
To dig in a little further, when we say base N, we mean that we are expressing an integer as a sum of the values N^i (for i being every nonnegative integer), each multiplied by a weight that is an integer between 0 and N-1 inclusive.

Why do we do this? Because every integer has exactly one unique representation in this system. We could have picked any values we wanted for the places (rather than N^i) but unless we pick carefully, either some numbers aren't representable, or some numbers have multiple representations.

Base one has a problem right from the start, which is that 1^i = 1 for any value of i - when all places have the same place value, numbers aren't going to have a unique representation. The other problem is that the only number you can write in base one is zero, because the only possible weight (the only integer between 0 and N-1) is 0.

When you write 1111 = 4 you are sneakily using the length of the number on the page to encode the value. The length of the number on the page isn't supposed to matter. In base 10, 17 = 017 = 0017 = 00017.

Re:The Code Side Of Color by stuffihavemade on Thursday October 04, 2012 @04:02PM (#4614088)
"When you write 1111 = 4 you are sneakily using the length of the number on the page to encode the value. The length of the number on the page isn't supposed to matter. In base 10, 17 = 017 = 0017 = 00017."

I couldn't find a rigorous definition of a base system offhand. If you require that number N prepended with additive identity I, so IN = N, I agree with you. But every number in the system I described certainly has a unique representation. Also, this is incorrect: "The other problem is that the only number you can write in base one is zero, because the only possible weight (the only integer between 0 and N-1) is 0." Try taking a look at: http://en.wikipedia.org/wiki/Peano_arithmetic

Re:The Code Side Of Color by alexchamberlain on Thursday October 04, 2012 @12:15PM (#4613015)
They clearly have a different understanding of base 16 to us!
Re:The Code Side Of Color by Tipzntrix on Thursday October 04, 2012 @11:36AM (#4612807)
Not to mention that they equate A-F as 10-16, when in fact it is 10-15, and the whole "ones column" goes from 0-15, not 1-16.
Re:The Code Side Of Color by ubernostrum on Thursday October 04, 2012 @04:28PM (#4614212)
Yeah, this bugs me in all kinds of ways (not least because I once wrote a library for converting between the common CSS color specifiers, and had to document this stuff, so there's a lot of "I can do this better and I'm just a guy who writes code").
Re:The Code Side Of Color by smashing_mag on Thursday October 04, 2012 @06:55PM (#4614851)
This mistake was corrected 30 minutes after the article was published. The article went through two technical reviews but apparently such mistakes still happen. Thanks for bringing it to our attention — the wording was incorrect.
Re:The Code Side Of Color by mnicole on Thursday October 04, 2012 @12:20PM (#4613042)
There needs to be a w3fools equivalent for Smashing Magazine.