And the best shared hosting service is… nearlyfreespeech

Being a blogger

A couple of years ago I tried to create a constructive, public-friendly blog that served mostly as a welcome page for doing contracting work on the side. It had a nice presentation layer to it which helped me to gain enough credibility to sign a contract with a big company. At the time, I had the objective of writing great posts often, along with beautiful pictures and highlighted code. All of my inspiration was coming from Jeff Atwood’s blog that had always fascinated me by the steady quality of its articles for years. I got started and was on fire! I wrote 4 long posts in 4 days! The 4th one ended with: “Blogging is easy! I could do it for 10 years straight!”… And that was my last post for 6 months.

Yeah, blogging for others is actually really hard. It requires time, dedication, self-discipline, patience, and humility. Kudos to all of you who have been maintaining public blogs for years. You are the memory of the internet!!

A few months ago I needed to keep personal technical notes again. I wasn’t going to go along the same route as before. My only objective was to write often, and I knew I couldn’t do that if I set the bar too high for myself. So instead I set the bar as low as possible by getting rid of anything that was not mandatory: colors, images, fancy templates, Javascripts, etc. My blog was just going to be plain, simple text, along with the cheapest shared hosting service to keep it on. I went from producing a tesla blog to a peugeot blog. It didn’t matter, I was not expecting more than a few visits a day from people who had mistyped some value and hit the I’m feeling lucky button. I didn’t care if it was fast. I didn’t care if it was pretty. I just needed to keep my notes on some blog somewhere.

The cheapest one out there
After comparing prices, I found out that the cheapest hosting service that you can find today is nearlyfreespeech.net. Go pay them a visit and you will notice right away a resemblance with this blog. We’re like 2 brothers sharing the gene of ugliness. Nothing there to attract the eye… But boy is it cheap! And it’s cheap because it’s fair: you only pay for what you consume. To give you an example I have 6 sites hosted there now:

  • Dynamic Sites : $0.06/day (6 sites)
  • DNS : $0.02778/day (7 zones, 2 external, 1 hosted, 4 registered & hosted)
  • MySQL Processes : $0.02/day (1 process)

6 sites that have handle about 300 visits per day (mostly related to my open source projects). 10 cents per day, that’s 3$/mo w/tax! AND this includes the whole package: FTP/SFTP/SSH access, advanced logging, unlimited databases, phpMyAdmin, etc. No other services in the world comes near in terms of price.

No pancake so thin it only has one side
Now shared hosting is great for websites that have little to no traffic. It wasn’t my first experience. I once happened to have a few hundred visits a day on another shared hosting service that I won’t name for their sake (ahem 1&1). As soon as I started to have very limited traffic, I received an email urging me to upgrade to a higher-tier or have my services disconnected. It bugged me but I recognized that it was fair. Those hosts have shared resources and should restrain you to your shared amount.

And I had always expected nearlyfreespeech to do the same thing…

Until last saturday.

I had written down my experience as a coder who happened to be often involved in the recruitment process at my last company. A friend of mine found it interesting and advised me to post a link to hackernews and reddit, after which I left to a kite festival with my wife and boys for the day. Had I known… The article went viral within a few hours and my blog was submerged. 85,000 views in less than 24 hours… I feel very humbled just thinking about it, and I was amazed to realize that so many people felt the same way as I did on that subject.

But as I saw the # of simultaneous connections increase hour after hour on analytics’ mobile app, I only had one thought in mind: “it’s just a matter of minutes: when will my blog crash? when will nfs pull the plug on me?”

They didn’t. They handled the charge perfectly, and my blog was super responsive the entire time.

But all that traffic? You pay for what you consume right? Yes… I went from paying 10 cents to 30 cents that day.

How they managed to pull that off and deliver that quality of service, I still don’t know… but I take it at heart to thank them for the awesome work that they do. They deserve to be more famous and have more business. So if you’re thinking about hosting some PHP somewhere cheap, look no further. And if by that time you’re used to reading my blog, you’ll find its design extremely attractive!

cheers, and thanks for reading.

How I ended up conducting the most successful technical interviews with a single question

The hiring process
A big part of my previous job was to take part in the hiring process and conduct technical interviews. That process was quite forward:

1/ An interview conducted by HR determined if the candidate is a serial killer / psychopath
2/ An interview conducted by technical experts determined if the candidate is a good programmer
3/ An interview conducted by big boss determined how low the candidate is willing to get paid

I interviewed 2 types of people: interns and future employees. Interns only went through #2 while the others went through all three steps. In the span of 2+ years working at that company I must have performed 200+ technical interviews. It was an enriching learning process for me, and I ended up figuring it out one step at a time. Now it is important for you to note that this occured in France, where you simply cannot fire people. Hire the wrong guy and you will be stuck with that person forever. It is critical to filter out the best candidates and not make any mistakes about it. It was a tedious process, and I loved every single part of it.

The very-specific lottery quiz
I conducted my first tech interview in 2008. At that time, the company already had a working process that I followed: interviews were 1 hour. The candidates would have 30 minutes to answer a 15 questions quiz. Then we would spend 15 minutes talking about their answers plus an additional 15 minutes answering questions about the job. I quickly realized how terrible that questionnaire was. I mean, I think that even if you tried, you wouldn’t be able to come up with something that terrible. About 50% of the company’s projects were in java, so the quiz was very java-centric. It contained 5 trivial questions and then 10 very hard questions specific to the java frameworks we were mostly using :

It went from

- What is the difference between a class and an object?

to

- What is the purpose of the execAndwait interceptor in 
  the struts 2 framework?

Heck even I couldn’t explain or expand on half the stuff that was asked... Every single time I would pray so that they wouldn’t ask questions about the questions! Pretty ironic for the interviewer... Anyways I would usually skim really fast (2-5 mins) through their answers and spend the rest of the time talking about their resume. It sucked big time and I wanted to improve it. So I went online and compared hundreds of interview questions. At that time I believed in the quiz format. It just had to contain the right questions in order to reveal how good people were. The right quiz for the right people.

The very generic quiz
After about a month of research, I had come up with the best 50 questions I could find online. I felt that they were good questions because they could be answered in any language, and they were in a smooth crescendo of difficulty. I scattered the 50 and ended up with 5 sets of 10 great questions that I would hand out randomly.

Example:

What is a singleton and when would you use it / not use it?

This was much better. or so I thought... The questions were good and I would also usually get good answers in return. I went on for a few weeks but somehow didn't feel completely right. I couldn’t shake off the feeling that even if what I did was good, it just wasn’t great. Yes it did test whether or not the person knew programming theories, but in the end it left me clueless as to whether or not the person could code. In the end I’m not sure that we ended up hiring anyone better using that method than with the caveman struts 2 questionnaire. The more I thought about it, the more I realized that there were 2 big issues with those 5 questionnaires:

1/ The questions were too generic. by not going into language specifics, I couldn’t talk about SQL, front-end specifics, etc.
2/ The quiz was too short. 10 generic questions just didn’t cut it. There was no way I could know if they were good programmers or not.

What I really needed was a lot more questions, and questions specific to the job the person was applying to.

Quiz manager 3000
This is where things got a little out of hand. I went ahead and created (with the help of an intern) a fully automated quiz tool: quiz manager (QM). The tool made the hiring process perfect: after the first interview, HR would select 3 topics related to the job description. The tool would then automatically create a multiple choice question quiz with 3 x 20 = 60 random but specific questions with a difficulty matching the person’s experience.

Example:

(javascript)
var i = 0;
function a(){
  var i = 2; 
  i++;
} 
a(); 
alert(i);    =>    0 ? 2 ? 3 ?

It would then draw little graphs, generate and email reports to HR, displaying the results compared to the average along with a bunch of other useless metrics. Man was I proud of that tool! I was looking forward to having candidates take the test! I would sit next door with HR and watch the candidate’s live score on the intranet app as the answers were selected. QM made all of our lives so much easier, it seemed perfect… Until we tested it on our own developers!

Well... Turns out that a lot of our great developers were getting the same score as some of the people I had refused. That's right, QM was proven useless! I had spent so much time building the tool that it took me a long time to realize the big mistake I had made: our desire to automate the results had constrained me to only ask multiple-choice questions. The user could only select one answer, and the questions ended up being mostly trick questions. The outcome was that we were not testing software development skills at all! It was tough for me to swallow my pride, but in the end I admitted that the tool was counter-productive, reflecting the wrong impressions about developers more than anything.

Just let ’em code
8 months had passed since I had the job. I did some more research and checked at how some US companies did their screening process. This is when I decided to go for another method: just have them code. That’s the reason they get paid, so why not show me right now how they do it. Quite logical when you think about it... Having learned some lessons with the first months, the test became quite simple: I would give out 3 algorithms to be solved in 30 minutes. Candidates could pick the language of their choice and have access to a machine (disconnected from the internet). Those were classic problems found online: One algorithm usually dealt with string operations (such as reverse words in a sentence), another with recurrence (such as calculate a term in fibonacci’s suite), and the last one with collections (such as ordering a list).

Example:

print out digits 1-100.
for multiples of 3, print out foo.
for multiples of 5, print out bar.
for multiples of both 3 and 5, print out foobar.

Everything got much clearer and better. I could directly see those who was indenting, commenting, using conventions, finding the solutions, etc. It gave me a pretty good sense of how much programming the person had done in the past. moreover, discussing about their solutions was also very informative. I like to think that candidates were comfortable with those tests because I had tried to take off all the pressure out of them. They could take their time, choose the language they wanted, ask for advice, etc.

I was initially happy with the results and did that for a couple of months. But then again I started feeling that I was missing something… Something that just wasn’t right… It's true that I could easily spot the ones who could solve algorithms from the others. But were they really the great programmers I was looking for? When you think about it, is the quality of a programmer defined by how well he/she can solve a math problem, or whether or not he is able to sort a list in O(n log n) and not O(n^2)?

The one question to rule them all
I can remember exactly when I first started programming. QBasic was shipped with MSDOS 5.0 way before windows 3.1 came out. It contained its own help screen with all of the functions and keywords of the language, like the perfect offline man page. To this day I distinctively remember the feeling that grasped me every time I hit F5 and saw my programs execute before my eyes. A single printed line, a prompt for a name, some colors, a puzzle... I was in heaven. I remember putting line numbers before each command, filling my code with horrible GOTOs, learning with excitement and fascination something new everyday. I loved programming. I would spend hour after hour creating games, solving problems, showing stuff to my parents and friends. Years went by, I went from qbasic to pascal to vb, wrote games for our BBS "Atomic BBS” that we ran from our home phone line through a 2400bps modem. I wasn’t really good. Well in fact I really sucked and my code was pretty horrible! But man did I love it!! I just couldn’t let it go... I guess some people feel that type of adrenaline the first time they fly a plane, sail a boat, smoke weed, eat at in n out... For me it was programming, compiling, executing. I gained that feeling 25 years ago, and it has never left me since. I was born for this. I’ve always been a programmer.

I have always been convinced that those who love code do not restrict their coding activities to their work. They take home that love and continue to create for fun as a hobby. How many times have I felt frustrated at work because of a struggling eclipse, only to find relief and joy when writing ruby on rails code back home!

And so it was, that after 1 year of trial and error, I completely stopped handing out technical tests. I would sit down with the candidate, read and comment his resume without asking him any questions for a good 5-10 minutes. And then I would flip over the resume, look at the candidate in the eyes and ask: “we have about 30 minutes left. Will you please tell me about the best project that you’ve ever created?”

That simple, unique and nonjudmental question was the key. Some answered vaguely about their previous work or school project. And then some others became suddenly alive and excited, even those who appeared to be the shyest. They would talk passionately about the game they were creating, the website they had made, the open source projects they had contributed to, the utilities they made after being stuck in the middle of nowhere without any internet access. They were proud to show me. I was always fascinated by what I heard and would ask about all the details of the project they had treasured. They opened up and talked about the technical difficulties that they had overcome, about the little personal touch they added. It was their baby. And as they talked it was impossible to miss: I could see that light in their eyes, the excitement of a child that compiles and runs his first hello world. I would know right then that we had something in common. They were programmers too.

Most of them didn't have a clue about struts or some other specific framework we were using. Yet once they got the job, they always ended up being golden developpers. They learned faster, they produced better code, they inspired others with their creativity and positivism. They were coders at heart.

And in the end that’s all that matters.


[Update 07/27/14]
I never thought that this would escalate so let me clarify 2 things:
#1: The question I would ask would include all types of projects, and I would put work projects at the exact same level as hobby projects. It was great (but rare since they were changing jobs) to meet people who were passionate about their work project. There is no perfect interview method, no method that will work perfectly for every single candidate out there. But I came to find out that even the best could freeze in front of a simple FizzBuzz problem, just because of the interview context pressure. So basically instead of asking the candidate if they knew "this" or "that", this question allowed candidates to bring me to their world, tell me who they were and what they knew best.
#2: The first 5-10 minutes weren't minutes of terror and silence. I just didn't ask deep questions about the resume. I used those first minutes to chit-chat and make the candidate feel as comfortable as possible, by reading and making positive comments about the experience he had written down. After all, it's easy to put anything on a piece of paper. My main objective was to spend most of the interview time listening to what he had to say on the thing he was most passionate about. I never looked down at candidates because each of them was unique and you never knew how good they were just by reading their resume. Also i've always been surrounded by amazing programmers so I've learned to listen more than to talk.

The big flaw with today’s open-source fashion

I’ve always been a fervent advocate of open-source software.

It’s been said over and over again: open-source software has won. Github has become the biggest freeware distributor in the world. You have something interesting to show to the world? Make sure it’s on there and open sourced. While you’re at it, make sure it’s also licensed under the most permissive licence possible. “GPL you say? I won’t even look. I can probably get the equivalent for free under MIT or WTFPL in your neighbor’s repo!”
and chances are that he will too… Hence the trend continues, encouraging all the software to become free to use, free to alter and free to redistribute.

So what? Why complain when everything is becoming more open, transparent, and (having to comfront public eyes) cleaner?

The reason is very simple: noone treasures something that is free.

It’s not against anyone, it’s a law of nature. we only treasure what we made sacrifices to get. And so by pushing developers towards the give-all-you-make paradigm, the value of their code is diminished, destroying its worth. Consumers take it for granted. After all, free IS the norm. They open feature requests after feature requests because they expect the software they use to be just as perfect, if not more, than a pricey software. As a result, they often never seek solutions to their own problems. They request them. everyone looses.

I can remember a time (ATDT…) when you would have to purchase a piece of software for 20-30 bucks. It had its flaws, but it was yours. You couldn’t really hack it, but you worked your way around it. Heck you had no choice, you bought it. You were not just a consumer, you became a contributor. If it didn’t fill all of your needs, you managed to still pull it off. It would make you proud, and you would treasure the tool that you bought, because it made you better than what you were before.

Today everything is open source. We are spoiled by it. We cannot appreciate it. And that’s its biggest flaw.

So how can we avoid this from happening? How do we balance things out?

I don’t have the solution but my personal thought is that open-source software should never be free. Perhaps starting at a symbolic $1, people should then choose the amount they want to pay depending upon what it’s worth to them. Developers will feel proud about their non-obligatory gains. Consumers will feel proud about their prized possession. Call it however you want, I call it the “Pay-Whatever-You-Want-Do-Whatever-You-Want” licence.

Well, what do you think?

Javascript inheritance without loosing class names

There are a LOT of articles out there that talk about Javascript inheritance, or even object-oriented javascript in general. There’s been thousands of frameworks that have provided javascript with the notions of encapsulation, classes, etc. This is probably because prototype-based programming is not intuitive to all those who work regularly with object-based languages such as java, php, ruby, c#, etc. Just look for object-oriented javascript stuff on github, you’ll find thousands of open-source frameworks / snippets… So why do people bother so much about turning javascript into something it’s not?

Well my personal thought is that it’s actually a good exercice. It really helps one understand and appreciate the depths of the prototype-way of thinking. In fact, I think that all javascript developers should create their own $.extend framework so that they may discover the subtleties and power of prototypes.

Anyways… I was reading some of the most famous inheritance scripts out there, starting out with this bright snippet from John Resig. I also went through the sources of the most appreciated related github projects (ooliboorja to credit a few) and quickly realized that all of them shared a big issue, which is best described in one of John’s comments : “@Justin: I don’t think there’s a reasonable way to actually assign a name to the classes, which is unfortunate.”

The problem

There are two ways to define a class in javascript:

1. var myclass = function(){...}
2. function myclass(){...}

Even though they may look alike, those 2 methods are very different :

1. creates a function that doesn’t have a name (anonymous function) and assigns it to the variable myclass
2. declares the function named myclass

It is important to note that “you cannot change the name of a function, this property is read-only.”. In other words, once you have started using an anonymous function to create your class, you will never be in control of the class name.

The impact

Let’s take John’s Resig’s code snippet and apply it in the console:

var Person = Class.extend({
  init: function(isDancing){
    this.dancing = isDancing;
  },
  dance: function(){
    return this.dancing;
  }
});
 
var Ninja = Person.extend({
  init: function(){
    this._super( false );
  },
  dance: function(){
    // Call the inherited version of dance()
    return this._super();
  },
  swingSword: function(){
    return true;
  }
});
 
var p = new Person(true); 
var n = new Ninja();

Both object’s class names are ‘Class’:

p.constructor.name; // 'Class'
n.constructor.name; // 'Class'

While this may not be a problem when dealing with small examples, it becomes a huge PITA when debugging a big javascript project based on anonymous functions. Try making an HTML5 game with it and you will see how fast it gets on your nerves. hence I looked at about 20 different pieces of code but the same issue / code pattern was there. In fact I haven’t seen any framework that could provide me with ninjas beeing Ninjas and persons beeing Persons (did I miss it along the way??).

So last night I wrote my own little inheritance snippet. It uses dynamic function naming to circumvent the issue above:

moo.js

There are a couple of objectives I wanted to achieve:

– achieve basic inheritance
– allow subclass methods to override / call upon their super methods
– have classes retain their class names
– support for event management

The code is released under the MIT licence. Feel free to use it at your convenience. I think it can be very useful for games or other object-oriented programs. It’s been tested with jasmine.

Project home with its documentation
Source code hosted on github

I’m sure it can be improved and i’m always open for feedback and criticsm so if you’ve got something to say, use the comments section below or create an issue in the github project.

Javascript declarations and assignments

This week I was chasing a javascript bug. At qualys we heavily rely on extjs, and we have a few thousands javascript files that have to live together. The bug ended up being in the following lines:

    ...
    renderer: function(layer, text){
        var tag = node = Ext.apply({
            color: '#FCFCFC',
            background: '#666666'
        }, layer);
        tag.text = tag.text || text;
        if(node.disabled){
            tag.style = "color: #CCC !important";
        }
        return tag;
    },
    ...

Can you see what’s wrong?

The issue comes from the first line, an unconvenient mix of declarations and assignments:

var tag = node = Ext.apply({...})

The developer thought he was initializing 2 local vars called tag and node.

Let’s take something simple:

    function test(){
        var a = b = 2;
        alert(a, b);
    }
    test();
    alert(b);

In the first line, javascript starts by evaluating b = 2. This is an assignment of 2 to the variable b. Because b does not exist, javascript creates a new global variable b and attaches it to the current context, window. (note that this would throw a ReferenceError exception if we were in strict mode).

A quick ref to ECMA-262 shows that assignments return the value that was just assigned. You can double check that in your console eval(b = 2); returns 2.

So now the compiler has evaluated the first expression and now reads var a = 2 since 2 was evaluated. This correctly creates a local variable a containing the value 2 through a declaration, or more precisely a VariableStatement. note that eval(var b = 2); returns undefined.

Anyways… don’t mix up var a = [value] with a = [value] as they are completely different expressions that evaluate to different values and can create unexpected surprises…