Archive for April, 2012

Download WaryPy.vdi for VirtualBox

15/04/2012

A few people have commented saying that they have tried to run RacyPy in VirtualBox and run into problems with PAE.

I’ve made a .vdi based of “WaryPy”. No PAE required.

WaryPy.vdi

MD5 sum:

15297a83b87bac54f58667f25820f076

 

Advertisements

Wary in VirtualBox (without enabling PAE).

12/04/2012

You can try Wary, but this version doesn’t have Python. I’ll see what I can do in the morning!

antiloquax

Would you keep a Puppy in a VirtualBox?

12/04/2012

Here are some links to some sites that help if you want to do this. I haven’t read all of them (yet), but I hope they are useful.

Simple text file with instructions.

Dad’s Virtual Place (blog).

AKS – Feel the Change.

Don’t forget that it will do NOTHING to your Windows installation if you boot into Puppy as in a Live Session.  You don’t need to install anything or make any changes to your hard drive.

Most PCs are set up to boot from the CD by default. So just put the CD in and reboot. If you have a different boot sequence, you’ll probably know how to get to the boot device selection menu (there’s usually a message at startup – it’s often F9, F12 or F2).

Puppy will then boot in a “Live Session”.

Puppy will not even mount your hard-drives drives unless you ask it to. If you like Puppy, you can choose to make a frugal installation, install to a USB stick, or just save a file with your settings (so that you can boot from the CD next time without losing your work or any changes you’ve made).

Have fun!

Any more questions, try the Murga Linux Forum!

antiloquax

Update: I found this worked quite easily, although I did have to enable PAE.  Maybe an older Linux kernel wouldn’t need this.

I chose: make new machine > Linux > Other Linux > 256mb memory > New Disk  > VDI  > Dynamically Allocated > 1GB .

Then I went into Settings > System > Processor and enables PAE. Finally I started it and chose the iso file as my installation media.

OOPs, there goes another Java program!

12/04/2012

It’s been a while since I published a proper tutorial, so I thought I’d share a program that shows off some of the features of Object Oriented Programming in Java. If you want to, you can get the code here.

Object Oriented Programming (or OOP) is a very important part of modern computer programming. For a while, C was the most popular language (here’s a .pdf of Kernighan and Ritchie’s classic book: The C Programming Language). However, as programs got more complex, it became near-impossible to write them in C.

Simula-67 was the first language that used OOP. It allowed you to create “classes” – these are basically blueprints for creating software objects. You’ll see what I mean by this later in the tutorial. Smalltalk was probably the most successful early Object Oriented Programming language (and it’s still alive today in, for instance, Squeak and Pharo). These languages influenced the creators of C++ (aka C with classes) and Java.

Okay, that’s enough history. My program is called: “RomeoAndJuliet.java”. It’s a very simple, console based program. It starts like this:

The code starts with a comment and then I am straight into declaring my first class. The program lets me create “Tragic_Lover”s. All instances of this class will have some attributes: a name (which will be stored in a string), an age (stored as an integer), a gender (I’ve used “char” because this will just be one character), a string telling us who they are in love with and another which stores the way they will choose to kill themselves.

Here’s the next section:

As you can see, this part is a constructor. This happens automatically when a new “Tragic_Lover” is created. In brackets after the class name, we see references for all the attributes we’ve set up. The program tells us that a new Tragic_Lover has been created. It puts the data into the object’s variables and then there are some lines which print out the lover’s name, age and gender.

The next bit is very similar because it’s an “overloaded constructor”.

If we want to create a Tragic_Lover who is not in love with anyone, we can now. This constructor doesn’t take a value for “in_love_with”. Instead, it puts the string, “nobody” in that variable. So if we try to make an instance of this class without that fifth parameter, Java will automatically use this constructor instead. I realise that this is a rather contrived example, but it does demonstrate this feature of the language.

The program continues …

Now we are defining some methods. These are things that “Tragic_Lover”s can do. The first one just tells us who this instance of the class is in love with. The next one, “seen_by”, is more interesting. When one of our lovers is seen by another, it calls the love_at_first_sight method belonging to that instance (here referred to with the variable “hot_stuff”. So, when Juliet is seen by Romeo, she send a message to him to fall in love with her (and vice versa). The fact that software objects can communicate with each other is one of the things that makes OOP so powerful.

Something similar happens  in the next method. When fate keeps the lovers apart, one lover’s “star_crossed” method sends a message to the other lover, leading them to commit suicide. Next we have the methods I have been talking about – one that sets a Tragic_Lover’s in_love_with variable to the name of the lover who called the method, the other which tells us that they have committed suicide.

Now we get to the main part of the program:

First we create two “Tragic_Lover”s. We don’t supply a value saying who Juliet is in love with, but the overloaded constructor will have no problem with that. Next we call the “loves” method, to find out who they are in love with. After they meet at the party, Juliet is seen by Romeo, which causes him to fall in love with her (and vice versa). We call the “loves” method to check this. Sadly, fate keeps them apart and so Romeo calls Juliet’s star_crossed method which will result in her suicide (and the same happens in reverse to him).

Here’s the output of this sad story:

Okay, that all for now!

(By the way, Shadow, if you read this, let me know if I have made any rookie errors!)

antiloquax

Eben’s webinar and the joe editor

10/04/2012

If you haven’t watched Eben’s webinar on programming the RPi, it’s here.

You’ll notice that he is using Python 2.6 (and no Pygame). He also uses the Joe text editor (which is included in the Debian RPi image).
Just in case anyone wants to have a go with this, I’ve made a .pet for RacyPy2.
When you have installed it, you can launch it by opening a terminal and typing;
joe

By the way, don’t forget to check out the blog I share with Lobster and Shadow. Click the image below!

happy coding!

antiloquax