There’s an easier way!

February 25, 2012

There is now an easier way to install Gambas 3 than by compiling from source. It won’t be the latest version but is better than starting off now with Gambas 2 which has quite simply reached end-of-life.

A Gambas user, Kendek, has created a repository which works fine. You have to tell your operating system where to find this repository. I am doing this on Lubuntu 11.10 but I guess the process works on any Oneiric derivative. There are versions for earlier Ubuntu versions (and derivatives) described at:

https://launchpad.net/~nemh/+archive/gambas3/+packages.

Drag over the following address, and copy into the clipboard with Ctrl and then c, or file, copy from menu or right-click copy on the mouse. The address is:

deb http://ppa.launchpad.net/nemh/gambas3/ubuntu oneiric main

Go to preference, software sources and click on the ‘Other Software’ tab. Click the Add button and paste the clipboard into the apt line with the reverse of any of the three methods above (the keyboard shortcut is Ctrl and then v). Click on add source and provide a password. You will now see two lines added under the ‘other software’ tab.

Close the window. That tells the operating system where to look for an installable Gambas3. Open a terminal window (Accessories, LXTerminal on Lubuntu or equivalent). Type in:

‘sudo apt-get install gambas3′ (without parentheses) and enter.

Provide a password and Kendek’s Repository package will be installed. You can then run Gambas 3 with ‘gambas3′ from the terminal or add a menu entry or a desktop icon.

Is Gambas better than Python?

February 5, 2012

I have decided to turn a comment into a topic. Here is the comment to this blog by kelvonyrroh.

“Is Gambas better than python. I have a problem in designing a GUI with data grid capability in python. I discovered Gambas on Synaptic package manager in MINT LINUX 10-JULIA. Am very curious about gambas. Please shed some light on this one”

Is Gambas better than Python? Simple answer: No. Just different.

As you point out, Gambas is very well integrated with the gui process. Having said that the gui part of the Gambas application is separated from the program logic to a degree that is not possible with say Python and (wxWidgets or TKInter).

My requirements from a programming language are narrow. Most of what I enjoy doing is desktop-based database front-ending. I use SQLite and mySQL.

I do not think there is a finer front-end for SQL work than Gambas.

I accept that I am a victim of my history: I used Fortran on an IBM 360/50 at university and did a LOT of BASIC work in my first job using an HP9830. Interestingly this was really a programmable calculator and not even microprocessor controlled. For its time, it was simply wondrous. I wonder if any readers can date these activities?

I guess I am saying that if I were a youngster starting out, there is no way I would use any BASIC derivative. Fine as many versions of BASIC are, there is little standardisation and probably no guarantee of continuity. From various Clustr maps and forums, I suspect there are countries which are still teaching BASIC in schools. They shouldn’t be.

On the other hand, I am sick to death of the Pavlovian antipathy to BASIC which is found on forums like the Ubuntu Forum. It is the same kind of immaturity which turns Apple users into fanboys. Gambas is a fine modern language which on occasions smells more of coffee than another leading brand. And it’s quicker too!

Gambas has a high dependency count (it requires a large number of standard libraries) to run. Each of the libraries used by Gambas is itself subject to development which in turn impact on Gambas. For example, the discontinuation of QT3 in favour of QT4 has effectively killed off Gambas 2. The newly released Gambas 3 is quite simply the only way forward. Library inconsistency between Linux distributions also has an effect. Gambas is better suited to development for own-use or controlled distribution. If you develop an application for widespread distribution around the world then I think the dependency issue will destroy you. That’s a comment on Linux in general rather than Gambas itself.

There is team effort in Gambas but at the end of the day it is the creation of one very bright chappy, Benoit Minisini. Should he be run over by a bus or lose interest, Gambas is in trouble.

Gambas is also Linux only. Whether we like this or not, it is a disadvantage. I was looking through the RealStudio forum the other day. RealStudio is a commercial BASIC variant originating on the Mac but now working on Windows and Linux. It is ok but in my opinion can’t hold a candle to Gambas. Anyway, this forum contributor had written a piece of cross-platform software which he had managed to sell 7000 times. Of those 7000 sales, 4 were for Linux. This may be in part cultural (typical Linux user: “You want me to PAY MONEY for SOFTWARE?”) but is not a good indication.

Python is of course cross-platform. I often wonder whether it would have suffered the same oddity status as Gambas had it been Linux only.

I personally don’t like Python but accept that it is good software. If someone were to ask me to point them to a good Python application I would probably suggest Gramps, the genealogy program written in Python, pyGTK and using XML data. I am not sure I could suggest a similar demonstration of Gambas’s abilities. Would Gramps have been written this way if Python was Linux only? I wonder.

Compiling and Installing Gambas 3

July 1, 2011

Gambas 3 has now been released. Development of Gambas 2 and some of its components (particularly the QT3 toolkit) has ended. That, in itself, should not be a problem and Gambas 2 should be available from distributions for some time to come.

If you are new to Gambas, I would recommend that you start using Gambas 3 now. It is sufficiently different from Gambas 2 to make later conversion of Gambas 2 projects to gambas 3 a frustration.

Unfortunately Gambas 3 is not yet in any distribution repository yet so this involves installing Gambas 3 from source code. This might be intimidating for new Linux users so I have written the note on the right to show a hopefully easy-to-follow process. These instructions work on all Ubuntu versions (I have only installed on 11.04 in Gnome rather than Unity desktop) as well as Linux Mint 11 and I guess most Ubuntu derivatives. The process is similar for other distributions.

Am I still using Gambas?

March 19, 2011

There has been a comment left on this blog asking if I have given up writing code in Gambas. Well, the answer (as with most answers) is yes and no.

As you can see elsewhere on the blog, we were using POS software written in Gambas to run my small retail business. We had a major staff problem just less than a year ago and found that card transactions were being rung up on the (separate) card machine but were then being cancelled from the POS screen before finalisation. The theory being that the customer was generally happy with the card slips and did not need a separate till slip. The money was then taken from the till to cover the excess and the till balanced at the end of the day.

I decided that we would have to integrate the card acceptance with the POS programme. The only solution I could find here in the UK was Ocius from Commidea. Needless to say they did not have a Linux solution which surprised me as I thought Linux was ideally suited to POS. Even worse, it was written in the dreaded .Net. Talk about an elephant to crack a nut.

My Gambas software would not translate onto Windows so I went and bought Windows POS software from a vendor who specialises in our trade. The bought software is much more comprehensive than mine would ever have been (home grown software is always ‘work-in-progress’!) but by definition caters for requirements well beyond my needs. I am disappointed firstly because I enjoyed writing the software and secondly because I have walked back into the arms of M$.

I still use Gambas particularly for manipulation of text files but no longer use it on a daily basis. I still prefer Linux although I must admit that Windows 7 is not at all bad.

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.URL=”ftp.drivehq.com/Documents/FileToSave.txt”
myFTPClient.User = “fred”
myFTPClient.Password = “dog”

myFTPClient.Put(“/home/fred/FileToGo.txt”)
END

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 gb.net and gb.net.curl 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.


Follow

Get every new post delivered to your Inbox.