Stack Exchange Challenge

My new hobby: the great Stack Exchange sites.

In the 90’s most of my questions on software development were either answered by friends and family, trial and error, or books. I’ve always loved reading books on this topic. Most of my books have some particular animal on the cover, from the company with a man on a mission. In addition to books, the new millenium lured me to the Google Groups on C#. It seems at the time of writing this only a “new” Google Groups exists, which is a good thing: even though I enjoyed reading and posting there very much, the spam drove me (and many others) away.

Of course, just Google Search remained a very decent source for answers to development questions. In recent years, the search results have slowly started to point to one particular site: Stack Overflow. The various interesting sister sites quickly grabbed my attention.

I can highly recommend looking at the sites they have, and joining some of the discussions. Overall, the communities seemed very friendly to me as long as you put effort and thought in your questions and answers. Personally, I’m seriously considering to set myself up for a challenge and investigate one site a time, with perhaps a blog post on my findings. Now where shall I begin?

Shredder

Shredder, nemesis of the TMNT!
Shredder, nemesis of the TMNT!

Trading my three year old PC for a bottle of whisky (or is it whiskey?) to a friend seems like a great deal. With several work-related files left on my computer, it felt like a great opportunity to try out a shredding tool. So I figured I’d just Google for the popular choice and try it out.

Then I got submerged in a whirlpool of information. Some folks linked to “non geek perspectives”, for example this article on 4 file shredder tools. Others gave walls of text on the technical details. I was in fact hoping to find some article on the Dutch hardware.info site on this topic. In the end the Stack Exchange site for “power users” gave me the most info through a dedicated file-shredding-tag.

And there, finally: a great list of shredding options! Options all around: bootable CDs, hidden Windows 7 tools, as well as a  great post on Scott Hanselman’s blog. For some reason one of the answers with almost the least amount of answers caught my attention.

So I downloaded a bootable ISO of Ubuntu and fired it up. First I tried the “basic” suggestion:

The terminal screen just sat there, with a blinking caret. Apparently I’d entered a staring contest. After some time I decided to hit the enter key a few times in the console: the caret moved. After a minute of pondering I tried CTRL+C: and the operation got cancelled. I’d lost the staring competition, that’s for sure.

Now, this staring contest had taken about one hour. So I decided to try the second suggestion:

No dice. Utterly confising console error messages. Since I’m mot quite a Linux guru like these guys, I did some more searching around. Finally I found some more detailed instructions on hdparm. First I had to unfreeze my drive, and I had to set a password (though I don’t quite grasp why). Then the moment of truth…

Ever since I’ve been in yet another staring contest with Ubuntu. Only this time I’m gonna win, or die trying!


Update: after over two hours the staring contest is over… and won! The console returns to normal. At first, it seems Ubuntu can still browse the drives. But, after a reboot, there is not a single file, folder or partition to be found anymore!

CSS first-letter drop caps

A little while ago this interesting Stack Overflow question caught my attention. The question is about drop caps: a typographical gimmick where the first letter of a paragraph is very big and prominent. In older texts this could be even more than “prominent”, for example this page from an old Dutch Bible:

Drop caps in an old Dutch Bible
Drop caps in an old Dutch Bible

Of course, the CSS pseudo-selector :first-letter seems perfect to achieve this effect on the web. The question on Stack Overflow used that as a starting point, and is about a particular situation where IE wouldn’t render correctly. While trying to find a solution to that particular problem I found out things were not so simple, and posted this answer. The answer basically came down to “no way to get it right in all browsers”. With rather “standard” CSS rules, various browsers gave varying results:

Rendering of drop caps in various browsers
Various browsers render drop caps differently

Not very satisfying at all! After thinking about this some more, I decided to try and at least get a “minimal” example of drop caps working in all current browsers. To keep things “minimal” my first try will:

  • Not bother with padding for now (just set them all at zero);
  • Not bother (yet) with browsers <IE9;
  • Stick to the basic 26 characters from the latin alphabet;
  • Stick with uppercase versions of those characters.

It took some time, but I did come up with decent results. You can show the example html file on my blog, or view it as a jsfiddle. The example contains a reset style and some coloring so you can see the results clearly. However, the nitty gritty is in this bit of CSS:

This actually gives acceptable and mostly consistent results. Here’s a screenshot of how this renders in up to date versions of my browsers (all on Windows 7):

Drop caps experiment in IE9
IE9
Drop caps experiment in Chrome
Google Chrome
Drop caps experiment in Opera
Opera
Drop caps experiment in Firefox
Firefox

Great! However, one browser is still not playing nice. No, not everyone’s “favorite” browser IE is acting weird, but Firefox is! Have a closer look at the left (:first-letter) rendering in Firefox: the height of the drop cap isn’t what we want it to be. However, some searching on Google leads to a related Stack Overflow question as well as this question, ultimately leading me to a bug from 2007 in Firefox. Guess it can’t be done easily then.

End of the road? Perhaps. But perhaps also a great opportunity to try and create a jQuery plugin that creates drop caps…

Eye love you

At work I spend most of my time looking at a computer screen. At home I also spend most of my time looking at a computer screen. Basically: I spend a lot of time looking at a computer screen. Recently I’ve been looking for ways to make this as pleasant as possible. So far I’ve come up with the following:

  • I’ve installed bias lighting after reading this.
  • From the same article I found out Windows 7 has a built-in screen setup procedure in the media center app (it turns out LCD factory settings are on “eye scorching brightness”).
  • Work in progress: getting a new set of hi-res screens at work. See point 9 on The Joel Test.
  • Changing my monospace font to one in this top 10 list. Courier New is apparently almost as bad as Comic Sans.
  • I’m also experimenting with inverted color schemes for my programming tools: C# and JavaScript disguised as Ruby!

In the next few months there will be more changes to my setup, most likely. First up would be a second LCD, although I can’t seem to decide if I want the exact same monitor twice, or perhaps a different one next to my HD one. Either way, so far these changes were more than welcome: can’t imagine how I got along without them.

Interested? Go for it! Show your eyes some love!

Programming music

Lying is useless: I’m addicted… to music. Just about whatever I do, I will have music in the background. Especially when I’m working on the computer: programming, photo-shopping, video-editing, gaming all require music.

Different activities and varying times of day require different types of music for me. Luckily, I enjoy just about all kinds of music. The growing popularity of Spotify has driven both di.fm and last.fm radio from my favorites, and allows me to pick just about anything I want to hear.

This brings us back to the topic of this post then (hope no-one was expecting a guide on how to program music on some device), music for programming duties! I realized I put on certain types of music whenever I’m in a certain type of zone. So here’s a go at my music choice per programming task.

Task Music Genre
Creating C# interfaces, designing server side code Dubstep or Classical Music
C# code (or any server side code, for that matter) Any album that’s very familiar, e.g. Homework
Database design & SQL queries (SELECTs) Electro, Hardstyle, or even some old Gabber tunes
SQL UPDATEs and DELETEs Ambient or downbeat
CSS and HTML (skinning and the like) 90s dance or dirty house
Debugging a difficult problem Classical music or Gregorian chants
Creating wireframes More dubstep
Excel formulas and VBA macros Death Metal or Industrial Powernoise
Footnote: recently ghettofunk has been a great fallback for any programming task. Stickybuds!

Hopefully I’ll be able to look back at this post some time in the future and create an updated overview. Perhaps this will even inspire someone to up a music-programming cross table of their own. If you do: let me know!

Re-discovering JavaScript

Around 1995 I started creating web pages. HTML was my friend, and analogous to the story of Adam and Eve, a companion called CSS was created. I considered HTML to be the robust male of the relationship, and CSS giving the beautiful female touch to my web pages.

Then Darkness came.

A brand new player invaded my perfect little web world and tried to make it into a love triangle. Enter JavaScript. At first this new technique looked awesome to me. I knew Turbo C++ 3.0  (with a nice DOS look and feel) as well as Visual Basic, and was eager to add some dynamic features to my web pages.

Oh how I underestimated the complexity. I knew no patterns, none of my code had ever been reviewed by others, and I tried to figure out everything with trial and error. Plus: I didn’t understand the DOM at all. So I ended up writing stuff like this:

The above snippet must have cost me a week to figure out. I was so frustrated I wanted to ban JavaScript from my pages as much as possible, which is exactly what I did when I learned to use Perl to add dynamic features to web sites.

More than a decade passed, but Darkness was still looming. I tried to stay in the Light with my happy couple HTML and CSS (only tolerating incidental guest appearances by JavaScript). I even turned to WinForms programming in .NET so I wouldn’t have to face the Darkness.

But then my ASP.NET days came, and it turned out: JavaScript was here to stay. However, my second encounter with JavaScript was mediated by jQuery, which had powers rivaling those of Dr. Phil himself. That library makes JavaScript feel like the love child of HTML and CSS, with a dynamic twist.

And so, JavaScript is getting a second chance. Any leftover JavaScript frustrations were explained in this presentation: I started to use JavaScript without ever learning it. So I picked up the corresponding book by Douglas Crockford, which shall be followed by The Definitive Guide. Hopefully this will allow me to Learn to Stop Worrying and Love the Bomb.


Foot note: at the time of writing, the piece of JavaScript code in this post is still running in production, in a Web Shop created in the 90’s, using Perl 5, HTML4, CSS2, and a hint of JavaScript…

Content is King

After having several months of fun with various Social Media, I found Twitter to be the best one for me. Took me a while before I understood why. It’s the quick fire-and-forget blogging “flavor” that I enjoy. Not only is it fun to fire some thoughts onto the web myself, but also to see other people’s thoughts, jokes, and other random goodness.

At the same time I was trying out Twitter I also took up a blogging project, using my World of Warcraft addiction to generate content. Because it’s true:

Content is king!

So after finishing that blogging project with my final episode (an Interactive Youtube Adventure), I sort of landed in a void. Without any more content: what was I to blog about? Besides: who’d want to read what I have to say?

The answer is: who cares!? You can also just blog for your own pleasure (or to overcome your fear of writing). So that’s exactly what I’ll do!