Archive for the ‘Uncategorized’ Category

Rails MemCacheStore Fu

Wednesday, June 10th, 2009

Or how to use the latest memcache-client (1.7.4 as of this writing) over the vendored copy in Rails and control the MemCacheStore initialization using the cache_fu/act_as_cached memcached.yml config file.

  1. get Mike Perham’s latest memcache-client on github or simply:
    sudo gem install memcache-client

    make sure to remove any other memcache-client gems from your system.

  2. follow Mike’s instructions to performs brain surgery on the Ruby environment to override ActiveSupport memcache-client
  3. to control the MemCacheStore initialization using the options in your memcached.yml file, grab my memcached-config code from github
  4. include the following code in your environments/*.rb files:
    
    unless (memcached_config = MemcachedConfig.new).disabled?
      memcached_options = memcached_config.options
      config.cache_store = :mem_cache_store, memcached_options.delete(:servers), memcached_options
    end
    

By using MemcachedConfig this way, all the recognized options by memcache-client in your memcached.yml config file, such as :namespace, will be used. You can also add specific memcache-client options such as :failover or :timeout in you memcached.yml.

The next spam wave will come from Twitter real time search

Friday, April 24th, 2009

I think Twitter is about to have a really bad spam problem and I am not talking about spam from the people you are following. This spam is manageable since you can always unfollow anyone.

No, real time Twitter search and tinyurls are a winning combination to flood the stream with spam.

I believe that the real time search phenomenon is one of the hottest concept in social medias now. Thanks to clients like TweetDeck, you can hook yourself to a search stream using keywords or hashtags and get a real time feed of everything happening in Twitter about these keywords. For example, when I saw the information about the acquisition of Sun by Oracle, I immediately started a real time search on “mysql” to get the beat on the implications of this acquisition on MySQL. Sure enough, in one tweet I found interesting, I clicked on the tinyurl and got to a spammer site. Ouch. That was too easy.

Any spammer can now leverage any hot trends in Twitter by sending tweets about this trend and include their spam url hidden behind a tinyurl. If the tweet is well worded, you can’t even rely on the url to get an idea of its validity.

I think this is just a matter of time before real time searches are flooded with spam.

What are the solutions?

First, tinyurl services should probably start checking for potential spammers urls and not transform them.

Second, at some point I think Twitter wont have the choice to run spam detection on inbound messages. Since the inbound messages throughput is quite large and increasing as Twitter is gaining popularity, it might be too costly to run spam detection on all messages. To avoid checking all messages maybe they could establish some sort of trustiness or karma indicator on users. Depending on the users behaviors or maybe by looking at their social graphs, Twitter could rate users and use that to decide to apply spam detection or not on inbound messages form these users.

What do you think?

Decision Making

Sunday, March 15th, 2009
Rose Tower

Rose Tower, Red Rocks, NV

I am a fan of Bruce Tate. First for his work and his books: I discovered him through Better, Faster, Lighter Java during my Java era, then with Beyond Java and From Java to Ruby. He also wrote two excellent online series: secrets of lightweight development and crossing borders. At some point he created the “Paddle Like Hell” blog where he sometimes made associations between his Kayaking passion and his professional life in his posts.

I guess this is one aspect of my life I share with Bruce, a passion for outdoor activities: in my case, rock climbing. I wish I could also share his story telling talent, but that’s another issue…!

I recently did a very nice rock climbing trip to Red Rocks, Nevada. One of the climb was “Olive Oil” a classic, easy, 6 pitches 5.7R trad climb. We chose this route for the relatively short approach: 45 minutes as listed in the topo, its “classic” nature and its “easy” grade. This was the first time Alex and me were doing multi-pitch trad climbing together. We did however share some gym training time, some crag climbing and a few ice climbing sessions. This route seemed like the perfect candidate for a first big climb together. We took off that morning, a bit late, at around 9AM, after sorting and organizing our equipment “rack”. After a 30 minutes drive we made it to the Pine Creek Canyon parking and hit the trail to get to the base of the route. As it happen frequently, we had a hard time finding our way to the base of the Rose Tower and a harder time finding the start of the route. It took us nearly 2hrs before starting the climb. We started climbing the first pitch, at around 11h30-12. A late start. During the climb we where on the lookout for bolted belays, as described in the topo but we never saw any bolts. This is not really a problem, we built our anchors along the way. Aside from the actual technique needed to climb, anchor building is the most critical skill required to do traditional climbing. At some point we had to do a bit of simul-climbing as I reached the end of the rope and needed to get to a ledge higher showing some rock formations that seemed favorable to build an anchor. With the bolts & route finding and the anchor building, the climbing took a bit more time than we anticipated.

After a few pitches we started discussing about the descent strategy: where the hell were the rappel anchors if we didn’t see any bolts on our way up? The topo page we took with us did not give us more information on the descent. We assumed the bolts we were looking for were also the rappel bolts for the descent.

Before starting the climb we decided that 4 o’clock was the time we needed to start the descent if we wanted to make it to the car before dark. at the end of February, it is completely dark at 6 o’clock in Red Rocks. We actually got the the base of the last pitch, a large comfortable ledge, at around 3h30. Knowing it took us around 45 minutes per pitch to climb we had to decide if we wanted to go on and finish the last pitch or bail out now.

We had to make the decision of either going up and taking the risk of ending up in the exact same situation that we were now but 45 minutes later with not much of the day left to deal with a possible descent epic or start going down now. Going down from where we were meant sacrificing some gear to build rappel anchors and rappelling into the “unknown” in what seemed the best possible descent line. So, with the information we had, we decided to start going down now to take advantage of what was left of the day and hope to make it through this “adventure” descent before dark.

We were both nervous for the first rappel as we didn’t know where we were going to end up. The idea is to go down and look for the best place to build the next rappel anchor. We made it to the top of a large pillar where we found a slung tree for the next rappel anchor. On our way down we ended up finding a few anchors and some lost gear, a good indication we were not the only one having to bail out from the route in this rappel line. Our rope got stuck once but we got lucky and found a way to pull it from another angle and avoid having to re climb that section to free it. In the end the descent went relatively well and we got back on the ground at around 5h30.

Later that night, while discussing our day with our friends and looking back at the complete topo we realized that the descent was in fact a walk off. Our error was that we did not carefully read the topo BEFORE the climb. Traditional multi-pitch climbing is never to be underestimated. Preparation and skills are key to avoid potentially dangerous situations.

One aspect of this adventure that struck me afterward was our decision process. In retrospective I believe we took the right decision – given the information we had at that moment. Since we didn’t know the descent was a walk off, we would have been, as we thought, in the exact same situation at the top of the climb, critical minutes later and an extra pitch to rappel down. We finally did a controlled descent, with some padding for possible problems and in the end we made it safely to the ground before dark.

This is where I will draw a parallel with my professional life: entrepreneurship and working with startups involves lots of quick decision taking. All decisions have a direct impact on businesses with limited resources, striving for their survival. An important skill for anyone working with a startup is the ability to make decisions, assume them, move on and focus on what should be done next. Set aside the speculation and tackle other problems. In retrospective it is always easy to judge a decision, but any decision is made in the context of the information available at the moment of making that decision. Some are better than other and lessons can be learned but in the end, decisions must be made!

how to serialize a proc/lambda in Ruby

Monday, February 16th, 2009

A friend asked on twitter if we could retrieve the Ruby code as a string from a Proc or Lambda with something for example: puts (lambda {1==1}).code –> “1==1″ see his original tweet.

It can probably be done with some Ruby2Ruby magic, here’s my 15 minutes attempt. First you need to install Ruby2Ruby from http://seattlerb.rubyforge.org/ruby2ruby/


l = lambda { |i| i + 1 }

def xlate(proc)
  (c = Class.new).class_eval { define_method :proc, proc }
  Ruby2Ruby.translate(c, :proc)
end

irb(main):009:0> xlate(l)
"def proc(i)\n  (i + 1)\nend"

Now, maybe a bit of regexp on the output and that’s probably close to what you need!

Enjoy!

Compiling Sphinx on OSX Leopard

Wednesday, January 7th, 2009

Here’s a quicky – I have recently moved my dev env from Ubuntu/Gnome on a Dell XPS m1330 laptop to a MacBook Pro laptop. My dev env requires the Sphinx search engine so here’s how to compile it on Leopard.

With a straight ./configure; make you will get the following error:


ld: warning in indexer.o, file is not of required architecture
ld: warning in libsphinx.a, file is not of required architecture
ld: warning in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
ld: warning in /usr/local/mysql/lib/libmygcc.a, file is not of required architecture
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found

Here’s what you need to do:


export LDFLAGS="-arch x86_64"; ./configure

Apple’s iPhone AppStore model fails with Internet applications and platforms.

Saturday, December 6th, 2008

Here’s another example of Apple’s iPhone AppStore model failure – the TwitterFon example.

TwitterFon is a (great) Twitter client for the iPhone. All Twitter clients rely on Twitter’s public API. Twitter is one of the stars of the Internet social medias / social networking applications. Like most Internet application startups, they have an agile development model which involves doing lots of incremental modifications/enhancements on their platform with frequent release cycles. Also like most Internet applications/platforms, they offer a public API for 3rd party applications to connect to their platform. Note that In the case of Twitter, the bulk of their traffic comes from their API and not from twitter.com. More generally, this model is the new model for Internet applications and platforms development.

This is where iPhone app developers have a problem: they develop native iPhone apps that connect to these Internet applications through their API but can’t keep up with these because of the slow AppStore approval process.

Case in point: TwitterFon. This morning when I tried to launch TwitterFon, it crashed on startup. Tried again, no go. Tweetted about it from my laptop and received a reply of similar problems from a friend. A few minutes later, the @twitterfon Twitter user started following me so I went to check it’s user profile and tweet stream to see that it was discussing the issues and also gave a link to it’s blog, here’s a quote:

The root cause is that twitter respond JSON contents which contain unexpected values.
[...]
I have already submitted a new version which implemented a workaround to address the issue, but it will take a few days to get an approval from AppStore. Also, I reported the issue to Twitter. I hope they fix the issue soon. Otherwise, you have to wait until Apple approves the new version of TwitterFon.

Now, can you see the problem? On one side you have agile Internet application developers which move fast, release often. On the other side you have Apple’s slow, bureaucratic AppStore approval process. In the middle you have the iPhone who want to be the best mobile Internet device.

If you want to be the best mobile Internet device you have to be able to cope efficiently with the Internet speed development style, period. In the TwitterFon example, we don’t really care if Twitter introduced a bug or not in their API that killed TwitterFon: by today’s standards, everyone must be able to move fast and in our example the only one that can’t move fast is Apple with its boggus AppStore model. Fail!

Le Québec numérique est en retard!

Sunday, November 23rd, 2008

J’ajoute ma voix au groupe qui fait la promotion de l’élaboration d’un plan numérique pour le Québec, notamment Yulbiz Montréal, Michelle Blanc et Patricia Tessier. Tel que décrit dans cette lettre ouverte au Premier ministre du Québec, le Québec accuse un important retard par rapport au reste du Canada et je suis aussi d’avis qu’une prise de conscience et un effort concerté est nécessaire et urgent pour permettre de rectifier cette situation.

Un groupe Facebook ainsi qu’un wiki ont été créé pour soutenir cette démarche. Vous pouvez aussi suivre @plannumerique sur twitter et/ou suivre le hashtag #planqc

Perfectionism can be harmful for an agile startup

Thursday, September 18th, 2008

Correctly choosing your partners, colleagues or employees is critical and must not be overlooked, in particular in a startup environment where resources are scarce and each individual contribution must be maximized. Conflicts between colleagues will drain energy and divert focus from the important issues.

When doing interviews, one personally trait that is important to asses is perfectionism.

It is easy to be fooled by someone admitting to be a perfectionist because, somehow, we often view this as a quality. We probably believe that a perfectionist will be someone striving for accomplishments, who will be motivated to persevere in the face of discouragement and obstacles. It is important to pay attention to the level of perfectionism in an individual to make sure it will stay at a healthy level of motivation and energy.

Unhealthy perfectionists will exhibit some of these personality traits: emotional guardedness, need for control, fear of failure, need to be above criticism, tendency to be stubborn or confrontational. Negative perfectionism can result in low productivity as individuals lose time and energy on small irrelevant details of larger projects. In the context of a startup, negative perfectionism can have serious consequences on the enterprise, yourself and your team.

One of the important concepts of an agile development environment is to “release early and release often” which condemns you to making lots of compromises. To release early and release often means that you have to be able to accept the fact that the product will not be at the quality or completion level where (you think) you want to bring it in time. To achieve this, scopes must be kept small and progress most be done in iterations. This means that you must be ready to make compromises on some aspects of the project and stay focused of the really important stuff. In other words, you must be ready to accept to do less and probably below your “quality” level and then iterate toward improvement.

When choosing a colleague in an agile startup, make sure you choose someone who will be able to cope with the compromises required for such an environment.

iPhone: the good, the bad and the ugly

Sunday, September 14th, 2008

The Good

First, I must say that the iPhone is the coolest device, not just mobile, to come out in many years. It is also probably the best piece of engineering ever from Apple.

I got myself an iPhone 3G when it was finally available from Rogers in Canada. It is the first Apple computer I purchased since my last Apple computer: a Mac 128K (some 24 years ago – yikes!).

I won’t enumerate all the reasons why the iPhone is such a cool device, like an actual working GPS (not like the Nokia N810), wifi, 3G, bluetooth, iPod, safari, camera, accelerometer, touch screen and a quite usable on-screen keyboard. Add on top of that the slick Apple design and their genius in the touch screen user interface and you’ve got yourself incredible device.

The Bad

These core functionalities are really missing IMOHO:

  • cut & paste: They really have to find a way to integrate cut & paste in the UI. This is something that bothers me on a day-to-day basis.
  • backgrounding : on two levels: why can’t the last.fm app, for example, play music while I use another app? It should be possible for 3rd party apps to run in background just like Apple’s own iPod player. Also it should be possible to run two applications concurrently and flip between them without relying on the application to save it’s own state between transitions. This is boggus and really gets me frustrated when using/switching between multiple applications.
  • bluetooth A2DP (hi quality audio) : Heck, my SE K790 had it. I own a Plantronic 590 A2DP headset and I can’t use it to listen to music on my iPhone. This seems like such a low hanging fruit feature for Apple.
  • bluetooth keyboard : given the possibility to use a bluetooth keyboard on the iPhone I’d have no problem considering bringing only my iPhone in travel trips to do all my online stuff. Onscreen keyboard is ok for short text but I won’t do a late-night email inbox-zero session on it, way too slow for reasonable text size.

Other stuff I’d like to see:

  • offline mapping : It happened to me a few times: without connectivity, GPS is worthless, it relies on Google Maps. It will probably surface through 3rd parties sometime I guess.
  • Skype/VOIP : Skype would be really cool. As for VOIP, I just found this list of top softphones for the iPhone. I’ll have to check that out.
  • movie recording : There is Qik and Cycorder but they both require you to jailbreak your iPhone.
  • mp3 ringtones : Ok, yeah, right, Apple? Hello? Do you really expect me to pay $.99 to create a ringtone out of a song I ALREADY PAID FOR???? You-gotta-be-kidding-me!

The Ugly

Is Apple the new Microsoft?

Below, some interesting articles on the iPhone/app store lock-in policies by Apple.

We want an open platform. Period. The idea of the app store is actually very good but the ugly part is that Apple keeps a Microsoft style lock-in control over it. It is basically the same concept as with Microsoft Xbox Live. Note that both the Xbox and iPhone security has been broken. The main difference is with the community motivation, on the Xbox its mainly for copying games while on the iPhone, users & developers don’t want to have to deal with Apple’s monopolistic behavior and just want to use or publish applications freely without Apple overlooking everything – just like with any other platform/operating system (Windows, OSX, Linux). The fact is that there is a lot of talented, motivated, creative people making applications outside of Apple’s sanctioned channels. Why can’t all iPhones users have access to this talent without going the “underground” route? Fail.

Why don’t they keep their “Apple’s sanctioned” app store but also allow 3rd party app stores for developers who want to distribute applications outside of Apple’s control?

Until then, I’ll just continue to play cat & mouse and jailbreak my iPhone (like Steve Wozniak) while dreaming about Android. Will it be the holy grail?

I simply can’t stand being locked-out of my devices: iPhone, Buffalo Linkstation, Linksys wifi, Xbox, …

blog love!

Saturday, September 13th, 2008

Ok, I gave a bit of love to my blog setup:

and I also installed in the Praized page our very own Praized Community blog plugin! as in “eat your own dog food” :)

I think this make for a really cool blog! Let’s try to put in some cool content too ;)