Database, Fuppes, Weekly Summary

Before Uni Begins (Weekly Summary Five)

DOE (Digest of Events)

This week in the news:

  • The Fuppes Packaging effort is moving along slowly; nobody has chosen to sponsor it yet.
  • I have written a html Logic Tree drawing program and it works on all HTML versions.

Uni Comes Back

University starts up again this week and I am really looking forward to it; after all, I will be doing AI, OS and Haskell. I have actually done quite a bit of study already for these subjects. Unfortunately, it means that I will not be able to spend as much time as I usually do on extra projects. It does not mean that I will stop working on them but that I will be moving slowly instead.

Dvorak

They say that “Prevention is better than Cure” and I do worry occasionally that all of this extended work on the Computer may eventually hurt my hands. To prevent that scenario I am now learning to use Programmer Dvorak and learning how to Touch Type at the same time. It is proving to be rewarding already and, though I type really slowly, I can already type without touching the keyboard. And I have noticed that my speed is regularily increasing. I was so happy with the improvements that I went online and bought Programmer Dvorak Keyboard Stickers and when they arrive in the mail I fully intend on applying it immediately. (You may have noticed that this post is not as long as usual; this is why)

Fuppes Config

Uli has spoken with me and he does not wish to add another dependency to Fuppes by using SOCI. Fair enough. As a result he is currently doing some database work and I am going to work on getting the Fuppes config separated into multiple files. That way for each different device you use a different file; so sharing devices will become much easier.

Advertisements
Database, Interesting

Surprises and Progress

Have you ever had one of those moments where you talk about something and then a moment later it is as though somebody read your mind and the thing you were thinking about happens in real life? Nothing religious mind just weird coincidence? Well in my last post I mentioned that I need to improve my Haskell skills (they were very lacking) and I was thinking about buying a book on Haskell to teach myself; or look at a good online tutorial. The very next day I went into university for a sysadmin meeting for CSEsoc and remembered that I needed to buy books for my subjects so I looked up to booklist. And what should I find but the prescribed text being “Real World Haskell” and therefore I was ‘forced’ to buy it.  I now have it sitting on my desk at the moment and I am currently up to page 73.

A really really good book on Haskell.
A really really good book on Haskell.

I think that I am really going to enjoy this book. I’m finally going to learn what a monad is.

I am still rewriting the database code for Fuppes and coming across some interesting pieces of code that are slowing me down. I have also sent another email to Eva requesting that I give her help with the merging of her package into mine. I really want to get Fuppes packaged and it’s been a long time now. I’ll give her a few days to respond and then decide how to act. It’s also been nice recently to see a surge in interest for Fuppes; many people have started getting into it and I want you guys to know that it is fun once you get started. And I’m always here to help anyway. The next post I make will be more focussed on Fuppes I think.

Database, Interesting

Learning to Write

Lately I have been amusing myself with one of life’s small ironies; I never liked to write large amounts of ‘English’, of any sort, writing down my thoughts, yet I am more that happy to spend hours writing code and even a bit of my time blogging. Hopefully you too can see the irony in that turn of events; because the way I see it, ever since I have started programming I have been Learning to Write. What is a program if not you writing down exactly how some system should operate. What is a blog if not the written form of your thoughts. When you really get down to it you could think of all computing systems as humanity writing down how we work, how we function as a society (and maybe as a species) in a way that is precise and unambiguous. For me atleast it is awe inspiring, that we can capture thought in our programs and that all we have to do is think correctly once and the right action will be performed correctly forever more (in theory at-least). For me it is truly beautiful. Just in case you were wondering, these thoughts came to me as I was editing my xMonad config file for better interoperability with gnome; coincidentally I have decided that I really want to learn how to write better Haskell…and learn what a monad is.

However, as much as I would like to discuss the beauty of code, I would also like to give a quick update onto the DB progress of Fuppes. Currently I am in the process of converting the project to still use sqlite3 but to use it through SOCI instead. Almost all of the code has been rewritten so far and I must say that I have seen a dramatic increase in code readability along with a decrease in lines of code: all while still achieving the same functionality. However, it has not all been good news and i have some more considerations to make:

  • Sqlite3 has a nice feature to get the id or PRIMARY KEY of the last inserted row; however the syntax for that command is non-standard sql. That means that there will be similar, but different, commands in the other DB implementations, like mysql or postgresql. This is causing me to think that I might want to get the program to track every ID in the database and do away with any primary keys and generate the indices myself when the tables are created by their respective plugins.
  • There are no unit tests in the code. I am going to have no way to test that I have not broken anything and I am not making small changes. A test harness really needs to be written for fuppes.
  • The soci package (atleast for Ubuntu) was packaged really poorly. Currently I have to add a ‘-I /usr/include/soci/ ‘ into the PreRules.am file just to make sure that all the right header files are found in their expected places. There must be a better way  that does not involve a rewrite of the soci code. Or perhaps that is it; I will look it up at the very least.

There are more things for me to consider but for now that is enough; that will keep me plenty busy. Currently I am just trying to rewrite the code so that it actually compiles using SOCI and then I am going to test it to see if it actually worked. I will be very excited once I manage that. I think that will be the moment when I push the changes that I have been making to the git devel repository that all Fuppes developers share.

In the meantime I am also waiting upon Eva from the Fuppes ITP bugs list on debian. Unfortunately, I am getting really close to the Ubuntu LTS Debian Import Freeze and I was hoping to see Fuppes in before that date.

Database, Fuppes

Fuppes Databases and ORM

While looking at the database structure of fuppes I decided to see if it was actually possible to get fuppes to work with mysql and found out that for the average user (and even myself, a developer) it cannot be done with the current revision without serious changes to the source code. I know this because the plugin is not even loaded as an option in ‘src/lib/libmain.cpp’ of fuppes which means that more work needs to be done before it is ready to use by general users.

It is difficult to write a framework where many different DB’s can be all used as the backend to the same program; unless you use some type of ORM of course. I was thinking that since I was planning on doing a little bit of a database overhaul for fuppes that I might look into using SOCI (http://soci.sourceforge.net/) for all of our database work. SOCI has many positives that make it attractive for fuppes:

  • It supports Oracle, PostgreSQL, MySQL and Sqlite which is three more DB’s than fuppes currently uses for the price of one API.
  • It works on Windows and *nix operating systems. I discovered that it has packages in Ubuntu too.
  • It is rather easy to read compared to the other C++ ORM’s.
  • Integration with the STL is also supported; which got me excited. I love the STL.

And those are just the benefits for fuppes, it has more features that I have not mentioned here. If you want to know more you should go check them out.

Even if we decide not to use it for some reason then I will be still happy knowing that I tried. I think I will be doing a fair amount of database work over the coming weeks trying to improve not only database speed but the range of databases that fuppes can use.