hskaratekid
Posts: 15
Joined: Sat Jun 15, 2013 5:36 pm

how to program

Sat Jun 15, 2013 5:46 pm

post websites that teach you to program easy

greenfoot.org
planetkodu.com

any more?


rickseiden
Posts: 411
Joined: Thu Aug 02, 2012 12:21 pm
Location: Buffalo, NY, USA

Re: how to program

Sat Jun 15, 2013 11:59 pm

There are 10 types of people in this world. Those that understand binary, and those that don't.

htbwmedia
Posts: 22
Joined: Wed Jun 05, 2013 2:39 am
Location: Canada
Contact: Website

Re: how to program

Sun Jun 16, 2013 6:59 am

.There are 10 types of people in this world. Those that understand binary, and those that don't.
Although I did get a chuckle out of your sig, 10 although it is on and off or yes and no, it really just equals 1. If you wanted to say two, that would then be a 01
I know it's nit picky and bordering on geek like, but since your joke is about understanding binary.....

I do think I will be checking out those links though. Although I do know binary, I don't know squat about programming a pi.
Cast your vote if you feel Eben Upton and the Raspberry Pi Foundation deserve a Nobel Prize for their work in creating an affordable education tool

http://www.loxone.org/eben%20upton%20raspberry%20pi%20nobel%20prize%20nomination%20vote

User avatar
rpdom
Posts: 15431
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: how to program

Sun Jun 16, 2013 8:04 am

htbwmedia wrote:
.There are 10 types of people in this world. Those that understand binary, and those that don't.
Although I did get a chuckle out of your sig, 10 although it is on and off or yes and no, it really just equals 1. If you wanted to say two, that would then be a 01
I know it's nit picky and bordering on geek like, but since your joke is about understanding binary.....

I do think I will be checking out those links though. Although I do know binary, I don't know squat about programming a pi.
It seems you don't know binary either...

Code: Select all

Binary Decimal
    0      0
    1      1
   10      2
  100      4
 1000      8
 1010     10
 1110     14
 1111     15

htbwmedia
Posts: 22
Joined: Wed Jun 05, 2013 2:39 am
Location: Canada
Contact: Website

Re: how to program

Sun Jun 16, 2013 3:02 pm

Could be co side red correct if you thought of the first digit for a binary 2, a zero in the digital form of not worthy of representation. The problem with that approach is one would not know it was meant to be there.

Eight bit model

1 - 10000000
2 - 01000000
3 - 11000000
4 - 00100000
5 - 10100000
6 - 01100000
7 - 11100000
8 - 00010000

The leading zero's (nulls or off's) are required, whereas the tailing are redundant, except, of course, to indicate the number of bits.

So if your joke was accurate, 10 could also represent 4. If you are arbitrarily leaving out leading zero's in a binary system, why stop at 2.

Again, I know it's a joke, but if one is to truly understand the representation of a binary number, no part of the sequence can be left out.

"Yes your honour, there were two people at the murder scene, oh wait, there was 4... Or was it 8???
I can't remember because I was using a binary digital hybrid"

Sorry to stomp all over the flower garden in an off topic post. Truly understanding binary, though, is important if one is to learn programming.

So you may want to change the 10 to 01, for an accurate representation of the number 2 in a 2 bit system. But this operating on 2 bit can only count to 3.

It just goes to prove, not everything you find in Wikipedia is correct. The lacking education system shows up everywhere, even in the spelling and grammar of my posts.

Maybe wiki logic is precisely the reason every second version of billyware fails 33% of the time.

See, that is how net logic works, I come up with an arbitrary figure based on leaving out information and it looks like I know what I'm talking about with regard to the failure rate of windows.

Eben, you were right.... We're doomed

Just to add to the alarm guy educational program of the day, Those dip switches you see on many PCB's work in the same way, the location of the switch represents to position within the binary string a dip switch with a series of 4 switches is a 4 bit system and can only count to 15 (or 16 when you see all off as a numerical representation of The digital 0) a dipswitch in the OFF position represents a 0 or NUL in binary. A switch in the ON position means we ADD. The digital numerical representation of that particular switch position to the total of the string

Switch position. Digital value

1. 1
2. 2
3. 4
4. 8

Etc.

Pos 1 ON 2 NUL or off equals a total digital value of 3 and would look like a 10 in the digital world (if on a two bit system.)
Cast your vote if you feel Eben Upton and the Raspberry Pi Foundation deserve a Nobel Prize for their work in creating an affordable education tool

http://www.loxone.org/eben%20upton%20raspberry%20pi%20nobel%20prize%20nomination%20vote

sprinkmeier
Posts: 410
Joined: Mon Feb 04, 2013 10:48 am
Contact: Website

Re: how to program

Sun Jun 16, 2013 8:37 pm

htbwmedia wrote:Eight bit model

1 - 10000000
2 - 01000000
...

The leading zero's (nulls or off's) are required, whereas the tailing are redundant, except, of course, to indicate the number of bits.
I suspect there might be some confusion here about big-endian vs little-endian.
Binary numbers, just like decimal, octal, hex and whatever other number base you use, are usually written with the least significant digit on the right.
This means that leading 0's are redundant, not trailing ones:
ten = 10 = 010 = 0010 = 00010 etc...
three = 0b11 = 0b011 = 0b0011 ...
answer = 0x2a = 0x02a = 0x002a ...
Some architectures swap the ordering of bytes around when you use numbers too big to fit in a single byte:
https://en.wikipedia.org/wiki/Endianness
on a Little-Endian machine the lest significant BYTE is stored in memory first (i.e. left-most), but within the BYTES the least significant BIT is still, by convention, written on the right.
The "10 people" joke has been around for years (decades?), my daughter has it on a t-shirt. If it turns out you're right I'll be sure to ask for a refund.

htbwmedia
Posts: 22
Joined: Wed Jun 05, 2013 2:39 am
Location: Canada
Contact: Website

Re: how to program

Sun Jun 16, 2013 11:13 pm

I know it's been around for awhile and the last time I saw it on Big Bang I even went to the wiki post and shook my head wondering if I was wrong.

So if the leading zero's were redundant, then how is one to tell which even number is being referred to in any given binary string?
2, 4, 8, 16 etc all those numbers are preceded by all NUL values. In Binary, the leading digits are the multipliers.

Of course it is a joke, perhaps a joke written as the joke of all jokes, one aimed at the joker.

Of course if I am wrong, please explain how a binary 2 would be different from a binary 4? Not in HEX, in Binary.

I read the endian thing and it didn't make too much sense, as I'm not as computer programming literate as i would like to be, but nowhere in the endian model is there a reference to binary strings it seems to be talking HEX.

To be honest, my hex counting knowledge sucks. I know the individual values but beyond that, it might as well be some random representation of numbers and letters.

I'm pretty sure I'm right on the binary front as many older alarm panels rely on binary for installer programmed options. but i will to look at any explanation that indicates otherwise.

After post edit:

Perhaps binary is being read from right to left? From what I understood it was from left to right
First digit is 1
Second is 2
Third is 4
Fourth is 8

If read from right to left a 1 in full would be
00000001
2
00000010
3
00000011

Which reads exactly like decimal, sort of.

Perhaps I was backwards all along??


Further edit

Egad my head hurts. I think I get it now. As the article mentions, this could very well explain alot of the billy crashes. Is this where all the problems converting from billy 3.1 forwards? I dunno I'm grasping at straws to figure out the logic behind this one. It appears I am truly dating myself here, sorta like any 300 baud modem and 40 meg harddrive comments.

It looks like there was a changing of the rules of math somewhere along the line. I can see the processor advantage of little endian but the big would confuse those in china who now make almost every computer.

All I have to say is.... Ummm yup ok

So how do bi systems translate? It seems to me this could cause alot of problems, particularly in the longer strings.

Thanks for taking the time to explain the endian thing. After I read through the wiki abit more it started to make a little sense. Somewhere the original binary and Hex played a little show and tell and out popped a little Endian.
Cast your vote if you feel Eben Upton and the Raspberry Pi Foundation deserve a Nobel Prize for their work in creating an affordable education tool

http://www.loxone.org/eben%20upton%20raspberry%20pi%20nobel%20prize%20nomination%20vote

Godmil
Posts: 13
Joined: Sun Jan 06, 2013 8:10 pm

Re: how to program

Mon Jun 17, 2013 1:11 am

Wow, this thread went in an interesting direction. :) I've vote too for codecademy. The python course got me up and running in no time at all.

rickseiden
Posts: 411
Joined: Thu Aug 02, 2012 12:21 pm
Location: Buffalo, NY, USA

Re: how to program

Mon Jun 17, 2013 2:47 am

For what it's worth, I've never seen the binary system represented as the least significant digit on the left. It's always, in my experience, been least significant on the right.

0=0
1=1
2=10
3=11
4=100

and so on. So the difference between 2 and 4 in the binary system is 10 and 100.
There are 10 types of people in this world. Those that understand binary, and those that don't.

User avatar
rpdom
Posts: 15431
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: how to program

Mon Jun 17, 2013 6:01 am

htbwmedia wrote:Perhaps binary is being read from right to left? From what I understood it was from left to right
First digit is 1
Second is 2
Third is 4
Fourth is 8

If read from right to left a 1 in full would be
00000001
2
00000010
3
00000011

Which reads exactly like decimal, sort of.

Perhaps I was backwards all along??
Correct.

Like most number systems.

Yes, you can get numbered switches on circuit boards, and they are often numbered with "1" on the left, but that is just the way we expect physical switches to work. They can be connected to anything in any order. Also, binary digits (bits) are usually numbered from bit-0 onwards, as the first bit is 2^0 (1), second is 2^1 (2), third is 2^2 (4) and so on.

Which way round the numbers are stored in memory often doesn't matter when coding, as long as whatever language you are using uses a recognised format for entering and displaying those numbers.

Sometimes the bit order (more often the byte order) is important for your program. When you are using shift operators for example. Using the ARM CPU in it's default endianness:

Code: Select all

MOV R0, #1 ;# Put 1 in register 0
LSL R0, #2 ;# Shift the contents of register 0 LEFT two bits
;# Register 0 will now contain decimal 4, 100 binary.
LSL instruction is Left Shift Logical
Last edited by rpdom on Mon Jun 17, 2013 6:46 am, edited 1 time in total.

gordon77
Posts: 4242
Joined: Sun Aug 05, 2012 3:12 pm

Re: how to program

Mon Jun 17, 2013 6:30 am

rickseiden wrote:For what it's worth, I've never seen the binary system represented as the least significant digit on the left. It's always, in my experience, been least significant on the right.

0=0
1=1
2=10
3=11
4=100

and so on. So the difference between 2 and 4 in the binary system is 10 and 100.
I'd agree with that :D

sprinkmeier
Posts: 410
Joined: Mon Feb 04, 2013 10:48 am
Contact: Website

Re: how to program

Mon Jun 17, 2013 8:35 am

gordon77 wrote:I'd agree with that :D
By my count that's 100 votes for and 001 votes against the joke being valid.

Return to “General programming discussion”