It’s those little things

Bicycles are pretty important in my life. I ride one to work every day. Sometimes I ride my mountain-bike in the woods, or even in the mountains when money is less of an issue. And very occasionally, when I feel I have something unprovable to prove, and too much time to spare, I take out the BMX and try to hurt myself.

So, I know something about maintaining a bicycle - though mostly just enough to get myself into trouble - and while I don’t expect everyone else to know as much, there is one thing that absolutely everybody should know about bike maintenance and that is : you must lube your chain, preferable weekly, but at the utmost ultimate minimalistically very least, monthly.

There is lots of stuff you can use to lubricate your chain.

This :

Lube1

Or this :

Lube2

Or even this :

Lube3

( But not this :

Not lube for chains at all

)

And you can do it in several ways.

Like this :

Way1

Or like this :

Way2

Or even like this, and you don’t have to use the extension thingy :

Way3

And don’t bother with complicated stuff like wiping off the excess lube, like this :

Not Necessary

By lubing your chain you will :

  • Be able to use your chain longer
  • Ride more smoothly and efficiently
  • Not annoy me with a squeaking chain

To show how your efficiency improves with increased lubrication look at this graph :

Lubrications / Year vs Energy Saved

Yeah I know, you don’t have to tell me, this is indeed great stuff !

Add comment June 18, 2008

Watch Weeds Every Day

A couple of days ago, a friend lent us some DVD’s, among which the - to me at least - unknown tv show called Weeds.

I didn’t know what to expect from this, as the picture on the cover made it look like it was a show in the fashion of Grey’s Anatomy. Grey’s Anatomy has received rave reviews all over the place but it really wasn’t my cup of tea. So, not expecting too much I started watching DVD 1 of Season 1 of Weeds.

Man was I ever surprised. This show is really good. The characters, the dialogues, the plot, … everything first rate. And apparently, the show was shot using only one camera. Pretty amazing if you take the numerous angle switches into account.
It is marketed as a comedy and that’s basically what it is, but it’s also so much more.

Season One and Two are completely consumed, and it seems that there’s a season Three out on DVD, plus they’re already filming season Four.

So, next time you don’t know what to get your girlfriend for some present inducing occasion, get a couple of Weeds DVD boxes. Success guaranteed.

1 comment June 5, 2008

The market is flooded with mini laptops

Actually, the title should have been : The market is flooded with mini laptops, that you cannot buy.

There is no shortage of news entries about yet another manufacterer that has jumped on the mini laptop bandwagon. The bandwagon is so chock-full that the elderly and the children are falling off it, but still, none of those fancy new gizmo’s can be purchased here in Belgium. They haven’t shown up in any webshop I frequently check out, nor have I seen them offered by the large retailers in the city.

That’s too bad though. At their projected prices of about 300 to 400 euro, I would gladly pick one up. Especially because I don’t really need one.

Well, I bet if I finally see one, they will be larger or smaller than I would like, and they will cost about 600 euro. But that’s life I guess.

Acer

Dell

Asus

Add comment May 30, 2008

Daily DRY Tip

Today’s DRY tip gives up some to gain some.

Let’s look at the problem at hand :

class CArbitrary
{
  public:
   CArbitrary()
   : mv_Value( 0. )
   {}
  private:
    double  mv_Value ;
};

Have you spotted the DRY-violation?
It’s in this line : mv_Value( 0. )

The literal 0. is a double, and the member variable mv_Value is also a double. So, you’re repeating yourself, definitely a DRY-violation.

A solution to this problem is calling the default ctor of your member variable explicitly.

Like so :

class CArbitrary
{
  public:
   CArbitrary()
   : mv_Value()
   {}
  private:
    double  mv_Value ;
};

This does not feature a literal of type double, but does initialize the member to 0.
Now where did we give up DRY-ness?
Suppose our class was a template.

template
class CArbitrary
{
  public:
   CArbitrary()
   : mv_Value()
   {}
  private:
    at_ValType  mv_Value ;
};

We are now forced to call the default ctor of our member variable explicitly although C++ would call it automatically…for non-built-in types. And that’s the dilemma we’re facing. Not writing the member default ctor would make this template behave differently for built-in vs. custom types. But writing it also makes us repeat the name of our member variable, and we don’t like to repeat ourselves. One reason for not wanting to do this is in case you would add other member variables. You’d have to remember to also change the ctor to include the extra member default ctors.

template
class CArbitrary
{
  public:
   CArbitrary()
   : mv_Value()
   {
      // oops, mv_ExtraValue not initialized
      // if at_ValType == built-in type
   }
  private:
    at_ValType  mv_Value ;
    at_ValType  mv_ExtraValue ;
};

Add comment May 17, 2008

Daily DRY Tip

DRY stands for Don’t Repeat Yourself. A paradigm that is indispensible in software engineering.
Since I enjoy writing concisely more than going extra-elaborate, I will keep this post as concise as possible.

Example of code that is has not DRY’ed out completely :

class Classy
{
  public:
    static Classy Schmassy() ;

};

int main()
{
  Classy  obj = Classy::Schmassy() ;

  return 0 ;
}

What could be the darned problem with such a tiny crumble of code? The un-DRY’ness of this code can be found in the body of the main() function.

If we let some sun shine on it, it DRY’s out completely.

int main()
{
  Classy  obj = obj.Schmassy() ;

  return 0 ;
}

There you go, just one reference to the concrete type.

Add comment May 11, 2008

Mom, look at this

The game of solitaire is deceptively simple. Well, not so much deceptively as really. However, predicting whether you can go all the way turns out to be a different matter altogether.

Luckily for me, Solitaire gives a warning when you are out of moves. If it didn’t I’d still be staring at this hand.

I present you : The Close-But-No-Cigarest Game of Solitaire. Ever.

Add comment May 8, 2008

The “fix it/break it” button

Since short, I have a laptop. And that laptop now has an application that enables to break the laptop, or fix it again.

See, the thing is, we’re currently living at a kind of in-between-residence. Our new house is not yet finished, and we had to move out of our old house. Because this solution is only short term - about three months - I wasn’t planning on getting a cable internet connection. However, being without an internet connection for three months wasn’t an option either.

The solution to this rather critical problem has come in the form of a 3G modem that connects to the laptop over USB. So, now I can connect to the internet everywhere within the nation’s borders. Actually I can also connect to the internet abroad, but at 16 euro / MB I choose not to.

Below you can see a picture of the application with the “fix it/break it” button encircled in red. Note : its state at time the image was taken, makes it work as a “fix it” button. When pushed, it automagically turns into a “break it” button.

Add comment May 3, 2008

The universal velcro snafu

Not too many words need be spent on this problem, namely the universal velcro snafu.

Anybody who has ever used anything that uses velcro must have experienced this highly irritating problem.

This drawing says it all.

Velcro Problem

Add comment March 2, 2008

Superguid

For those of you who think, like me, that a regular GUID is for wimps and lUzer5, I have created something a lot better : the Superguid.

Not 128, but 256 bits of pure binary goodness, guaranteed to be 2^128 times as unique as a regular guid.

Some samples :

{09A9EE54-A605-4FD0-FE88-
CF44D37E4DC2-B246CA47-CD26-
4097-8F8D-6B61D521B364}

{F69D23E9-8852-4CE9-BAB0-
F19F730F2137-FC0C17EA-880A-
4B89-4EA9-37663121246B}

{F69D23E9-8852-4CE9-BAB0-
F19F730F2137-FC0C17EA-880A-
4B89-4EA9-37663121246B}

For those who are interested in creating their own superguids, you can find a Ruby script below to do just that.

require 'Win32API'@uuid_create = Win32API.new('rpcrt4', 'UuidCreate', 'P', 'L')

def raw_guid
result = ' ' * 16
@uuid_create.call(result)
result
end

def super_guid
result = raw_guid + raw_guid
d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16  = result.unpack('SSSSSSSSSSSSSSSS')
sprintf('{%04X%04X-%04X-%04X-%04X-%04X%04X%04X-%04X%04X-%04X-%04X-%04X-%04X%04X%04X}', d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16 )
end

print super_guid

Add comment March 1, 2008

A simple and fast permutation generator (7)

You know what’s weird? It was right in front of me, but I didn’t make the connection. If you look at part 4 of this series, you can see that the runtime order formula was : ~2,718281828 N!

Dude, 2,718281828… that’s e.
A colleague of mine had to point that out to me ( thanks xtofl ;) )

Pretty amazing to see that little magic number pop up in this subject. I mean, with the number pi , you can at least see that it has to do with a circle and its circumference, and that almost always explains how pi pops up in formulas. But with e, this is less clear. Less clear to me, that is. The average mathematician will probably think nothing of this result.

Hopefully more on this later, but I can guarantee absolutely nothing.
Any help here would also be greatly appreciated.

Add comment February 29, 2008

Previous Posts


Recent Posts

Categories