How to make a MacBook Kensington Lock Adapter
Apple, in its infinite wisdom, has not included a Kensington lock
slot in the current model of the MacBook Pro computer.
Given the computer's price, desirability, and
the fact that three people I know have had theirs stolen,
I decided to build an improvised adapter that would allow me
attach a Kensington lock to the computer.
I realize, that the security offered by such a contraption is what
calls an "advisory lock",
for Kensington locks can be easily picked or pried away.
However, I think it might deter a casual thief who would
snatch the laptop you've left unattended for a couple
Continue reading "How to make a MacBook Kensington Lock Adapter"
Ten Lessons I Learned from Fixing my Laptop's Motherboard
A month ago I managed to break my laptop, by reversing the polarity of
a universal power supply.
The repair shop diagnosed the problem as a failed motherboard,
and asked for €659 to replace it.
I found the price preposterous and the notion of throwing away a motherboard
for a single failed component ecologically unsound.
Here is how I fixed the laptop on my own, and what I learned in the process.
Continue reading "Ten Lessons I Learned from Fixing my Laptop's Motherboard"
Batch Files as Shell Scripts Revisited
Four years ago I wrote
about a method that could be used to have the Unix Bourne shell interpret
Windows batch files.
I'm using this trick a lot, because programming using the Windows/DOS
batch files facilities is decidedly painful, whereas the Bourne
shell remains a classy programming environment.
There are still many cases where the style of Unix shell programming
outshines and outperforms even modern scripting languages.
Continue reading "Batch Files as Shell Scripts Revisited"
Useful Polyglot Code
Four years ago I blogged about an
incantation that would allow the Windows command interpreter (cmd) to execute
Unix shell scripts written inside plain batch files.
Time for an update.
Continue reading "Useful Polyglot Code"
HP-200LX Remote Control Hacks
All my friends know that for the past 15 years I've been semi-attached
(recently updated to a 200LX)
for my personal information management and many other tasks.
The device is extremely versatile, sturdy, and flexible.
Amazingly, after so many years of hard daily use, I still find new
applications for it.
Continue reading "HP-200LX Remote Control Hacks"
How to Create a Self-Referential Tweet
Yesterday Mark Reid
create a self-referential tweet (one that links to itself).
clarified that the
tweet should contain in its text its own identifier
(the number after "/status/" bit should be its own URL).
I decided to take up the challenge
("in order to learn a bit about the Twitter API" was my excuse),
and a few hours later I won the game by posting the first
Here is how I did it.
Continue reading "How to Create a Self-Referential Tweet"
Earth Hour: A Geek's View
What happens to the power grid when millions of people turn of their
I had a chance to study this during tonight's
event organised by the
which asks households and businesses to turn off
their non-essential lights and electrical appliances for one hour to raise
awareness towards the need to take action on climate change.
Continue reading "Earth Hour: A Geek's View"
Visualizing Revision Logs with a UML Sequence Diagram
How can you visualize the developers' contributions in a collaborative
One way involves drawing timelines adorned with marks indicating
each developer's contribution.
This is a simple UML sequence diagram,
a diagram that allows you to see the interactions of objects,
but in this case the objects are the actual developers and the
interactions are their contributions.
Continue reading "Visualizing Revision Logs with a UML Sequence Diagram"
Palindromic Palindrome Checking
Stan Kelly-Bootle's column in the April 2007
ACM Queue, titled
Ode or Code? — Programmers Be Mused!,
was as always very enjoyable.
However, I found its ending,
a C function that returns true when given a palindromic string
(e.g. ABCCBA), anticlimactic.
The function given is recursive; I was expecting it to be palindromic.
How difficult can it be to write such a function?
Continue reading "Palindromic Palindrome Checking"
The Power of Reusable GUI Elements
One can manipulate any graphical element of the
Squeak environment by bringing up
a rectangular set of icons representing actions that one can perform
on any object.
At first I found it cumbersome to have to go through the halo
in order to perform any action, like recoloring an object or
changing its name.
Later I saw that this method is incredibly powerful.
Continue reading "The Power of Reusable GUI Elements"
(Not) Hacking the Digipass Go 3 OTP Dongle
My bank moved to two factor authentication solution, and thus required me to purchase
from them a Digipass Go 3 dongle in order to authenticate my transactions.
To register my dongle I keyed-in a five-digit code they gave me,
and also the key's serial number appearing on its back.
Given that Go 3 utilizes an
open authentication framework,
and a published algorithm
for generating the one time password (OTP), could I utilize the key and the
numbers I keyed in, for using the key in my own applications, of for cloning
the dongle in my mobile phone or palmtop?
Continue reading "(Not) Hacking the Digipass Go 3 OTP Dongle"
White Noise Calms Babies
A week ago I told my colleague
that drying the body of a newborn baby with a hair drier keeps
it consistently dry avoiding rashes, and also calms the baby down.
Today he told me the advice worked wonders.
Many parents have discovered that sources of white noise, like the sound
of a vacuum cleaner or a hair drier, seem to calm down a baby's
Continue reading "White Noise Calms Babies"
Converting RIS to BibTeX
Digital libraries increasingly provide an option to export bibliographic
Unfortunately, many, like
don't support the BibTeX format I use for storing
(To its credit the
ACM Portal offers a BibTeX
On the other hand, Elsevier's
JSTOR don't offer
any export facility.)
Continue reading "Converting RIS to BibTeX"
Web Page Hits, Amazon.com's Sales Rank, and Actual Sales
Over the past three years I've been collecting the
amazon.com Sales Rank for my book
Code Reading: The Open Source Perspective,
and (lately) also for its sequel
Code Quality: The Open Source Perspective.
Yesterday I mapped the sales rank to actual sales, and correlated those
with significant events and hits on the book's web page.
Continue reading "Web Page Hits, Amazon.com's Sales Rank, and Actual Sales"
Batch Files as Shell Scripts
Although the Unix Bourne shell offers a superb environment for combining
existing commands into sophisticated programs, using a Unix shell
as an interactive command environment under Windows can be painful.
Continue reading "Batch Files as Shell Scripts"
A General-Purpose Swap Macro
A couple of days ago I came up with a general-purpose macro for swapping
values in C programs.
My colleague Panagiotis Louridas suggested an improvement, and
this prompted me to see the two macros got compiled.
Continue reading "A General-Purpose Swap Macro"
How to Sort Three Numbers
Quick: how do you sort three numbers in ascending order?
Continue reading "How to Sort Three Numbers"
Supporting Java's Foreach Construct
Java 1.5 supports a new
construct for iterating over collections.
The construct can be used on arrays and on all classes in Java's Collection
I searched the internet for an example on how to make my own
classes iterable with this construct, but could not find an example.
Continue reading "Supporting Java's Foreach Construct"
Solving Singh's Substitution Cipher
Many of us enjoy playing with encryption algorithms.
Simon Singh, before a book promotion trip to Greece,
published a "substitution cipher with a twist".
I would consider solving a substitution cipher aimed
at the general public unfair, but the "twist" made me curious.
Continue reading "Solving Singh's Substitution Cipher"
A Pipe Namespace in the Portal Filesystem
The portal filesystem allows a daemon running as a userland program
to pass descriptors to processes that open files belonging to its
It has been part of the *BSD operating systems since 4.4 BSD.
I recently added a pipe namespace to its FreeBSD implementation.
This allows us to
perform scatter gather operations without using temporary files,
create non-linear pipelines, and
implement file views using symbolic links.
Continue reading "A Pipe Namespace in the Portal Filesystem"
Macro-based Substitutions in Source Code
A friends asks:
"How can one easily replace a method call (which can contain
arguments with brackets in its invocation code) with a simple
Continue reading "Macro-based Substitutions in Source Code"
Measuring the Effect of Shared Objects
For the Code Quality
book I am writing I wanted to measure the memory savings of
On a lightly loaded web server these amounted to 80MB,
on a more heavilly loaded shell access machine these ammounted
Continue reading "Measuring the Effect of Shared Objects"
Digital Data Makes Anything Possible
Once data becomes digital anything and everything becomes possible.
Consider arranging the books on your bookshelf by the color of
Continue reading "Digital Data Makes Anything Possible"
Binary File Similarity Checking
How can one determine whether two binary files
(for example, executable images) are somehow similar?
I started writing a program to perform this task.
Such a program could be useful for determing
whether a vendor had included GNU
Public License (GPL)
code in a propriatary product, violating the GPL license.
After writing about 20 lines, I realized that I needed an accurate
definition of similarity than the vague
"the two files contain a number of identical subsequences"
I had in mind.
Continue reading "Binary File Similarity Checking"
A Unix-based Logic Analyzer
A circuit I was designing was behaving in unexpected ways:
the output of a wireless serial receiver based on Infineon's TDA5200
was refusing to drive an LS TTL load.
To debug the problem I needed an oscilloscope or a logic analyzer,
but I had none.
I searched the web and located
software to convert the PC's parallel port to a logic analyzer.
I downloaded the 900K program, but that was not the end.
Unfortunately the design of Windows 2000 does not allow direct access
to the I/O ports, so I also downloaded
a parallel port device driver and a program to give the appropriate privileges to other
Finally, I also downloaded from a third site the Borland runtime libraries
required by the logic analyzer.
Needless to say that the combination refused to work.
Continue reading "A Unix-based Logic Analyzer"