Friday, January 22, 2010

Quote of the Moment

“So many times, it happens too fast:
You trade your passion for glory.
Don't lose your grip on the dreams of the past,
You must fight just to keep them alive;
It's the eye of the tiger,
it's the thrill of the fight,
Rising up to the challenge of our rival,
And the last known survivor,
stalks his prey in the night,
And he's watching us all with the eye of the tiger..” – Survivor, “Eye Of The Tiger”

Friday, January 15, 2010

Why would you need a Gender table in your DB??

A friend of mine was tweeting about how he found a drop down control in some application he’s working on that binds on a (“lookup”) table with only the 2 rows for male & female.. Check the short conversation on twitter.

In my humble opinion -as weird it may sound-  this approach (for similar, small lookups) might makes sense, in some way. Not exactly as is, may be it will make sense more if it’s within a lookup module (a single table for all lookups where every entry has a lookup type).

Other “regular” approaches (& their expected problems) :

People usually tackle such small lookups using enums, or just using an “agreed on” key/value pairs convention (not stores anywhere in code or DB, may be only a code comment here or there) which usually tend to get forgotten & you have to  trace code to know which key stands for each lookup value..

Even worse, is using a boolean for such

Benefits of a DB Table approach:

Other than the benefits of avoiding the above, using DB to explicitly state lookup values, is that they are more dynamic, ie: you can always edit them without touching much code, that would be handy in cases like:

  • Clients constantly changing small stuff like spelling, etc
  • Adding other functionalities/features, like multilingual support for eg..

Thus, I find avoiding enums, etc & using tables even for small stuff like that gender much more convenient..

Let me know what you think about it, & (hopefully) suggest a better approach..

Saturday, January 09, 2010

TekPub/CodeThinked Challenge


Justin Etheredge posted this challenge on CodeThinked so I thought I should give it a try though I’ve just had my TekPub subscription (Looking forward to use it, heavily!! :D)

So here’s my solution:

var myPrimes =
                Enumerable.Range(1, SomePositiveValue)
                    .Where(x => x != 1 &&
                        !Enumerable.Range(2, (int)Math.Ceiling(Math.Sqrt(x)))
                            .Any(y =>   x % y == 0 &&
                                        x != y));

You might want to remove the “x != 1” depending on you consider 1 as a prime or not :)

Friday, January 08, 2010


Today I came across a couple of petitions,

ScottGutoME & #iWantScottGuInCairoCamp:

The first one was about asking Scott Gu to be there on Tech·Ed ME 2010 in Dubai..

After tweeting about it, Meligy & I started a convo about it, which lead to a kinda another petition for Cairo Code Camp 2010, so go on retweet it!! :D

RT #iWantScottGuInCairoCamp if you want @scottgu to come to Egypt during #CairoCodeCamp.Make it twitter trend so that GU notices


Another nice petition was about pushing Google to Support Arabic in Android, which is a nice petition from a user perspective, but kinda lame speaking as a developer & taking into consideration that Android is (mostly) open source.. Arab Developer community need to get more involved.. not to just "ask for Arabic support"!!

Another funny thing is that most of the comments on the issue on Android Google Code project is that almost all the comments are in pure English.. For God sake, dudes!! Google has “Google Translate”!! :D

Yet, speaking about ROI (for Google), Arabic Language is spoken by more than 280 million people as a first language, and by 250 million more as a second language.

Monday, January 04, 2010

Fix Arabic Google Translation

Go to ‎ translate "اسرائيلي يقتل فلسطينيا" from Arabic to English, then "اسرائيلي يقتل فرنسيا"!! The 1st is translated "Israeli killed by Palestinians" and the 2nd "Israeli killed Frenchman"!!

Please share & Contribute a right translation!!


All the opinions expressed on this blog are my own and don't necessarily represent my employer's positions, strategies or opinions.