Atomeo

the open web, web development, ubuntu, and more

Tuesday, May 13, 2008

Tips to Drink More Water (and earn nerd points)

Water Bottle and CupDrinking water is good for you. However, this post isn't about trying to convince you of that. Instead let's assume, like me, you want to drink more water but find it difficult to consume eight 8-ounce glasses per day.

To help me drink more water I need a glass of water at my desk and a reminder to actually drink it. The reminder is a crucial part because I have had a bottle of water sitting at my desk for weeks and barely touch it. The problem is I tend to get engrossed in what I'm doing and forget to drink.

Fortunately, the solution is simple. All I need is a system that forces me to stop what I'm doing and reminds me to drink a glass of a water periodically. If you use Ubuntu or another Gnome distribution (I'm sure this can be adapted to work on any OS) you can set this up in a few easy steps with Gnome's session manager, the AT command, and a bash script.

  1. Create drink.sh in your home directory (anywhere is fine but you'll need to adjust the instructions accordingly) and copy and paste the following code into it:

    #!/bin/sh

    if [ "$1" = "schedule" ]
    then
    at 9:00am < $0
    at 10:00am < $0
    at 11:00am < $0
    at 12:00pm < $0
    at 1:00pm < $0
    at 2:00pm < $0
    at 3:00pm < $0
    at 4:00pm < $0
    at 5:00pm < $0
    echo "Drink reminders have been scheduled."
    else
    /usr/bin/gnome-screensaver-command -l
    fi

    Don't forget to give this file executable permissions. One way to do this is to right-click on the file, select Properties, select Permissions and then check the "Execute" checkbox.

  2. To verify this works, open a terminal (Applications > Accessories > Terminal), navigate to your home directory, and type ./drink.sh (WARNING: This will cause Gnome to lock you out of your current session and you will have to unlock it with your password). If this worked, go back to your terminal and type ./drink.sh schedule. You should see several lines of output and a final line, "Drink reminders have been scheduled." If you don't see this, stop and investigate.

  3. Gnome Sessions DialogueNow that this is working, you just need to tell Gnome to run the drink scheduler upon logging in. To do this, go to System > Preferences > Sessions and click "Add" under the "Startup Programs" tab. Enter whatever you like for the Name and Description, just make sure the Command points to your drink.sh file and passes the "schedule" argument (e.g. /home/username/drink.sh schedule).

And that's all there is to it. Next time you log in to your computer the drink scheduler will run and tell your computer to lock your screen every hour from 9:00am to 5:00pm. If you want to be reminded to drink at different times, just adjust drink.sh accordingly (should be fairly obvious what to do). As an added hint that it is time to drink, I set my screensaver to Ripples.

Here's to better health!

P.S. I initially tried to set this up with CRON but ran into limitations getting CRON to work with Gnome, as best summarized in this thread. If you know how to achieve similar results with CRON, please let me know.

Wednesday, April 9, 2008

Get Ready for Google Apps Engine - Learn Python and Django

I've recently began learning Python and the Django Web Framework for a project I am working on. And with Google's recent App Engine announcement it seemed like other developers might be interested in learning these technologies too.

My first bit of advice is keeping an open mind. If you have never written Python code before, but have a background in other languages like Java or PHP, you are in for a bit of a shock (or at least I was). Python's syntax is minimalistic (and not very flexible) with the goal of making Python scripts look very similar from programmer to programmer and thus understandable by all. After fighting syntax errors and swearing at gedit for auto-inserting spaces instead of tabs I've actually come to like Python a lot.

I have no experience with Ruby on Rails but hear rumors that Django has much in common. Regardless, Django is a lightweight framework that provides the developer with a lot of shortcuts and conveniences. Less configuration hassles and more code (the Python kind that is succinct and readable).

So with an open mind, here are some resources that should help you on your way:

  • Dive Into a Python - a freely available website that provides a good introduction to Python. As an added bonus you can download a PDF or HTML version of the book to read while (gasp) offline;
  • Python Tutorial - An indispensable reference;
  • Django - download the Django Framework and follow the 4 simple tutorials.
  • Django Book - I must admit, I just found out about this free resource and haven't had a chance to look through it yet;
  • DjangoSnippets - User contributed code snippets. Sometimes looking at someone else's code can be invaluable and save a lot of time;
  • Django Screencasts - I prefer reading through well-written documentation, but if you like fancy screencasts, these should help.
This short list contains all that you need to get going. Grab your favourite editor and marvel at how easy web development can be. You'll be mocking your J2EE-toiling friends in no time.

... and if you really want more to read, check out this Top 30 Django Tutorials List.

Sunday, March 30, 2008

Open Web Vancouver

Open Web Vancouver is coming April 14 & 15 to Vancouver Convention & Exhibition Centre. I'll be attending this year and I'm quite excited as I haven't had the opportunity to attend many web conferences in the past.

The sessions look great and I am particularly looking forward to:

Tuesday, March 11, 2008

Firefox 3 Beta 4 and Prism 0.9 Work Very Well

As promised, here is a follow up on my previous post about running the latest version of Prism as an extension. Good news is: Prism on Ubuntu actually works now.

It would seem that installing Firefox 3 beta 4 from the Mozilla site solved a lot of the problems I was having. So far I haven't had any problems creating Webapp shortcuts for the Google Apps I use and as an added bonus it is easy to select an alternative icon (the favicon is a bit too small for some uses).

The most noticeable improvement is really not Prism related but due to the improvements in the Gecko Platform (see beta 4 release notes). Webapps start significantly faster now.

Another nice feature is that Prism instances run in a separate process now. It used be that all Webapps shared the same process. A poorly written Webapp should not be able to take down all Prism instances (in theory). Additionally, since cookies are isolated to each instance of Prism the chance of one Webapp running in Prism making an XSRF is greatly reduced since it won't have access to session cookies from other Webapps.

Happy Webapping

Friday, March 7, 2008

Prism: Now an Extension for Firefox 3

Mozilla has announced that Prism version 0.9 is now available as an extension for Firefox 3. See the official Mozilla Labs announcement or Marke Finkle's Blog for more information.

Installing the extension is simple but does require Firefox 3 since it relies on Firefox 3's ability to allow other applications to use its XULRunner platform. As an Ubuntu user, the simplest way to install Firefox 3 is to enable the Unsupported Updates Repository and use Synaptic. Update: Save yourself some headaches with the Prism extension and follow the instructions at Tombuntu (still very simple and applies to Firefox beta 4 too). Once installed, start Firefox 3 and install Prism.

My first (and only) attempt at converting a website to an application failed. The problem was that the wizard wouldn't actually save the Web Application icon to the desktop. And without this I saw no way to launch Prism. I hope this is a Linux specific bug that will be ironed out soon. I'll post again once I get to play with Prism more.

As an aside, using Firefox 3 was nice. Compared to Firefox 2, it felt a lot snappier and faster at rendering pages. Hopefully some lagging extensions will support Firefox 3 soon.

Friday, February 29, 2008

Ubuntu Brainstorm For The Win

The new Ubuntu Brainstorm site has been launched and is off to an enthusiastic start. In a nutshell, this site gives users the ability to submit and vote on ideas for Ubuntu. The site has been live for less than 2 days and has already received over 1500 submissions. It will be interesting to see how Ubuntu development balances the desires of enthusiastic users and Canonical's needs.

One novel idea (of the many good ideas) proposes a new system for installing fonts. If you would like to voice your Ubuntu ideas, head on over to Brainstorm.

Friday, February 15, 2008

Cloud Samurai: New look for Atomeo

If you are reading this post from an RSS Reader, head on over to Atomeo to see the new "Cloud Samurai" theme. With previous blogging attempts I got wrapped up in the development and maintenance of the blogging platform (yes, I'm talking about you WordPress) and hardly posted to my blog. With my latest attempt at blogging I decided to use Blogger and focus on the content. So far this has been working out so I figured it was high-time I gave it a better skin.

I learned a lot about image creation from this project since the Samurai Kite image was created from scratch (hand sketched, scanned, GIMPed and Inkscaped). Knowing what I know now I think I could create a better image (I should have used Inkscape from the start) but I have run out of steam and want to move on.

Let me know what you think.