Tuesday, October 19, 2010

CSD Forum Notification

In order to follow up with all the CSD forum new posts I made nice little app in Python that would notify you of any new posts and opens them all in your browser with one click


You can download it from here 

I will show you here how to install it and use it

Before you download the application you need to install python (in case you don't already have it) and python-gnome extra from the synaptic package manager






you will download the file forum.rar after extracting it to any where in your computer, use your command line to run it ... in case you don't know here it is I have the folder in my Desktop



And here it is telling me that there are no new posts


You will have to enter your user name and password only the first time after that the cookies are stored in file called cookies.txt in the same folder ... you will not have to enter your username and password every time you want.

The application will check for any thing new every 15 mins

If there are any new posts then it will tell you



You can click the CSD icon in the panel up there which will open the new posts in your default browser

If you want to see NOW if there are any new posts you can click the CSD icon it will tell if there are any click on it again to open the posts

If you have no internet connection the application will tell you that it is unable to check for you


One last thing if you want to shut it off ... just right click on the icon up in the panel that will do it :D

Please try it and tell me about any issues ... because the code is bad and needs refactoring ... I will try to add other options soon isA

You can download it from here 

w n7eb nshokr 3bas 3la tshge3o lya :D :D






Friday, October 15, 2010

Fe Net ??!!

Bsfty w7ed el router bta3o mzwlo 3la tool beb2a fi wireless bs mafesh net .... w bsfty bardo btzwel fi el kolya bsbab el net el wahmy ely te3mel connect bs mosh yb2a fi net ... 2olt badal m3od aft7 el terminal w akteb ping w bta3 a3mel 7aga zarefa keda

el mohem ana 3mlt python script 7ker keda lma te3mel run y2om 2ylk fi el notifications area bta3t Ubuntu lw fi net aw mafesh

ana 3mlt launcher bardo fo2 fi el panel ynady el python script 3la tool`

You can find the script on my Ubuntu one space here
tell me if there is something wrong with it (there has to be as I cooked it :D)

dah example





try:
    import pynotify
    if pynotify.init("My Application Name"):
        n = pynotify.Notification("Title", "message")
        n.show()
    else:
        print "there was a problem initializing the pynotify module"
except:
    print "you don't seem to have pynotify installed"


ady el shots

keda fi net




lw b2a fi wireless bs mafesh net



lw b2a 7drtk zaky w b test w aslan mosh 3amel connect l2y network



Saturday, May 29, 2010

CStack

I just added a stack implementation in C to the project on source forge, I will change its name but it seems that source forge has some problems with that :D
I will isA add other data structures
Wish me Good luck in my exams !!!

Saturday, May 22, 2010

C dynamic list

I have been following a programming course that is on Stanford University channel on You tube, it's really nice, and I made that implementation of a generic dynamic list in C, I put it on source forge, so you can have look it and tell me if there is any thing wrong with it :)

CList on source forge.

Wednesday, April 21, 2010

Mercurial





Sometimes you miss up your code with some changes that cause it not to work and you are unable to remember what you did or even worse not able to recover what you deleted, that's way their is something called Source Control, this helps you keep different versions of your projects, so you can just move between them without losing any thing, there are many stuff that do Source Control like cvs or svn, any way I came across something called Mercurial which seemed a nice thing to write about.
The guide is really good and simple, but I am gonna explain things little bit more and with some examples.

Installation

You can install Mercurial easily by typing sudo apt-get install mercurial in your terminal if you don't already have it, you also need to create a file name .hgrc in your home directory, Mercurial uses this file as your preferences, so you type your user name, and your preferred editor (ex. nano, vim or emacs).
my .hgrc file looks like this

[ui]
editor = nano
username = Khaled Hady

Creating a Repository

The first thing we need to do is to create a repository which is like telling Mercurial this folder is where I work and I want you to keep tracking any changes that I do.
If you already have a folder where your projects are then you will write two commands, let's say that my project is in a folder called Test in my home directory, and I have only one file "main.c" in it, that I want to keep track of.



I used cd to go to Test folder, then I used hg init to initiate a repository. I typed hg add because I want ALL the files to be tracked, if you want only some files to be tracked use
$ hg add first.c third.c
where first.c and third.c are the files you want to keep track of.
I also used the hg status command to know which files I am following and which I am not.





I used the nano command to edit the main file by adding few lines, then I added a new source file named newFile.c





After that I use hg diff to show the differences between the current version and the data in the files I am tracking, it tells me that there have been changes, so I type hg commit to make a new version that maintains the changes I made, and I am asked to type a comment which is important so I can keep track of my changes.





Now accidently, I changed the "newFile.c" and wrote some stupid code, then I commited the version so now I have two versions (0 and 1), I want my old version back (version 0)



first I will type hg log to see what each commit did in the project (so you must write reasonable words when you write the comment of the commit), then I will type hg update 0, I typed 0 cause I want to go to the first version which is zero, also you can use hg update tip to go to the latest version whatever it is.

Now the files are the same in version 0.




there is also a command called hg identify -n which tells you on which version you are now, if it has the form [num]+ (ex. 3+) this means you made changes to the version number 3 but hasn't commited these changes.


That's for now, there are other commands that we can talk about later.

Sunday, February 28, 2010

الفندق

أسف على التأخير فى تكملة ما بدأنا سويا ً عن سيوة , ليس هناك الكثير ليقال عن الفندق , كل ما استطيع أن أقوله أنه جيد و نظيف و يبدو أنه يتعامل مع أفواج فى أغلب الأوقات , الفوج يحتل طابقين , كل طابق يحتوى على حوالى 10 إلى 15 غرفة , و الغرفة تحتوى على 3 أسرة , الشىء الذى لاحظته أن عمال الفندق و هم بالطبع من أهل سيوة يأخذون عملهم بجدية عالية التى تتحول أحيانا ً إلى جفاء , لكن الشىء الجيد أنهم يتركونك فى حالك , فلا يحملقون فى الزوار و لا ينتظرون البقشيش.

بعد أن استرحنا بضعة ساعات , ذهبنا لعين اسمها "عين فنطاس" أو "فطناس" لا أتذكر, المهم أنى كنت متحمس أن أعرف ما هو مفهوم "العين" كنت أظن أنها مجرد فتحة "خرم" فى الأرض تخرج منها المياه , هذا التصور الساذج بالتأكيد كان خاطئا ً و اكتشفت أن العين هى شىء أشبه ببئر إذا نظرت فيه تستطيع رؤية فقاقيع و المياه تكون دافئة لأنها خارجة من باطن الأرض , عين فنطاس هذه كانت أصغر من عين كليوبترا التى زرناها فيما بعد.

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

 


 







Wednesday, February 10, 2010

Between pages and screens

Many novels have been turned into movies but not vice versa, this mostly takes from the novel more than it gives, even financially a person would buy a ticket rather than buying a book, but any way the authors get millions of dollars so there is no need to worry about them :D.

When a novel is turned into a movie, the movie will have two types of audience: people that read the novel and people who haven't, clearly the second type will be larger that's why the director will try to reach and satisfy them more than the first type, this leads to you watching something totally different from what you expect (in case you are of the unfortunate first type).

I just been to Sherlock Holmes by Robert Downey and Jude Law, the movie is great from the perspective of a person that never read any of Sherlock Holmes cases, but when I recall the cases and the voices (as Sherlock Holmes was presented by the BBC Radio in sixtieth) I see Sherlock Holmes as a man in his late fourties or early fifties, maybe in a good shape but not so athlete, we can say quite fat with a moustache, and as I hear the strong sound of Dr Watson, I see him similar to Sherlock Holmes but little older maybe, and with a full rounded face, a typical gentleman of London in the 19th century, well all this "imagination" of mine might be what Sir Arthur Conan Doyle wanted the reader to say or maybe not, but I am quite sure that while he was writing he never thought of Sherlock and Watson as two men destroying London while they are chasing criminals like the movie put them, actually the movie made them closer to cowboys rather than gentlemen of the 19th living in London, when you read any of the cases, you will rarely see the kind of extensive force and action that existed in the movie.

This surely puts the largest part of the audience in great satisfaction as they watch the two men jump, hit and make jokes, and they will surely enjoy Sherlock's mad acts and expressions, which doesn't match with the cases, maybe he was a little bit "weird" and unorganized but not a lunatic that is closer to insanity than geniosity.

Anyway as the director wants ALL the audience satisfied, he will make up with you be emphasising on details that might not be of importance but they were in the original Sherlock Holmes like: the address of the rooms where Sherlock and Dr.Watson lived which is 221 Baker Street, the names of the landlady "Miss.Hudson" and the detective "Lastrade". These things could have been ignored without disturbing you but the director kept them, just to tell you "hey man don't be upset this is still Sherlock Holmes of Sir Arthur".

I guess the same thing happened with "Angels and Demons" of Dan Brown and "The Twilight Saga" by Stephenie Meyer, on the other hand stories like "Troy" and "300 Spartians" were sent to life again by movies.

So what do you think about novels turning into movies.



 

Statue of Sherlock Homes in Edinburgh


A Drawing of Sherlock Holmes


 
Dr.Watson (left) and Holmes (right)



The ALL NEW Holmes and Watson


 

COOL isn't it? :D :D

Saturday, February 6, 2010

جبل الموتى

من الغريب أن تبدأ زيارتك للواحة بجبل يسمى جبل "الموتى" , و لكن هذا ما حدث فبعد أن وصلنا حوالى الساعة العاشرة صباحا ً اتجهنا إلى هذا الجبل الذى سمى بهذا الاسم لأن سكان الوحة القدامى كانوا من الفراعنة و كانوا يدفنون موتاهم فى هذا الجبل , ما استغربه هو لماذا تركوا الوادى و ذهبوا إلى هذه الواحة ليسكنوا فيها أم أن هذه المسافة كانت مأهولة بالسكان ؟ المهم أنهم لم يمتلكوا رفاهية بناء الأهرامات فاستخدموا الجبال المنتشرة بكثرة حول الواحة ليحفروا فيها سراديب لدفن الموتى , أحدهم يدعى سى - آمون , لم أتمكن من دخول المقبرة لأنها كانت صغيرة و عددنا كان كبيرا ً .
 
من فوق هذا الجبل استطيع أن أصف  لك منظرا ً عاما ً للواحة , فهى محاطة بعدد من الجبال التى شكلتها الأمطار على مدار ألاف السنين على هيئة مخاريط يمكن تسلقها بدون معدات , الجبال ليست عالية و ربما كلمة تلال الوصف الأدق لها , هذا على الأفق البعيد أما إذا نظرت قريبا ً فسترى عددا ً من البحيرات ذات شواطىء مهجورة , لست متأكدا ً إذا كانت هذه البحيرات عذبة أم أنها ناتجة عن صرف زراعى , أما سفح الجبل فهو محاط ببيوت بسيطة أغلبها يتكون من طابق واحد , الشىء العجيب فعلا ً الذى لاحظته طوال الرحلة أن البيوت فى سيوة هادئة بشكل غير عادى حتى تشعر أنها مجرد مقابر كالتى تمتلأ بها الجبال . هذه البيوت تفصل مجموعات ضخمة من النخيل المتشابك حتى أنك لا تستطيع أن ترى نخلة دون أن ترى معاها 5 نخلات !!





Friday, February 5, 2010

الطريق

ركبنا الأتوبيس بعد منتصف الليل بقليل بعد عدة محاولات "لدفس" الشنط فى أماكنها , لن أنكر أنى كنت خائفا ً من الطريق خاصة أننا سنسافر وسط الصحراء فى الشتاء فى ظلام الليل , أضف إلى ذلك أن مناطق فى سيناء و أسوان تعرضت لسيول قوية قبل السفر بعدة أسابيع , لكن الحمد لله لم تحدث مشاكل سوى أن الأتوبيس الثانى تعطل عدة مرات و تم استبداله فى النهاية .

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


واحة الغروب

بعد انتهاء فصل دراسى أول أقل ما يمكن أن يقال عنه أنه "غريب" (ربما نتحدث عنه لاحقا ً) قررت أنا و 9 من زملائى بالقسم الذهاب إلى سيوة فى رحلة نظمتها الكلية , خلال هذه الرحلة سجلت مجموعة من المشاهدات التى أريد أن أحدثكم عنها.


Wednesday, January 27, 2010

Clean Your Grub !!





If you are an Linux user, you must be familiar with the kernel updates (especially when you download a cut edge version), those updates are important and surely we do them, but the problem shows up when you find your grub full of kernels ( a kernel version + recovery), this happened to me I had 4 kernels with 4 recovery and another memory check, add to that I have Windows 7, so actually I had 10 items in my grub menu which makes it looks like a start menu :D, so I searched for a way to solve that problem, and I found this link ... it's very good, I tried it my self and removed two kernels and left two for safety, just follow the instructions but be careful coz you are missing with your kernel here!!