Getting Started: Emacs & C++ (w/ cmake) (On the fly syntax highlighting)

I am a recent convert to emacs. My vast majority of development is in Java EE and I have not found an easy way to get the functionality in eclipse into emacs. So I still use eclipse for this.

However, I like to tinker with C++ and I wanted to get some of the CDT functionality into emacs. In truth, I have used very little CDT so my expectations from emacs will be set differently. Considering that emacs has been used for C/C++ development for decades, I am hopeful that it will be more feature-rich than eclipse or any of the other IDE’s like Anjuta, Code::Blocks etc (both I have tried to use).

First things first. In the world of Java, I am a massive fan of maven which makes build management so easy and simple. Having used it now for years, it is easy to forget how much of a learning curve it had to get started.

Autotools are a massive pain to use and has a very steep learning curve. I have used it in the past to set up build environments and it works fine. pkg-config is pretty awesome and in a lot of ways, maven does pale in comparison. i.e. instead of having maven pull in dependencies, you just use your systems package manager like apt-get or yum and it installs the libraries for you.

Continue reading

Gnome Desktop Inaccessible After Screensaver Kicks in [1103]

Yesterday, I mentioned a problem that I’ve been having with GNOME 3 on Ubuntu 11.10.

Essentially what happens is that when I leave my desktop for a while, under specific circumstances, and often, on returning and moving the mouse or using the keyboard, the pointer would come back  on screen. However, this only works on one of my two screens.

The unlock dialog does not show up and it seems that there is no way to get back in.

In the past, I would log into the terminal (Ctrl-Alt-F1 or any function key through to F5 or so) and

$ kill -9 -1

This would of course kill all processes owned by me and is therefore unpleasant at best and have you losing a bunch of work at worst.

After a brainwave yesterday (as detailed in the aforementioned post), I decided to check the status of the screensaver and killed just those processes. Happily, this gives me my desktop back. However, my gnome-shell had given up which I had to restart

$ gnome-shell --replace

Unfortunately, I did not get the windows into the original workspaces since everything just got dumped into the one workspace but it is better than having to kill everything off.

EDIT: I just realised that the screen saver of course no longer kicks in and I had to restart it

$ gnome-screensaver --no-daemon

First Love

The first phone I ever got was a Motorola Startac 70. This was back in 98 or so, a flip phone and I still remember it ever so clearly!

I’m pretty sure my next phone was an A1000, a pretty awesome phone. This was around the time that Motorola started releasing the razr which I was far from impressed with. I jumped ship to Sony Erricson and I went through a couple of those before heading over to the wonderful world of HTC. I wanted a smart phone to help with work and so on and I got the HTC HD (If I recall) which was a Windows phone.

While this make me uncomfortable, I was still more comfortable with this than a blackberry. I couldn’t get an iPhone for some reason that I cannot remember.

The phone was pretty laggy and I got pretty sick of it pretty quick. I then got myself my first android phone – an HTC Hero… Most people didn’t like the curvy bit at the bottom but I didn’t care. I was happy to be on the cutting edge. It was also a bit slow and laggy. but it was android and I loved it. It started a brand new love affair… Let me tell you more…

Continue reading

Perfect Linux

According to Brian Lunduke, Ubuntu 9.10 is almost perfect, and I concur.

Being a bit of a purist, I ran Debian for very many years but found their stable releases lagging behind far too much. This was largely due to their perfectly understandable view of it being ready only when it is right.

For a while, I ran their unstable distribution called Sid, based on the disturbed, hyperactive 10 year old boy in the film Toy Story. The idea being that Sid breaks things, and it certainly did. While it taught me a heck of a lot about linux (and the terminal), my computer was broken on a very regular basis.

Continue reading

Database Systems Compared

My first experiences of a computer started with DBase III+ which is now dBASE, then went on to Foxpro, now Microsoft Visual Foxpro. I have since used Filemaker Pro, Microsoft Access, Microsoft SQL Server, MySQL, PostgreSQL, SQLite and HSQLDB. I have not yet used IBM DB2, Oracle. Wikipedia has a list of database systems.

Having worked with this range of database systems and having done copious amounts of research into DB2, Oracle and other DB systems I have not mentioned, I like answering the age old questions. Which is the best database system?

Ah! if only it was that simple. There is no database system that is appropriate for any given requirement. But then, if you have been in the technology sector long enough, you would already know that. It’s all about using the right tool for the job.

I separate these systems into two broad categories and Oracle. There are the Desktop based database systems:

  • DBase
  • Foxpro
  • SQLite
  • HSQLDB
  • Filemaker Pro
  • Microsoft Access
  • MySQL

DBase, FoxPro, Filemaker Pro and Microsoft Access are essentially a GUI frontend that has a database backing.

Access is the best choice for this purpose under the majority of circumstances. Filemaker Pro is relevant in some. The usual reason to use DBase or FoxPro is simply that the developer is used to it. This is not a good enough reason.

I have used DBase III+ for developing an office management suite back in 1994. I have since used Filemaker Pro to develop a simple contact management database in 1998, Microsoft Access to develop a patient management system for a clinic.

SQLite, HSQLDB and MySQL are database engines that are to be utilised by popping a frontend on top; sometimes the frontend is Microsoft Access. Microsoft Access can also be used for its database engine.

Access is usually the worst choice for this except as a stopgap. There are exceptions to this. One is for a web frontend if the site is not too busy and its running on a microsoft platform. You don’t have to go to the hassle of installing anything on the server. The drivers will take care of it all.

HSQLDB becomes an obvious choice for a light java based application and SQLite for any other lightweight applications.

MySQL is substantially more powerful and scales a lot better. I include it in this section because it is a server grade database system that can also work well in a desktop environment.

I have used Access for several web based systems and I have used HSQLDB for unit testing hibernate and for a quick and dirty MP3 library that linked into musicBrainz. I have used SQLite in passing to be utilised by open source products.

I have used MySQL with an Access frontend as a management suite for a website as well.

And we have the server based database systems:

  • MySQL
  • Microsoft SQL Server
  • IBM DB2
  • PostgreSQL

MySQL was used as the backed database system for the edFringe.com website. This was the perfect choice since the most important requirement was speed. Particuarly with the Query Cache and Master Slave replication, MySQL was the best choice.

SQL Server was used as the backend system for an online course for the Scottish Enterprise around 1999/2000. While MySQL would have been a good choice this, it was not of production quality at the time.

We have also used Ms SQL Server for an insurance company since all the infrastructure was based on Windows and PostgreSQL did not have a viable Windows version at the time.

We use PostgreSQL for megabus. While speed is absolutely critical, it is a ticketing system which means that transactionality is absolutely critical.

While MySQL now has transactionality with innodb, it is still nowhere near as good as the transactionality provided by PostgreSQL through MVCC (Multi-version Concurrency Control). We could have used Ms SQL Server but the cost savings are dramatic.

To summarise, each system has a specific use, specific strengths and weaknesses and which should be used is highly dependent on what it is to be used for. I am hopeful that the summary of what we have used each of these systems for us useful in determining which one is best placed to solve any specific problem 😀

We have not yet used Oracle and it was a strong contender for megabus but the serious heavyweight functionality provided by Oracle comes at a price and it is not yet a cost effective option.

Customisation

Being an avid Linux user for users, I am seriously spoilt in terms of being able to customise everything / anything to be more the way I want it to be…

Two main reasons for this is that most software that comes on Linux is highly customisable to start off with. The second reason is that if you don’t like something, you can change it.

There is also the nice thing that most things that you think would be cool or useful in software is already available in some form since someone else thought so too, but before you did and has had the chance to spend some time building it.

I love this so much so that I have often put together a quick linux box for doing things that one could easily replace with an embedded device like a router. I have swayed between the two options based on how much I want simplicity vs flexibility.

One of my favourite responses to someone telling me that we need something that we don’t have is – “we’ll build one”… The software customisation / writing has turned into a metaphor that I apply across more and more things. You need a new table with custom bits – let’s build it. You need a classic car with all the modern gizmos – you know what – let’s just build it.

This has its pro’s and cons. For one, it feels like anything is possible. It also becomes very frustrating to work with limited, limiting, or closed source software (esp when you just want to fix a quick bug that really irks you). It also eats up all your time as you try and do all the things you want… just because you can…

Striking a balance is hard especially when a client asks if it is possible to do something very specific. The answer is of course yes and there is a question that goes with that response. At what value does it become cost effective and provide a good Return On Investment(ROI)

Controversy

We have never been shy about voicing our opinions or being controversial. While discussing some PR requirements recently with a potential agency, the question was asked about whether we would be willing to be controversial.

We are not necessarily controversial, just that we hold a view that is usually a little different from the mainstream views. It could be said that we bring the alternative to the mainstream.

But then, so did some world governments, bringing open source software into their work places, successfully or unsuccessfully in the last few years instead of Microsoft.

Someone recently suggested that we were anti-microsoft. I don’t think that is case. Microsoft has its place in a technology infrastructure. It is simply that its position is usually overrated or misplaced. As far as desktops for technically shy users are concerned, there is really no alternative but Microsoft Windows. I can hear the Mac users scream that Macs are also an alternative. Theoretically, yes but the fact is that they are too expensive for someone to dabble with it. This is precisely the reason that Microsoft Windows dominates the desktop market.

We support and use Linux. In fact, the majority of the desktops in the office run Linux (Ubuntu as it happens) but people who have a non-technical role use Windows. They could use Linux but Windows is better suited to their role.

This is not necessarily a cost-saving decision. Sure, we have saved thousands of pounds by sticking to Linux instead of using Windows but that is a co-incidence more than anything. In some ways, it is a testament to the skillset of the people who work at Kraya that they are comfortable with Linux. The mindset of Linux is in alignment with the mindset of a developer.

I used to develop in Windows and I often found myself fighting with Windows, whereas with Linux, it just fits. There are several reasons for this. One being that Linux forces you to understand what you (trying to ) do to a bit more depth instead of pretending its magically taken care of.

I am not, for one moment implying that developers who use or develop on the Windows platform is inferior or not as skilled. Simply that my experience was that the Windows platform made it easier to do things badly and more difficult to do things well.

Microsoft has done wonders in bringing technology to the masses and making it more accessible. However, there is still a massive barrier, even for people specifically in the technology sector to appreciate and use technologies which require a bit more experience or knowledge to use appropriately.

There are a couple of really good examples. PostgreSQL is a powerful outstanding database server that can easily compete with Microsoft SQL Server and Oracle. However, very few people know about it and even fewer use it.

MySQL on the other hand is also an open source database server but is much more widely used and accepted.

It surprises me when MySQL is used when PostgreSQL is, from a technical perspective better suited. MySQL is faster than PostgreSQL at the cost of poor transaction managment (at best). For any system where data integrity is even remotely important, PostgreSQL is a better choice. However, since there are better GUI tools for MySQL and since it is easier to get the hang of, it gets chosen.

This give technology and people in that sector a bad name. Every tool or software has its place, and should be used in an environment where its strengths are displayed, not its weaknesses. We have instances where we use multiple database servers within one project. PostgreSQL for all the data integrity sensitive areas and MySQL for the speed sensitive areas. Sometimes you want integrity and speed. In these cases, you have to make a choice based on which is more important or layer the databases to use the strengths of both.

Metaphorically speaking, MySQL is a hammer, and PostgreSQL is a sledgehammer. Would you use a sledgehammer to crack a nut, or a hammer to crack a slab of concrete?

Before someone jumps down my throat, I am not suggesting that PostgreSQL is better than MySQL or vice versa – just that they both have different goals, different strengths and weaknesses. They have spent a lot of effort to converge and strengthen their weaknesses but not matter the amount of convergence, their core goals are still different that they will never truly be able to remove their weaknesses without giving up some of their strengths as well. One tool cannot be both a hammer and a sledgehammer…

On top of Tasktop

My post about tracking time attracted the attention of Tasktop. While this had been mentioned to me before, I was mistakenly under the impression that this was a windows only app.

I was pleased to find out that this was also available for linux. Great… Lets try it out.

First stumbling block is the requirement to register on the website before I can download a trial. I am a firm believer of try before you buy. I should be able to register but it should be entirely my choice.

I am more comfortable with registering before buying or for the use of a free piece of software. However, registering for a trial always irritates me. This was also the case when I wanted to trial InDesign / Illustrator the other day.

After registering, there was the irritating wait for the email to arrive. Now, this is irritating. When I want something, I want it NOW. I hate waiting. Adobe did not make me wait for the confirmation email of registration before downloading the trials. There are two good reasons as to why this irritates me.

  1. Email, as reliable as it is generally, can take time. In theory, this can be anywhere from a few seconds to hours. How about if my mail server is currently down. Or even more importantly, what if I have shut down my mail client so that it does not keep distracting me from something that I am trying to do. Opening up my mail client, I now want to find out about the other emails that are in my inbox and whether any of them require an action…
  2. I have reluctantly provided details about myself. Confirming my email address before I am allowed to download a trial suggests that Tasktop does not trust me enough to just let me download the trial. The software has started off on the wrong foot. How much of an issue is it really if someone gave the wrong details before downloading a trial. Is it really that important that you are able to keep bugging them via email to buy the product?

I was curious enough to jump through the hoops to download the product. The first thing I noticed is that there is no 64bit for Linux :-(. More steps involved in installing this on my 64bit machine. So instead, I installed it one of my 32bit machines – save time.

Once the download completed, the steps on the website suggested that I needed to configure it (with ./configureTasktop.sh) and then run Tasktop. The configuration step required no input from the user and outputted nothing. I have to ask:

  1. Why is the configuration step not integrated into Tasktop and configured to run once? Alternatively,
  2. Why does the configuration step, not start Tasktop right after.
  3. Even better: Make Tasktop a symlink to configureTasktop.sh, which then relinks that to the Tasktop Binary with the configureTasktop running Tasktop right after. This means that from the users perspective, they are always running the same command, and you save any cost associated with run once checks.

I finally got Tasktop to run and it asks me if I want to install the firefox addon to integrate with Tasktop. I want to see how it integrates, so I do. Of course, this is yet another step.

A restart later, I was ready to try out Tasktop – or was I? We use bugzilla to track tasks and I wanted to integrate that in similar to how I do it in Eclipse. This was also trickier than I expected.

I went into the partner connectors section which did not cover bugzilla, which I assumed meant that it came with Bugzilla integration by default. This is true but how the hell do I get there to configure it. It took me a little while to find the configuration section (there are no menus). Once I was there, I wanted to get back to the original layout which was tricky since the “close configuration” button was nicely hidden away up at the top right.

Once I had this working, I tried out the active/deactive mechanisms and this works just the same as in Eclipse. Except with the Firefox plugin, it adds in the links that you browse as part of your context – GREAT!

Add in a task to blog about it and went through writing half the document, then decided to de-activate it before I started working on something else. All the firefox tabs were closed – again, great…

The problem is that when you re-activate the context, it just clears the tabs in firefox and shows you the links you last had open. The page titles for the pages that I had open were the same for a few, so going through them trial and error to get to the blog post was tricky. More importantly, the cookie was already gone and I had to re-login. This might be a timeout issue with WordPress so wont tag that against Tasktop.

I haven’t tried linking folders / files yet but considering that with the above process taking me more time than I expected due to the sheer number of steps involved, I shall have to leave that to another day. In all honesty, it might never happen.

I do like the time logging feature of Tasktop as it tells me which tasks I spent my time on in different chart formats. This is great. However, I have a problem in that this is on an individual basis. I see nothing on here about how a team leader can link in Tasktop used by the team to calculate total time spent on a project / task. This is a necessary feature for a tool like this in the team environment.

It is possible that all of this is easier in a windows environment. Possibly because it was built on there, but more likely because Windows users are used to taking several steps to achieve something (what is it – 7 clicks to delete a file in Vista?)

Having ranted on for a while, dont get me wrong. I think that Tasktop is a fantastic concept and with a bunch of tweaking can be a very intuitive tool to use. However, at the stage that it is in, it does not do what I need it to do. It is actually more obtrusive than useful (e.g. by removing all my tabs from firefox when switching out of a context and not re-instating them on going back to the context).

Then, it is probably just because I simply expect too much… 😦

Eclipse TPTP on Ubuntu (64bit)

I run ubuntu 64 bit (technically, I run an ubuntu 64bit vserver which I access from ubuntu 32 bit but thats not really relevant).

In the open source world, I expect that all things which are accessible as 32bit are also accessible and 64bit and ubuntu makes it automagic enough that everything just works. Yes, I run into problems with closed source software like Flash Player (recently resolved with flash player 10) and the Java Plugin but that is another story. I use Eclipse and wanted to do some performance analysis and benchmarking to find a bottleneck and installed the TPTP plugin; and ran into a problem. It just didn’t work.

To resolve it, I turned to google… In this instance, it turned out to be a distraction and a red-herring. It lead me in the direction of installing libstdc++2.10-glibc2.2_2.95.4-27_i386.deb which was difficult at best since there was only a 32bit version of the package and that wasn’t even in the standard repository.

In the end, digging deeper, I found that it simply missed the following shared object libstdc++.so.5.

All I had to do was install libstdc++5:

sudo aptitude install libstdc++5

and it worked… 😀

Now, I think that ACServer which Eclipse uses to do TPTP should not link to an outdated library but that is another issue…

Breaking Software Down

Jeff Atwood likens software development to tending a garden. I can relate to this. In fact, I would like to ask, if you have a nice plant in one of your gardens, how complicated is it to “copy” that across to another one?

I realise that I am moving away from the analogy here but there is an important concept here. Libraries were born out of the desire to share and distribute code to be re-used.

The idea for Remote Procedure Calls dates as far back as 1976. Microsoft brought along OLE and then COM made this more generic and better.

RPC is widely in use these days and there are several other mechanisms for inter process communication including CORBA, REST & SOAP.

I don’t think software is broken down into small enough components. *nix is great in that you can tag a whole bunch of commands together on the command line to do some amazing things. I have personally piped data through a dozen or so commands and scripts to do some interesting things.

If we could break everything down into individual components that could be linked together, we would have a massive arsenal of interoporable tools that each user can pick and choose to put together very powerful solutions.

How many times have you found a piece of software that does one thing really well, but fails in something else. Then found another piece of software that does the other thing really well.

For example, the extensibility of Firefox is fantastic but I love the rendering of Safari. I love the Contact Management within Evolution and the Mail capabilities of Thunderbird.

Why don’t we break each software down into each of it’s individual components (and I am not talking about libraries here) and allow them to be deployed as services usable by other pieces of software.

In other words, release the contact management capabilities of Evolution as a product of it’s own right with a pre-defined API that any application can link into (including perhaps a web interface). Release the Mail management component of Thunderbird as a service, Release GUI’s as a component. Then we can pick any GUI we want, link into a specific mail component and another addressbook component.

Do one thing and do it well. In fact, let’s take it one step further and release a public API for each software component – an API for Mail, one for Contact Management and so on.

Each software component can then be a black box that delivers this API.

Choice can be a bad thing if it makes it difficult to choose – Subclipse vs Subversive is a good example of this. Let us however, not confuse choice with flexibility.

Let’s say that you want to find all the files within a folder modified within the last 3 days containing the text “abracadabra” and then replace all occurences in those files of the world “super”  with “hyper”.

To do this in linux, all you would do is chain find (to identify files modified in the last 3 days), grep (to identify only the files that contain “abracadabra”) and sed (to do the replacement).

If you know these commands well enough, you could chain something together in half a minute or so. You could probably figure out how to do this with the search tools in Windows within a minute or so but where this really shines is if there are thousands of files that needs to be processed. With other search tools, you would have to wait for the original search results to be returned before running to replace operation. This takes up the users time.

With the chaining of commands, I have run it and worked on something else while it completes.

Let me visualise a brave new world:

In this world, all software would be interoperable components. For example, there would be components for:

  • Mail account management (Perhaps genericised into configuration management)
  • Text composition (usage for mail, documents, plain text et al)
  • Text reading (again, usable for mail, documents, plain text et al)
  • Spam Filtering (already available to some extent)
  • Contact Management (optionally linked into organisation’s LDAP server)
  • Task Management (Standalone Mylyn if you know the product)
  • Scheduling (or calendering if you prefer that term)

If all of these components were interoperable, then there would a GUI that is generic and could bring all of these together. In this way, the people working on each of the components could concentrate on doing one thing and one thing well.

If we then start working on public API’s in a collaborative fashion, each of the component could be fleshed out to be as flexible and complete as necessary to gain maximum benefit.

If these components provided the services as a network based API, it would also allow for the components to be distributed across a network providing redundancy and efficiency. This makes it easier to turn each desktop into more of dump terminal concentrating purely on user interaction and getting closer to the invisible interface.

Software as a service has taken a step in the right direction. Can we take a leap and have software component as a service…