Interesting

Google Chrome and Vimium

If you are like me then you enjoy using Vim as your text editor. The thing you love most about vim is how intuitive the commands are. ‘d’ to delete and “[n]gt” to goto the n’th tab. If only everything contained the same commands and were as easy to use as Vim. Well other people have had the same thoughts. In firefox you may be familiar with the popular Vimperator plugin that essentially makes it possible to run firefox as though it was vim. Makes the entire browsing experience that much easier and for a long time I loved it.

However, more recently, Google Chrome has come out and in my humble opinion it seems to be fast, easy to use and also easy on the eyes; and now google have released it for linux and I’m sold. The only thing that I am missing is my vim-like browser experience. So after a little bit of searching around I found something that looked very promising: Vimium. Currently it is a simple javascript extension to Chrome that works pretty well. It is currently early days and the extension has a few bugs and a few missing features that I would like but I’m going to keep my eyes peeled. With any luck, in another couple of months I’ll be able to use my browser with Vim extensions.

Edit: Recently it has become nicer and I would now recommend that you download it and try it out yourself. There is no better judge for you than you.

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.

Interesting

Kindle for PC (And probably for Linux too)

Through the tangle of links that make up my daily browsing routine I came accross this gem from howtogeek which describes the windows beta for ‘Kindle for PC’. I had not heard about it before but I am very excited; when I first heard about the Amazon kindle i really wanted to get one. A cool little device that would allow me to read many and varied books? That seems like a winner to me. But alas, the price of the device drove me away, it was just to expensive to be worth considering as I would have to buy a large number of books via kindle for it to have been worth it. But now with the ‘Kindle for PC’ look at the benefits:

  • The device is completely FREE
    The ‘device’ as I called it, is just a piece of software that they will be giving away for free. You’ll essentially turn your computer into a kindle and I know that in my case it certainly has a bigger screen (though reduced battery life compared to a kindle). This also means that when you buy a book for the ‘kindle reduced’ price you immediately get the cost benefits.
  • You can have upto six kindle devices at any one time
    This means that if you want to share your books with a partner or your family then you merely have to all use the same account. So just setup a family kindle account and you can all benefit from each others purchases, each on your own PC. No more do you have to buy one book that everybody wants to read (like Harry Potter or Eragon in my families case) and read it one at a time; you can all read it at once with no more cost than that of buying one book.
  • You retain all of the other Kindle Benefits
    You have portability, guaranteed ownership of books and every other positive of owning the original Kindle.

With all these benefits I was spell-wrapped, here is a piece of software that I could now feel free using for all my book purchases; but will a version be made for linux? That was my one worry. I checked with the Kindle webpage and it said that there would be a version for Windows and that a Mac version was coming soon: but nothing about linux. I could try and get the Windows version and run it under wine but I would always be doing a little bit of fighting to get it to work correctly. So I just asked them directly if they were going to produce a version for linux and this is there response:

Hello,

Thanks for writing about Kindle for PC for Linux.

Kindle for PC is compatible with PCs running Windows XP, Windows Vista, or Windows 7.

We’re working on a Kindle for PC for operating systems like Linux, Mac which is expected to be available soon.

Strong customer feedback like yours helps us continue to improve the service we provide, and we’re glad you took time to write to us. I’ll send your comments to the Kindle team.

Well that’s a start (please note that that is only the head of the message; the rest looked auto-generated). They are working on a version for linux. If that is true then we may have something to hope for; if they have started work on it then all we have to do is show interest and we can hopefully see a version for Linux in the future. I for one know that I am really looking forward to it; I promise that should a version of the ‘Kindle for PC’ come out on Linux then every time I goto buy a book I will choose the Linux ‘Kindle for PC’ version first; that’s how much I love this idea.

Fuppes, Interesting

Using devtodo for FUPPES

I happen to really like the program known as devtodo (http://swapoff.org/DevTodo) which is aimed at developers who want a nice and easy way to manage a todo list. I have been using it for a little while for fuppes individually but today converted the TODO list that you can find in the fuppes svn into a devtodo ‘.todo’ file. And as a result we have nice todo list that we can both share. The positives of using devtodo include:

  • The database file for devtodo is in non-random (or sane) XML; which means that many different people using devtodo to edit the todo file should not be able to make changes that will corrupt it. I am hoping to find that there are no merging errors and it stays rosy.
  • You can prioritise everything nicely from five different importance levels
  • You can filter the todo list easily. For example, running the ‘todo done’ command gives you every item that is complete. Very useful if you are say, writing a debian/changelog.
  • You can purge items from the database as well so that it never gets too large. Though I cannot see myself doing this; too much useful information is retained otherwise.

All in all this is a very favorable move and I think that it is just one of the little things that can benefit from some more organisation. I just wish that there was a feature to allow converting the done items on the todo list into a debian/changelog. That would be ridiculously useful but unfortunately it does not seem to exist; ‘changelog2todo’ exists in /usr/share/devtodo/contrib but todo2changelog seems mysteriously absent. Maybe I’ll just write it myself; we’ll see.
Still working steadily on fuppes. It’s all getting there and every little bit helps.

Fuppes, Interesting

Bash-Completion: Fuppes and more

Very recently I have started writing a few bash completion scripts for myself. The first one I wrote was for the Ubuntu ‘powermanagement-interface’ package that allowed the binary pmi to autocomplete. And then I tried my hands of Fuppes for autocompletion and it turned out to be really easy. When the fuppes package comes out then it will ship with autocompletion for every option bar one. And that is where things start to get interesting. You may be wondering ‘Well why is there one command left that does not get autocompleted?’ Why not just finish it off? The reason is because I am dealing with the second half of the following option:

--friendly-name 

So the question is: how do you autocomplete or offer suggestions for a name? The first idea that popped into my mind was to create some sort of ‘username-computer’ by permuting ‘compgen -u’ and ‘compgen -A hostname’. That would work but I don’t like the thought of lots of permutations and that sort of code could easily become problematic.

At the same time I could just try a markov chain generator for the lolz. Keep pressing tab and generate your own random server name; yeah I can see that having some fun results. But is it actually useful; which is the whole point of bash completion?

I guess that there are many interesting things that you could do with the bash autocompletion and I’ve only just touched on some of them. I’m going to continue to speculate on what funny or cool things i could add in that space. If you have any interesting ways in which I could generate cool names for bash completion then please give me a comment about it.