kerneljack’s diary

some thoughts and comments on my day to day experiences

My blog has moved!

Posted by kerneljack on March 10, 2008

Over the next few days I’m going to move this blog away from wordpress.com and host it at my own domain, http://www.kerneljack.com.

Please head over there from now on as I am going to stop updating this here.

Posted in blogging, website | Leave a Comment »

Fix for strange white borders with Compiz Fusion on Ubuntu

Posted by kerneljack on August 30, 2007

I’ve just installed Compiz Fusion on my 3-year old ASUS laptop which is running Ubuntu Feisty. I’m quite pleased at how stable it is. I tried Beryl a few months ago and it was not usable at all on the same hardware.

I did run into one problem, though and I couldn’t find any solution to it on either the Ubuntu Forums or anywhere else on the net. My top Gnome panel had a strange white bar under it and all my context menus had white borders. Maybe my google-fu wasn’t very good yesterday, but the only solution that I managed to find after about an hour was this on a Gentoo forum:

This is a known issue. Go to ccsm->Window Decorations and add the string !dock to the value Shadow Windows. I had to enter 2 !dock. First disabled shadows of the context menus and the tool tips, the second stops shadows for the gnome-panel.

I’m just putting this here in case it helps someone with a similar problem.

Technorati Tags:

Powered by ScribeFire.

Posted in beryl, compiz, fusion, hardware, linux, software, troubleshooting, ubuntu | 8 Comments »

Such an insightful essay …

Posted by kerneljack on August 28, 2007

Paul Graham has impressed me time and again with his stunning insight. Whenever I read his writings, it’s as if he plucked his ideas out from my own head and then put pen to paper. His latest, Holding a Program in One’s Head, contains several gems that I personally have experienced several times at work.

The danger of a distraction depends not on how long it is, but on how much it scrambles your brain. A programmer can leave the office and go and get a sandwich without losing the code in his head. But the wrong kind of interruption can wipe your brain in 30 seconds.

This is spot-on, and I notice this a lot during my lunch break. Sometimes I can’t get a program or problem out of my head and occasionally I even come up with a solution not 10 minutes into my lunch break and then I can’t wait to get back and finish it. Other times however, especially if I have lunch with my colleagues the whole ‘problem space’ I’ve built up in my head simply vanishes. Due to the amount of work it usually takes (maybe a half-hour to an hour) to re-load my brain with the problem I was working on, a lot of post-lunch time is wasted and sometimes I can never recreate the problem fully again because I tend to be sharper in the mornings than in the lazy afternoons.

Since there’s a fixed cost each time you start working on a program, it’s more efficient to work in a few long sessions than many short ones.

I have often wanted to do this, but it’s almost impossible to do. There is always lunch, some other interruption, going home, eating dinner or something similar. On the weekends, however, I sometimes manage to stay up late and can work uninterrupted for quite a while.

Rewriting a program often yields a cleaner design.

True sometimes, but I agree with him that even the process of rewriting a program can lead to significant insights; even if the rewritten program is not a huge improvement.

Instead of summarizing the whole essay here, I highly recommend that all programmers and their managers go read it. Even non-IT staff, such mathematicians, whose work involves long-stretches of thinking, and constructing problem spaces in their heads will benefit from the advice in this essay.

I haven’t been paying attention to my RSS feeds recently and I forgot just how good some people are at writing and expressing their insights :-) Paul Graham and Joel On Software are two blogs (journals?) that I really enjoy reading.

Technorati Tags:

Posted in coding, programming, software, writing | Leave a Comment »

Some writing tips

Posted by kerneljack on August 23, 2007

I’ve spent the past 2 weeks on and off reading ‘Bugs in Writing’ and have definitely learned about some mistakes to avoid in writing. In order to fix these mistakes, it is best to do a lot of your own writing so you can find them and eliminate them. I will try to write a brief note about some common mistakes here. I haven’t asked the author for permission, so I will try to do it here in a very general and concise manner.

#1. Avoid using passive voice. Passive voice just means that when you say something about the world or some event that happened, make sure you identify ‘who or what’ was involved. The ‘who or what’ is commonly referred to as an agent.

For example,

Wrong:
The tea was made.
The program was written.
The computer was dropped.

Correct:
Mark made the tea.
Jane wrote this computer program.
Christopher dropped the computer.

#2. Speak directly to your reader. Never address your audience as the reader or refer to yourself as the author. You should speak directly to your reader. You should refer to her as you. If you are the sole author of a book, use I and if you have co-authors, use we. In addition, avoid using one, as in One should realize … or One has written.

#3. So, So that and Such that. Just remember the following:

So means therefore
So that means in order that
Such that means in such a way that

#4. Two or more. Use the terms between, each other, either, and a couple to refer to precisely two entities; and you should use among, one another, any one of, and several to refer to more than two entities.

I will add some more tips later on, but probably not many. The problem is that I haven’t gotten permission from the author and several of the tips have examples that are best quoted verbatim from the book.

Posted in blogging, news, writing | Leave a Comment »

Been too long …

Posted by kerneljack on August 6, 2007

I know I haven’t updated this blog for a while … in fact I frequently abandon it for a few months while I carry on with life’s struggles. Keeping up with my job, finding time to spend with my beautiful wife, all the while attempting to keep current with the fast pace of technology growth.

Starting today, I will try and change that. You see, in order to motivate myself to keep this blog updated I have decided to set myself a goal and complete it. I will keep updating this blog not only with my progress, but will also write about what I have learned as I go along.

So my first goal will be ‘to improve my writing skills’. I have enjoyed writing stuff for a long time now and friends have occasionally told me that ‘you could be a really good writer’. Well I’ve finally decided I should give it a shot.

To be honest, I’ve never been good at grammar, and people find that hard to believe. I’ve simply developed a good ear for what ’sounds right’ based on my perusal of several newspapers, magazines, novels and books over the years. Learning a lot of vocabulary while preparing for my SATs and reading ‘lots’ has really helped.

The first book I’m going to try and read and understand is going to be Bugs in Writing, which I bought several years ago, but never got around to reading. It is written mainly for people who come from a scientific or technical background and hence is perfectly suited for someone like me. Each chapter aims to analyse and fix a single ‘problem’ and you can read each chapter in whatever order you like.

With that, I bid you farewell. I believe my next post is going to be about ‘passive/active voice’. Exciting times indeed :-)

Posted in blogging, news, writing | Leave a Comment »

Links for June 3, 2007

Posted by kerneljack on June 3, 2007

Fedora 7 is released!: I really liked the last Fedora release, but I believe it was slightly plagued by problems with some of it’s package management utilities. I have already installed this release and am quite impressed. Wireless now works with WPA out of the box and their new re-spinning feature is something I will try out someday.

XML Parser benchmarks: I have always had my own suspicions of which XML parser model would be faster (Sax or StaX), but I’m glad to see this benchmark done by the O’Reilly folks.

Fear and loathing at Cupertino: Jeremy Allison’s terrible experience while trying to prepare a talk for his Apple WWDC presentation. Jeremy works on Samba, along with Tridge, who they all call “the smartest man in Australia” :-) Jeremy works at Google now. Smart man.

Posted in apple, coding, computers, linux, mac, news, operating systems, osx, programming, software | Leave a Comment »

Some web links for today

Posted by kerneljack on May 17, 2007

I’m going to occasionally post links here that I find particularly insightful, interesting or geeky.

Three things that caught my interest today:

PowerTOP: Released by Intel, this utility builds on work done by kernel developers to make the Linux kernel power-efficient. PowerTOP gives you a snapshot of what apps are consuming the most power. Turn off these apps or modify their behavior, and you’ll notice an instant increase in the battery life.

The Linux SLAB Allocator: Traditional heap memory managers suffer from fragmentation, among other issues. The SLAB Allocator in Linux, inspired by a similar implementation for Solaris and various embedded systems, allocates memory as fixed sized objects and uses caches to reduce fragmentation. It also has options to enable hardware cache alignment which allows objects in different caches to share the same cache lines, thus improving performance.

Advanced Linux Programming: After many years of coding mostly Java, I’ve been meaning to brush up on my C, Assembly and general Unix programming skills. I found this excellent book freely available online and it seems to be getting a lot of praise from reviewers on Amazon so I downloaded it. It has a lot of topics that I’m very interested in, like IPC and threads, and it even has a few assembly oriented chapters. I will definitely be reading this one :-)

Posted in coding, linux, operating systems, programming, software | Leave a Comment »

Switzerland Trip

Posted by kerneljack on April 5, 2007

p1010093.jpgp1010005.jpgp1010099.jpg

We have just come back from a brilliant trip to Switzerland! The weather was awesome throughout our trip. We spent most of the time in Lucerne, where we stayed at the Hotel Drei Koenig. On our first day we decided to wander around Lucerne’s Old Town and see as much of it as possible. We ended up quite dreadfully tired and in the evening we just went back to the hotel and simply crashed.

We went on a trip to Mount Titlis the next day. Mount Titlis is one of the highest mountains in Switzerland, at 10,000 feet. I must admit to feeling quite terrified at that height. I was feeling quite disorientated.

The next day we made a long hiking trip up Mount Rigi-Kulm. To get to the start of the hiking point, you have to take a cruise along the river, then a trip up the mountains by train, before you get to your starting point. This is the day of our trip which I think we enjoyed the most.

We spent the rest of the trip in and around Lucerne and on the last day we made a day trip to Zurich. This allowed us to catch our flight straight from Zurich Airport back to London. All in all, a wonderful and highly recommended to anyone interested :-)

Posted in holidays, news, switzerland | Leave a Comment »

Passed my driving test!

Posted by kerneljack on March 31, 2007

Wow, I finally passed my driving test about after 3 or 4 tries! It is quite difficult to pass in this country, they can fail you for very simple mistakes like forgetting to turn your indicators off when stopping or taking off.

In any case, I’m glad I finally passed, now I need to learn about cars and what to buy, etc. I’ve just never been into cars, but I feel I might become an avid car enthusiast. I do like to tinker with technical things, the more geeky the better :-)

Posted in cars, driving, news | Leave a Comment »

GLLUG Meeting

Posted by kerneljack on November 12, 2006

I helped out yesterday at the Greater London Linux Group’s meeting, held at my old alma mater, the University of Westminster in New Cavendish street. It was a blast going back after so many years, I met one of my best teachers, Sean Tohill who always had an open mind and a keen intellect. The whole event was organised by Simon Morris.
A lot more people than we had anticipated turned up for this meet! There were easily more than 100 people that showed up. Simon had installed SLED 10 on several desktops there and I got Debian running VLC on a big projector screen, playing a movie in a continuous loop.

A few people, including me, volunteered to give short presentations about certain aspects of SLED, and I was giving a short talk and demo of XGL under SLED. I demoed it to about 20 people and they were all quite impressed with it. Along they way I managed to help out several people with their linux problems.

I absolutely loved this meetup and I hope I can attend many more in the future. There are more details and pictures here.

Posted in linux, news, operating systems | Leave a Comment »

LinuxWorld 2006

Posted by kerneljack on October 26, 2006

LinuxWorld started yesterday here in rainy London and I had a great time! It was the first time ever that I wasn’t a visitor, but was helping out at the Jokosher stand. I did several demos of the app to tons of people and we managed to distribute more than 130 Jokosher flyers to interested people.

I was quite surprised at the level of interest in the app, and we managed to solicit a great many feature requests from people, some of which will hopefully end up in Jokosher someday, making it rock even harder! I will definitely try to help out at more of these events in the future :-)

You can find the photos I took with my camera phone at my flickr photo page.

Posted in coding, computers, linux, podcasting, programming, python | Leave a Comment »

Surrey Street, Croydon

Posted by kerneljack on October 18, 2006

Since we moved to Croydon in July I have grown particularly fond of our Saturday morning food shopping. Surrey street is not very far from our place and hosts a farmers market every day, except Sunday. There are a great variety of fruit and vegetables available, plus a fishmonger that sells freh fish everyday. I got my Sony Ericsson W850i phone last week (will write a review soon!) and decided to see how good its camera is by taking some pictures of Surrey Street and the fishmongers. I’ve put a few pictures below and you can see the rest by going to my Flickr page. Enjoy :-)

dsc00014.jpgdsc00016.jpgdsc00015.jpgdsc00018.jpg


Posted in food, health, shopping | Leave a Comment »

Wierd Java error on my Mac

Posted by kerneljack on October 16, 2006

I turned my computer on today to get some work done, started Eclipse and started coding. When I tried to use the command-line though, I got this strange error:


Error: no known VMs. (check for corrupt jvm.cfg file)

I couldn’t run 'java' or 'javac' from the command-line at all! I immediately went to /System/Library/Frameworks/JavaVM.framework and looked for 'jvm.cfg'. I have 3 VMs installed on this machine, 1.3.1, 1.4.2, and 1.5.0. 1.3.1 and 1.4.2 had a proper jvm.cfg file installed but for some reason 1.5.0’s jvm.cfg was a zero-length file. Googling didn’t turn up anything useful except this tip, which wouldn’t work because in my case all my permissions were correct. Fixing permissions using Disk Utility didn’t show any permissions problems at all.

In the end, all I did was copy the 1.4.2 version over to the 1.5.0 directory and all was well. The tip above mentions that Eclipse might have had something to do with this, and there might be some truth to that, as I did update my Eclipse to 3.2 recently, but I have been using it for a week without any problems …

Posted in apple, coding, computers, mac, operating systems, osx, programming, software | 1 Comment »

WordPress finally supports WXR imports!

Posted by kerneljack on October 13, 2006

I’ve been waiting for so long now to import my old WP blog from my old web server to this site. The problem has been that until now, wordpress.com blogs did not have an ‘Import Self-Hosted WordPress Blog’ option so I couldn’t move my older blog across. The only option I had was to spend many days manually adding all of my posts to kerneljack.wordpress.com and correcting all the dates, which would have been a nightmare.

Thankfully I just discovered the wordpress-to-wordpress plugin which allows me to export my old blog as a WXR file which wordpress.com can then import. Now that I am back I will try to keep updating this blog more often.

Posted in blogging, software, website | 1 Comment »

Always buy RAM from Crucial

Posted by kerneljack on May 2, 2006

I needed some extra RAM in my 512MB laptop to do some Java heavy lifting (Eclipse, Netbeans, JBoss, Profilers, etc). Those things can take up a lot of RAM, not leaving much for Firefox and other apps. Seeing that my laptop does not cover upgrading RAM under the warranty (very strange) unless done by authorised personnel, I went down to the store I bought my laptop from (Micro Anvika) and asked for a quote. 130 pounds is how much they wanted for a 1GB stick; in contrast I could get the same type of RAM from Crucial for 89 pounds!! That’s a saving of just over 40 pounds! I was hoping it would all go smoothly and the RAM would work because if something messed up I would be without a laptop and a warranty :-)

It all went perfectly of course and a month later I’ve had no problems with the RAM. It’s so simple to buy it from crucial too. They have a comprehensive database of products (computers, laptops, motherboards, etc) and the type of RAM these products take. Simply make the right selections and they tell you what to buy, even how many slots you should have free by default. If even that’s too much for you and you happen to be on a Windows PC or laptop they have an ActiveX applet that will download and try to figure out the RAM type for you. This didn’t work for my system though.

Anyway, the moral of this story is: Always buy RAM from Crucial. It is crucial that you do so :-)

Posted in computers, hardware, website | Leave a Comment »

Apple’s Boot Camp – easily install XP on a Mac!

Posted by kerneljack on April 5, 2006

Wow this is unbelievable! Apple has officially released a public beta of Boot Camp which allows anyone to take a Windows XP CD and install it on a Intel Mac complete with dual-boot! I haven’t seen this discussed anywhere today as yet, but in just a short while this is going to be huge. Ars Emporium and Macintouch seem to be the first to have this story. So this is why Apple joined that Windows benchmarking group a while ago. The next version of OSX (Leopard) will also include technology to let you run XP on a Intel Mac. I think Leopard will also include some virtualization technology so you won’t have to reboot your Mac just to use Windows.
From the Boot Camp page:

Boot Camp lets you install Windows XP without moving your Mac data, though you will need to bring your own copy to the table, as Apple Computer does not sell or support Microsoft Windows. Boot Camp will burn a CD of all the required drivers for Windows so you don’t have to scrounge around the Internet looking for them.

Well … I never thought I would see this day. Everyone has known that Apple wouldn’t officially support Windows on Macs and they still won’t offer support for this but it was always assumed that people would have to use hacks to get Windows to run on a Mac. With Boot Camp people will no longer have to rely on hacks and it will also burn you a CD of the required drivers for your XP system. Very very cool indeed.

Posted in apple, computers, mac, operating systems, osx | Leave a Comment »

Scoble’s Dashboard Spy

Posted by kerneljack on April 2, 2006

With all the April Fools jokes flying around, The Scobleizer Dashboard has got to be funniest thing I’ve seen in a while. It would be great if someone actually came up with something like this so a blogger can instantly monitor what’s being said about him all over the web. Kind of like web stats but for an individual blogger or blog; maybe I’ll call it BlogBuzz or BlogStats. BlogBoard, BlogDashboard, dont’ sound that nice. Maybe MemeBoard? That sounds better.

Posted in computers | Leave a Comment »

Doing quick tasks in Python

Posted by kerneljack on March 31, 2006

A lot of the time at work I have to come up with quick solutions to various programming problems, and I mean *real* quick. There is usually very little time for finding the right library or open source toolkit that has already solved the problem or some part of it and then to figure out how to integrate that into our own workflow. It is usually much quicker to simply write a few scripts that get the job done.

In such situations I increasingly find myself solving these problems using the Python programming language. I’ve usually whipped up scripts using bash scripts and even Perl but I often find that I have to “re-learn” Perl again and again, or at least the part that I’m temporarily using to solve some problem. Python just seems (and looks) so much natural and cleaner. I’ve been fascinated by Ruby recently after my brush with Ruby on Rails and I am seriously trying to find a project to use it in all the time!

Anyway I wanted to give some examples of Pythons’ ability to solve quick problems. I’ve used it to make remote backups, check if certain services are running remotely and to fetch and delete mail off a remote server. For example, the following snippet of code can be used to send mail:

import smtplib

mailServer = smtplib.SMTP(serverURL)
mailServer.sendmail(sender, to, message)
mailServer.quit()

Really sweet and simple. I’m sure you can do this in only 1 line or even half a line in Perl (or even Python!) but this is really clear and concise. When I needed to write a script to send mail, I simply googled for it and dug this up in literally 20 secs! That’s one other reason I like writing scripts in Python: you can always google for snippets of code to do stuff.

Similarly, the following can be used to check if SSH is running and accepting connections on a remote server:

IDENT_STRING = "SSH"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, int(PORT)))
data = s.recv(1024)
s.close()

if data.find(IDENT_STRING) == -1:
sys.exit (1)
# if everything OK, exit normally
sys.exit(0)

If you put this in a script and run it, you can use the exit code (echo #?) to determine if SSH was running or not. Very useful if you’re writing a script to make backups to a remote server; you need to make sure that the service is up and running on the server and that it is accepting connections from the local machine.

I will try to see if Ruby makes any of these tasks even easier to do or perhaps easier to write and comprehend. I might even give Groovy a try since Java is my day job and Groovy is described as a scripting language for Java programmers.

Posted in coding, computers, programming, python, scripting | Leave a Comment »

Windows XP on a Mac!

Posted by kerneljack on March 27, 2006

The motherboard on my server died 2 weeks ago and it’s taken me this long to find a replacement and get the server up and running again. A benefit of changing the motherboard is that now the server is even more quieter than before! It’s all because I took more time to isolate the noisier case fans and to re-install them.

So I haven’t been able to blog for 2 weeks and *so* many things have happened. narf and blanca finally managed to get Windows XP running on a Mac! This is awesome news, especially after disappointing news a while back that Vista will not support EFI either. It seems they have managed to emulate a regular BIOS for the XP on Mac competition. Soon after the announcement, Leo Laporte did a great segment for MacBreak where they install XP on a Mac Mini and that’s the first place where I saw it actually running. A lot of people can now dual-boot their new Intel Macs and have a choice of XP or OSX (and even Linux!). I’ve never seen such a versatile machine! These are interesting times indeed.

Posted in computers, news, operating systems | Leave a Comment »

Ruby on Rails

Posted by kerneljack on March 7, 2006

“Rails is the most well thought-out web development framework I’ve ever used. And that’s in a decade of doing web applications for a living. I’ve built my own frameworks, helped develop the Servlet API, and have created more than a few web servers from scratch. Nobody has done it like this before.” -James Duncan Davidson, Creator of Tomcat and Ant

I tried out the Ruby on Rails (RoR) framework this weekend and I’m quite impressed. I used Apple’s new tutorial for developers which explains how to install and quickly get up and running with a simple Accounts/Expenses webapp. I did encounter one minor glitch while following the install instructions because I was installing on my Debian Linux webserver, instead of an Apple machine. It seems the default ruby install no longer comes with the ruby-zlib library, but that was quickly fixed by following these instructions.

Rails applications all have a consistent directory structure, so you always start by running a command to generate the directory structure for you. This creates directories like app, config, doc, test, etc. The names are very familiar and easy to remember and they reinforce the purpose of the directory, i.e. the test directory is used to hold unit tests and functional tests for our application.

Automatic test creation makes testing an obvious and integral part of the development process, not an afterthought. It encourages you to think of a testing strategy upfront. This is perhaps the single most appreciated aspect of Rails development for me. You are supposed to test your code in other environments, but programmers often write code and if time permits, write tests. Rails tries to make it easy and painless (as much as possible) to test your code.

The next thing I learned about was the fact that Rails, like the Struts framework, tries to explicitly embed the notion of Models, Controllers, and Views within the development workflow. The concept of Actions, which are sent to Controllers in Rails is familiar to Struts. It is very easy to take a Rails URL (as shown in the example) and figure out how the server is going to parse and execute it.

Validation came next and I was suitably impressed. You simply need to add a few lines to the model, describing what each field should validate as, sort of like describing a type for a variable. Simply restart your server and voila, type rubbish in a field and Rails will highlight the field in red and ask you to re-enter it.

After all that, the tutorial shows you how to create a relationship between two models, much like in a relational database. The relation is that ‘one account can have many expenses’. This is accomplished in Rails by adding a ‘belongs to’ field in the Expense model (an expense belongs to an Account) and a ‘has many’ field to the Account model (an Account has many expenses). Simple as that.

Other things covered in the tutorial were:

  • adding business logic to total up the expenses for the account
  • using helpers to change the view slightly and show the total in red if we are over budget
  • writing simple unit tests and running them

Overall an excellent introductory tutorial which has left me wanting more. I will definitely go through the Rails website and find out more about RoR and what it can do.

I know this is a small toy example and I want to know how RoR handles in a real mission critical business app as those are the only kinds of apps developers write these days :-) RoR is easy to code for, but is it easy to maintain? After we get past the simplicity of the example app, how hard is it to write huge apps in it, and how long does it take a new developer to become familiar with and productive with a new codebase? These are all questions that I need answers to and I have the feeling that RoR won’t disappoint.

Posted in coding, computers, software | Leave a Comment »