Page 1 of 2

Puppy Programming School

Posted: Mon 16 Jan 2012, 11:17
by Lobster
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 :shock:

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 8)

Posted: Fri 03 Feb 2012, 13:33
by antiloquax
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

Posted: Sun 19 Feb 2012, 17:26
by Lobster
This GUI front end should be both useful and easy to understand and modify:

http://www.murga-linux.com/puppy/viewto ... 850#185153

Posted: Sat 03 Mar 2012, 19:34
by Lobster
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 8)

Code: Select all

## 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)

Posted: Sun 04 Mar 2012, 08:51
by antiloquax
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!


Image[/url]

Re: Puppy Programming School

Posted: Fri 09 Mar 2012, 13:10
by L18L
Hi, could not resist the temptation to i18n
First Script
Save it as lob :wink:
------------------
edit
back from asking my translator whether lob is anything other than lobsterĀ“s first 3 letters: yes it is :D

Posted: Sun 11 Mar 2012, 13:32
by antiloquax
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 ...
:D :D

Posted: Sun 11 Mar 2012, 14:07
by SFR
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!

Posted: Sun 11 Mar 2012, 15:04
by antiloquax
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
11111111 = -1
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

Posted: Sun 11 Mar 2012, 15:13
by GustavoYz
"Signed magnitudes".
This has great information.

Posted: Sun 11 Mar 2012, 15:17
by SFR
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!

Posted: Sun 11 Mar 2012, 16:41
by antiloquax
Thanks for your help! It's becoming clearer!

Posted: Fri 16 Mar 2012, 10:42
by antiloquax
Image

Lazarus

Posted: Thu 22 Mar 2012, 12:24
by minesadorada
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%

Posted: Mon 30 Jul 2012, 03:30
by antiloquax
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

Posted: Tue 31 Jul 2012, 07:58
by antiloquax
I've been doing a little reading up on different Scheme implementations. Some of the popular ones (eg Clojure) actually run in a Java VM. Personally, I find that slows down the whole thing (I divide my time between a reasonably fast desktop, a Raspberry Pi and a very old laptop!).

GNU Guile, on the other hand, seems to be written in C. I am putting together a .pet for this as we speak. It takes quite a long time to compile and needs libffi and libunistring.

mark

Posted: Wed 01 Aug 2012, 12:37
by antiloquax
If anyone fancies having a go, I have made some .pets for guile, libffi and libunistring.
They are at: raspberrypy.co.
User: a3804781
P'word: puppi1
mark

Posted: Sat 04 Aug 2012, 13:53
by antiloquax
There are now 5 tutorial videos on YouTube.
This link takes you to the most recent.

Posted: Sat 04 Aug 2012, 14:06
by RSH
Cool!

I want to watch the video and learn something!

And then...

...the most recent video of the puppy programming school teaches you (teaches me)...

...NOTHING! :lol: :lol: :lol:

It is removed... :roll: :roll: :roll:

Image

Posted: Sat 04 Aug 2012, 14:17
by antiloquax
RSH wrote:Cool!

I want to watch the video and learn something!

And then...
Sorry - I didn't know about the 15 minute limit.
It will be online later!

In the meantime my previous videos are available. here.
:oops:

EDIT
Tutorial Video Five is now available!
:D