Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 hexadecimal integers in Javascript
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

seahorse
Senior Member

USA
1075 Posts

Posted - 08 October 2003 :  01:17:13  Show Profile  Visit seahorse's Homepage
Hi All,

What is the point to hexidecima and octal integers?

I'm currently reading a book on Javascript and there's a section explaining variables. One thing it goes into is hexidecimal and octal integers. I can't wrap me head around it and I'm not inclined to try.

Does anyone actually use this stuff in day to day web development or is this some throwback to the "good old days" of programming?


Ken
===============
Worldwide Partner Group
Microsoft

Doug G
Support Moderator

USA
6493 Posts

Posted - 08 October 2003 :  10:46:07  Show Profile
Hex is definitely used regularly by programmers. Octal is used less often, but if you have linux server and chmod 755 somefile you just used an octal number.

The reason hex and octal are commonly used in code is because they are human-understandable representations of binary numbers. 0xc4 is much easier on the eyes than 11000100. And since digital computers still exclusively use binary math hex and octal will be used for a long time.

In a lot of places even for a user hex can be more understandable than decimal imho. Color values are one example, rgb colors represented as 3 pairs of hex numbers is much easier on the mind than the decimal equivalent (for an example of the decimal equivalent look at the color properties in a Microsoft Access form control). If you have a hex color value of #dcdcdc it's easy to understand the first dc is the red value, the 2nd is the green value, and the last is the blue value.




======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 08 October 2003 :  10:59:10  Show Profile  Visit D3mon's Homepage
I use Hex values for web colors all the time.

In CSS, colors are usually defined in 3 Hex. values - Red, Blue and Green each one representing a number from 0-254. The benefit of using Hex here is that the resulting definition is only six characters instead of 9:

White = (max)Red, (max)Green and (max)Blue

To represent that in Decimal would be: 254 254 254
in Hex: ff ff ff

Oddly enough, I find it more difficult to work with RGB color values than Hex now - e.g. it is much easier to tell if a color is websafe in Hex than in RGB.


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

seahorse
Senior Member

USA
1075 Posts

Posted - 08 October 2003 :  22:09:22  Show Profile  Visit seahorse's Homepage
I've always used a color picker. Is there any other place for hex numbers in everyday web development aside from colors? I knew that FFFFFF was white, but never really cared if it was hex or not. I just memorized it.

Assuming I ever build up the necessary skills, I don't think I'd ever develop anything more complex than Snitz. Would I ever need hex for that?

I guess I look at it from a different perspective. I'm basically an ASP hobbist. If I can use a tool, like a color picker, to free myself from any "non-essential" learning and get the job done, I'll do that. If that's lazy coding, then I'm a lazy coder.


Ken
===============
Worldwide Partner Group
Microsoft
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 08 October 2003 :  23:44:58  Show Profile
You won't need to know hex or octal for most asp coding. However, if you want to have an understanding of computers and how they work you should make the effort to understand these different number bases and how to use numbers in a base other than base 10. It's enlightening, and you'll enjoy dayve's (and others who use it) sigs: "there are 10 kinds of people. Those who understand binary and those who don't"


======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 20 October 2003 :  13:47:49  Show Profile  Visit D3mon's Homepage
Found this and thought of this thread:

Counting Binary on your fingers


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"

Edited by - D3mon on 20 October 2003 13:49:31
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 20 October 2003 :  13:55:42  Show Profile
cool ... you can count to 1023 on two hands.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 20 October 2003 :  14:14:29  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
I like the number 4

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 20 October 2003 :  17:16:56  Show Profile  Visit D3mon's Homepage
Yeah!
No wonder, when I indicate I'd like 4 items, everyone gets upset!


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

silent_frosty
Junior Member

USA
178 Posts

Posted - 21 October 2003 :  11:19:59  Show Profile  Send silent_frosty an ICQ Message  Send silent_frosty a Yahoo! Message
Whoo Hoo, now I can count in binary, thanks D3mon. Lol, I agree with Brad, #4 is great!

Life is a waste of time. Time is a waste of life. So get wasted all of the time and have the time of your life.
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 21 October 2003 :  11:32:18  Show Profile  Visit dayve's Homepage
There are 10 types of people, those who understand binary, and those who do not...

Go to Top of Page

silent_frosty
Junior Member

USA
178 Posts

Posted - 21 October 2003 :  16:39:55  Show Profile  Send silent_frosty an ICQ Message  Send silent_frosty a Yahoo! Message
quote:
Originally posted by dayve

There are 10 types of people, those who understand binary, and those who do not...



I never really got that until now

Life is a waste of time. Time is a waste of life. So get wasted all of the time and have the time of your life.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.5 seconds. Powered By: Snitz Forums 2000 Version 3.4.07