General

I'm typing this as I wait for my dad's brand new Sony VAIO to run Vista's "checking your hardware" utility; it has been doing this for about 8 minutes now. Before this lovely state, I had to wait while it ran "windows gets ready to run for the first time" for about 20 minutes.

wait.. it just rebooted, looks like it is done.

So in total, it took me 5 minutes to unpackage the VAIO plug it in and turn it on, and about 28 minutes to run Vista for the first time.

Two things I don't understand:

1) This is a brand new US$2,000 laptop with a fancy hybrid hard drive, why does it need to "check my hardware"?
2) Why OEM's put up with this? I mean Sony should have enough leverage to force Microsoft to provide them with a "quick firstboot" version of Vista.

Don't get me wrong, I'm not a Windows hater, I'm fine with it for the most part, but this just pushes my patience to a whole new level... has no one at Microsoft used a Mac and seen their elegant "firstboot" system? Or used pretty much any recent Linux distro for that matter?

btw.. windows is still booting...

rafael | General | 2 May, 11:20pm | 6 comments

For some odd reason I came across this video today, it brings together Mr. Dawkins and Pastor Ted. I'm not quite sure why professor Dawkins would even consider something like this but it is hella funny.

Even if you are a big Pastor Ted fan, this video should still serve to show you the crumbling grounds that one must take to argue about logic and reason against an evolutionary biologist.

rafael | General | 10 March, 2:55am | 2 comments

This may not surprise some of you but, believe it or not, you can write very simple asynchronous delegates in plain old bash. Yeah that's right, BASH.

Here's the scenario, let's say you have to perform a task that might take a long time (let's pretend you need to check the health of an nfs server prior to attempting to mount exports from it) but you do not want to block the main "process" waiting for it, here's how something like that can be implemented:

###################################################
# ASYNC NFS CHECK
# Rafael Ferreira <raf@ophion.org>
###################################################

# CONFIG FLAG - whether NFS has been checked or not
NFS_OK=1

# Runs a command asynchronously
# $1 is the command to run
# $2 is the callback function
async_run() {
        {
                $1 &>/dev/null

                # calling the callback passing the result
                $2 $?
        }&
}

nfs_callback() {
        if [ $1 == "0" ]
        then
                touch /tmp/$$
        fi
}

for i in $(mount -l  -t nfs | grep nfs2 | awk -F ":" '{print $1}')
do
        if [ $NFS_OK == "1" ]
        then
             async_run "/usr/sbin/rpcinfo -p $i" nfs_callback
             disown

        fi
done

sleep 1s

if [ -f /tmp/$$ ]
then
        echo "NFS OK"

else
        echo "NFS NOT OK"
fi
 

In a nutshell, async_run() is where all the action happens. It takes a string parameter of a command to be run and a callback function to be dispatched once the command is done. On the example above, I decided to block the main process and wait for the async call to return for at most 1 sec, this allows me to have constant execution O(1), no matter how long the async task takes.

Yeah, I know this is pretty silly, but hey, I like it.

rafael | General | 6 March, 11:00am | 2 comments

This guy Mark Fink should get the Arse of the Year Award for the most obtuse gnome mailing list post:

http://mail.gnome.org/archives/desktop-devel-list/2008-February/msg00131.html

My fav quote from that whole thread:

"I've never written a program before so I also need some help. Also I need a place to put it on the web"

We are indeed doomed....

rafael | General | 23 February, 1:03am | 5 comments