Monthly Archives: August 2007

Google

I opened my inbox last night and had an email titled “Greetings from Google!”. Ah! nice try, spammers! Ok, I’ll just open it to laugh at what they came up with this time. But I’ve never seen any spam coming from @google.com before, strange.

Oh.

Haha looks like a job offer.

WHAT ?

That’s righty-dly-doo! I got a job offer (or more of a 17 interviews offer) from Google! Wahooo! What an honour! I couldn’t believe this email was dedicated to me, all I do is copy code from other people (my lawyer told me to remove this).

StandoutOfficeAlthough this is really flattering, it doesn’t overcome my passion and excitement of working at a crazy startup here in Montreal, with the best people I ever worked with: Fred, Ben and Daniel. We might not have free food and Segways, but we have a fridge full of Gurus, an amazing view and a believe we can change the world (of recruiting, for a start).

I guess some people will think I’m crazy declining this offer. But for me, this is like waiting in line at the grocery, you always have 3 choices:

  1. You pick the shortest line and you stick with it whatever happens
  2. You pick the shortest line and you switch once if another line gets shorter
  3. You pick the shortest line and you switch whenever another line gets shorter

I quit my previous job because I truly believed in Standout Jobs. I chose to dedicate a part of my life to it and now is the time to stick.
Knowing when to quit or stick is hard. Like Seth Godin say it in his life changing book The Dip:

Winners quit fast, quit often, and quit without guilt-until they commit to beating the right Dip for the right reasons. In fact, winners seek out the Dip. They realize that the bigger the barrier, the bigger the reward for getting past it. If you can become number one in your niche, you’ll get more than your fair share of profits, glory, and long-term security.

Losers, on the other hand, fall into two basic traps. Either they fail to stick out the Dip they get to the moment of truth and then give up or they never even find the right Dip to conquer.

- Seth Godin

You always have 3 choices whatever you’re trying to achieve:

  1. You try really hard until you finally get it
  2. You try really hard and quit
  3. You don’t even bother to start

The only stupid choice in those 3 is the second one.

And whoever referred me at Google, thanks a lot! This is a great honour for me!

11 Comments

Filed under Misc

But it’s faster this way …

As a guy who have studied in software engineering, for most of my family members and friends I’m the guy to call when anything breaks on your computer, even though I’m clueless about computer hardware. So one day someone asked me to come by and see what didn’t worked right on his machine. A website didn’t worked. So I asked him to show me that website. He booted his computer, opened a remote desktop connection to his office network, wait and opened Internet Explorer. I said that he could just use Internet Explorer directly in his start menu. He tried clicking on the Start Menu and then on the Applications sub menu several times, with no success. The drop down Application menu kept disappearing because the mouse pointer did not follow the path of the menu box. He finally conclude that his way was faster.

Some people might argue that doing things the wrong way is faster.

Sure it’s faster, if you do it like that all the time!

4 Comments

Filed under Misc

This week in our world

Here are a couple of things I’ve found interesting while browsing in the last week. All this content is aggregated from my sideblog. Please, let me know what you think about this! Or share something you’ve found!

Content aware image resizing

Ruby self-explanatory truthy / falsey


api.connect(true)


using self-explanatory truthy / falsey values instead


api.connect(:auto_retry) # true
api.connect(!:auto_retry) # false

The Devel!: True False parameters

What every business can learn from spaghetti sauce


Malcom Gladwell

Yes, Deep-Fried Oreos, but Not in Trans Fats

Deep fried Oreo

How to detect dead pixels

“I’m a retard. I was trying to use Windows Magnifier to enlarge the dead pixel area to look at it better. I had it open for like 5 seconds, then like ‘wait a minute’…”    — RainmakeR.

Dead Pixels Test

Retro MacOS WordPress Theme

Retro Mac OS Theme

Leave a comment

Filed under DWIOW, links

Incremental Perfectionism : 5 ways to write perfect code

If you’ve ever done a couple of interviews, you’ve probably got the “I’m a perfectionist” candidate. When asked about its flaws he says with a fake-hidden smile: “I’m a lil’ bit of a perfectionist”, thinking deep in their mind this is more of a good thing then a bad one. Perfectionist, those people that only craft perfect thing, only the best (by the best), free of any flaw (except being too perfect), a piece of art left to be admired, not touch by anyone even it’s creator!

Well, that might be good for some poor artist on crack but we’re not! We’re developer driven by business rules, deadlines, changing requirements, technology and coffee. Unhealthy perfectionism is like the big bang approach to integration. It’s all or nothing, but most of the time, it’s nothing.

Here are 5 ways to bring your software closer to perfection, bits by bits, while still shipping your damn code (no crack required).

1. Small changes

TinyMaking 1000 lines of code perfect in a respectable amount of time is impossible. But tuning 10 to perfection is easy and fun. It’s also easier to wrap your head around the tiny problem you’re trying to fix.
It’s even easier to do this when writing tests, they help you split a complex problem into smaller and simpler ones and focus on one, one at the time. Hack some code, make the tests pass, commit, update and repeat.

2. Every single change should make the whole better

BetterIncremental Perfectionism, is like the poor-artist-on-crack perfectionism on a smaller, healthier scale. Don’t try to make the whole thing perfect. But never ever settle for something that is not the best possible solution to the small problem you’re solving. Don’t copy paste some code because it’s easier, don’t comment out a block of code because it’s faster, don’t live with ugly code. But don’t fix it all at the same time!

3. Refactor, refactor and refactor

Perhaps your understanding of the problem has evolve or you’ve learn a new and better way of doing something. Backed by a bunch of solid tests, listen to the code artist in you and refactor! Make the code beautiful, gorgeous, a piece of art, more perfect! Make the tests pass, commit, update and repeat.

4. svn -R revert .

Back signIf you feel you’re breaking any of the previous rules, start over. Maybe your changeset is getting too big. You’re trying to change too much things at the same time. If you’re afraid to loose your precious code, commit your working copy to a branch:

svn cp . http://svn.icanhazcode.com/svn/branches/my_precious

or create a patch:

svn diff > my_precious.diff

then, step on your ego and

svn -R revert .

But since we’re working with small changes, you haven’t lost that much right ?

5. Read lots of code

RubyForgeA good way to trigger your imagination into moving your software closer to perfection is too look at how other people are trying to do it. Open source projects are open books into some of the best programmers mind. They’ve spent time trying several ways to solve a problem, don’t spent your time doing the same thing!

I hope you find this helpful. Let me know how you’re making your code more perfect!

14 Comments

Filed under Misc, tips

DemoCampMontreal4 Follow-up

Once again DemoCampMontreal was fun, entertaining, energizing, cool, refreshing, techy, geeky, branché, nice, brilliant, awesome, instructive, pleasant, crowded, webish, tendance, crowded and tonight.

BrainCuts

First presentation was by a company called Categorical Design Solutions. I’m sorry to say things started pretty bad when they showed slides claiming they’re creating the web 3.0… Plus on their site there’s a web 2.0 sticker!!! OMG11!!^^lolZ! (Web 2.0 is for social web apps BTW). Then they presented a web app allowing exploration of the “semantic web” in a Explorer style UI, although we didn’t saw where that data came from. Then, they demoed an app built on top of it looked like an old 3D Desktop attempt by Microsoft I remember seeing. Maybe I missed something ’cause I was really confused (and shocked by the web 3.0 thing) after all this!

PodBean

logoNext was David Xu of Podbean a Podcast hosting, Social Subscribing site. It make brain-dead easy for people to create and publish a Podcast, even a paying one. He showed lots of stuff! I think part of it is a Worpress plugin… He’s currently studying at Mc Gill and building this part time, impressive. It seems to have lot of content already, I don’t know since when it exists, forgot to ask him.

ClixConnect

ClixConnectThen, Mitch Cohen presented ClixConnect. He’ve talked to me about it before but I was really happy to see it live with explanations. It’s a chat service that can be added to a company web site to support visitors. It’s like phone support but with a chat pop-up window. Supposedly support personnel have a super secret and cool UI to work with effectively. I’m not sure pop-up is a good thing, but like he said, this is not for everyone and you can pop the chat window by clicking a button instead.

IronRuby and Ruby autocompletion

IronRubyJosh of YashLabs took us through the heart of IronRuby and showed how he fixed a major bug in it! John Lam even replied to his blog post saying this was a bit embarrassing to him… He then showed how he implemented autocompletion for Ruby on E the text editor. Fairly interesting!

url_pipe

Daniel closed the event with url_pipe. A (soon to be) open-source and geekier version of Yahoo! Pipes. He demoed a grep, contains and geocode RSS filters that output another RSS feed that can be then passed into other webservices (such as Google Maps) or used in other filters. Although filter chaining didn’t work when he presented it, he said it will be like a command line on the web with something like this:
geocode http://.../myfeed.rss | grep -expression cool.

I met a couple of new people and talked with lots of interesting people, hope to see you there next time!

8 Comments

Filed under conference, montreal

This week in our world

Here are a couple of things I’ve found interesting while browsing in the last week. All this content is aggregated from my sideblog. Please, let me know what you think about this! Or share something you’ve found!

Ze Frank

One of the funniest presentation I’ve watched in a while!

Amazing list of videos by Seth Godin

The last one was found on this page.
Videos that can change your organization on Squidoo

Quotes

Beware of bugs in the above code; I have only proved it correct, not tried it.


Don Knuth

I mean you can reduce any thing to one-line of code, ultimately, right?

_why

The Blackberry isn’t the opposite of the iPhone. A plain jane Motorola phone is. Apple understands this. Blackberry doesn’t seem to.

Seth Godin

This is all your app is: a collection of tiny details.

Daring Fireball

why we’re all blogging less

5. The future we spent a long time evangelizing has already arrived.

hugh macleod

Amazing Coordinated Samsung Dance (via kydrice)

Leave a comment

Filed under DWIOW, links

Colorize code in your blog posts (with Ruby of course)

A couple of people asked me how I highlighted my code in a previous post.

Well, at first I though I’d tell the truth and say that I took the code and added colours manually in span and div. Then I though, hum, maybe I should print my code on a piece of paper and colorize with my girlfriend pen collection. Then I realize, it would look better if I just write the code directly in colours on a sheet of paper. Then I though, people think I know Ruby a lot so I better find some code on the internet and pretend I wrote it. Then, when I realize there was no solution for pasting code in a blog post on wordpress.com, the only solution left was really to write this code myself…

Using the simple syntax Ruby gem by Jamis Buck:

#!/usr/bin/env ruby
require 'rubygems'
require 'syntax/convertors/html'

BACKGROUND_COLOR = '#2B2B2B'
COLOR = '#E6E1DC'
COLORS = {
  :keyword => '#CC7833',
  :symbol => '#6E9CBE',
  :constant => '#DA4939',
  :attribute => '#D0D0FF',
  :string => '#A5C261'
}

html = Syntax::Convertors::HTML.for_syntax('ruby').convert(STDIN.read)

COLORS.each do |token, color|
  html.gsub!(%Q{class="#{token}"}, %Q{style="color:#{color}"})
end

puts %Q(<pre style="background-color:#{BACKGROUND_COLOR};color:#{COLOR};padding:6px;overflow:auto;line-height:12px;font-size:12px;padding:6px;"><code>#{html}</code></pre>)

Use it like this:
ruby2html < code.rb > code.html

Pretty cool but only for ruby...

Ends up I remember seeing a thing about a Ruby gem that could read TextMate magic and pops out the highlighted code. Switching gem...

#!/usr/bin/env ruby
require 'rubygems'
require 'uv'

BACKGROUND_COLOR = '#2B2B2B'
COLOR = '#E6E1DC'
COLORS = {
  :keyword => '#CC7833',
  :symbol => '#6E9CBE',
  :constant => '#DA4939',
  :attribute => '#D0D0FF',
  :string => '#A5C261',
  :comment => '#BC9458',
  :variable => '#D0D0FF'
}

html = Uv.parse(STDIN.read, 'xhtml', ARGV[0], false, 'sunburst')

COLORS.each do |token, color|
  html.gsub!(/class="#{token}"/i, %Q{style="color:#{color}"})
end

puts %Q(<pre style="background-color:#{BACKGROUND_COLOR};color:#{COLOR};padding:6px;overflow:auto;line-height:12px;font-size:12px;padding:6px;"><code>#{html}</code></pre>)

Use it like this:
code2html ruby < code.rb > code.html

You can use it with all languages supported by TextMate, just replace ruby with the desired syntax.

The catch is TextPow requires Oniguruma which I had to install from source. Or you could just wait for Ruby 2.0 as it will include Oniguruma...

Good luck with your highlighting!

Note: You don't need to have TextMate to use this (I think, by looking at UV's code)

10 Comments

Filed under ruby