About Me

My photo
PhD Candidate at Purdue University, Computer Science.

Tuesday, February 27, 2007

ليــس الغريب

أقوى أبيات الشعلر التى قرأتها فى حياتى، وعندما علمت كاتبها رضى الله عنه زالت عنى الدهشة.

ليــس الغريب غريب الشام واليـمــن .. إن الغريب غريب اللحــد والكفــن

إن الغــريب لـــه حـــق لغـــربـتــــه .. على المقيمين في الأوطان والسكن

لا تنهـــرن غــريبـــا حــال غربتـــه .. فـالدهـر ينهــره بــالـذل والمـحـــن

سفـــري بعيــد وزادي لـن يبـلـغـنـي .. وقـوتي ضعفـت والمــوت يطلبنـي

ولـي بقـايــا ذنوب لسـت أعـلـمـهـــا .. الله يعلمهــا فــي الســـر والعـلـــــن

مــا أحلــم الله عنــي حيـث أمهـلـنـي .. وقـد تمــاديـت فـي ذنبـي ويسترني

تمــر ساعـات أيـامـي بـلا نـــــــــدم .. ولا بكــاء ولا خـــوف ولا حــــزن

أنـا الـذي أغـلـق الأبـواب مجتـهـــدا .. علـى المعاصي وعين الله تنظرنـي

يـا زلـة كتـبـت فـي غـفـلــة ذهـبــت .. يـا حسرة بقـيت في القلـب تحرقنـي

دعنــي أنـوح علــى نفسـي وأندبـهـا .. وأقطـع الـدهـر بالتـذكيــر والحـزن

دع عنـك عزلي يا من كان يعزلنـي .. لـو كنت تعلـم ما بـي كنـت تعذرنـي

دعنــي أسـح دمـوعا لا انقطــاع لها .. فهـل عسـى عبـرة منهــا تخلصنـي

كأنـنـي بيـن تـلك الأهــل منـطــرحا .. عـلـى الفــراش وأيـديهـم تقـلـبـنــي

وقـد تجمــع حولـي من ينــوح ومـن .. يبكــي عـلـي وينعـانـي ويندبـنــــي

وقـد أتــوا بطبـيـب كــي يعــالجـنـي .. ولم أر الطب هذا اليوم يـنـفـعــنــي

واشتد نزعي وصار الموت يجذبهـا .. مـن كل عـرق بلا رفـق ولا هــون

واستخرج الروح مني في تغرغرها .. وصار ريقي مريرا حين غرغرني

وغمـضونـي وراح الكل وانصرفوا .. بعـد الإيـاس وجــدوا في شرا الكفن

وقـام مـن كان حـب الناس في عجل .. نـحـــو المغســل يأتينـي يـغـسـلـنـي

وقــال يــا قــوم نـبـغ غـاسـلا حــذقا .. حـــرا أديبـــا أريبـــا عــارفـا فطن

فجـــاءنـي رجــل منهــم فجــردنــي .. مــن الثيــاب وأعــرانــي وأفـردني

وأودعـــوني عـلى الألواح منطرحا .. وصـار فوقـي خريــر الماء ينظفني

وأسكـــب المــاء فوقــي وغسلنـــي .. غســـلا ثـــلاثا ونــادى القوم بالكفن

وألبسـونـــي ثيابـــا لا كمــــام لهـــا .. وصــار زادي حنوطـا حين حنطني

وأخرجونـي من الدنيــا فــوا أسفــاه .. علــى رحيـــــل بــــلا زاد يبلغـنــي

وحملــــونــي علــى الأكتاف أربعة .. مــن الــرجــال وخلفـي من يشيعني

وقدمـوني إلى المحراب وانصرفـوا .. خلــف الإمــــام فصلـــى ثم ودعني

صلـــوا علـي صــلاة لا ركـوع لها .. ولا سجــــود لعــــل الله يـــرحمنـي

وأنـــزلونــي إلى قبري علـى مهــل .. وقدمــوا واحــــدا منهــم يلحدنــــي

وكشـف الثوب عن وجهي لينظرني .. وأسكـب الدمــع من عينيـه أغرقني

فقـــام محتـــرما بالحــزم مشتمـــلا .. وصفـف اللبــن من فــوقي وفارقني

وقـــال هلـوا عليه الترب واغتنمـوا .. حسن الثواب من الرحمن ذي المنن

فــي ظلمــة القبــر لا أم هنــاك ولا .. أب شـفـيـــق ولا أخ يـؤنـســنــــــي

وهالنـي صورة في العين إذ نظرت .. مــن هـول مطلع ما قد كان أفزعني

مـن منكـر ونكيــر مــاذا أقــول لهم .. قــد هالنــي أمــرهم جـدا فأدهشنـي

وأقعدونــي وجــدوا في مساءلتــــي .. مالـــي ســواك إلهــي من يخلصني

تقــاسم الأهل مالي بعد ما انصرفوا .. وصـار وزري على ظهري فأثقلني

واستبـدلـت زوجتي بعلا لها بدلــي .. وحكمتــه علـــى الأمـــوال والسكـن

وصيــرت ولدي عبـــدا ليخدمهـــا .. وصـــار مالــــي لهــم حلا بلا ثمــن

فـلا تغــرنــك الدنيـــا وزيـنـتـهــــا .. وانظـر إلى فعلها في الأهـل والوطن

وانظر إلى من حوى الدنيا بأجمعها .. هـل راح منهــا بغيـر الحنط والكفن

خــذ القنـاعة من دنياك وارض بها .. لــو لــم يكن منهـا إلا راحـــة البــدن

يــا زارع الخيــر تحصد بعده ثمرا .. يـا زارع الشـر موقـوف على الوهن

يا نفسي كفي عن العصيان واكتسبي .. فعـــلا جميـــلا لعــل الله يــرحمني

يـا نفس ويحك توبي واعملي حسنا .. عسـى تجــازين بعد الموت بالحسـن

ثــم الصـلاة علـى المختـار سيدنــا .. مــا وقـــع البــرق في شـام وفي يمن

والحمــد لله ممسينــا ومصبحنـــــا .. بـالعفـــو والخيــر والإحسـان والمنن



الإمام زين العابدين (علي بن الحسين بن علي بن أبي طالب رضى الله عنهم)

اللهم لا تجعل الدنيا أكبر همنـــا

Sunday, February 25, 2007

Acts_as_Statable

I have been introduced to rails for about 30 days ago. I really don't spend much time on developing my coding skills. I almost know nothing about the ruby syntax, I took the shortest way and dig into my tasks.
Many people think that the best way is "do it yourself"; don't spend much time on reading tutorials, couple of days are enough and then release your skills to go further. me too, I believe in this. But I think also, that you have a good view to know when to stop digging.
It's true that i did good progress in my programming tasks, but i still find that this is not enough. I believe it's time to make some readings to enlarge my dictionary.

Hunting the best opportunity to do so is the most important part. It's not a silly H.W you do to raise your salary. It's the willingness of tasting some craft.
We were working on a small forum, when it comes to define a forum/thread to be closed, blocked, forbidden..bla, bla...whatever anybody calls these restricted access issues.
Yeah, it's simple. A tiny flag in some few minutes will solve the whole story...."NOW Let's move to another real task".
I started to think for something different. Why we don't just add some craft to this part; although it doesn't deserve all that panic.

My proposed solution to go for using a rails plugin. I know I may look silly, but Just I felt that I need to make more interaction with plugin.
I made a quick lookup for the available plugins, it was difficult at the beginning as I was looking for something without knowing what it can be called. Finally, I found the acts_as_enumerated plugin, it should be the one. I succesfully installed it, at the end it didn't work with me ( I may be missing something) but i decided not to give aq second try for now. I thought it doesn't satisfy my design. Instead i started to think of something which should like this:
Did I make something wrong here? It seems no sense to make a relation of many-to-many. Why could any forum have more than one state!!!
Well, I made this on purpose. What if we want in the future to expand our feature to be supported on the user-level. I mean, we may want to support (for example) "block option" for a forum on the user-level. In this case the forum will have more than one state depending on the user. We will need to add to the staging-table a new column carrying the user_id. Let's keep it simple for now, this is my first plugin, I don't want to get stuck.

Steps to create a plugin:
Note: the following steps are provided as guidance to create plugins.

1. In your project directory run the following command.

$ruby script/generate plugin acts_as_statable
create vendor/plugins/acts_as_statable/lib
create vendor/plugins/acts_as_statable/tasks
create vendor/plugins/acts_as_statable/test
create vendor/plugins/acts_as_statable/README
create vendor/plugins/acts_as_statable/Rakefile
create vendor/plugins/acts_as_statable/init.rb
create vendor/plugins/acts_as_statable/install.rb
create vendor/plugins/acts_as_statable/uninstall.rb
create vendor/plugins/acts_as_statable/lib/acts_as_statable.rb
create vendor/plugins/acts_as_statable/tasks/acts_as_statable_tasks.rake
create vendor/plugins/acts_as_statable/test/acts_as_statable_test.rb


2. Edit "vendor/plugins/acts_as_statable/init.rb" to look like this

require 'acts_as_statable'
ActiveRecord::Base.send(:include, ActiveRecord::Acts::Statable)
require File.dirname(__FILE__) + '/lib/stating'
require File.dirname(__FILE__) + '/lib/state'

3. your real work will be in this file "vendor/plugins/acts_as_statable/lib/acts_as_statable.rb"
you will need to define your methods just right here

module ActiveRecord
module Acts
module statable
..........
end
end
end

4. create the new classes stating and state
"vendor/plugins/acts_as_statable/lib/stating.rb"
"vendor/plugins/acts_as_statable/lib/state.rb"

class Stating < ActiveRecord::Base
belongs_to :state
belongs_to :statable, polymorphic =>true
............
............
end

class State < ActiveRecord::Base
has_many : statings
.......
end

Wednesday, February 21, 2007

Two Hours with Oracle

I attended the Oracle technology day. "Join Us for an Oracle Technology Day Highlighting Successful Implementations of Grid Computing".
The title seems very interesting; and the most interesting is that it was in Hilton green plaza, Alex. I decided to go and attend, it is a good chance, I thought so.

The seminar didn't introduce something new, it was based on the Oracle10g. Oh yes, "g" stands for "Grid". It didn't meet my expectations at all.
I couldn't stand for more than two sessions. the seminar was behind schedule by more than 45 minutes at the moment I left!!

The first session included an example with Amazon, it was the best part of the seminar probably. The problem facing Amazon is that they have machines:
  • Order entries: it easy to expect that these machines got the peak load in December.
  • Financial: dedicated for reporting and statistics. these machines will face the peak load in January to extract the reports needed to put the plan for the next year...etc
Enterprise grid computing model for IT

Anyway, although oracle10g is the most scalable database, it is still lacking when it comes to time and usability concerns.
Number of steps and time in oracle10g is almost 2x or more than DB2, and SqlServer.
There are a lot of improvement comparing to 8i, for example Enterprise Manager can be accessed through Browser and PDA clients.

I will appreciate if they enhance the usability before releasing the next release. I can't think of getting Oracle and wasting more than double my time, and hiring a DBA with a big salary .
For now, Oracle is forbidden for me.

Monday, February 19, 2007

Acts_as_Taggable Tag Cloud

I am using the Acts_AS_Taggable plugin in one of my applications. the application is a forum where users can add tags to any thread.
The forum includes a set of forums which in turn include a set of threads.
When a user displays the forum/show.. he should see a tag cloud involving all the tags attached to the threads in this forum.
I found this link describing the code for the tag cloud; but it doesn't satisfy my need as it can be used only on the threads level.
I should confess that the performance was not my concern this time.
in the vendor/plugins/acts_as_taggable/lib/tag.rb file I added this code:

def self.tags(options = {})
query = " select tags.id, tags.name, t1.count"
query << " from tags INNER JOIN"
query << " (select tag_id , count(*) as count FROM taggings, posts "
query << " where"
query << " posts.forum_id=#{options[:forum]} and "if options[:forum] != nil
query << " taggings.taggable_type='Post' and taggings.taggable_id=posts.id"
query << " group by tag_id)AS t1 ON t1.tag_id=tags.id"
query << " order by #{options[:order]}" if options[:order] != nil
query << " limit #{options[:limit]}" if options[:limit] != nil
tags = Tag.find_by_sql(query)
end

Following the link, everything should be working well now.

OOPS...Don't forget to restart the server!!!

Tuesday, February 13, 2007

Web Roots

Reading About REST applications....It is not something new introduced recently. It's not an innovation, it's an old trend, old standard , it's not Web2.0.
I found this article very good. It seems that there are some characteristics which did not get the deserved attention. What is really great, is that Web2.0 represents a return to the essential principles that guided the Web.
  1. Open Source: Yahoo was built on the foundation of open-source operating system(BSD Unix) and open-source language(Perl). The core of the Web was (NCSA Mosaic browser, NCSA and CERN HTTP Servers)
  2. Collaboration: Tim Berners Lee inventor of the World Wide Web and the leader of DIG put an original design for the Web to enable researchers to collaborate.
  3. Simplicity: we can find a lot of web2.0 products very elegant, simple, and focusing on only one single point; "make a single focus and do it well". This isn't an innovation. the RocketMail was one of the first major free webmail services, and it was focusing just on "e-mail".
  4. Architecture of participation: Epinion.com is a review site that was established in 1999. we can see now the success story of Amazon and eBay
  5. Lightweight programming model: many of the Web1.0 generation were built using scripting languages (example: Perl used in yahoo). Large companies used widely the complex web services stack and forgot the REST which was originated in 2000. (Amazon provides the web services in both forms SOAP and REST)
  6. Social Software: in 1994 Match.com was started. The "social software" was called "viral market".

Friday, February 09, 2007

Catching the "A"-Team

"I am a geek, I am friendly, I am a designer, I am strict, I am a business guy..Woow, I should be in the company's "A"-team!!"

If you really think that a company can have different classes of teams, then you are totally wrong. We can prove this by contradiction :)
Let's assume that a client calls for your service; a team will be assigned to provide the client for his needs. If he is lucky, he will get the "A"-team and get what he really expected; otherwise, of course he will be unlucky. When you claim that your company possesses a "A"-team, the later unlucky client will smash your head "Where the hell was that team when my project was under construction?".
On average, your company has not an "A"-team, customers will certainly turnover.

So, we agree that the dilemma is not individual; it's a team work by the end.

Now, you can start to ask yourself about your chances to catch the world's "A"-team.

6 great reasons to catch it

1-Possessing Positive Attraction:

We are all influenced by the "Law of Attraction". Everyone has his own impact on his environment. You should increase your positive impact. Are you trying to deal positively with events which you observe around you? Or you just complain your bad luck and the lack of resources?

You should also have the ability to reject negative thoughts from people surrounding you and substitute it by your own positive ones. Know that what anyone or any source offers you; it is only one view, one description or interpretation of an event or truth. It is only one perspective of an interpretation gained from other third parties who in turn focuses on the topic and did not experience the subject first hand.

Positive attraction will help you more for the team spirit, you will think for the best of the team on the long run. your colleagues will be inspired by your attraction. You will be a good team player who has a positive effect on his environment.

2-Building Trusts

Why trust is important?
" If you don't have trust, people won’t cooperate, won’t be committed, and won’t know where they stand.”

In The 7 Habits of Highly Effective People, Stephen Covey talks about an “emotional bank account”which is the reserves of trust that we build up in our relationships with people. T
he bank account becomes full when there is a lot of trust between people. You feel safe, committed, and comfortable with the other person. Trust is what makes us feel understood. It’s what makes work groups get along. It’s what makes us believe in people, organizations, and causes. Trust is the thing that makes us commit and stay committed, despite problems and misunderstandings.

Gaining trust:
Before searching for trust you must trust yourself.

  • Be reliable and available. Try always to be available when the client wants to talk directly to the people working on his project whenever he wants. Don't let him feel that he has to send 100 emails and 100 phone calls to make you appear online.
  • Keep your promises and follow through with commitments
  • Forgive and move on
  • Don't be threatened by people who are different from you
  • Tell the truth
  • Communicate openly and honestly

Be aware that Trust is bidirectional relation. You should evaluate how much trusting you are in order to make a successful trust construction.


3-Self Motivated.

Why anybody needs self-motivation?

Because if you want to improve your self esteem or improve yourself in any way at all you first need the inner desire and will to do it. Of course, anybody may be motivated by external factors, others may encourage you to start something new or begin moving in a positive direction.

But you cannot always rely on others to encourage you. To take up a new activity, hobby or challenge. The self-motivation is the way to "Initiative", without motivation you can't take any initiative on any level.

Increase your self-motivation

  • Focus on what you really enjoy doing. Think about giving it priority to start doing what you love doing.
  • Always keep a list of things you'd like to improve on and how you're going to do it.
  • from time to time, try to totally forget all the negatives you have faced and review all the success in your life.
  • Contact positive people.
  • Give your soul a break to read some good books.(NLP, How To increase your energy, Getting things done, Motivated Mind, How to Raise your Self Esteem, Self Help Stuff that Works..etc)

4-Knowing About Business.

Client-side:
Keep in mind the budgetary and time constraints that the client faces. This will help you define the customer goals and priorities in concrete terms. Further, it will help you to deliver a robust business solution through usable deliveries.

Tools-prespective:
Constitute a cross-industry perspective of the technologies you can consider in developing. You should keep some kind of aim at the different technology trends. Your attention should be varying significantly across industries. This can be done based on continuous data entries for the "benefit Vs mainstream-adoption" (can be called "Priority Matrix") for each technology such as Web 2.0, Ajax, Grid Computing, RFID, DNA Logic, Social Network Analysis, wikis..etc

The end result should be awareness (or at least prediction) of the following regarding each technology:

  • Prevalence: How prevalent is it in the current crop ventures.
  • Essential: does this characteristic stem from expediency or is it a core part of competitive advantage, Newness, Longevity.
  • Newness: Is this characteristic really new, or just rediscovered or relabeled.
  • Longevity: Will this last during the next five years.
A characteristic can be:
  • User: content, metadata, usability,
  • Open: open SRC product, public API, open process, open source platform,
  • Lightweight: Ajax, REST, Scripting Languages,
  • decentralized: RSS/Content, Code, Development,
  • Still Missing: Security, Transactions, Durability, Global Audience, Mobile.

5-Listening

You start a project by learning and listening. The result will be a clear plan that ensures results for you and a great experience for your customers.
Listen is another aspect to the "trust", it is an important key on the building trust journey.
You should know how much you like to involve others and seek their opinions when working on a project.
  • When you are talking with someone face to face, don’t answer the phone, check e-mail, or sort the papers on your desk.
  • Make time to talk one on one with your spouse or partner.
  • Be a patient listener. Not everyone thinks or speaks as fast as you do.
  • Avoid putting words in people's mouths.


6-Flexibility

Referring to the IEEE, flexibility is the ease with which a system or component can be modified for use in applications or environments other than those for which it was specifically designed. Yess that's right, imagine that you are the system or the component. So, we mainly mean your flexibility to switch between different methodologies and dealing with new concepts and technologies.

"There is nothing permanent except change"; said Heraclitus. That has been true throughout the history, but it is especially true in our exciting and ever-changing field. You should value the "Responding to change" and may be "search for it".


After evaluating yourself, do the NLP H.W to change behaviours.

First step is to stand outside the 'creative state' and think of a time when you were acting creatively according to your own standards. You should refresh everything you saw, heard and felt while reliving that experience.



After you have created 'creative' states follow these steps:
  1. Stand in the state that represents 'behavior' and think of a behavior that you would like to change. Make sure that you already have a representation of the behavior in one of the three senses.
  2. Move to the 'intent' state, and then ask the question, 'What is the intent, of the behavior?'. Once you get a sense of the intent for the behavior move into the 'creative state'.
  3. Ask yourself 'how else can I fulfill the intent for the behavior?'. When you get plenty of alternatives behaviors you can go back to the state for 'intent'.
  4. Review the alternatives and select the best three options. Step back into the state for 'behavior'.
  5. Test out each of the three options one at a time by imagining using each new behaviour in the original situation. Check if there are any objections to any of the selected options. If so, step back into the state for 'intent' and repeat the entire process, until all objections are satisfied.


Saturday, February 03, 2007

دع الأيـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــام

دَعِ الأَيَّـامَ تَفْعَـلُ مَا تَشَـاءُ
وَطِبْ نَفْساً إِذَا حَكَمَ القَضَـاءُ
وَلا تَـجْزَعْ لِحَـادِثَةِ اللَّيَالِـي
فَمَا لِحَـوَادِثِ الدُّنْيَـا بَقَـاءُ
وَكُنْ رَجُلاً عَلَى الأَهْوَالِ جَلْداً
وَشِيمَتُـكَ السَّمَاحَةُ وَالوَفَـاءُ
وَإِنْ كَثُرَتْ عُيُوبُكَ فِي البَـرَايَا
وَسَرّكَ أَنْ يَكُـونَ لَهَا غِطَـاءُ
تَسَتَّرْ بِالسَّخَـاءِ فَكُلُّ عَيْـبٍ
يُغَطِّيـهِ كَمَا قِيـلَ السَّخَـاءُ
وَلا تُـرِ لِلأَعَـادِي قَـطُّ ذُلاً
فَإِنَّ شَـمَاتَةَ الأَعْـدَاءِ بَـلاءُ
وَلا تَرْجُ السَّمَاحَةَ مِنْ بَـخِيلٍ
فَمَا فِي النَّـارِ لِلظَّمْـآنِ مَـاءُ
وَرِزْقُـكَ لَيْسَ يُنْقِصُهُ التَأَنِّـي
وَلَيْسَ يَـزِيدُ فِي الرِّزْقِ العَنَـاءُ
وَلا حُـزْنٌ يَدُومُ وَلا سُـرُورٌ
وَلا بُـؤْسٌ عَلَيْكَ وَلا رَخَـاءُ
إِذَا مَا كُنْـتَ ذَا قَلْبٍ قَنُـوعٍ
فَأَنْـتَ وَمَالِكُ الدُّنْيَا سَـوَاءُ
وَمَنْ نَزَلَـتْ بِسَـاحَتِهِ المَنَـايَا
فَـلا أَرْضٌ تَقِيـهِ وَلا سَـمَاءُ
وَأَرْضُ اللهِ وَاسِـعَـةٌ وَلكِـنْ
إِذَا نَزَلَ القَضَـا ضَاقَ الفَضَـاءُ
دَعِ الأَيَّـامَ تَغْـدِرُ كُلَّ حِيـنٍ
فَمَا يُغْنِـي عَنِ المَوْتِ الـدَّوَاءُ

Friday, February 02, 2007

Donormyl


Still fighting to sleep :(
2day i took "Donormyl"which contains Doxylamine succinate which is an antihistamine of the ethanolamine class which has a high incidence of sedation.
My sister recommended it for me. it is supposed that it reduces the time taken to fall asleep & improve the duration & quality of sleep.

i hope it makes a good effect to make me sleep.