biais.org

Friday 2 October 2009

Calculating How Much Time You Spend Writing Tests

I like testing piece of code I write. Because I often rewrite things, optimize and try to make things better (maybe i'm bad in doing the best thing at first time ?). When I'm working, I have constraints : time, coworkers, boss. In some of the companies I worked for, tests were only an option on particular code. I'm trying to convince that testing everything is good (In my current job, I'm actualy happy about that, because I'm not the only one who want to write tests ;) ). I never had the idea to do that, but I think this is something I should have done before : calculating how much time you spend testing.

The estimation done by the author reveals a 10% of his time writing tests and 90% writing the actual software :

The number of hours spent on the project is my best estimate, as I have not kept track of these numbers. Also, the 10% breakdown comes from keeping track of my coding habits for the last two weeks of coding. But, these are my best guesses.

Thursday 2 April 2009

Where the World Sees Junk, Africa Recycles: Maker Faire Africa

Maker Faire Africa (MFA), a celebration of African ingenuity, innovation and invention, will take place August 13-15 at the Ghana-India Kofi Annan Centre of Excellence in ICT in Ghana's capital, Accra.

You also should check out the Afrigadget website:

dedicated to showcasing African ingenuity. A team of bloggers and readers contribute their pictures, videos and stories from around the continent. The stories of innovation are inspiring. It is a testament to Africans bending the little they have to their will, using creativity to overcome life’s challenges.

Friday 13 June 2008

Russian Word Stress Dictionary

I'm trying to learn russian since a few weeks. I was looking on the Internet for a Russian-English dictionary with stress on Russian words because this is the only tool I needed to learn spoken russian by myself. I found the eSpeak Project, they worked on a russian dictionary with stress associated to each word. It's great but it's annoying to look for a word in a big text file... That's why I wrote a small django+jquery frontend to query the dictionary easily. Also I don't have russian keyboard so I add a small transliteration tool to the interface.

You can access it here: http://www.biais.org/russian-stress/

EDIT: It doesn't work in IE, Get Firefox

EDIT2: It's now working in IE, anyhow Get Firefox

Note: The dictionary is not perfect but it contains about 220000 entries.

Monday 26 May 2008

Screened Emacs Launcher

I'm used to run emacs from my shell and my mind is not able to switch from the command emacs to emacs-client when I have an opened windows. This is why I wrote this simple shell script that:

  • run emacs (and force server-start) in detached screen with a particular id (emax) if this screen doesn't already exist
  • run emacs-client (with the -n option : don't wait for the server to return) else
[shell]
#!/bin/bash

screen -list |grep emax > /dev/null
if [ $? -eq 1 ]; then
	echo "screening -- emacs $@"
	screen -S emax -d -m emacs -f 'server-start' $@
else
	echo "connect to emacs server and detach -- emacs $@"
	emacsclient -n $@
fi

I prefer to get a separate emacs instance when I'm writing mail because I can focus on it. You may want to have special cases for this, use this script instead :

[shell]
#!/bin/bash

# special case for mutt mail edition
if [[ "$1" =~ "/tmp/mutt"  ]]; then
    echo "attached"
    detach=0
else
     echo "detached"
    detach=1
fi

screen -list |grep emax > /dev/null
if [ $? -eq 1 ]; then
    if [ $detach -eq 1 ]; then
	echo "screening -- emacs $@"
	screen -S emax -d -m emacs -f 'server-start' $@
    else
	echo "normal mode -- emacs $@"
	emacs -f 'mail-mode' $@
    fi
else
    if [ $detach -eq 1 ]; then
	echo "connect to emacs server and detach -- emacs $@"
	emacsclient -n $@
    else
	echo "connect to emacs server -- emacs $@"
	emacsclient $@
    fi
fi

Note: I also set a zsh alias to emacs on this script

Monday 24 March 2008

ack: a better grep for programmers

ack is a grep like for programmers. I'm used to run grep -R and find ... -exec grep to search for something in my code or in others code. But since I found ack, I definitely switched to ack when I code. ack website.

My favourites features:

  • Color highlighting of search results
  • Searches recursively through directories by default, while ignoring .svn, CVS and other VCS directories
  • Many command-line switches are the same as in GNU grep, so the transition is nothing

ack 1.78 is out

Saturday 1 March 2008

Two common database mistakes

A really well explained post about 2 database mistakes

Mistake #1: treating a database as a dumb object store. This is a really popular idea right now- Hibernate does this, as does Ruby on Rails, and a number of other ORM packages take this effective approach. On the other hand, dynamically typed languages are also really popular.

[...]

Mistake #2: file formats (and this includes marshalled data structures), are wire protocols, and need to be designed to be as abstract as possible- to reveal as little about the internal structure of the program as possible (preferrably none at all).

[...]

Wednesday 19 December 2007

CAPTCHA resistance test: results

In this blog post, I wanted to test the spammer crawlers. Experience time : 2007-02-08 to 2007-12-18, more than 10 months. Some results:

  • 114 Mo of pure spam
  • 17443 mails (average: 150 / day during the last 2 months)
  • 9498 mails in the ceresistan mailbox (with the mailto: link)
  • 7945 mails in the recetansis mailbox (text only)
  • 0 mails in others mailbox (fortunately spammers don't use visual captcha breaker today)

A chart of the number of spam (both mailboxes) received per day during the test:

I forgot to test this one:

  • retancesis (at) biais (dot) org

Wednesday 2 May 2007

My Simple Rules and Zen To Done (ZTD), simpler Getting Things Done (GTD) methods

Since I began to work, I'm trying to follow simple rules to organize myself to do what I have to do. Simple rules, nothing original. I discovered something much more evolved: the Getting Things Done method. I didn't read the GTD bible but I read many blog posts about it and tried GTD online tools. In my personal point of view, it's really too complicated and it creates an important work overload. Then I discovered something really close to my "simple rules" Zen To Done (ZTD). My "simple rules" ( SR ;) ) are:

  • The use of a centralized todo list accessible from anywhere, in practice: a wiki page on my website. This centralized todo list is associated with a decentralized (temporary) todos, in practice: a pen and something to write on.
  • Focus on what you're doing and do one task at time. I'm, personally, mono-threaded, I can't work on 2 tasks at a time. Before starting on something important, I'm focusing on my need of focus ;) . That's strange, but I just need to think about focusing to focus on my task.
  • Write on my decentralized todo what i'm doing when somebody or something interrupts me.
  • Take a break when you need it. Focusing is something hard, unfortunately I can't focus on my tasks all day long.

Really, focusing is the most important thing, other rules work to support my memory.

Tuesday 24 April 2007

Internet Explorer on Linux

I'm working on a linux box (ubuntu). Sometimes, I work on web design and web development with firefox and firebug but I have to maintain scripts and styles working with Internet Explorer. I used to deal with these solutions:

  • Work on Linux, reboot on Windows and debug
  • Use a Windows box with VNC
  • Virtualize a Windows on my Linux box (unusable because it's too slow on my computer)
  • Work on Windows
  • Use wine with a complete windows installation

I recently discovered a better solution: ies4linux. It simplifies the configuration of wine and the installation of different versions of IE 5.05, 5.5, 6 and also 7 in their new beta version.

Tuesday 17 April 2007

Learn what the kernel can do for you

A very interesting article from a FreeBSD kernel developer. Learn what the kernel can do for you (and better than you):

Varnish allocate some virtual memory, it tells the operating system to back this memory with space from a disk file. When it needs to send the object to a client, it simply refers to that piece of virtual memory and leaves the rest to the kernel. [...] Varnish doesn't really try to control what is cached in RAM and what is not, the kernel has code and hardware support to do a good job at that, and it does a good job.