Showing posts with label Hello World. Show all posts
Showing posts with label Hello World. Show all posts

Saturday, February 27, 2010

HELLO WORLD IN ADA 2005

HELLO ADA !

I should not be writing this article ! ...... however, trying out very simple programs in Ada 2005 made me realise how I have lost touch of the syntax etc !

Ada is a high level language which is a favourite for safety critical and real time systems. Trying out the 'Hello, World' in Ada,


The syntax has a 'pascal like' sing to it, Ada program files have extensions adb or ads. The compiler used for Ada is GNAT (which is a part of gcc).

Compilation creates 3 more files.

Running the program,



Friday, February 19, 2010

DABBLING WITH BASH -1

DABBLING WITH BASH - 1

BASH (Bourne Again SHell), the name seemed to echo between 'Bashing' to 'Bourne Trilogy'. The command line for nearly all *nix Operating Systems is actually a programming language !

I am working on version 4.0.33


1)The Hello World Program

1a) from command line

1b) from script


1c) 'Exotic' Hello, World(s)

This program prints Hello and the first command-line argument


2)Counting from 1 to 10



3)Evaluating the squares


4)Some Arithmetic


Monday, August 24, 2009

HELLO HASKELL !

HELLO WORLD

Seems I am into some 'Hello World' frenzy !. The Haskell 'Hello World' is similar to that of Python .

Fig 1. Hello Haskell








REFERENCES

(1) Haskell in 5 easy steps

Sunday, August 23, 2009

HELLO ANDROID !

ANDROID

Android is a Google platform for mobile devices. IDE Eclipse allows for the Android plug in and the programming is in Java.

Fig 1. Android Logo

The 'Hello World' program was indeed some struggle, not because of the code but rather since one has to wait for about a minute as the emulator executes the program.

Fig 2. Hello Android

Fig 3. Hello Android code

Fig 4. 'Home' in the emulator

Fig 5. 'Hello Android' in the menu

Fig 6. The blog spot




Thursday, June 25, 2009

STARTING WITH GAMEMAKER 7.0

GAMEMAKER 7.0

I got inspired to try out GAMEMAKER 7.0 after skirting through the wonderful book by Jacob Habgood and Mark Overmars.

Fig 1 . The Game Maker's Apprentice

GAMEMAKER reduced the 'coding' aspects and allows creation of games using GUI. Excellent software ! in some beginnner's pursuit I was able to create game snippets similar to PAC-MAN and SUPER-MARIO. The software is also supported by GAME MAKER LANGUAGE (GML) which is similar to Java/C++.

Fig 2. Game snippet similar to SUPER-MARIO. The 'mushrooms' add life and energy whilst the 'snakes' reduces it.

Video 1. Game snippet similar to SUPER-MARIO

Fig 3. GML 'Hello World'

Fig 4. GML 'Hello World' script

Monday, June 1, 2009

CHERRYPY : HELLO WORLD

HELLO CHERRY

CherryPy is a python based web-development tool. The traditional 'hello world' is scripted as follows.

Fig 1. 'Hello World' in CherryPy

After running the program , on opening http://localhost:8080/


Fig 2. In Firefox

Fig 3. In Safari

REFERENCES
(1) CherryPy Website

Sunday, May 24, 2009

CONCURRENCY AND WINDOWS DO NOT MARRY !

THE UNFAITHFUL MARRIAGE !

WINDOWS does not support multithreading concurrent and real-time structures. What an irony !.The most popular OS does not allow systems and structures which can control the most breathtaking technologies of the day. Aerospace , trains, nuclear power plants and other state of the art embedded technologies cannot use WINDOWS !

When I learned about Real-Time and Concurrent Systems ,it was not very acceptable that Microsoft would make such a redundant OS. A bit of dabbling on the internet led me to
Article Number 22523 in Microsoft knowledge base.

Fig1. Article 22523
Which clearly stated that ,

"In no sense can Microsoft Windows be considered a "real-time" system. It is a message-driven, event-polling system, with nonpreemptive scheduling".

Being initiated in Windows and using it for about ten years , did make me stubborn and I tried to look for other alternatives which would
allow to construct real-time structures in Windows.

Cygwin came to my rescue ! However on running threads in POSIX and tasks in Ada, I realised that it is only a cheap makeover.

Python and Ada however worked in windows , Ada because it is a concurrent language and platform is not an issue. Python did execute the threads , though on a closer inspection it revealed that Python reduces the concurrent codes to their sequential evil twin brother.

A simple code which which prints out 'Hello World' and the thread number ;

Fig 2. The threading code

gives slightly different results with different OS. When run on Ubuntu Linux ,

Fig 3. Execution in Ubuntu

The order of execution of the threads is 3,4,1,5,2 then 1,2,3,4,5 and then 5,4,3,2,1. Thus the order of execution is non-deterministic , typical of real-time systems.

However on Windows ,

Fig 4. Execution in Windows, 'evil twin brother'

the order of execution is deterministic , as seen above. Thus windows prevents the real-time characteristics of non-determinism and reduces it to sequential processes.

Linux confirms the standard characteristics of concurrency as nondeterminism and preemption , hence a joy for all concurrent programmers. Seems Bill Gates got it wrong this time !