Posts filed under ‘Command Line’

So long, and thanks for all the phish

Oh so very recently I acquired an iPhone 3GS. My better half had gotten one for her 10th year working at her company – now that is what I call a gift – and as soon as I touched it, I was convinced. Convinced that I held the future of consumer computing. The iPhone can only be bought simlock-free in Belgium, which makes it too expensive for sure. But it’s also too cool, so you can see the dilemma I faced.

It’s almost two months since I got mine – the 16GB version – and I can most surely testify that our laptop is seldom used anymore. Mail, feeds, Facebook, browsing, reading ( Kindle for iPhone, best app ever ), music, maps, routes, text messages, photo’s, phone (duh) … it’s all right there in the palm of my hand. The only glaring omission is a banking app. That’s the main reason the laptop is still awoken from its sleep these days.

Using an iPhone is very different from using mouse and keyboard. It’s a much smoother experience. What I do have to say though, is that an iPhone generally does not lend itself to textual content creation. For example, while I used to think about blogging actively, because the laptop was always on anyway, I now discard most ideas because it would require booting the laptop.
This is not completely the iPhone’s fault however, although it has a very small keyboard, it’s just that the management interface of this blog is not adjusted to mobile devices.

Well anyway, most people don’t really get it that I seldom use the laptop anymore. Just as I wouldn’t have when someone would have told me this up-front.

Oh yeah, one last point, there is no need for any fear of malicious websites anymore. The evil codes have no idea what to do when faced with the iPhone platform.

May 7, 2010 at 6:42 pm Leave a comment

Less

There are very few rules in programming that are always right. Ever rule ends up losing a fight when it ends up in the wrong corner.

There is however one rule that seems to be always correct, in whatever code base it wanders into, and that rule is : less.

Because you see, less code is less prone to have bugs, because there is less of it.
Concise is also less than verbose, which means that if you go less you have a good chance of making yourself understood.
Less also tends to be faster because there is less to transfer and execute.
You are forced into writing better abstractions by writing less code, because you have less real estate to express semantics.
Redundancy is reduced by orders of magnitude when you try to have less code because redundancy is trivial to remove.
Less is easier to refactor, because you have to refactor less.

You could try to argue that less is just the result of striving for orthogonality, speed, clear code and zero bugs, and that I have it backwards. But you would argue wrong.

January 23, 2010 at 10:32 am Leave a comment

Nice Try G-men

OK, so Microsoft tries to launch something revolutionary – with Bing Visual Search, which isĀ  a nice idea but won’t alter the search landscape much -, and immediately Google tries to one-up the Redmond boys by making something out of their Beta stable accessible to the public.
The thing we are talking about is Google Fast Flip.

Now don’t get me wrong, I welcome new superfluous extravaganza on the web as much as the next guy, but why in heaven’s name would I want to use Fast Flip, when I already have a boatload of newsfeeds in Google Reader.
How is this Fast Flip any different from manually polling websites to see whether there is something new? I tried that once, it almost killed this whole internet thing completely for me. Well, sort of.

It looks nice, and is pretty fast, but either I seem to completely miss the point, or Google has finally made something which is utterly useless.

How many times do we have to repeat this – actually I have never ever said this, some other guy did, but not me – : the web is not printing on a screen.
If Fast Flip is a good idea, why not print hyperlinks in a newspaper and expect people to type them in their browser’s address window? Because a printed medium is not the web on paper.

This post could very well lead to a meganormous rant about the fact that people should use RSS – and by default Google Reader – to stay up-to-date, not visit websites time and time again
But it won’t. I’m saving that for another day. Although really, you should. Use RSS that is. And Google Reader. But not Fast Flip. Never that.

September 15, 2009 at 10:17 pm Leave a comment

Compile-Time Log2

While I was looking for a compile-time Log2 calculation for integer numbers, I couldn’t find anything simple and concise enough.

So I wrote something myself, putting all my trust in the good old compiler. This is what I came up with. It’s so simple that I cannot believe nobody came up with this before, but anyways, here it is :

//Description: a compile time truncated log2 for integer values
template< size_t ac_Val > struct CLog2
{
static const size_t result = CLog2< ac_Val / 2 >::result + 1 ;
};

template<> struct CLog2< 1 > { static const size_t result = 0 ; } ;

template<> struct CLog2< 0 > { } ; // undefined

Of course, the truncated Log2 is also the index of the highest set bit in an integer number.

July 4, 2009 at 11:13 am 3 comments

Deleting Files ( on Windows )

Shift + Delete = Bad
Delete = Good

Shift + Delete = False sense of empowerment
Delete = Wise approach to one’s own fallibility

Shift + Delete = Lost forever
Delete = Still there when you need it

Shift + Delete = Old Fool
Delete = Old Skool

Shift + Delete = Clever road to utter madness
Delete = Becoming one with the universe

The only thing you need to remember is :

like_this

not_like_this

April 3, 2009 at 6:57 pm 7 comments

Home Entertainment Schmamblings

Between the last article and this one I have been busy putting together our home entertainment system.

Since I like Visio, I made a diagram in Visio.

Home Entertainment Network

Home Entertainment Network

Interesting items in this setup :

  • Popcorn Hour media player
  • Western Digital MyBook NAS
  • DVB-T antenna

This setup does not include digital cable television. Currently we get a couple of real good stations through our antenna. So we get to see the news and several very good shows. This is more than enough for us for what tv is concerned.
We also use it for radio. The disadvantage is that your tv has to be on, because it contains DVB-T decoder.

The Popcorn Hour media player is the device that connects to all media that is not tv or radio : it streams off the MyBook NAS, internet stations and USB storage. It is also capable of acting as a server, but I do not have an internal drive for it yet. That internal drive is going to be a Compact Flash card with a CF to SATA converter module.
For two reasons : it’s fast, quiet and cool. Well, that’s three reasons. So three reasons then : fast, quiet, cool and cheap. Again, the four reasons for using a CF to SATA converter are : fast, quiet, cool, cheap and an almost fanatical devotion to the pope.

This is not the ultimate setup. There is no ultimate setup. Video format wars, hardware vs software dialectic, smaller and faster components, network technology advancements and Boxee are all things that make your setup quite crappy in regard to the ultimate setup. Which does not exist, but would currently be something like a mix between LinuxMCE, Boxee and Apple TV. All of this working flawlessy of course, playing every media format known to man.

The disadvantages of our current setup are :

  • Popcorn Hour does not have a movie or music jukebox built in
  • Popcorn Hour does not seem to play .mp4 files that my Lacie Cinema Premier did play. They play but there is no sound. And by playing them, the Philips Soundbar is audiophonically tilted, refusing to play any more sound.
  • .mkv files seem to work best for the Popcorn Hour. But alas they do not play well on the Vista laptop using either VLC or Mediaplayer, nor on the Aspire One using VLC. Apparently MPlayer would be the solution for the Aspire. One more media player removed from bliss.
  • There is no tv recording.
  • There are three remotes. This will be remedied in the future with a Logitech Harmony 885.

You could probably come up with a couple more disadvantages, but I’m quite happy with this setup. My main requirement was bridging the lean-forward pc media environment to the lean-back television world. Having the complete South Park collection at my fingertips sitting in a comfy sofa is a great feeling. A reward for all those years of neck- and backache inducing late night pc sessions.

Note : you could be thinking when reading this article that the all the devices in the network have access to the internet. But this is not so. Only the laptop currently has got an internet connection in the form of a USB modem using the GSM network. The real internet will be installed on March 10.

February 12, 2009 at 8:02 pm 5 comments

Home Entertainment Ramblings

A while ago we moved to our new house. At last we have the space and comfort we always wanted. And comfort is relative, since several parts of the house still need to be completed. But the essential things are there. Well the essential essential things at least.

One thing that we do already have is a new tv. I have searched high and low for the optimal television set. Plowed through endless lists of specs, prices and reviews. I also went to electronics shops to see for myself what the picture quality of some of these tv’s was really worth.

The result of the search was this tv :

I ordered it online, from Redcoon.be. Its price was unbeatable for this particular model. But do your own research before buying one, things move fast on the web. Just google for ‘<thing you want> price [|prix|prijs|preise]’.

The next thing on my list was a decent set of amplifier and speakers combo. I didn’t really care for a specific setup like 5.1, 6.1, 7.1, plain stereo, biamp stereo,… It just had to be something relatively cheap – which rules out high-end receivers and speakers – and decent sounding.

And the results of the groundbreaking jury ( that’s just me in fact, there’s no real jury, I just made that up for effect, but I soon realised that this lie would not hold for long, so I just thought it better to confess right away ) are :

This device uses a technology that creates surround sound using just one speaker cabinet. Of course you need the subwoofer for the lows as well. Two features, simplicity and compatibility, made this device stand out from all the others.
It has been ordered, but not yet delivered.

So now that we have the two main devices sorted, the question poses itself : what to hook up to them? How to have a big collection of movies, music and photographs that is accessible from anywhere in the house?

Do I use small specialized pc’s? Or dedicated devices?

Do I buy a media streaming client? And a server? Or do I set this up with an old pc featuring Ubuntu? Or should I look at media disk drives?

Will I switch to Apples’s iTunes/iPod/Apple TV?

Every setup has its drawbacks and imperfections. It looks as if with current technology you should be able to make a setup that is perfectly suited to your needs, but whatever you think of, there is always a catch.

And the truly terrible thing is : whatever you eventually install, you’ll always have that nagging feeling that you did it wrong.

Next time I’ll ramble some more about possible setups and their drawbacks.

And what the hell is up with these expensive HDMI cables anyway? Don’t people realise that a digital signal is mostly an all or nothing affair over such a short distance? Either you have bytes or you don’t. The bytes don’t care about gold or nickel, shielded or unshielded, expensive or cheap. This is more than adequate.

January 17, 2009 at 2:44 pm Leave a comment

Bright red links do not invite clicks

If you want your links to be clicked, I guess you shouldn’t color them bright red. To me, this color indicates danger or need for caution.

So, without even thinking too much about this, I skipped the links seen in the picture. Then again, why would someone put links on their site that are dangerous to click. But still, pick a friendly color like green or blue or maroon.

Red Links

Red Links

November 1, 2008 at 11:03 pm Leave a comment

You heard it here first

If you are into programming you may have come across the acronym YAGNI, which is used when you are doing stuff more out of geekiness than to provide a real added benefit. For instance your boss tells you to provide a driver to read data from .wav files and you set up a generic framework that allows you to hook-in all kinds of implementations : .mp3, .ogg, … . You think this is awesome, but after a couple of years the only driver the clients still really need is the .wav file driver, which you already have of course. So the framework turned out to be YAGNI.

However, there is an opposite of YAGNI, namely WANIFALT.

Suppose you would have written the .wav driver as a straightforward piece of code, not having the capability to easily integrate other formats. Then after a while, you’re told to provide support for .ogg files. And off you go, writing a completely separate non-orthogonal driver to support .ogg. And then you need to do the same for .mp3. As formats are added, the codebase’s complexity explodes. Finally, another developer, who can no longer bear to witness this, refactors the drivers into a generic framework, with different subclasses for different formats. Now that’s WANIFALT : We Already Needed It For A Long Time.

Of course, Murphy’s Law applied to these concepts makes sure that if you apply YAGNI, you will need to resort to WANIFALT eventually. And if you are thinking WANIFALT, it actually turns out to be YAGNI.

October 23, 2008 at 8:43 pm 1 comment

Daily DRY tip

Hello, back again with the daily, erm, monthly DRY tip.

Again, a short piece of C++ code.

if( bBool )
  a = some_constant ;
else
  b = some_constant ;

Auwch, such repeatingness is almost unbearable to even glance at.
To the rescue, our dear friend the ternary operator.

( bBool ? a : b ) = some_constant ;

The brackets are there so the ternary operator does not get confused and tries to evaluate b = some_constant as one of the parts of the ternary expression.

September 17, 2008 at 7:30 pm Leave a comment

Older Posts


Categories