| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Whenever you search in PBworks, Dokkio Sidebar (from the makers of PBworks) will run the same search in your Drive, Dropbox, OneDrive, Gmail, and Slack. Now you can find what you're looking for wherever it lives. Try Dokkio Sidebar for free.

View
 

Hello World

Page history last edited by PBworks 16 years, 1 month ago

INTRODUCTION

 

Note this tutorial was done using the OLPC emulator. I have found it easier to follow by using a OLPC Squeak image with the Windows version of Squeak.

 

This series of tutorials is not designed the children using Etoys. It is designed for programmers whom intend to develop applications for the OLPC laptop using Smalltalk-Squeak. The OLPC laptop has three languages: Javascript, Python and Smalltalk-Squeak. To develop using tutorial Javascript already we publish a series of in this link. But the Javascript serves applications from the web so web access is needed. Using Smalltalk-Squeak the application can be installed native and to be used with the detached laptop, without restrictions. When you program in C++ or assembler, you compile the program and later it can execute it directly. If you program in Java or C#, it compiled in byte-code and will be compiled “just-in-teams” for a virtual machine. In the case of the Smalltalk-Squeak the thing is different. Beyond program to be alone one script, it will only twirl inside of a “proper environment”. This remembers a little an old system of the called Microsoft FoxPro. To make the exercises of these tutorial ones, presuming that you do not have a micron OLPC but a PC twirling Windows, you it has that to install an emulator of micron OLPC. It follows, step by step: Step 1 - You go to make download of two compact archives with extension .ZIP and will need to use a descompactador. If you do not have one you will be able to lower a version of the WinZip. Step 2 - It makes download of the archives: olpcwindowsA.zip and olpcwindowsB.zip. They are approximately 130 Mb () but it will not delay very if you it will have a fast connection. Clicando in link will appear an acknowledgment window and you any will have to opt to saving the archive in a folder. We are using two archives because as he contains the last “image” of the native software (operational system Linux-Fedora, graphical interface To suck, to browser, chat etc.) of micron OLPC, that always is brought up to date. The first one contains the called emulator: qemu. When to appear a new version of “significant image” we will publish it - we always come back to this page to verify - and you do not need to lower the first one again. The current version of the “image” is the 131 of 28 of October. Step 3 - It creates a folder with any name and inside unpacks the two archives of it. Step 4 - Duploclique in olpcsimulator131.bat. Appearing the initial screen of the Fedora it is fast e presses the space keyboard key.


HELLO WORLD! - PART 1

It is a tradition between programmers, when they are studying a new language, to try to write a program that prints “HELLO WORLD1” on the screen. We will do this also. In the figure you see the screen of the OLPC laptop with the Windows emulator. You have that to click inside of the window for the hand to start the emulator.

 

 

To see the “frame”, you have to move the mouse cursor to the top part of the window. To start Squeak, double click on the “moving star" with the cursor.

 

 

After a minute Squeak will appear, loading a “project”.

 

 

An application in Squeak is called a project. As the OLPC system still is very unstable, if the Squeak environment does not appear, start the emulator again. Squeak occupies the entire screen and the frame disappears.

 

 

The project that begins the first time Squeak is loaded, advertises the “Etoys”. Now drag the Navigator flap and click on PREV. Next click on NEW to start a new project.

 

 

An orange rectangle appears that is an icon for the new project. If you click on the orange rectangle it will open so you will have “a clean” screen. Drag open the Supplies flap and, next, drag out a Text object.

 


HELLO WORLD! - PART 2

 

If you to click on the Text object and later click with the right button of mouse, there appear an important thing in Squeak: the halos. (This only functions thus in the emulator.)

All object with graphical representation has a halo with its some buttons. Passing the hand on each button tip appears one saying so that it serves. We go to clicar the button with the eye, to appear the Viewer of the Text object.

 

We can consider a Viewer as a list of properties and methods of an object with graphical representation. The idea of who created the Squeak is that children would obtain to only program using the elements of the Viewer. In the reality, to create something more sophisticated, we use the Viewer but also we write code lines.

 

We go to see as if it makes this soon. It drags, for the arrow, the line that has: Text's characters: Text and will be opened a Publisher of script already with this line of code. We imagine that you he is a programmer of C++, or Appearance Basic or Java and is if asking: “that code line”. Click in the button of the Publisher of Script that seems a menu and, in janelinha, click in: show code textually.

 

There you are more in house… In script called Script1 we have the code line: self setCharacters: “Text” What it means this? With the “prefix” self we have the method setCharacters that it receives for parameter string: Text. If we were to write this in the syntax of the Java, for example, it would be any thing thus: self.setCharacters (“Text”); We go to soon say more on the syntax of the Smalltalk. We go to change the line of ours script stops: self setCharacters: “HELLO WORLD” It drags the hand on the word to substitute. As one becomes normally. To use a keyboard apostrophe in the emulator, using Brazilian keyboard presses the keyboard key with the accent-circunflexo/til signal. It would be the til (very small). This functions in my computer, one notebook D600 Latitude. It can be another keyboard key in its.


HELLO WORLD! - PART 3

As script was changed, we need to give one save in the new version. With the hand on the Publisher of Script it presses the Alt keyboard key together with “s”. Janelinha appears one where you must use a keyboard the initials of its name and to clicar Accept.

Saved script, to execute it to clicar in the button of the Publisher of Script that has one point-of-exclamação.

We have now that to change the size and position of the object. For this we go to use botôes of the halo. Click on the object and later click with the right button. It appears the halo. It uses the buttons brown and yellow.

 

But our idea was to create a program that showed “HELLO WORLD” in the screen. Our screen very is poluida. We go to erase the Publisher of Script and the Viewer clicando in the button with one “”. Easy. But also we want to take off those tongues-piece. As they they are objects with graphical representation, have halos. Opening halos we find the button pink that plays the object in the garbage. As the garbage can also is an object with graphical representation, it has halo. To erase we use it pink button the same.


 

HELLO WORLD! - PART 4

 

As we said, a Squeak application is a “project” and alone wheel inside of the “environment” Squeak. Already we have our project that shows “HELLO WORLD”. We need to save it. For this we click on the window and we press Alt with Shift and “w”. The “World” that is window appears and is very important. (This only functions thus in the emulator).

 

Click in the line: save project on file. It appears as a picture. Only the name of the project is required. Click OK.

 

A “tree” of folders appears. We only select Save and our project is in the MyEtoys folder

 

Now that your project is saved, you can leave the Squeak using the window “World”. Click the Quit line. It does not save anything! We will speak of this “general Save” of the Squeak later. When you to leave the Squeak he is not surpreso: it came back to appear the “initial page” of it! This happens because, perhaps when you, at the beginning, the Squeak went off (was better to say: “the Squeak-Etoys went off”), clicando in the “star that goes up”, three copies of it had been opened (we do not understand because - this happens with browser, chat etc. also). When you close the copy where she was working, she appears second. To see that still she has two copies active you are enough to clicar in the button of the superior part of the “frame”, that one that has a point alone. You go to see, in the “wheel”, that she has two buttons with the “star that goes up”. Duploclique in one to reopen a copy of the Etoys. COMMENT: We can say that the Squeak-Etoys is a customizada version of the Squeak, with determined specific objects that another version of the Squeak can not have. (It exists, for example, a “Squeak-Croquet” that works with three-dimensional objects.) the general architecture, however, is the same one.

 

As you already have Squeak-Etoys open, we will to try to reopen our project. We drag the Navigator flap and click in Find. In the window, click in MyEtoys and Hello World.001.pr and later: OK.

 

The project if opens. Unhappyly with the flaps - nothing it advanced to try to take off them. Thus, we made our first project.

Comments (0)

You don't have permission to comment on this page.