Author |
Message |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15556 Location: Paradox Realm
|
Posted: Mon 16 Jan 2012, 07:17 Post subject:
Puppy Programming School Subject description: A new Class of Variables |
|
Puppy Hacker School
starts its first program of studies
http://puppylinux.org/wikka/PuppySchoolProgramming
Because Puppys are the friskiest breed of mongrels in this dimension
you can expect the students to be setting the pace . . .
Help
What have I started?
1. This year Puppy will be ARM'd and dangerous as we become Raspberry Pi enabled
2. The first language used on http://puppylinux.org/wikka/PARM
PARM will probably be bash script, leading to Bacon when we get a compiler with the Devx
3. Your ability to write tutorials with the language of your choice, is a good way of developing for the new generation
. . . must be time for a little rant . . . I remember the day I created a BASIC tutorial in Pascal for my students. Most adult students were only interested in using Word (A DOS program in ye olde days) and other applications but one guy got it. Programming is not for everyone but everyone can do a few basics . . .
Please share your knowledge
_________________ Puppy on Raspberry Pi Release Candidate
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html 
Last edited by Lobster on Fri 09 Mar 2012, 09:19; edited 1 time in total
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Fri 03 Feb 2012, 09:33 Post subject:
|
|
Hi Lobster!
Your Hackers' School is great. I notice that you have put a link to my Python blog - thanks for that!
I am interested in learning a bit more BASH scripting. I have been dipping into "The Shellcoders Handbook" and "Hacking: The Art of Exploitation". I got rather out of my depth with the second of these! Very interesting though!
mark
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15556 Location: Paradox Realm
|
Posted: Sun 19 Feb 2012, 13:26 Post subject:
|
|
This GUI front end should be both useful and easy to understand and modify:
http://www.murga-linux.com/puppy/viewtopic.php?p=185153&search_id=628951850#185153
_________________ Puppy on Raspberry Pi Release Candidate
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html 
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15556 Location: Paradox Realm
|
Posted: Sat 03 Mar 2012, 15:34 Post subject:
|
|
Gosh have not programmed in python for a couple of years
Something simple to start with . . .
A python example of two arrays and the random function
to create fruity insults - kids should instantly find this very useful
Must be supervised
Marks given for gentler insults which are more hilarious and disarming
Code: | ## Random fruit response
# Lobster March 3 2012
import random
verb = ['erratic', 'unbelievable', 'unfortunate', 'inconsequential']
fruit = ['raspberry', 'pomegranite', 'banana', 'grape', 'loganberry']
print "You are an" , random.choice (verb) , random.choice (fruit) |
_________________ Puppy on Raspberry Pi Release Candidate
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html 
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Sun 04 Mar 2012, 04:51 Post subject:
|
|
Nice one!
I led a class of Y9 (about 13-14 year olds) through a simple "You suck and I rule" infinite loop program last week!
My latest blog post is a "hack your homework" offering. I've been learning about math.pow() and "repr().rjust()"!
Grid Multiplication
I think I did this the hard way - if anyone can think of a more elegant solution, please let me know!
You can see the RPi logo just peeping around my screen-shot!
[/url]
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3450 Location: www.eussenheim.de/
|
Posted: Fri 09 Mar 2012, 09:10 Post subject:
Re: Puppy Programming School Subject description: Python international |
|
Hi, could not resist the temptation to i18n
First Script
Save it as lob
------------------
edit
back from asking my translator whether lob is anything other than lobster´s first 3 letters: yes it is
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Sun 11 Mar 2012, 09:32 Post subject:
|
|
I'm reading (and trying to learn from) Schildt's "Java: The Complete Reference". I've got a bit lost in the section on bitwise operators.
Can anyone explain "two's complement" to me. I don't see how swapping all the bits and adding one would make the computer see it as a negative number. Also, what is the "high-order bit"?
I have a feeling I won't necessarily need to know all this, but still ...
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1749
|
Posted: Sun 11 Mar 2012, 10:07 Post subject:
|
|
Hi antiloquax.
My English isn't so sophisticated, but examples should explain everything:
[BIN = DEC]
00000000 = 0
00000001 = 1
00000010 = 2
00000011 = 3
...
01111111 = 127
but:
10000000 = -128
10000001 = -127
10000010 = -126
10000011 = -125
...
11111111 = -1
Simply, the HOB (High Order Bit) or MSB (Most Significant Bit) may indicate if the number is positive or negative.
Two's complement example:
00101101 = 45
Now let's XOR all bits:
11010010 = -46
And add 1:
11010011 = -45
HTH
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Sun 11 Mar 2012, 11:04 Post subject:
|
|
Thanks for the reply SFR - what you wrote certainly fits in with what I have read about this - but I still don't see how
Isn't "11111111" 255?
I'm clearly missing something very obvious - I'll try to work it out later.
Let's say we have the binary number 7 - "00000111"
So we do "two's complement" and that gives us: "11111001".
So the left-most bit means -128, and then we add 64, 32, 16, 8 and 1 to get -7.
I get that. But how does the computer know that we don't mean 249?
antiloquax
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
Back to top
|
|
 |
GustavoYz

Joined: 07 Jul 2010 Posts: 894 Location: .ar
|
Posted: Sun 11 Mar 2012, 11:13 Post subject:
|
|
"Signed magnitudes".
This has great information.
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1749
|
Posted: Sun 11 Mar 2012, 11:17 Post subject:
|
|
antiloquax wrote: | I get that. But how does the computer know that we don't mean 249? |
Computer doesn't know that
For CPU 11111001 may mean 249 as well as -7.
The beautiful thing is that when we add another 1, we'll get:
249 + 1 = 250
-7 + 1 = -6
11111010 = 250 = -6
so whatever you do, the result is always correct regardless if it's interpreted as positive or negative value.
The programmer decides how to interpret and display the result.
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Sun 11 Mar 2012, 12:41 Post subject:
|
|
Thanks for your help! It's becoming clearer!
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Fri 16 Mar 2012, 06:42 Post subject:
Subject description: For those who haven't tried Scratch yet, a little "guess the number" program! |
|
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
Back to top
|
|
 |
minesadorada

Joined: 11 Sep 2011 Posts: 68
|
Posted: Thu 22 Mar 2012, 08:24 Post subject:
Lazarus |
|
I'm having fun with Lazarus/FPC
I just wrote a general-purpose pascal object to handle calculating EGA handicap adjustments, EGA playing handicaps and new Exact EGA handicaps. It plugs into any simple Lazarus GUI app.
This is making my life a lot easier as the (temporary) handicap secretary of my local society.
I'm going to subclass it next to accept open-source golfML XML course definitions as an import. Then a golfML editor....
With Lazarus/FPC, I just recompile the same code for Linux 32, Windows 32 and Windows 64-bit versions, and it all works 100%
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Sun 29 Jul 2012, 23:30 Post subject:
Subject description: a couple of .pets |
|
I thought I'd post up links to a couple of .pets that might be of interest to programmers.
These are all available at ftp://raspberrypy.co/Pets/
User: a3804781
P'word: puppi1
Valgrind 3.7.0 - this is a memory checker that is recommended by Zed Shaw in his book "Learn C the Hard Way".
MIT Scheme 9.1.1 - An implementation of the dialect of LISP.
CLISP 2.49 - Common Lisp
MDK 1.2.6 - The MIXAL Development Kit
Lua 5.2.0
Ruby 1.9.3
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
Back to top
|
|
 |
|