Geniuses are made, not born

November 1st, 2009 by Ahmed S. Farghal 3 comments »

I couldn’t record the presentation, so I will upload only the slides.

Have Fun

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • DZone
  • PDF
  • Reddit
  • RSS
  • Twitter

Dreaming Loud

October 29th, 2009 by Ahmed S. Farghal 11 comments »

Lately I discovered how fragile I am, I tend to be depressed more than being happy. I tend to be angry more than being patient and quiet. My tentative to feeling upset is because of the cumulative effect of living in Egypt with all the corruption and abusive education system.

So, I started to dream and to think about what I really wish to happen to me and I came to the following. Remember that I’m just dreaming loud.

“Cairo has been awarded for it’s excellent public transportation to be the best public transportation in the world”

“Three Universities in Egypt took the top three positions in the best 500 university around the globe”

“Egypt become the safest country in the world after having the crime rate around 0.0″

“Egypt is the IT valley of the Middle East (including Israil)

“I’m traveling around the world exploring different cultures and enjoying the nature”

“To see people smiling again in the streets and to get help when I need help from the closest person in the street and to provide help to everybody without being scared to be robbed or killed!”

“To build a successful company that compete Google in the workplace that attract the best computer scientists in the whole world”

“To be innovative so I can be a landmark in the history of computer science”

and lots more, I think those are overwhelming enough for me for now.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • DZone
  • PDF
  • Reddit
  • RSS
  • Twitter

Common Mistake about Python default parameter value

October 1st, 2009 by Ahmed S. Farghal 8 comments »

I know it’s a little bit long title but didn’t find a better one :) It’s one of the common mistakes a python beginner does and even more experienced programmers can fall into the same mistake so I thought it might be useful if I illustrated that out here so you can know the concept.

you can easily fall into writing code that look like that:

def get_me_bad_list(arg1, myList=[]):
    myList.append(arg1)
    return myList

In [1]: get_me_bad_list(“hello”)
Out[1]: ['hello']

In [2]: get_me_bad_list(“world”)
Out[2]: ['hello', 'world']

Interesting, no?

The issue here is that the default value for function parameter is evaluated at function definition time (i.e, module import?) and as list objects are mutable they allow you change the value so you keep having the same default object for every function call and you modify it and return it back and even worse the caller can change it and it’ll reflect the list inside the function like the following

In [3]: x = get_me_bad_list(“Assalam”)

In[4]: x.append(“Alaykum”)

In[4]: get_me_bad_list(“Ya Shabab”)

Out[4]: ['hello', 'world', 'Assalam', 'Alaykum', 'Ya Shabab']

So, what’s the right way to do that? (if you are not doing that intentionally and you just want the plain default function parameters) that you define the initial value inside the body of the function (execution time)

def get_me_good_list(arg1, myList=None):
    myList = [] if myList is None else myList
    myList.append(arg1)
    return myList

In [1]: get_me_good_list(“hello”)
Out[1]: ['hello']

In [2]: get_me_good_list(“world”)
Out[2]: ['world']

and I’ll leave the rest of the tests to you, but generally the explanation is that everytime you call the function we create a new list (if you didn’t supply one explicitly) and that list is populated and returned so you won’t see any nasty behavior.

It’s interesting that you see that the deep you understand how the python interpreter scan and execute the code can really affect the way you fall into mistakes because if you are good enough then you will be somehow safe :)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • DZone
  • PDF
  • Reddit
  • RSS
  • Twitter

Do we really need H4ck3rZ?

September 28th, 2009 by Ahmed S. Farghal 3 comments »

An important question popped into my head, do we really need H4ck3rZ website?

We have done enormous efforts for renew our web footprint and now we have stuff that CAT never had, like the central authentication and social networking but with no result on the activity meter.

Currently almost nobody is visiting our website and no activity is being done except for the projects which are terribly slow because no serious contributers are around, so let’s think for a moment, what will happen if we gave up and stopped H4ck3rZ? Will you even notice?

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • DZone
  • PDF
  • Reddit
  • RSS
  • Twitter

Design Patterns Course

September 25th, 2009 by Ahmed S. Farghal 27 comments »

I’m planning to launch a software design patterns course in Mansoura on Fridays for 5 days that would introduce the most important patterns (8 Patterns) to those who are interested in software design.

The course is comprehensive and will have hands-on example using Java 5. The course is also considered the first professional design patterns course in Mansoura, if you are interested please post because I’m collecting votes.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • DZone
  • PDF
  • Reddit
  • RSS
  • Twitter

كل عام و انتم بخير

September 19th, 2009 by Ahmed S. Farghal 6 comments »

كل عام و امه محمد صلى الله عليه و سلم بخير بمناسبه عيد الفطر

اللهم اعد علينا رمضان و بلغنا اياه مرات عديده و سنين مديده و اكتب لنا القبول و العتق من النار يا ارحم الراحمين

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • DZone
  • PDF
  • Reddit
  • RSS
  • Twitter

Mercurial 2

September 16th, 2009 by Ahmed S. Farghal 1 comment »

Session 2 of Mercurial Tutorial in Arabic

http://www.vimeo.com/6597676

التسجيل كان قبل الافطار بنص ساعه فعذراً لو كان فيه لخبطه بسيطه في الكلام :)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • DZone
  • PDF
  • Reddit
  • RSS
  • Twitter

Screen Tricks

September 14th, 2009 by Ahmed S. Farghal 2 comments »

If you are using the famous ‘screen‘ command and you are using ‘windows‘ in screen alot then you might find it pretty useful to add the following lines in either your /etc/screenrc or ~/.screenrc file.

hardstatus alwayslastline
hardstatus string ‘%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]‘
shelltitle “$ |bash”
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
shelltitle "$ |bash"

This will add a very useful bar in the bottom of the screen where you can see in which window you are working and the process running and some other useful stuff.

Special thanks goes to Ahmed Kamal for the tip.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • DZone
  • PDF
  • Reddit
  • RSS
  • Twitter

Introduction to Mercurial

September 12th, 2009 by Ahmed S. Farghal 5 comments »

This is an introduction to mercurial distributed SCM published as part of my contributions to CAT H4c3krZ, the video is in arabic and all the next sessions will be in arabic also.

http://www.vimeo.com/6519247

Let me hear your opinion….

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • DZone
  • PDF
  • Reddit
  • RSS
  • Twitter

اجازة رسميه

September 9th, 2009 by Ahmed S. Farghal 12 comments »

كل سنه و انتم طيبين جميعاً ، النهاردة هاكلمكم عن حاجة غريبة و مستفزة كالعاده و هي موضوع الاجازات الرسمية ، الأجازات الرسمية دي يعني مجلس الوزراء اللي بيحددها للأحتفال بموضوع معين و في اجازات دينية و رسمية برضو زي اجازة عيد الفطر و عيد الأضحي للتحديد و دول الاجازتين اللي ربنا حددهم عشان المسلم يحتفل مع اهله و عائلته و يحس بالسعادة لكن سبحان الله تلاقي في اختراع طلع اسمه ان الاجازات الرسمية دي للقطاع العام بس و القطاع الخاص بيعمل اللي هو عايزو

يعني مثلاُ عيد الفطر ربنا شرعة تلات ايام لكن الشركات )اغلبها( قرر انه يومين بس و تالت يوم ده شغل!! يعني السنه دي لقيت ان الاجازة في الشغل هي يوم الاحد و الاثنين بس على الرغم من ان الاجازة الرسمية من مجلس الوزراء اربع ايام تبدأ السبت و اخر يوم فيها هو الثلاثاء ، الشئ الاظرف ان في اجازات زي عيد العمال مثلاً الحكومة عملت الاجازة السبت عشان عيد العمال كان موافق يوم جمعة اصلاً و الشركات طنشت تماماً و ماقلتش مثلاً ندي احنا الاحد بداله. بس مااااشي السبت اصلاً اجازة في الشركات و مش هانتكلم لكن عيد الفطر؟؟؟ اللي الواحد كان بيستناه هو و عيد الاضحى عشان يشوف اهله و اصحابه و يخرج او يسافر؟!

السنه دي انا قررت اني اعرف حقي اللي قانون العمل بيحدده و لقيت الماده 52 اللي لازم كل الناس تشوفها

للعامل الحق في إجازة بأجر كامل في الأعياد التي يصدر بتحديدها قرار من الوزير المختص بحد أقصى ثلاثة عشر يوما فى السنة .

ولصاحب العمل تشغيل العامل في هذه الأيام إذا اقتضت ظروف العمل ذلك ، ويستحق العامل فى هذه الحالة بالإضافة إلى أجره عن هذا اليوم مثلى هذا الأجر .

يعني ببساطة شديدة كل واحد فينا من حقه على اليوم التالت ده ضعف مرتبة في هذا اليوم عشان الشركة شغلنه يوم الاجازة ا لرسمية

تفتكروا هانعرف ناخد حقنا في البلد دي؟

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • DZone
  • PDF
  • Reddit
  • RSS
  • Twitter