Planet Open Ghana

May 12, 2012

Joachim Breitner

10 years of using Debian

Today, it must have been exactly 10 years that I started using Debian. The story of how I came to Debian shows some of its strengths, so I’ll use this occasion to share it.

I spent the first half of 2002 as an high-school exchange student in Wenatchee, USA. I was already a user of Linux at that time: I made my first contact roughly in 1996 and did my first installation at home two years later, but all that time I was dual-booting and my main system was a well-arranged Windows 98. The machine was a regular tower PC, but nevertheless I put the computer into my trunk when I flew to the US. It took away most of the space, and I had to put some of my cloths inside the case.

So I was there, happily using my Windows and my manually set up “Linux From Scratch” until one day the inevitable happened; inevitable at least until you start doing backups: On April 30th, my hard drive crashed, and took the two systems together with 4 years of personal data with it.

Two weeks later I had a new hard drive and was pondering my options. I did plan to install Windows again; at that time Windows XP was just released. But I wanted a German version of Windows, which would be hard to get there. Also, I did not want to use Linux from Scratch any more, and wanted to make a well-founded choice of a distribution. On the other hand, I really wanted to get my machine up and running quickly, to be able to read my mail more comfortably. I had heard that Debian had good support for network installations (downloading a full 700MB CD was something to avoid at that time), so I grabbed some netinst images, burned a CD, and quickly installed Debian.

I was planning to use the system for about two weeks. I did not pay any particular attention to the setup. Heck, I even picked from my Simpsons sidekick machine naming scheme one that I would not miss being used up (“barney”). Nevertheless, I was using this installation for many years (and many upgrades), until I eventually switched to using laptops. In fact, that very installation is still on the machine somewhere and works. I did install Windows XP a few weeks later as well, but hardly used it. So May 12th of 2002 was when I turned into a full-time Linux and Debian user.

I soon became interested in Debian the project and started to contribute. But that is another story for another ten year anniversary blog post, most likely on October 21, 2013...


Flattr this post

by nomeata (mail@joachim-breitner.de) at May 12, 2012 10:00 AM

May 07, 2012

Joachim Breitner

Free Groups in Agda

I must say that I do like free groups. At least whenever I play around with some theorem provers, I find myself formalizing free groups in them. For Isabelle, my development of free groups is already part of the Archive of Formal Proofs. Now I became interested in the theorem prover/programming language Agda,so I did it there as well. I was curious how well Agda is suited for doing math, and how comfortable with intuitionalistic logic I’d be.

At first I wanted to follow the same path again and tried to define the free group on the set of fully reduced words. This is the natural way in Isabelle, where the existing setup for groups expects you to define the carrier as a subset of an existing type (the type here being lists of generators and their inverses). But I did not get far, and also I had to start using stuff like DecidableEquivalence, an indication that this might not go well with the intuitionalistic logic. So I changed my approach and defined the free group on all words as elements of the group, with a suitable equivalence relation. This allowed me define the free group construction and show its group properties without any smell of classical logic.

The agda files can be found in my darcs repository, and the HTML export can be browsed: Generators.agda defines the sets-of-generators-and-inverses and FreeGroups.agda (parametrized by the Setoid it is defined over) the reduction relation and the group axioms. Here are some observations I (disclaimer: Agda-beginer) made:

  • Fun fact: Free groups exist not only in classical logic.
  • Without any automation as in Isabelle, even simple things get quite complicated. A simple substitution of an equality with subst requires me to specify not only the equality and the term I want it to apply, but also to repeat the common part of the terms. Or when using the associativity of list concatenation, I have to pass all three sublists to the lemma. Maybe I am a bit spoiled by Isabelle, but I’d be worried that this would prevent large proofs.
  • The levels are also annoying. Although my theory stays within one level, I have to annotate it everywhere. I’d expect the type inference to figure this out for me.
  • Equality reasoning with begin ... ∎ is quite nice and surprisingly well readable.
  • Besides the additional work, it is nice to be able to do the proof in almost all detail. There is a limitation, though, as some steps are done automatically (if they happen to occur when evaluating/normalizing a term) and the others, even if similar-looking, are not.
  • It’d be great if one would be free in the choice of editor, but vim users generally have a hard time in the field of theorem provers.

If I were to extend this theory, there are two important facts to be shown: That there is a unique reduced word in every equivalence class (norm_form_uniq), and the universal property of the free group. For the former (started in NormalForm.agda) I’m missing some general lemmas about relations (e.g. that local confluence implies global confluence, and even the reflexive, symmetric, transitive hull is missing in the standard library). For the latter, some general notions such as a group homomorphism need to be developed first.

I planned to compare the two developments, Isabelle and Agda. But as they turned out to show quite things in different orders, this is not really possible any more. One motivation to look at Agda was to see if a dependently typed language frees me from doing lots of set-element-checking (see the “mems” lemma in the Isabelle proof of the Ping-Pong-Lemma). So far I had no such problems, but I did not get far enough yet to actually tell.

Thanks to Helmut Grohne for an educating evening of Agda hacking!


Flattr this post

by nomeata (mail@joachim-breitner.de) at May 07, 2012 01:24 PM

March 13, 2012

Joachim Breitner

ghc-heap-view: Complete referential opacity

During the last week, I created ghc-heap-view, a library to investigate the actual memory representation of Haskell values. It is inspired by vacuum and the GHCi debugger, but goes beyond them by allowing the user to look inside thunks and functions and see what other values they refer to. Let me demonstrate it by running the included demo:

ghc-heap-view-demo

Here are a four different lists, where the first three are already evaluated.
The first one, l, was defined as a top level constant as

> l = [1,2,3]

and is now found at 0x00000000006d1750/2 (where the /2 is the pointer tag information) and fully evaluated:

    ConsClosure {info = StgInfoTable {ptrs = 2, nptrs = 0, tipe = CONSTR_STATIC, srtlen = 1}, 
                 ptrArgs = [0x00000000006d16e0/1,0x00000000006d1730/2],
                 dataArgs = [], descr = "ghc-prim:GHC.Types.:"}

The second one, l2, is locally defined

> let l2 = 4:l

and now found at 0x00007fdce19fe4b0/2. See how the cons-cell references l!

    ConsClosure {info = StgInfoTable {ptrs = 2, nptrs = 0, tipe = CONSTR_2_0, srtlen = 1},
                 ptrArgs = [0x00000000006dca50/1,0x00000000006d1750/2],
                 dataArgs = [],
                 descr = "ghc-prim:GHC.Types.:"}

And the binding

> args <- map length `fmap` getArgs

evaluates to the “one”, global empty list at 0x00000000006db640/1:

    ConsClosure {info = StgInfoTable {ptrs = 0, nptrs = 0, tipe = CONSTR_NOCAF_STATIC, srtlen = 0},
                 ptrArgs = [],
                 dataArgs = [],
                 descr = "ghc-prim:GHC.Types.[]"}

And now we have, at 0x00007fdce19fe4c8, the concatenation of them, but unevaluated:

> let x = l ++ l2 ++ args

The thunk keeps a reference to l2 and args, but not l, as that is at a static address, unless you are running this in GHCi:

    ThunkClosure {info = StgInfoTable {ptrs = 2, nptrs = 0, tipe = THUNK_2_0, srtlen = 1},
                  ptrArgs = [0x00007fdce19fe4b0/2,0x00000000006db640/1],
                  dataArgs = []}

Now to some more closure types. m and m' locally bound of type the unboxed type Int#, with values 42 resp. 23.

> let f = \x n -> take (I# m + I# x) n ++ args
      t = f m' l2

So here is (0x00007fdce1937d50/2), referencing its free variables args and 42:

    FunClosure {info = StgInfoTable {ptrs = 1, nptrs = 1, tipe = FUN_1_1, srtlen = 65553},
                ptrArgs = [0x00000000006db640/1],
                dataArgs = [42]}

And t is a thunk that applies f (also referenced here) to an unboxed value (23) and l2:

    ThunkClosure {info = StgInfoTable {ptrs = 2, nptrs = 1, tipe = THUNK, srtlen = 0},
                  ptrArgs = [0x00007fdce19fe4b0/2,0x00007fdce1937d50/2],
                  dataArgs = [23]}

Lastly, here is the standard example for self reference:

> let x = id (:) () x

This is what x (0x00007fdce1947940) looks like, at least without -O:

    ThunkClosure {info = StgInfoTable {ptrs = 0, nptrs = 0, tipe = THUNK, srtlen = 1},
                  ptrArgs = [],
                  dataArgs = []}

So it is unevaluated. Let us evaluate it using seq. Now we have, still at 0x00007fdce1947940:

    IndClosure {info = StgInfoTable {ptrs = 1, nptrs = 0, tipe = BLACKHOLE, srtlen = 0},
                indirectee = 0x00007fdce194cc98/2}

The thunk was replaced by an indirection. If we look at the target, 0x00007fdce194cc98/2, we see that it is a newly created cons-cell referencing the original location of x:

    ConsClosure {info = StgInfoTable {ptrs = 2, nptrs = 0, tipe = CONSTR_2_0, srtlen = 1},
                 ptrArgs = [0x00000000006db620/1,0x00007fdce1947940],
                 dataArgs = [],
                 descr = "ghc-prim:GHC.Types.:"}

After running the garbage collector (performGC), we find that the address of x is now 0x00007fdce19f30d0/2 and that the self-reference is without indirections:

    ConsClosure {info = StgInfoTable {ptrs = 2, nptrs = 0, tipe = CONSTR_2_0, srtlen = 1},
                 ptrArgs = [0x00000000006db620/1,0x00007fdce19f30d0/2],
                 dataArgs = [],
                 descr = "ghc-prim:GHC.Types.:"}

Future plans

The output of ghc-heap-view is not really pretty yet; even the indentation in this blog post was added manually by me, so this really needs a pretty printer providing a nicer, possibly more compact representation, including something like what vacuum provides. Maybe vacuum can be ported to use this library, and also include the thunk’s and function’s references in the output. Maybe also the GHCi debugger can be extended to show more information about unevaluated expressions using this. Internally, the library is not very polished yet either. It only handles those closures types that I have seen so far, and is likely to break horribly if run in a threaded or debugging enabled runtime.

How it works

Obviously, this is not standard Haskell 98 code, but rather deep trickery involving the GHC API and some C code. Initially I tried to use the API that vacuum and the GHCi debugger rely on, which is an operation

unpackClosure# :: a -> (# Addr#, Array# b, ByteArray# #)

which takes any Haskell value and returns the address to its info table, the pointers and the non-pointer-data in the closure. Unfortunately, it was not complete in that it was meant only for data closures and will for other closure types, e.g. thunks, return no data and no pointers (as can be seen in the code). So I implemented my own version of this operation:

foreign import prim "slurpClosurezh" slurpClosure# :: Any -> (# Addr#, ByteArray#, Array# b #)

where the returned ByteArray# contains the complete closure, including extra information fields such as the arity of a function. The Array# is again the list of pointers in the closure. At first glance, this is a duplication, as the pointers are of course also contained in the ByteArray#. But as soon as the GHC runtime reigns again, a garbage collector run can happen, the referenced values will move somewhere else, and the words that once were pointers in the ByteArray# become useless. But the corresponding entries in the Array# are updated by the garbage collector, as it knows that these are pointers, and not just words. This way, we get both a faithful copy of the closure on the heap and useful references to the contained data. Here is a demonstration of this effect:

$ ghci -XMagicHash -package ghc-heap-view
GHCi, version 7.4.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
[..]
Loading package ghc-7.4.1 ... linking ... done.
Loading package ghc-heap-view-0.1 ... linking ... done.
Prelude> let {a = [1,2,3,4]; b = 5:a}
Prelude> :m + GHC.HeapView 
Prelude GHC.HeapView> rawHeapData <- getClosureRaw b
Prelude GHC.HeapView> rawHeapData 
(0x000000004080d658,[1082185320,140040739366568,140040739365928],[0x00007f5dc68626a8,0x00007f5dc6862428])
Prelude GHC.HeapView> System.Mem.performGC
Prelude GHC.HeapView> rawHeapData 
(0x000000004080d658,[1082185320,140040739366568,140040739365928],[0x00007f5dc41b3ad8,0x00007f5dc41b3b28]) 

The function rawHeapData is a thin wrapper around slurpClosure# which turns the primitive array in normal lists. Note that the second component of the triple is unchanged, but the third is updated by the garbage collector. Of course this means that the Show instance for the data type that ghc-heap-view uses to reference values is not referential transparent either.

The foreign function import above is of type “prim”, i.e. does not call a C function but rather a Cmm function. Cmm is a reduced C that GHC uses internally to compile the Haskell code to, and most primitive operations are implemented in this language – although I do quickly call regular C from my Cmm code to do the more complicated stuff, mainly figuring out what words of the closure are pointers.

The knowledgeable reader might notice that I am passing a boxed value of type Any to the foreign function. This is currently not possible with foreign prim functions, and to actually use that code, you need the patch in GHC ticket #5931. But you can use ghc-heap-view without that as well (and the Cabal package will by default use that path), using the following hack to obtain the pointer to a Haskell value on the Heap as an unboxed type that can pass to the primitive operation:

foreign import prim "slurpClosurezh" slurpClosure'# :: Word#  -> (# Addr#, ByteArray#, Array# b #)
data Ptr' a = Ptr' a
aToWord# :: Any -> Word#
aToWord# a = case Ptr' a of mb@(Ptr' _) -> case unsafeCoerce# mb :: Word of W# addr -> addr
slurpClosure# :: Any -> (# Addr#, ByteArray#, Array# b #)
slurpClosure# a = slurpClosure'# (aToWord# a)

This works because a Word and a Ptr' have the same closure layout, only differing in the fact that one stores an a, and the other stores a Word#.

Once we obtained the raw representation of the closure, we do the parsing in Haskell. Using the info table and the raw closure, we have enough information to tell which words have to be replaced by the appropriate pointer (which might already have been updated by the garbage collector) in the pointers list.

This work was supported by a scholarship from the Deutsche Telekom Stiftung.


Flattr this post

by nomeata (mail@joachim-breitner.de) at March 13, 2012 09:52 AM

February 26, 2012

Joachim Breitner

GHC 7.4.1 speeds up arbtt by a factor of 22

More than two years ago I wrote arbtt, a tool that silently records what programs you are using and allows you to do statistics on that data later, based on rules that you define afterwards, hence the name automatic rule based time tracker. I wasn’t doing much with it recently (the last release has been half a year ago), but it nevertheless was running on my machine and by now has tracked a total time span of 248 days in 350000 records.

Yesterday, I had a use for it again: measuring the time spent creating a certain document with LaTeX. So I added a rule to my categorize.cfg and ran arbtt-stats. I knew that it was not very fast, and that my data set has grown considerably since I last used it. And indeed, it took more than 6 minutes to process the data and spit out the result.

Since I’m currently working on the GHC 7.4.1 transition in Debian anyways, I decided to check what happens if I compile the code with that version of the Haskell compiler, instead of the previous version 7.0.4. And behold: The whole process took merely 17.3 seconds to complete! At first I did not believe it, but the result was identical, both binaries were built with the same option, i.e. no profiling enabled or anything like that. Wouldn’t you also like to have such speed ups for free, just by waiting for someone else to improve their work?

I tried to find out the reason for the speed up and created profiling output from both the old and the new binary. The old binary spends 83% of the time in Categorize.checkRegex, which basically just call Text.Regex.PCRE.Light.match. Since the version of pcre-light is the same in both binaries, I conclude that the Foreign Function Interface that GHC provides to interact with C libraries (libpcre in this case) is much faster now, although I do not find any mention in the release notes. And even if I do not count the 83% time spent in checkRegex, the code from the new compiler is still 2.7 times faster. Thanks, GHC devs, great work!


Flattr this post

by nomeata (mail@joachim-breitner.de) at February 26, 2012 04:25 PM

February 15, 2012

Joachim Breitner

Including full LaTeX documents in another LaTeX document

Assume the following situation: You set problem sheets for a class, and at the end of the semester, you have 13 individual LaTeX files, including the preamble (the stuff from \documentclass to \begin{document}). Now you want to provide a file that contains all problems, followed by all problems with solutions. You could just concatenate the resulting PDFs, but that would waste quite a bit of paper, as most problem sheets do not fill the whole page. You could just copy’n’paste the LaTeX code, but that is not neat either.

So you want to include the 13 individual documents in one LaTeX document. LaTeX provides \include and \input commands, but these would require that the content of the individual files, i.e. the stuff between \begin{document} and \end{document}, is put in a file of its own. You cannot just \input the full problem sheet document, as there must be only one \documentclass command, and a few preamble commands are invalid within the document.

There are various solutions suggested, e.g. on Wikibooks and StackOverflow, and there are packages helping with that functionality, such as combine or subfiles. I chose a rather rough, hands-on solution that worked great in my case: The idea is to simply re-define all commands that you have in your preamble to do nothing, including the document environment, before including the other files and constraint to a group. In my case, the preambles were relatively small, as the common definitions of the problem sheets were in a file of their own. I am also using the \foreach command provided by the TikZ package for a convenient loop over all problem sheets:

\foreach \x in {0,...,13} {
  {
    \excludecomment{solution}
    
    \DeclareDocumentCommand{\documentclass}{om}{}
    \DeclareDocumentCommand{\usepackage}{om}{}
    \newcommand{\Blattnummer}[1]{}
    \DeclareDocumentCommand{\FirstDueDate}{mmm}{}
    \DeclareDocumentCommand{\ThisDueDate}{mmm}{}
    \newcommand{\SkippedWeeks}[1]{}
    \renewenvironment{document}{}{}
    \section*{Problem Sheet \x}
    \setcounter{problem}{0}
    \input{GraphTheoryProblems\x}
  }
}
\clearpage
\label{sols}
\foreach \x in {0,...,13} {
  {
    \newenvironment{solution}{
      \par\addvspace{1em}
    }{
    }
    \DeclareDocumentCommand{\documentclass}{om}{}
    \DeclareDocumentCommand{\usepackage}{om}{}
    \newcommand{\Blattnummer}[1]{}
    \DeclareDocumentCommand{\FirstDueDate}{mmm}{}
    \DeclareDocumentCommand{\ThisDueDate}{mmm}{}
    \newcommand{\SkippedWeeks}[1]{}
    \renewenvironment{document}{}{}
    \section*{Solution Sheet \x}
    \setcounter{problem}{0}
    \input{GraphTheoryProblems\x}
  }
}

To redefine commands taking optional arguments, using the xparse package is convenient. You can see how I include every file twice, first with the solution environment turned into a comment and then again with the solution environment actually showing its content. I create a section header based on the counter of the foreach loop, but I could have easily redefined \title and use that for a header, if my problem sheets had used that command (They don’t, as they calculate the problem sheet number and the due date based on the number in the filename – very convenient, and maybe worth a blog post of its own). The problem counter is reset for each file, so that the problems are numbered individually. I could have left this out, then the problems would be numbered consecutively across all included problem sheets.

The individual and resulting files can be found on the Graph Theory course website.


Flattr this post

by nomeata (mail@joachim-breitner.de) at February 15, 2012 01:45 PM

January 14, 2012

Henry Addo

Good To Be Back!

Nairobi, Kenya is one of my favourite cities in Africa. Her cozy climate reminds me of a town I grew up in Ghana. It feels so good to be back in Nairobi. Now I feel enabled. With that said, let me go and get some stuff done.

by Henry Addo at January 14, 2012 12:48 PM

January 05, 2012

Henry Addo

Happy New Year

Using this blog to wish everyone a Happy New Year. Twenty twelve, let’s see what you have to unveil.

My mantra this year is to write more. So be it!

by Henry Addo at January 05, 2012 04:01 PM

October 30, 2011

Odzangba Dake

Iotop Crashes When Not Run As Root

Welcome to another an-update-broke-me-box post. Iotop now requires root access:

:~$ iotop -o
Traceback (most recent call last):
File "/usr/bin/iotop", line 16, in <module>
main()
File "/usr/lib/pymodules/python2.6/iotop/netlink.py", line 229, in recv
raise err
OSError: Netlink error: Operation not permitted (1)

To fix it, run iotop as root:

sudo iotop -o

There’s a lively debate here between the iotop author, Guillaume Chazarain, and Linus Torvalds  on the pros and cons of requiring root access for throughput statistics. It’s another linux developer classic with Linus using words like abortion, castration, disaster, utter crap… makes for a few laughs if you can spare a couple of minutes.


by Odzangba at October 30, 2011 06:01 PM

October 18, 2011

Odzangba Dake

How To Download Flash Videos On Ubuntu 11.04

It seems Adobe is on a mission to make downloading Flash videos as difficult as possible for those of us used to grabbing them from /tmp. A few weeks ago, I noticed Flash videos were no longer being saved in the /tmp directory. Instead, they were being placed in the browser’s cache folder… minor inconvenience, life goes on. After a recent update however, the files  are no longer being saved in the cache folder. A quick

lsof | grep -i flash

gave me:

plugin-co 26044          o   17u      REG        8,1  2020248     393786 /tmp/FlashXXxaK1Jq (deleted)

You guessed it… there is no file called FlashXXxaK1Jq in the /tmp directory. I see what you did there Adobe, nice one. I’ll spare you most of the technical details but the output indicates that the file is somewhere in the /proc directory. Using the process id 26044 (the second field in the output of the lsof command), we can hunt down the file FlashXXxaK1Jq in the /proc directory. So:

cd /proc/26044/fd ; ls -l | grep FlashXXxaK1Jq

will give you something like:

lrwx------ 1 o o 64 2011-10-18 10:30 17 -> /tmp/FlashXXxaK1Jq (deleted)

So the flash video is named 17 and being symlinked in a sneaky manner to /tmp/FlashXXxaK1Jq (deleted). Now do something like:

cp 17 ~/Videos/funny-youtube-video.flv

and you’re done. Go back to your Videos folder and watch that cat playing the piano to your heart’s content.

And now, I must cover my tuchis so here goes… downloading copyrighted material may be illegal where you live.


by Odzangba at October 18, 2011 12:11 PM

May 15, 2011

Odzangba Dake

How To Ping NETBIOS Names On Ubuntu

I make heavy use of the ping utility on a daily basis and it absolutely galls me that Ubuntu cannot ping hostnames by default. I need to use the nmblookup utility to find the ip address of the machine I want to ping and then ping that ip address… primitive, silly, unnecessarily complex… I feel a rant about idiotic default settings and legal gymnastics surrounding the universe repository coming up so I’ll just get on with the post. :D

1) Back up and edit the /etc/nsswitch.conf file by copying and pasting the following commands:

sudo cp /etc/nsswitch.conf /etc/nsswitch.conf.original

gksu gedit /etc/nsswitch.conf

2) Add wins to the hosts directive:

hosts: files mdns4_minimal [NOTFOUND=return] wins dns mdns4

3) Install WINBIND:

sudo apt-get install winbind

4) Ping away. :)


by Odzangba at May 15, 2011 12:40 AM

May 14, 2011

Odzangba Dake

How To Restore GRUB On Ubuntu 11.04

Since version 9.10, Ubuntu uses the GRUB2 boot loader and manager on clean installs. This means my earlier post on how to restore GRUB will not work properly. To restore the boot loader on these versions of Ubuntu (and possibly any debian-based linux distribution that uses GRUB2), you need an Ubuntu 11.04 live disk. The 10.10 live disks will work too… any ubuntu live disk that uses GRUB2 will work. Fire up a terminal once the live disk finishes loading and enter the following commands:

I) Let’s find where Ubuntu is installed on your hard disk:

sudo fdisk -l

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2611 20972826 83 Linux
/dev/sda2 2612 60279 463218210 83 Linux
/dev/sda3 60280 60801 4192965 82 Linux swap / Solaris

My ubuntu partition is /dev/sda1 (it has the asterisk under Boot).

II) Armed with this information, mount the Ubuntu partition:

sudo mount /dev/sda1 /mnt

III) Install the GRUB2 boot loader:

sudo grub-install --root-directory=/mnt /dev/sda

That’s /dev/sda — the hard disk itself, not the ubuntu partition – /dev/sda1.

IV) Unmount the Ubuntu partition and restart the computer like so:

sudo umount /dev/sda1 ; sudo reboot

V) If you have more than one OS installed, re-detect OSes like so:

sudo update-grub

That’s it.


by Odzangba at May 14, 2011 11:37 PM

January 11, 2011

Odzangba Dake

Manage Multiple Computers With Synergy

It’s lightweight, cross-platform and allows me to share one keyboard and mouse among several networked computers…

Synergy Desktop

and it’s called Synergy. Visit the download page and grab the appropriate installers. Click here for instructions on how to configure your dekstops. Ubuntu users can avoid a text configuration file by installing a GUI configuration app like so:

sudo apt-get install quicksynergy

Have fun. :)


by Odzangba at January 11, 2011 05:02 PM

June 29, 2010

Kofi Boakye

I love my country

It had to take the on going world cup to really bring the fact home to me …but i really love my country, mother land and land of my birth , the black star of Africa…GHANA…GHANA (GH) totally rocks…Go Black Stars and make the whole Africa proud


by kdex at June 29, 2010 02:21 PM

April 24, 2010

Henry Addo

Google Maps Team Launched Driving Directions For Africa – Awesome

The Google maps team finally launched driving directions for Africa. This is something I have been waiting for, for sometime now. Finally its here. :-)

http://google-africa.blogspot.com/2010/04/google-maps-for-africa-gets-better.html

I like this part of the post about the launch.

So the next time you are in Ghana driving from Kotoka International Airport to Hotel Novotel in Victoria Borg, Accra or you just want to drive from Nairobi to Kampala, visit Google Maps and allow us to help you get to your destination.

Now no more clumsy directions, like we usually do here in Ghana, which goes like, Yeah, go left( its not far ), turn right, you will see a plantain seller at the corner, then go further down the street, there is a house painted black, by pass it and go further until you see a “shoe shine” sitting on the other side of the street. Ask around if anyone knows Mr. Pee Jay. He is popular. Once someone says yeah, I know Mr. Pee Jay, that means you are at the right neighbourhood. Then start looking for a house painted red with yellow gate and green walls. Oh gosh, this kind of directions gives me a migraine. By the time the direction is done, you’ve even forgotten where to start from.

To satisfy my curiosity. I tested the map direction. Work so well. I can see the direction form Kotoka Airport to Dansoman where I live. Super cool.

<iframe frameborder="0" height="350" marginheight="0" marginwidth="0" scrolling="no" src="http://maps.google.com/maps?f=d&amp;source=s_d&amp;saddr=Kotoka+International+Airport,+Ghana&amp;daddr=dansoman&amp;hl=en&amp;geocode=FcyEVQAdqm79_ynRLQlD3prfDzFhOXfPydunnw%3BFcOfVAAd4hL8_ymZshIbcZffDzHxJ_sF3dfU_w&amp;mra=ls&amp;sll=37.0625,-95.677068&amp;sspn=46.226656,93.076172&amp;ie=UTF8&amp;ll=5.576055,-0.20846&amp;spn=0.06027,0.0988&amp;output=embed" width="425"></iframe>
View Larger Map

Kudos to Google Maps team for bringing this to us. It will save some of us tons of time.

by Henry Addo at April 24, 2010 05:16 PM

March 16, 2010

Henry Addo

Away From Home

Kumasi road

Kumasi road

I got really tired of Accra because of the scorching sun and the unbearable humidity. So I decided to geek out at a different location and headed straight to Sunyani, Brong Ahafo. Also I have had this pending motorcycle trip to Sunyani for a while, so I decided to do it this time.

Me on the motorcycle

Me on the motorcycle

On Wednesday morning, I packed up my backpack, took my camera and G1 Android powered( courtesy Google Ghana ) phone and rode all the way from Accra to Sunyani. It was my longest motorcycle trip. The distance about is about 383.01 km (238.0 mi). Made few stops on the way for photos. I saw lots of accidents on the road, even saw a fresh accident, involving two vehicles, veered off the road into the bush. This got me a bit scared but I was so determined to get to my destination safely.

Linda Dor

Linda Dor

My first stop was at the famous Linda Dor restaurant on the Accra – Kumasi road. There, I rested for about 15 minutes, stretched , peed, jumped back onto the bike and headed straight to Nkwakwa. On the Nkwakwa road, I saw this huge mountain with masts on it. Caught my eyes so I decided to document it.

Nkwakwa

Nkwakwa

From Nkwakwa rode about half an hour to a fuel filling station to top up the tank. From there, I rode straight up to kumasi where I rode through Kejetia finding my way to the Sunyani road. I rested in Kumasi for about an hour, drinking and socializing with the local people I met at the bar. I also charged up my dead phones to get them back to function.

Kumasi

Kumasi

After resting in Kumasi, the second trip started. I rode into the night to Sunyani. I made it to Sunyani about 2 hours. On the road, I got high way night riding experience. Riding in the night wasn’t fun at all if you ask me. Vision wasn’t so clear ,so riding became extremely dangerous. There were lots of insects on the road. They got tricked by the headlights, thinking they have got a place to linker on but rather got busted on the helmet and the riding jacket. If you are very sensitive to slight pains, then night riding isn’t for you. You might scream and if you don’t take care, you might lose your balance.

Sunyani

I documented my trip on Google maps using My tracks to record the journey.

<iframe frameborder="0" height="350" marginheight="0" marginwidth="0" scrolling="no" src="http://maps.google.com.gh/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=102921804835279272593.000481dc319f531679fc2&amp;ll=7.262105,-2.214112&amp;spn=0.187385,0.233776&amp;output=embed" width="425"></iframe>
View Sunyani Trip in a larger map

The trip was a good one. Worth the effort and the money spent on the journey.  Sunyani’s weather was much bearable. It was a bit colder compared to Accra’s and I managed to touch base with a long time friend. She was really happy to see me after 3 years not seeing each other. The only issue I have in Sunyani was the poor connectivity but hey, better than nothing. I managed to get down at work. I’m going to do this again but a different location.

by Henry Addo at March 16, 2010 01:12 AM

November 16, 2009

George Gyau

Is been a long time

Is been like ages since i blogged. Is been crazy for me since i got back to Ghana, land of my birth. but i am finally in control and want to start blogging seriously. expect more now.

Currently moved this BLOG to http://www.egoleo.net


by egoleo at November 16, 2009 10:58 AM

November 12, 2009

Henry Addo

The Go Programming Language

Go The programming language

Go The programming language

It seems Google is doing everything under this sun. From search engine, mobile OS, browser, and other several products, now its the Go programming language. I can’t wait to see them reveal a teleport system, that way I don’t have to ride about 218km to get to the Western region.

Go is a system programming language  like C and C++ but with new features and eliminations of the short comings of C and C++.  Go is designed to be extremely fast and avoids some of the complexities in writing software( like C is :-) ). Its an open source project aiming to have a community to contribute to make it even more powerful.

It is optimized for massive scaling and for multi-core processors that handle many tasks in parallel. It has a strong focus on object oriented principles. The project looks bright. However, Francis McCabe who has been working on a programming language also called Go is seriously begging Google to change the name of their programming language Go. I wonder how such a big company couldn’t do their homework well.

by Henry Addo at November 12, 2009 07:24 AM

October 06, 2009

Kofi Boakye

The Global Village

If the world is now a global village, then I guess Aunt Araba can go and spy on what Mrs Obama is cooking for supper nd we the village elders sit and drink some pito with Osama and Gordon Brown while the German chancellor plays ampe with Sirleaf Johnson.Now where r the power chaskele boys , Mugabe and Wen Jiabao??

ah these boy paa !!

(Memoirs of a global village elder)


by kdex at October 06, 2009 02:19 PM

Karmic Kaola Goodness !!

Wow!!

Just spent over three hours downloading the Karmic Kaola beta  over a crappy wireless connection.

And I just got to shout “Wow!!”. Beta saf be this. Man, they really put some good work into this stuff.Little touches here and there . And I think my screen display just increased or something cuz there seems to be more space on the desktop. No kidding !! It is really worth the long wait , short fevered naps and the ever present angelically annoying mosquitoes buzzing and taking painful dives at my body…Karmic Kaola rocks , though there’s still more work to be done..And this time I hope to be part of it contributing my quota to it!!

Screenshot


by kdex at October 06, 2009 06:50 AM

September 19, 2009

Kofi Boakye

From Gnome to KDE and back again

First cut is the deepest as they say and its really

I tried KDE 4.3 over the week and I must admit they got some bling,bling. Wow!! Great work, guys and ladies.. The panel looked more spacious and the various effects and widgets/ plasmoids were just amazing !! And the preview effects in Dolphin were just over the top. (Top that if u can, Windows 7)

But then ,bam, without any warning stuff just started to mess up .First it was my Intel graphics cards not agreeing with compiz.(though KDE still looked good and handled ok without the bling,bling) Then KPackage Kit just made me boil with its interface. I mean, if I want to go through the list of available and installed software I d**n well want to see it all without typing keywords to get a list. sheesh!! Of course it just made me love Synaptic all the more)

Finally I just gave up and guiltily run back to Gnome. So simple!

Of course I’m waiting with huge anticipation for the final version of Karmic Kaola. Even the Alpha releases do show some serious improvements that  make me swell extra extra with pride at being a linux user. Go Karmic Kaola team!! All the best !!

After Karmic , I’m definitely gonna become a full time evangelist for Linux Usage in Ghana….


by kdex at September 19, 2009 10:05 PM

July 01, 2009

Kofi Boakye

Back Again !!

Hello World

Its sure been a while since i last posted on this blog.

However i’m back and this time i hope to put up new stuff everyday about what i’m currently doing .Hoping to start releasing some serious apps for the linux world soon.

Adios amigos


by kdex at July 01, 2009 05:47 PM

March 05, 2009

Kwasi Kwakwa

What else I’ve been watching

I started this post when I was talking about The Wire, I figured I’d put out a list of what else has been keeping my attention TV wise these days. Its late, but I already wrote most of it so I figured why not. I’m not really a huge TV person, never have been. I tend to time-shift my shows and then watch them when I’m not doing anything else, which usually ends up being late at night.

  • Battlestar Galactica: This has been one of my favourite television shows of the last few years and is now heading towards an ending. If you haven’t seen any of it, you should have. Its really, really good. Basically its a rimagining of on old science fiction show in which the human race is wiped out my a race of machines we’ve created and the survivors are forced to run for their lives while being hunted by the same machines. Along the way thugh it becomes a great meditation on the nature of humanity, morality, religion etc. Its science fiction at its upper end. I recommend highly.
  • Big Bang Theory: This I was determined not to like. Its a sitcom about a pair of socially awkward physicists and their friends. I pretty much expected that the writers would settle for the dumbest possible nerd stereotypes, add no real depth and screw the story up. Instead, they kept the stereotypes but managed to add enough depth and authenticity to make them real people. Interestingly enough, there are quire a few scientists I know who are followers of the show because of how well its written and the inside jokes it throws our way. Also recommended
  • The Unit: Dennis Haysbert shooting people and looking cool in the process. Need I say more? Its a bit on heavy handed in its stance at times,but its great pulp action and good acting. All things I’m partial to.

Other stuff I’m watching but not so keen on writing a short paragraph about, Mobile Suit Gundam 00 and  the new season of Hajime No Ippo (yes, I like anime. It doesn’t say geek up there because I couldn’t come up with another name)

I was also watching Dr. Who and Torchwood until both seasons ended. I’m really, really waiting for them to start back up again, even though they shall no longer be servicing my Freema Agyeman crush. Again, if you are a science fiction fan and not watching these, your loss. Majorly.


by kwasi at March 05, 2009 11:00 PM

March 04, 2009

Kwasi Kwakwa

In which the absentee host returns. Again

A very belated happy new year to you people. Apologies for the long absences. Again. At this point I’m pretty sure I’m down to just the people who forgot to remove me from their feed readers.

Quick Updates on what I’ve been up to:

I was officially awarded my Masters by Research in Physics. My parents and big sister were in town for my graduation and that will easily pass for my best day this year. Since then I’ve gotten accepted into a physics PhD program with the same advisor at the same university. 3 more years of this and I get to walk across a stage again in a gown with a hood on it and put ‘Doctor’ on my business cards.

On the Physical side. I persist with my judo and have now logged hundreds of hours of being thrown around, pinned, choked and armlocked. On good days I get to do the same to other people. In a little under 2 weeks I get to compete in the BUCS(British Universities and Colleges Sport) kyu grade competition. Hopefully all that work will end up in me getting a few good throws. Either way there will be pictures and maybe even video. At some point before I get the PhD I want to get my first dan(black belt)

Otherwise, I live in London, I study, I train, I hang out with friends, I still read too much, I watch the odd movie and life continues.

There’s a bit of a backlog of topics I was planning to write about but never got around to. Some will make it out in the coming weeks, some won’t. Either way, keep me in your readers people. If nothing else I need the touch typing practice


by kwasi at March 04, 2009 11:43 PM

November 05, 2008

Kwasi Kwakwa

HE WON!!!!!

The next first family of the USA

Yes, I stayed up all night to watch the results come in. I’m still not entirely sure it happened though.

We are officially living in interesting times people. Lets see how it goes


by kwasi at November 05, 2008 12:19 PM

November 03, 2008

Kwasi Kwakwa

*Hat tip*

H & H

H & H

Great race. And hopefully a good omen.


by kwasi at November 03, 2008 10:55 AM

October 15, 2008

Kwasi Kwakwa

Recent additions to the bookshelf

One of the advantages of this past year has been a commute from the south of London to the center of the city daily that meant I had between 1 1/2 and 2 hours sitting or standing while waiting to get where I was going. Sometimes that went to reading academic papers for my masters, but a lot of the time it went to recreational reading. Add that to the fact that I got a library card as soon as I could(making this the sixth city on the third continent where I have paid library fines) and I was able to get through quite a few books. Well, considering that I was in school at the time.

The highlight list includes:

That’s not a fully complete list, but those are most of the books I remember. Well, there’s also a bunch of classic science fiction books, but I’ll talk about those later


by kwasi at October 15, 2008 09:46 PM

September 08, 2008

George Gyau

How do I disable the ping response?

Usually a ping is used to check if a machine is up and to check the network status.

It is a small network packet sent to the machine. If the machine is up, an answer will be sent. The time needed to get the answer is called ping time or round-trip time.

The ping response from an IP indicates the machine is up.

Unfortunately this can be used to quickly scan an IP-range for reachable hosts.

This can be used to find potential hackable machines. If your machine doesn’t answer to pings, your chance to be seen is reduced. (That doesn’t mean your machine is more secure, the machine is just not that easy to be seen from the internet. Nothing more.)

Add the following line to your init script for the network (the name depends on the distribution you use):

echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all

This disables ping responses.

To reenable, use the following command:

echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_all

To make this permanent set the following into /etc/sysctl.conf (if you have such a file)

net.ipv4.conf.icmp_echo_ignore_all = 1


by egoleo at September 08, 2008 03:37 PM

Custom teaser length by View using node.tpl.php

I have been working on this project, www.newsafrican.com which is a news site which focuses on everything african news. This project is been built on the Drupal CMS which is very flexible arguably.

I got into a situation where i have to customise the teaser length by View which happens to be one of the Drupal modules using node.tpl.php.

One way to vary teaser lengths is to check the current View with a modified node.tpl.php modify the output based on this

In this example a teaser of length 75 or 150 will be shown for the Views “frontpage” and “ghana_page” respectively.

I worked on this for Drupal 5 with the help of the good guys in the drupal IRC rooms, my solution is below. But this is a solution for Drupal 6 by friends on the drupal-support channel of IRC.

<div class="node<?php print ($sticky) ? " sticky" : ""; ?>">
<?php if ($page == 0): ?>
<?php else: ?>
<?php print $picture ?>
<em class="info"><?php print $submitted ?></em>
<?php endif; ?>

<?php
global $current_view;
if(
$teaser) {
if(
$current_view->name == ‘frontpage’)
{
?>

<?php foreach ((array)$node->field_news_image as $item) { ?>
<div class=”field-item”><?php print $item['view'] ?></div>
<?php } ?>
<h2><a href=”<?php print $node_url ?>” title=”<?php print $title ?>“><?php print $title ?></a></h2>
<?php print $node->content['body']['#value'];
}

if($current_view->name == ‘ghana_page’)
{
?>
<?php foreach ((array)$node->field_news_image as $item) { ?>
<div class=”field-item”><?php print $item['view'] ?></div>
<?php } ?>
<h2><a href=”<?php print $node_url ?>” title=”<?php print $title ?>“><?php print $title ?></a></h2>
<?php print $node->content['body']['#value'];
}

if($current_view->name == ‘africa_page’)
{
?>
<?php foreach ((array)$node->field_news_image as $item) { ?>
<div class=”field-item”><?php print $item['view'] ?></div>
<?php } ?>
<h2><a href=”<?php print $node_url ?>” title=”<?php print $title ?>“><?php print $title ?></a></h2>
<?php print $node->content['body']['#value'];
}
if(
$current_view->name == ‘business_page’)
{
?>

<?php foreach ((array)$node->field_news_image as $item) { ?>
<div class=”field-item”><?php print $item['view'] ?></div>
<?php } ?>
<h2><a href=”<?php print $node_url ?>” title=”<?php print $title ?>“><?php print $title ?></a></h2>
<?php print $node->content['body']['#value'];
}

if($current_view->name == ‘gh1′ || $current_view->name == ‘gh2′)
{
?>
<?php foreach ((array)$node->field_news_image as $item) { ?>
<div class=”field-item”><?php print $item['view'] ?></div>
<?php } ?>
<h2><a href=”<?php print $node_url ?>” title=”<?php print $title ?>“><?php print $title ?></a></h2>
<?php print substr($node->content['body']['#value'], 0, 90). ‘&nbsp;’;
?>
<a href=”<?php print $node_url ?>” title=”read more”>read more</a><?php
}
} else {
print
$content;
}
?>


by egoleo at September 08, 2008 05:23 AM

September 02, 2008

George Gyau

S Leone president declares assets

President Ernest Bai Koroma has become the first head of state in Sierra Leone to declare his assets to the country’s Anti-Corruption Commission.

As i read this news item, i was wondering when all other African leaders will do follow this. Expecially in Ghana were there is been much talk about such a thing. We always here leaders saying i already had my money or wealth before i came to power.

Koroma, i hope this will not be a nine day wonder, but to go beyond that let things work in S-Leone.


by egoleo at September 02, 2008 05:11 AM

Google launches internet browser

Google is launching an open source web browser to compete with Internet Explorer and Firefox.

The browser is designed to be lightweight and fast, and to cope with the next generation of web applications that rely on graphics and multimedia.

Called Chrome, it will launch as a beta for Windows machines in 100 countries, with Mac and Linux versions to come.

“We realised… we needed to completely rethink the browser,” said Google’s Sundar Pichai in a blog post.

The new browser will help Google take advantage of developments it is pushing online in rich web applications that are challenging traditional desktop programs.

Just waiting to try it out. :)


by egoleo at September 02, 2008 05:00 AM

December 22, 2006

Lorenzo E. Danielsson

Sign this

I finally did the right thing by going here and signing Bruce Perens’ petition against the Novell-Microsoft deal which everybody is talking about. If you value the freedom to write and share software, please read up carefully on the implications of this deal and, if you feel that Novell’s deal with Microsoft is a threat to those freedoms, do sign the petition as well.


by lorenzod at December 22, 2006 09:04 AM

Seasonal greetings

Today is the last work day before the holidays so Happy Yule everybody.


by lorenzod at December 22, 2006 07:32 AM

December 21, 2006

Lorenzo E. Danielsson

Vad i helvete..?

Idiot!

Hur kan någon vara så genomkorkad? Jag är givetvis 100% emot dödstraff, men om det skulle bli infört hoppas jag att “författare” som David Anderson blir de första in i gaskammaren. Men lyckligtvis kommer inte dödstraffet tillbaka så jag rekommenderar instället tjära och fjädrar.

Så vilka brott skulle dödstraff utdömas för? “De allra grövsta brotten”. Terrorism är ett exemples som ges. Okej, det kan jag gå med på att det är ett grovt brott. Och i så fall borde vi omedelbart hänga två superterrorister, nämligen Busken och hans pudel, Tony B. Liar.

För övrigt anser Anderson att landsförräderi och högförädderi är grova brott för vilket dödstraff borde utdömas. Eh, ursäkta mig? Landsförräderi???? Det är ju så idiotiskt att jag saknar ord. När blev det ett grovt brott? Nu när jag kommer att tänka på det, när blev det ett brott över huvudtaget?

Förbannade idiot!


by lorenzod at December 21, 2006 07:57 AM

December 18, 2006

Lorenzo E. Danielsson

Hilarious

Yeah, yeah, so God hates Sweden, so what? Sweden hates God as well.


by lorenzod at December 18, 2006 08:39 AM

December 14, 2006

Lorenzo E. Danielsson

Regn export

Eftersom ni i Sverige har överskott på regn, kan ni inte skicka lite till oss? I Ghana är det hett och torrt. Lite regn skulle verkligen hjälpa.


by lorenzod at December 14, 2006 08:17 AM