Timebook – command line time tracking

What is Timebook?

Timebook is a command line utility that tracks your time without costing you any of it.

Preface

There are a few time tracking tools out there. I’ve used SlimTimer in the past, but having an extra window open is a pain, especially a browser window. As much as I love Firefox, I don’t want my paycheck to count on it not crashing.

So, I usually end up keeping a big Google Docs spreadsheet. I have different pages for different clients and columns for date, task, clock in time, clock out time, etc. It’s not a bad system, but it means clocking in takes me 30 seconds. Too much overhead.

So I was talking to Trevor about two weeks ago, and mentioned my frustration. “I wish there was a way I could track time by just entering “timer start ‘client’ ‘task-description’ on the command line.” He shot me a link to a python script he’s been using for a few years that does just that (though the syntax is a little different)! And ever since, we’ve been refining it and adding features. I find it incredibly useful – take a look!

Using Timebook

First, let’s take a look at the Timebook commands. Note that the base for timebook is “t” and you can use 1 letter shortcuts for every one of the timebook commands. So in the examples below, I’m going to use “t s” instead of “t switch”, etc.

$ t --help
Usage: t [OPTIONS] COMMAND [ARGS...]
 
where COMMAND is one of:
    alter - alter the description of the active period
    backend - open an the backend´s interactive shell
    display - display the current timesheet
    format - export a sheet to csv format
    in - start the timer for the current timesheet
    kill - delete a timesheet
    list - show the available timesheets
    now - show the status of the current timesheet
    out - stop the timer for the current timesheet
    running - show all running timesheets
    switch - switch to a new timesheet

Timebook will start you off on a timesheet called “default”. You’ll probably want to have different timesheets for different groups of tasks; say, different clients. Let’s say you have one for your client Acme. Switch to the Acme timesheet like this (it will be created as you start using it).

$ t s Acme

Now let’s say you’re going to spend an hour tightening widgets. Punch in like this.

$ t i tightening widgets

Pretty easy! Let’s say you’ve been working for a while and you wanted to be reminded what task you were on and how long you’d been on it. Try this command.

$ t
Acme: 0:40:48 (tightening widgets)

Clock out like this.

$ t o

Now let’s start a new task, and display our timesheet so far.

$ t i running errands
$ t d
Timesheet Acme:
Day            Start      End        Duration   Notes
Mar 19, 2009   14:47:59 - 16:30:28   1:42:29    tightening widgets
               16:30:33 -            0:00:03    running errands
                                     1:42:32    
Total                                1:42:32

Play around with some of the other commands. You can list your timesheets, display which ones are active, export your timesheet (even given a particular date range) as a csv (hopefully soon an excel doc).

Lots of fun stuff to play with. And it’s definitely the lightest weight timekeeping app I know of.

Installing Timebook

Linux

$ sudo apt-get install mercurial # if you don't already have mercurial
$ hg clone http://hg@bitbucket.org/trevor/timebook/
$ cd timebook 
$ sudo python setup.py install

Windows
coming soon
OS X
First get mercurial. Here’s one option: http://mercurial.berkwood.com/

$ hg clone http://hg@bitbucket.org/trevor/timebook/
$ cd timebook 
$ sudo python setup.py install

turn off trackpad taps while typing

So I have this Macbook I’m running Ubuntu 8.10 on.  I have taps turned on as a way to click on things because that’s my general preference… but it can get me in trouble.  The thing about Macbooks is that they have huge trackpads.  It’s pretty easy to touch the trackpad while you’re typing, which will cause you to jump around mid-sentence.  Annoying.

Wouldn’t it be nice if we could disable touchpad taps while typing?

Here we go… from the terminal, try out this command:

syndaemon -dti 1

That will turn off tapping on the keypad for 1 second each time you press a key on the keyboard. What do those flags mean?

-d    Start the process as a daemon (in the background)

-t    Only disable tapping, not mouse movements.

-i #  how many seconds to disable tapping after the last keypress.

So, play with it and figure out your preferred settings.  1 second?  2 seconds?  When you are happy with how you have it set up, go to System -> Preferences -> Sessions (in Ubuntu) and add the command so it will run every time you start your computer.

these are a few of my favorite things

I know these videos are a few years old, but they still make me smile. Enjoy!

(two more after the bump)

Schweppervescence


Read the rest of this entry »

Ubuntu’s crappie fonts

If you develop websites on Ubuntu, you may have noticed the horrible fonts it uses.  You want Times New Roman?  It gives you some quasi Courier-New mutant.  Microsoft’s Truetype fonts, though free, are not open source, so Ubuntu cannot offer them as part of its default package.

You can, however, install them yourself.

sudo apt-get install msttcorefonts

That’s it!  Reboot your browser and you will now see fonts (at least the common ones) the way the rest of the world does.

bad coffee

It was 2pm and I was stalling at my desk. I decided I needed some coffee but was too lazy to walk to any of the several coffee shops 2 blocks from my office. And thus the following saga was set in motion…

I put a french press filled with water in the microwave for 2 minutes. I don’t know if there’s anything technically wrong with microwaving a french press… but it just feels wrong.

When the microwave chimed, I started spooning coffee grounds into the french press. I should point out the the coffee was pre-ground “Uban” brand coffee in a pop-top can. The 30 ounce can cost me something like $6. Less than premo, one might say.

Now when I went to stir the grounds I realized that the water was not nearly as hot as I had assumed. It was less like hot tea than it was like warm milk. “No big deal,” I thought, “I’ll just give it an extra few minutes to steep before I drink. It will all even out.”

Ten minutes later I realized that I had completely forgotten about the coffee. I tossed aside my keyboard, pressed down the filter on the french press, grabed a mug off of my desk and poured. At this point I realized two more things:

  1. My coffee had the pallor of a light beer.
  2. The mug I had found sitting on my desk was the one I had used the previous day to eat chicken noodle soup.

Project Euler

If you’re into puzzles and enjoy some light coding, you should check out Project Euler. It’s a site devoted to problems (mostly mathematical) which require a computer to be solved.

Problem 35

The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.

There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.

How many circular primes are there below one million?

Sure, you could solve that kind of problem on paper, but it would take you a lifetime. On the other hand, it is pretty simple if you attack it with a computer.

  1. Find all the prime numbers under a million.
  2. Split each number into a string and recombine it using all possible rotations.
  3. Test each rotation, if all are prime, add 1 to the tally.

When you have the answer, you can go back to ProjectEuler.net and punch it in.  The site will keep track of which problems you’ve solved, and if you have lots of time on your hands, you might even make it on to a list of the top 1000 problem solvers.

If you like mulling over a problem in the back of your mind all day, Project Euler is worth a look.

Have fun, and let me know what you think!

favorite SF short story

Years ago I read this short SF story that has hung with me ever since… long after I forgot what book it was in or who wrote it. Today, thanks to several awkward google searches (aliens + probes + AI = the dark side of the internet) I found the story again! And the frosting on the cake is that the author has it freely readable on his website!!

The story is called Lungfish. It was written by David Brin, and falls into the category of hard SF. In other words, no faster than light travel, no super-mega-death-rays, no monsters. The story centers around this strange culture made up of million year old, self replicating probes.

The idea is simple, it takes hundreds of thousands of years to travel to even nearby stars. So why not let machines do it for you? If the destination proves interesting or habitable, the probe will build a society, replicate itself as necessary, and when ready will clone beings of your race from DNA data in its memory banks. It can then teach the clones about your culture, and bingo – autonomous space colonization.

Now imagine a universe where many alien societies (over the last 100 million years) have launched probes like this, but with differing intent… some for colonization, some for exploration, but some are simply xenophobic. They send out probes to self-replicate, and then detect and destroy other societies.

So some probes meet and form alliances. Some lay in wait to trap and destroy predatory probes… some will simply orbit a planet waiting for the life there to evolve so it can make contact!

The story is only about 20 pages when printed in trade paperback, so it’s a quick read, but the idea is truly amazing. Like I said, it’s one of my favorites—but don’t take my word for it…

LeVar Burton

sync folders across multiple machines

syncbig.gif

I work from all over, on many machines. In the past I’ve just had to be absurd about carrying my files with me and always killing the old versions that stack up on whatever machine I didn’t use that day… in other words, a huge pain.

You’d think there would be an easy way to just automatically have your computers make sure that the most recent version of all your necessary files are on every computer – and that the files you’ve deleted are removed from every computer.

Well, you’ve guessed it, there is!

Today I found FolderShare, a free little app by our friends over at Microsoft (hey – they can’t be all bad).  You install a tiny app on your computers, go to foldershare.com and create a free account, and then you can just log in through foldershare.com to tell your account (which then tells the apps on your computers) what folders you want synced!

It’s super easy, and once it’s set up FolderShare works in the background to sync your folders any time the content in one of them changes.

adding a Slideshow feature to a SimpleViewer gallery

SimpleViewer is a great, easy to impliment, polished little gallery written in flash that lets you tie your photos and thumbnails in with XML. It’s got a decent feature set as far as changing the aesthetic of the viewer, but no option for an automated slideshow.

One of my clients wanted this option, and it took me a while to figure it out – so for those of you who are wondering how to incorporate a slideshow into simpleviewer, here’s how!

My finished project can be seen at SixEightyThreePhoto.com

(note – if you’re going for the free version of SimpleViewer this won’t help you – you need access to the source code, so you will need SimpleViewer Pro for this)

Step one – simpleviewer.fla

  1. Open simpleviewer.fla
  2. Create a new layer in the timeline.
  3. Create a keyframe by selecting frame 30 on your new timeline and hitting F6.
  4. Create your start/stop button and put it here, on this keyframe, on this layer. I’m calling mine ssButton. (for those in the know, I’m not really using a “button” element… I find them awkward to work with… I’m using a MovieClip as a button… but really, either way should work)
  5. Now we’re going to need a bit of code. This is all pretty simple stuff. A setInterval to iterate the slideshow, and instead of having a boolean to look at to determine whether or not the slideshow is playing, I’m just looking at whether the “play” layer of the button is visible. Open up the actions panel (F9) and copy this…

var nInterval:Number;

ssButton.onRelease = function():Void {
    ssButton.mcPlay._visible = !ssButton.mcPlay._visible;

    clearInterval(nInterval);

    if(!ssButton.mcPlay._visible) {
        nInterval = setInterval(slideshow, 3000);
        sm.ssNext();
    }
}

function slideshow():Void {
    sm.ssNext();
}

Step two – StageManager.as
I wish I knew a better way to do this, but I guess it’s not too painful… What we’re going to do here is pass our function call right on to another class instance. So at the bottom of StageManager, right before the last close brace, add this function…

public function ssNext() {
    mImageArea.ssNext();
}

Step three – ImageArea.as
Here’s where we actually, finally, DO something. Place this function right before the last close brace at the end of the file…

public function ssNext():Void {
    var nStart:Number = mCurrentImageIndex;
    mThumbArea.selectedThumbIndex++;

    if(nStart == mCurrentImageIndex)
        mThumbArea.selectedThumbIndex = 0;
}

Ta-Da!! If you built your button right, you now have working slideshow button in SimpleViewer! You’ll have to publish the simpleviewer.fla file again to get the updated version of your viewer.swf, and then you’ll probably have to tinker a bit to get the button in the right place – but that’s kid stuff.

screencast tutorials at wikivid.com

WikiVid.com Logo

Well, that didn’t take long! In my last post I talked about how I didn’t know of any free websites that had good collections of screencast tutorial videos. I just stumbled upon….

wikivid.com – A screencast aggregator

There’s nothing very wiki about it, as the videos are all static content collected from sites all over – but it’s still a great resource. Visit the link, and you will see a list of tutorial categories. When you select a category (for instance, Linux or Flash) you will see tutorial videos within that category organized under subheadings (like Intro or Actionscript).

A nice feature wikivid is that it doesn’t send you off to all those frightening, distant websites to view the screencasts. You get to watch everything without ever leaving wikivid. The interface is simple and quick, and even allows you to give quick feedback on the videos you view.

So – it’s all pretty simple, but that’s what makes it so easy to use. I look forward to seeing where the go from here!