Can haz layout

Contains IE Hack This weekend I decided to deep dive in a StackOverflow question on the combination of pseudo-elements and the IE8 (and lower) filters. Even though it seemed to me the question couldn’t be answered with 100% certainty, I still gave it a shot. A similar but better answer got accepted (damn you, “ScottS”!!), but that’s besides the point. The most important thing I learned from answering this question, is understanding the magic in IE (especially version 8 and below). So, for reference, here are the important links of articles that made me understand IE a bit better:

The kicker from all this research is that I now finally understand this remotely related line of CSS I’ve seen (and even used) a lot:

This is a CSS hack to get some versions of IE to behave nicely. So far, nothing new. However, after reading the above articles, I finally understand what it does: it  forces the hidden IE property hasLayout to true. And that’s useful for quite a few cases where you’d expect things to have layout, but when they don’t by default.

Hack or not, I’m glad I understand things a wee bit more now.

Episode 3: Gaming Stack Exchange Challenge

Space invaders wall painting
Space invaders wall painting

It’s been a while since my previous post: Episode 2 in my Stack Exchange Challenge, on Programming. Work, a new table-top RPG experiment, a Twitter vs Voice Recognition experiment, some playing around with MVC 3, and a big-ass painting on our living room wall (see pica) were all keeping me from writing on my blog.

In addition, even though I’ve been mildly active on various SE sites, I didn’t have a real drive to dive deeply into one of them. However, I did experience one peculiar effect of the SE engine last month: you can earn badges while not being very active on a site anymore.

One of the sites stood out the most, awarding me a gold badge for asking a (now apparently) famous question. And that’s as good a trigger as any to grab some more writing experience, et voila: a blog post on Gaming.StackExchange!

Current Statistics

Again, like last two reviews, some of the current facts for the site:

Fact Gaming.SE
Questions 18,629
Questions with no upvoted answers 845 (4.54%)
FAQ (questions with most links) 4,573
Top 3 questions 156 votes, 130 votes, 112 votes
Questions active last hour 8
All-time rep for top 3 users 75.6k, 34.6k, 31.6k
Meta questions 1,240

With 18k questions about as big as Programming, examined in my previous blog post.

Gaming.StackExchange logo
Gaming Stack Exchange

My Questions

At the time I write this I’ve asked a measly three questions. In my previous blogpost on Programming what held me back in asking questions was that I found it hard to ask “good subjective questions”. On Gaming there’s no such barrier, and as you can see in the FAQ they go for a totally different kind of questions here. What held me back in this case is just that on most games (the ones I play, at least) there’s already a ton of information to be found through Google search engines, rendering it useless to ask it again on SE. Of the three questions, these two were most interesting:

My Answers

Wups! Bad, bad community member. I haven’t written any answer yet. I came close once though.

Interesting Questions

Although I guess what gaming-questions are interesting depend heavily on what games you like, there are some questions that stand out if you have a look at the top questions:

Community Wiki

Not too many fun questions in this category at first sight, besides perhaps the Starcraft 2 skill improvement question.

Conclusion

The site is great for browsing through occasionally. It’s probably more fun if you go with the hype and by AAA titles the moment they come out. Surely the site will be flooded with Diablo 3 questions soon. Not intending to play D3 that will probably chase me away though, but perhaps that will push me to another SE site for my next SE challenge?

Episode 2: Programming Stack Exchange Challenge

Programmers Stack Exchange
Programmers Stack Exchange

Last week I wrote a post about CSS naming conventions, while trying to start up my review of the Programmers Stack Exchange site. Writing the question got me all excited about the wonderful answers and insights I was about to gain. Unfortunately my question fell to the 2nd page of the site quite quickly, with a meager one upvote, and one (though well-written) unsatisfactory answer.

For a week I debated whether to skip Programmers and review a different site, but today this problem struck me as an opportunity! This is a great way to test the bounty system. So I decided to put 100 of my current 106 reputation up for a bounty, looking for any answer that can provide me with something more solid than the “personal-preference” argument.

While waiting and frantically F5-refreshing the question I have some time to write about the site. One fun side-effect from the reputation system already became clear though: I can’t upvote any answers on the site anymore, because the 100 rep bounty I gave up dropped me below the 15 rep threshold you need to pass to be able to upvote things.

Current Statistics

Just like last review, first we dig up the current facts for this site:

Fact Programmers.SE
Questions 17,311
Questions with no upvoted answers 225 (1.30%)
FAQ (questions with most links) 4,241
Top 3 questions 313 votes, 275 votes, 275 votes
Questions active last hour 10
All-time rep for top 3 users 37.4k, 34.7k, 31.1k
Meta questions 1,004

Bigger than Cooking SE, but still quite the “little brother” to Stack Overflow.

My Questions

Next up, my questions. Even though I often have questions that feel like a great fit for Programmers SE, once I’m halfway writing them I tend to delete them again. The reason is simple: even though the “good subjective” kind of questions are the bread and butter of Programmers SE, I’m probably too exact to ask a subjective question. However, the one question that got this post rolling is still worth noting:

My Answers

Like many people I have a certain mental threshold before I post anything on a public site like Stack Overflow. However, I was determined to overcome or ignore the threshold for the Stack Exchange Challenge. Nonetheless, at the time of writing this, I came up with zero answers.

Perhaps in the future I will answer a question or two (heck, I may even answer my own question), but until then, this section is shamefully empty…

Interesting questions

Now this is the good part of Programmers Stack Exchange. Although often subjective or even “whiny”, there are quite a few questions that are interesting or plain fun to read! Some questions i enjoyed:

Community Wiki

Some fun ones on this site:

Conclusion

This particular Stack Exchange is a fun site. It’s a fine line though between subjectivity and questions following the “good” Q&A format. This fine line will probably keep me from becoming a regular poster. However, I can highly recommend the level of interaction I’ve currently settled on: follow them on Twitter for the occasional fun-to-read question that pops by.

CSS syntax naming conventions

My next Stack Exchange Challenge post will most likely be about the Programmers SE. One part of the challenge is to actually ask a question I have on the topic. The question I came up with (to be honest, this has been bothering me for months now) took quite some time to write down carefully. So, as I don’t have my next SE Challenge post ready yet, I decided to cross-post my question here on my blog as well.

The Question: what are the practical considerations for the syntax in class and id values?

Note that I’m not asking about the semantics, i.e. the actual words that are being used, as for example described in this blogpost. There are a lot of resources on that side of naming conventions already, in fact obscuring my search for practical information on the various syntactical bits: casing, use of interpunction (specifically the - dash), specific characters to use or avoid, etc.

To sum up the reasons I’m asking this question:

  • The naming restrictions on id and class don’t naturally lead to any conventions
  • The abundance of resources on the semantic side of naming conventions obscure searches on the syntactic considerations
  • I couldn’t find any authorative source on this
  • There wasn’t any question on SE Programmers yet on this topic

Some of the conventions I’ve considered using:

CSS naming conventions
CSS naming conventions
  1. UpperCamelCase, mainly as a cross-over habit from server side coding
  2. lowerCamelCase, for consistency with JavaScript naming conventions
  3. css-style-classes, which is consistent with naming of css properties (but can be annoying when Ctrl+Shift+ArrowKey selection of text)
  4. with_under_scores, which I personally haven’t seen used much
  5. alllowercase, simple to remember but can be hard to read for longer names
  6. UPPERCASEFTW, as a great way to annoy your fellow programmers (perhaps combined with option 4 for readability)

And probably I’ve left out some important options or combinations as well. So: what considerations are there for naming conventions, and to which convention do they lead?

Episode 1: Cooking Stack Exchange Challenge

Cooking Stack Exchange
Cooking Stack Exchange

Last week I announced the little Stack Exchange Challenge that I’d designed for myself. In this post I will be doing the first episode, featuring the Cooking Stack Exchangesite. This post should be the first in a series. I’ll try to stick to a format, though it may evolve a little over the episodes.

Important note: in all cases, I try to go through the site and actually contribute as a well-behaved member of the community. I’d love to be able to ask questions, answer some, and will up and downvote if it seems appropriate; but only if it is appropriate! Afterwards, I’ll summarize:

  • The questions I may have asked.
  • The answers I may have given.
  • Some questions that I found interesting and subsequently upvoted.
  • Noteworthy “community wiki” questions and answers.
  • A conclusion.

So, let’s move on to the Cooking site.

Current Statistics

First up, the current “fun facts” for this particular sub-site:

Fact Cooking.SE
Questions 5,336
Questions with no upvoted answers 56 (1.05%)
FAQ (questions with most links) 1,617
Top 3 questions 134 votes, 72 votes, 59 votes
Questions active last hour 3
All-time rep for top 3 users 27.6k, 23.4k, 19.1k
Meta questions 386

Not the biggest SE site, but still a decent volume of knowledge.

Photo's for the dishwasher-fish-recipe
Photo’s for the dishwasher-fish-recipe

My Questions

To be honest, my choice to do Cooking SE for the first episode was because I wanted to answer a particular question. When I wanted to do so it turned out that I needed to have earned at least 10 rep before I was even allowed to answer that question. Not to worry though, there were two actual questions I still had from my own cooking experiments in the past few weeks, so I came up with these:

My Answers

This section was the reason I picked Cooking SE first: I was very eager to provide an answer with empirical evidence for one particular question:

My wife and I were laughing uncontrollably when it turned out the experiment was successful. It was extremely fun to write this particular answer. Afterwards, I felt the urge to thank the creators of Stack Exchange, and so I did via Twitter. To my surprise and excitement @CodingHorror a.k.a. Jeff Atwood almost immediately retweeted this to his 65,000 (!) followers. What followed were several retweets, favorites, upvotes for the answers, and wonderful direct responses about my answer. This made me realize: I love the interwebs!

Interesting questions

There were several very interesting questions on this site for a home chef. Don’t expect any recipes (which are probably subjective and thus off-topic), but do expect very practical tips. Some questions I enjoyed:

Community Wiki

At first sight, there was just one real “ultimate list” question that caught my eye:

Conclusion

The Q&A format of Stack Exchange seems perfect for a particular type of cooking questions. Once you’re used to the fact that things like recipe-requests are off-topic you’ll start to appreciate the practical aspect of this site.

Probably because it’s a sister site to things like Stack Overflow, several top users note in their  bio that they’re “fulltime computer guy, part-time amateur chef“. That probably means I’m going to have a lot of fun there!

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!