Using containers to make Gambas applications behave.

August 30, 2010

I have put a tutorial in a page on the right hand side. Containers are not actually something I use very much but I do think the existing documentation is not very helpful when you do need a window to behave like a window oughta.


Fsarchiver is one useful piece of software

May 23, 2010

I have put a page on the right with my experiences using this super piece of backup software.

Creating a database and tables from within Gambas.

May 16, 2010

I wrote this little demo program some time ago. It is in the pages on the right.

It might help somebody.

Ubuntu Forum beginners challenge #9

February 21, 2010

I wrote the following short program as a response to a ‘beginners programming challenge’ on the Ubuntu forum. I just got so tired of all the terminal-based solutions and chided the contestants that even phones had GUIs these days! It was kind of difficult separating original entries from rehash/error-correction but the tallies (by the time enthusiasm seems to have got lost) was:

PHP 11
C 4
Java 4
Python 4
Bash 2
C++ 1
Gambas 1
Haskell 1
Lisp 1
OO Spreadsheet 1
Perl 1
Scheme 1
Userland/awk 1

I didn’t see much evidence of ‘beginners’ in the entrants.

Anyway the brief was:
Your program should be able to open a text file and read its contents. The file will consist only of LOWERCASE letters and numbers 0-9. The file will be formatted such that there is only one alphanumeric character per line.
Your program must read each line and store the data in a data structure of your choice. Parse through your structure and print out the following information:

1. The sum of all the individual digits.
2. How many times each character appeared in the file.

I have put the code in a page on the right. It just needs a few standard objects on the form: a filechooser (default name filechooser1), a listbox (listbox1), a button named btnExit and a button named btnRun. If any real ‘beginner’ needs help to get this going, just shout.

It is easy enough to cut and paste from the blog although I have also put the source code as a tar.gz at Prog Challenge Source.

Gambas also does a good job at compiling run-time versions of applications and I have put a Debian package installer at Prog Challenge Installer.

Gambas FTPClient

February 7, 2010

FTP (File transfer protocol) is used to send and receive files over the internet. I have issue with a lot of the supplied Gambas examples in that they often over-complicate the process they are trying to demonstrate. New users, searching for the answer to a particular problem, need the bare-bones answer: something on which they themselves can then build. Searching on ‘Gambas’ and ‘FTP’ currently leads to samples of amazing complexity with timers and event-logs all over the place to the point where you just can’t get the essence of the sample itself.

Well here is the bare-bones of FTP in Gambas:

‘ Gambas class file
PRIVATE myFTPClient AS NEW FtpClient

PUBLIC SUB Button1_Click()

myFTPClient.User = “fred”
myFTPClient.Password = “dog”


Now, how simple is that? The .URL includes the file name on the ftp server and the .Put gives the local filename that you want to send. You won’t be surprised to hear that there is a .get method to do it the other way round.

Ideally you would do a bit more e.g. monitor theFTPClient.status to check completion.

Make sure you click on networking components when you create the project (or click on and in project,properties,components)

Gridview and the Data Handling Event

December 10, 2009

I have put a short tutorial about this very useful feature in a page on the right.

Tutorial Update

October 7, 2009

I have updated the tutorial and renamed it Gambas 2.8 on Ubuntu 9.04 (in pages on the right). I have just removed the reference to the external repository (which no longer worked).

It would be nice if Ubuntu could offer a more up-to-date version of Gambas. Other distros seem to manage it. Actually, even Gambas 2.8 is quite usable.

As mentioned the current stable version is 2.19.0 and compiles from source quite reliably on Ubuntu 9.10. The development version of Gambas 3 is (I guess) nearly ready.

Dropbox and encryption

September 25, 2009

I have put a few notes in a page on the right and shown how file encryption can be included in a Gambas program. Obviously the logic can be used from other programming language as well.

Opus Minimus

June 28, 2009

Well, at long last my Gambas project is up an running. In my small retail business I have used an in-house Point-of-sale system based on VB6 and Access97 for nearly 10 years. I lost interest in developing the system further because I found it increasingly difficult to re-install on modern equipment. One of my tills and the ‘file server’ were still running Windows 95, LOL.

Well, I have now cloned the system onto Gambas 2, mySQL and Ubuntu 9.04. I won’t say it’s completely bug free yet but it is up and running. It has helped that the staff has been positive about the changes. I have two tills, a separate goods receiving machine and an admin machine using one of the tills as a server. There is a cunning plan, carried over from the old system, whereby the machines can run stand-alone if the network crashes (I only used it once in the last 10 years).

The goods received program and point-of-sale program are separate and both are mouse-free. This adds enormously to the code but is something that I think Gambas excels at. The point-of-sale is just less than 2000 lines of code and the goods received about 1300.

I cannot fault Gambas and am stunned by the speed of SQL searches (even on un-indexed fields) in mySQL. I just lurv Ubuntu 9.04 probably because Nautilus file manager works just the way I do. I now look forward to developing the system further although I accept the adage that one shouldn’t develop software and run a business at the same time! I just enjoy programming too much!

POS runs 800x600 on 15in LCD

POS runs 800x600 on 15in LCD

Goods Received runs 800x600 on 17in CRT

Goods Received runs 800x600 on 17in CRT


May 9, 2009

I can’t be alone in disliking laptops. I can’t stand the keyboards, can’t use those finger pad thingies with any proficiency, can’t stand crouching over those grotty little screens and above all can’t stand the responsibility of carting the damn thing around with me. Don’t even mention tired batteries.

It does have its problems though: Gnu/Linux does such a good job of running on old kit that I have a multitude of computers running different distributions both at home and at work. I used to get into an awful muddle with my Gambas code with overwriting changes with other changes until I started using Dropbox ( Now within seconds of switching on any net-connected computer with Dropbox, the Gambas source is updated on that computer. Problem sorted. It obviously can’t cope with server-bases databases so I backup the database into the Dropbox directory and restore it on the other machine. Apart from that, it has made life a lot easier.