Ada Seminar

February 18th, 2008 at 9:27 · Filed Under Ada, Conferences · Comment 

I gave my last Ada Seminar in March 2005 at MMU Melaka. It has been 3 years since I last active in Ada and Ada projects. It will be a great pleasure to restart any Ada related activities after quite a long inactivity.

This time, I am going to give a talk about Ada at two universities. For more information about the Ada seminars, read here.

Coding War or Extinction of Human Race?

December 18th, 2007 at 16:28 · Filed Under Ada, Blogging, Call Me a Geek, Computing, Software Development · 6 Comments 

When I stumbled on this story about a software engineer and his encounter of a bug in a missile launch command and control system, I read with delight because it has been a while since I read an exciting piece of story about Ada. On the other hand, I was so nervous because our extinction might just be a string away.

The story is about a software engineer trying to maintain a 400KSLOC legacy system when the OS and compiler version were upgraded. You can read the full story here.

It is pretty exciting to read about the job of working on the legacy Ada code of such mission critical system. Why was the error occurring? What would be the consequence if the missile launch test failed? What if the missile were launched “accidentally”?

I believe, one day, the human race will extinct as was portrait in the movie Terminator. The extinction will be due to an error in a software, or rather the negligence or ignorant of a software engineer.

What the story tells us is that it appeared to be some 20 lines of code which caused the upheaval this Thanksgiving. May be it is really Thanksgiving for giving the human race another chance to survive. So, do what you want to do most, enjoy life while you can.

Leopard unleashed!

October 28th, 2007 at 22:46 · Filed Under Ada, Computing, Mac OS X, Software Development · Comment 

Apple has unleashed Leopard (Mac OS 10.5) last week. It’s an awesome operating system beating all other OS flat out! New features such as time machine, desktop space, interoperability with Apple Mail and many more.

Time Machine is a repository with version control system to keep track all the changes to your files and directories. When you plug in a FireWire hard disk, Leopard will automatically version all your files and directories onto the external hard disk. You are able to go back in time to look for a file (or directory), which you have deleted or modified, and to restore them.

Desktop Space gives you more desktop spaces to organize your works on the screen. It makes switching from task to task simple and easy with a click of the mouse.

It will be a nice upgrade but if you are developing software with Ada, unfortunately, you have to wait for a while. Ada does not come with xcode yet. The folks at MacAda is still working on a stable and working version of Ada compiler.

HOWTO – Building GtkAda project with xcode

October 7th, 2007 at 11:35 · Filed Under Ada, Call Me a Geek, Computing, Hacking, HOWTO, Mac OS X, Software Development · 3 Comments 

My current project (here) requires to develop a GUI application for displaying some JPEG images. I intended to develop a native Mac OS X GUI application using Carbon or Cocoa. Since there is no Cocoa binding in Ada, I narrowed down my option to Carbon. I hit on the wall of frustration where Carbon binding on MacAda.org is very old and supports only gnat-3.3 and PPC (I hope I am not wrong on this).

I have to turn to Gtk+ which will require GtkAda and X11 on Mac OS X. I compiled my test code written for GtkAda very well on console. But when I imported the codes into xcode project, it did not compile. I got the following errors:

error: "gtk.ads" must be recompiled ("a-except.ads" has been modified)
error: "gdk.ads" must be recompiled ("a-except.ads" has been modified)
error: "glib.adb" must be recompiled ("a-except.ads" has been modified)
error: "glib-object.adb" must be recompiled ("a-except.ads" has been modified)
error: "glib-type_conversion_hooks.adb" must be recompiled ("a-except.ads" has been modified)
error: "gtkada.ads" must be recompiled ("system.ads" has been modified)
error: "gtkada-bindings.adb" must be recompiled ("a-except.ads" has been modified)
error: "gtkada-c.adb" must be recompiled ("system.ads" has been modified)
...

I sought help from GNAT-OSX mailing list (September 2007 archive), but to no avail. I spent many days investigating the cause but to find out that gtkada source codes would be compiled and produced .ali and .o files in the build directory when I used gnatmake to build my GtkAda application.

$ gnatmake testproject.adb `gtkada-config`

To build a GtkAda project in xcode, follow the instructions below:

  1. In the project browser, under the Group & Files column, locate Targets and the your project name. Right click your project name and select Add Link Binary With Libraries. Select GtkAda libraries from /opt/local/lib/gtkada and necessary libraries from /opt/local/lib.
  2. Select your project name and click on the Info button. In Build tab, select Search Paths under Collection. Include /opt/local/include/gtkada in Header Search Paths. Also include /opt/local/lib and /opt/local/lib/gtkada in Library Search Paths.
  3. Select Source in your project. Select Add to Project … in Project menu. Include all the GtkAda source files in /opt/local/include/gtkada.

HOWTO – Installing gnat-4.3 on Mac OS X

October 4th, 2007 at 23:15 · Filed Under Ada, Call Me a Geek, Computing, Hacking, HOWTO, Mac OS X, Software Development · 4 Comments 

Perhaps someone has written this before but it seems no where to be found. So I just write a simple HOWTO about installing gnat-4.3 on Mac OS X.

My installation is on MacBook 2.16GHz Intel Core 2 Duo running Mac OS 10.4.10 with Xcode 2.4.1. Pre-requisition is to have Xcode installed before installing gnat-4.3.

  1. Go to MacAda.org to download gnat-4.3 and other necessary tools. Launch the installation in the disk image.
  2. Make the following softlinks:
    
    $ ln -s /usr/local/ada-4.3/bin/gcc /usr/bin/gcc-4.3
    $ ln -s /usr/local/ada-4.3/bin/g++ /usr/bin/g++-4.3
    
  3. Launch gcc_select:
    
    $ sudo gcc_select 4.3
    

Adrenaline Hack

September 25th, 2007 at 14:39 · Filed Under Ada, At Home, At Work, Call Me a Geek, Computing, Days in My Life, Hacking, Mac OS X, Software Development · 4 Comments 

Wow! I’ve done it! Yes! Yes! Yes!

After a successful hack to receive a server-push JPEG stream from a video server (more story here), the next challenge for me was to display the JPEG in a GUI window.

I have been trying to get Carbon binding to work with gnat 4.3 on xcode but I am forced to abandon it for a while. I switched my target to GtkAda which will require X11 on Mac OS X. One plus side is that my application will be platform independent if I use Gtk/GtkAda. That means my application can be compiled and run on Linux, Solaris and Windows with the platform-independent GUI. More business may be and hopefully.

I was working to get GtkAda to work on my Mac since yesterday but I had corrupted some of the files I installed with Fink. Fortunately, I have a backup (actually I copied) on my MacBook but I guess I won’t need it anymore since the Gtk+2 and GtkAda are working on my Mac Mini. I will delete the copy on my MacBook later and install it with the working Gtk+/GtkAda.

I spent the entire morning and noon to write a single window, stripped down application to display the JPEG image I downloaded using the application I worked on earlier. I could not get the result. After many hours of hacking, I finally got it to work!

It is so rewarding to see it happens and I have got a good dose of adrenaline today. The feeling is difficult to describe. So it is difficult for other people to feel the excitement and the rewarding state of mind I am into.

The next challenge is to write an experimental application to continuously receive multiple streams of JPEG images and display them in multiple frames in a window, the last and toughest task with parallelism involving socket and GUI. After this, comes the serious software development by integrating all these experimental applications into a nice GUI application.

A Petition To Apple

September 14th, 2007 at 10:42 · Filed Under Ada, Cocoa, Computing, Mac OS X, Software Development · 22 Comments 

I have been on and off using Ada (gnat) on Mac OS X. The folks at MacAda.org are doing a great job. Thanks to Jim Hoppers, Andrew Reynolds, Mike Feldman and others.

It has been years since Apple rolled out Xcode, an integrated development environment. Xcode is heavily centered around Objective C and Cocoa. MacAda.org, a group of Ada enthusiasts, took on a NDA (Non Disclosure Agreement) with Apple and integrate Ada, based on gnat, into Xcode. This is very encouraging for developers who develop on Ada to switch to Mac.

I have been developing some Ada standard tools (console applications without GUI) on Mac with Xcode. I am kind of on and off of Ada on the Mac. Every each time when I come back with a project with Ada on the Mac, I will find inconsistencies and between Ada and Xcode.

The support of Ada-Carbon is really hard to follow up with. Even the MacAda’s website does not provide enough information and a proper link to the Carbon binding. The easiest way to develop a GUI application using Ada on Mac is using GtkAda. But getting GtkAda built and installed will require tremendously arduous work to build and install Gtk+ first. And running the GtkAda application will require X11 and of course Gtk+. The application will not be Mac native application.

I (and many others too) would love to see Apple really makes serious consideration to incorporate Ada into Xcode as a de facto standard. Here’s the list:

  1. Makes Ada comes with Apple’s Xcode so that there will be a consistency with every updates from Apple and not from 3rd party website such as MacAda.
  2. Enable Xcode to create Cocoa and Carbon projects with Ada bindings.
  3. Support Core Data Application project using Ada.

Any Mac Ada developers who wish to add to the list, please feel free to post your comments. Thank you!

Server-Push JPEG Stream

September 13th, 2007 at 23:46 · Filed Under Ada, Call Me a Geek, Computing, Hacking, Mac OS X, Software Development, Web · 6 Comments 

I am working on a video server project since last week. This project is to develop a client software running on Mac OS X to control a video server and to retrieve streams of JPEG images from it. And of course, I am going to develop with Ada together with AWS (Ada Web Server).

Up to this point, I am able to connect to the video server with AWS and retrieve a stream of JPEG images from the video server. I have been able to manually extract JPEG images from the stream identified by SOI (0xFFD8) and EOI (0xFFD9). But some of the images extracted from the stream are not recognized as JPEG file while some images appeared to be corrupted. I am totally puzzled by this behavior.

Could it be the size of the stream buffer (512 bytes) causing the corruption? Could it be the output of the received stream to a disk file delay the receiving process?

Here’s a snip of my Ada code:


     ...
     Data         : Ada.Streams.Stream_Element_Array (1 .. 512);
     ...
     loop
        AWS.CLient.Read_Some (Connection, Data, Offset);
        exit when Offset < Data'First or Count > 512_000;
        Ada.Streams.Stream_IO.Write (File_Handler, Data);
        Count := Count + Integer (Offset);
     end loop;
     ...

It is quite fun spending entire day hacking the server-push stream and the JPEG images. It has been a long time since my last hacking. Welcome back to the reality!

A bunch of Ada-holes talking

May 26th, 2007 at 0:40 · Filed Under Ada, At Work, Blogging, Days in My Life, Software Development · Comment 

Like last week, a bunch of “Ada-holes” meet up on every Friday midnight (MYT) to discuss about work progress and some jokes. They are Jesse (the team leader), Jeffrey, Jerrid, Chip, Mark and I. Mark and I are from the far east. Mark from Vietnam and the rest are in the U.S.

We discuss mainly on the svn commit guidelines, Ada coding standards and document formats. We have yet to choose either ODF or LyX. The discussion is fruitful and we begin to see a software development process emerging.

It is tiring but fun!

Peculiar behavior of Sed

What is Sed?

Sed is the ultimate stream editor. If that sounds strange, picture a stream flowing through a pipe. Okay, you can’t see a stream if it’s inside a pipe. That’s what I get for attempting a flowing analogy. You want literature, read James Joyce.

Anyhow, sed is a marvelous utility. Unfortunately, most people never learn its real power. The language is very simple, but the documentation is terrible. The Solaris on-line manual pages for sed are five pages long, and two of those pages describe the 34 different errors you can get. A program that spends as much space documenting the errors than it does documenting the language has a serious learning curve.

You can read more about Sed here.

My project uses a thick binding of PostgreSQL/MySQL called APQ. APQ is a project by Warren and I helped to host it at my server. See my post here. The configure and make process are not really stable which I think is due to various version of MySQL and the Linux tools such as sed.

To build APQ, first, two MySQL include files, errmsg.h and mysqld_error.h need to be parsed. These files contain MySQL error codes and they need to be parsed and translated into Ada syntax. This translated Ada code will be inserted into apq_mysql.ads.

However, this parsing and translation process are not working correctly as they supposed to be. When I look into this problem, I found a peculiar abnormality. The parser uses sed. When I built APQ on Mac OS X, FC5 and Solaris (Intel), the result in apq_mysql.ads is not consistent on these different OS.

After I upgraded to Mac OS X 10.4.9, the parser refused to work with some error messages which I think caused by sed. I was mingling with the configure script until this hour. Suddenly, something struck my mind. Why do I need to mingle with configure? The problem is the parsing and it deserves the highest priority. The build configuration does not perform a thorough check of the environment but it still works fine at this point. So, I moved my priority to write a parser in Ada to solve the parsing problem. This light shed on me at this whee hour in the morning and I was really too tire to continue working on the parser.

Scarce resources on AWS with Ajax

March 17th, 2007 at 14:04 · Filed Under Ada, Software Development, Web · Comment 

Although AWS comes with some demo codes, I find it insufficient to learn using AWS to develop an Ajax web application. Due to the scarce resources on using AWS with Ajax, I’ve been trying to understand the working mechanism between AWS and Ajax.

To build a knowledge base in myself about developing a web application using AWS and Ajax is challenging. To use AWS with Ajax, I need also to learn/use XML/Ada. I’ve played around with XML for a while, mainly hacking into data saved in XML format by some Mac OS X applications.

XML is Extensible Markup Language. This is a format used to organize text files into tags and associated set of values. XML/Ada is a collection of simple modules that provide manipulation of XML streams.

In an Ajax (or Reverse Ajax) capable web application, data streams are packaged and sent in XML format, for example:


<client_info>
   <name>Acme Corporation</name>
   <id>ACME</id>
</client_info>

A JavaScript will interpret and read the corresponding tags and associated values after the web page has received the package.

Reverse Ajax

March 17th, 2007 at 12:28 · Filed Under Ada, Software Development, Web · Comment 

Since my new job at Singo Solutions, I’ve been reading about Ajax and Reverse Ajax. My development project requires the use of Ada, AWS and Ajax to build a web application with real-time data display and better user-browser interaction. See my earlier post about Developing web applications with AWS. Ajax was a term new to me. I had not bothered to read about Ajax and JavaScript before I joined Singo Solutions.

What is Ajax? Ajax is an acronym for Asynchronous Javascript And XML. The conjunction was injected into the acronym to spice up and to make pronunciation easier. Ajax is not a technology. It is a web programming technique to develop interactive web applications using combination of technologies such as JavaScript (JS), XML, DOM and XHTML. Ajax makes the web page to exchange a small amount of data with the server behind the scene, so that the entire web page will not have to be refreshed each time the user requests a change. With this technique, information can be displayed on web page in real-time without user’s intervention or a web page reload.

What is Reverse Ajax? Reverse Ajax is just different from Ajax, as reverse Ajax is a compounding technologies for pushing data from a server to a client. These technologies include COMET or PiggyBack and Polling, and, of course, Ajax.

Ajax keeps alive a connection between a server and a client and send data to the client. In another words, the server will contact the client when data need to be sent (without Ajax, the client will have to contact the server in order the data can be sent from the server to the client). The problem is that some web servers can’t easily contact web browsers. One thing for sure, the firewalls will get in the way.

Comet, or long-lived http or slow load technique, keeps the communication between a server and a client open. This technique actually have a client to send a request to the server and also allows the server starts replying to the request, slowly, extremely slowly but the reply actually never finish. This permits the server to keep the communications channel open to pass down additional information when the time comes. The closest comparison to this technique is server push.

Reverse Ajax makes the browser to send requests in the background to the server and receive responses/data from the server without the intervention of user.

To use both Ajax and Reverse Ajax, I need to use JS in web templates although the web application (server) is developed with Ada and AWS. I am starting a love/hate relationship with JS.

Developing web applications with AWS

February 24th, 2007 at 15:20 · Filed Under Ada, Software Development, Web · 1 Comment 

What is AWS? AWS or Ada Web Server is a complete web application framework written completely in Ada and allows development of application with an embedded web server. The application is self-contained with an embedded server. That means, the application is also a web application that can be controlled and manipulated using any web browsers on any clients that connect to it. And more, you don’t need any web server like Apache anymore.

My current job involving developing a web application using Ada and AWS only and there will be Ajax using server push technology in AWS. I was developing some web applications using AdaCGI. One drawback about using AdaCGI is that if there is a minor format changes in the html code, the entire application needs to be re-compiled again.

I was not totally familiar with AWS before I joined the US-based company but I was familiar already working with mails using AWS with the SMTP and POP protocol. I am beginning to understand the mechanism of the http protocol in AWS and I hope to write about this with more details in near future. I am beginning to love this job already and I believe I will be busy in the mud hole mingling with Ada, AWS and Ajax.

A tribute to Jean Ichbiah

January 27th, 2007 at 23:39 · Filed Under Ada · 2 Comments 

Jean Ichbiah? Who is he?

Jean David Ichbiah was born March 25, 1940. He was the chief designer of the Ada programming language from 1977-1983. During that time, he worked as a member of the Programming Research division at CII-Honey Bull (CII-HB) at Louveciennes, France. He had been chairman of Simula User’s Group and was one of the founding member of IFIP WG 2.4 on System Implementation Language.

CII-HB’s proposal won the US DoD (Department of Defense) contract to design a new programming language. After Ada was selected, he left CII-HB and founded Alsys Corporation in La Celle-Saint-Cloud which continued language definition work on Ada and later went into the Ada compiler business. Alsys first released a PC version of Ada compiler in 1983 making Ada compiler more affordable in PC programming. Ichbiah later moved into the Waltham, Massachusetts subsidiary of Alsys.

Ichbiah later started the Textware company, which sells text entry software for PDA and tablet PCs as well as text entry software for medical transcription on PCs.

Jean Ichbiah was a member of the France Legion of Honor and the French Academy of Sciences and received a Certificate of Distinguished Service from the DoD for his work on Ada.

He died of complications of brain tumor and a fall, on January 26 2007.

APQ and AdaVox

November 11th, 2006 at 15:27 · Filed Under Ada, Computing, Software Development · 2 Comments 

I’ve assumed the hosting of APQ and AdaVox from their creator, Warren W. Gay. Warren is an old friend from CLA who seek help to host his projects due to his limited web space and he is no longer writing software.

Both APQ and AdaVox can be found by following the link in my Projects page. Anyone who wish to contribute patches and maintaining the code, please contact me.

Warren, if you’re reading this, enjoy your new found interest and all the best to you.

« Previous PageNext Page »