قُلْ إِنَّ صَلَاتِي وَنُسُكِي وَمَحْيَايَ وَمَمَاتِي لِلَّـهِ رَبِّ الْعَالَمِينَ - الأنعام: ١٦٢

Wednesday, September 30, 2009

Problem Solving

السلام عليكم و رحمة الله و بركاته

I came through three interesting links yesterday. May be they are common, I'm not really sure.
Here they are..

-UVA toolkit
Here you can browse for a problem, write the Input & it generates the output for you.
Perfect for testing when you think you have the problem right :)
It also links you to the problem statement and the statistics of the problem.


Here, there are 2 useful links
  • C programming basic
  • Algorithm
  • Math puzzle
  • IQ
where you can check the source codes of some problems.


If you navigated to the "UVa" on the left side, you can choose a volume and browse for problems.
Then you can check the category & difficulty of your problem.
If you chose a specific problem, you get some hints for it & sometimes the code is available too.

Monday, September 28, 2009

Detecting the "Enter" key

السلام عليكم و رحمة الله و بركاته

This is a short post.
almost a year ago, I tried to solve a problem on the UVa and i got it "Time limit exceeded". I knew before submitting that it won't be accepted, as i didn't know how to detect the "Enter" key press and it was needed as a stop condition for the first loop :D

anyway, here we go
if you are trying to use "cin" then you'll not be able to detect the new line.
when debugging, u may enter 10 new lines & then a value...i mean it will wait for the value and won't consider the new lines!

you may go to a lower level
if(cin.get() == '\n')
but that's when u are expecting the enter to be pressed
as it reads 1 char only

or u can use "cin.getline()"
and then check for the string's length
if == 0 then "Enter" is pressed
That's useful when u r expecting a mix of strings & enters


sources:
ACMaa Magdi (thanks :))

Thursday, September 24, 2009

Let's Share, shall we?

السلام عليكم و رحمة الله و بركاته

Do u remember having some milestone in a code & finding the solution somewhere online??
happens a lot, right?

i do remember our algorithms project...when my friends & me searched for the algorithms online
and sometimes we used to get the source code to be able to understand something
i remember LOTS of assignments and searching for codes to do a specific task
i remember searching for a function and not understanding it except when i see it in use
i guess we all had this very same experience through our past years in college

for me, it has been from the very first time I started writing code that I considered the Internet as my primary gate. It has always been helpful.
So i guess now it's time to pay back.

Many people have this urge of helping others. I felt this spirit in FCIS.
Students giving sessions, posting informative topics in their blogs, helping each others in anything & everything!

I owe Roaa for motivating me to do the prolog project. I used to hate it, really, and i just didn't know what could be done with this silly language.
I downloaded her documentation & saw the program snapshots. Thinking that she was just as old as me, and nearly with the same experience gave me the required confidence and the will to do something good.
I also remember in our algorithms project when we didn't know how to read the image to do the processing we needed, we almost did it because of her topic here
last but not least, open sourcing their image package project :). Well, i personally think that it was a great idea, and I guess it will motivate people to share more :)

So now that I have the urge to help others. I decided putting every useful thing I write online for people to get use of.
I know for a fact that I'm not very good in writing code. Maybe I'm not the most organized nor the most optimized. But at least I find a way to get the job done, and maybe it will help someone.
It's an open invitation for you to help others :)

Good links:

feel free to add more resources :)

SPREAD KNOWLEDGE: الحكيــــــــــــــــــــــــــــــــــــم

السلام عليكم و رحمة الله و بركاته

just read a post in my little sister's blog, and thought of sharing it

SPREAD KNOWLEDGE: الحكيــــــــــــــــــــــــــــــــــــم

It reminded me of the quote:
"Two men look out the same prison bars; one sees mud and the other stars."

Most of the time ppl have different opinions in the same thing. You may ask yourself how come
someone saw something in some way different than u? and u may think it is totally weird and everything, but it is not weird at all!
we all have different backgrounds. We don't share the same type of thinking nor the external effects.
In other words we don't all wear the same glasses!

So what can we do about this?
It's really simple...
-listen to other people
-put yourself in their shoes
-accept that we are all different
-try to appreciate a little

and remember to make sure that you understood what the other person is telling you in the way he/she means it.
always ask for feedback :)


Sunday, September 20, 2009

تكبيرات العيد

السلام عليكم و رحمة الله و بركاته
very nice takbeerat :)
enjooy :)




Happy Eid

Ramadan farewell...

السلام عليكم و رحمة الله و بركاته

رمضان سايبنا و رايح فين؟



ربنا يتقبل منا جميعا عملنا في رمضان
و يرزقنا الثبات بعده :)

عيد سعييد :)

نونو

Friday, September 4, 2009

Super

السلام عليكم و رحمة الله و بركاته

just watch the videos :D









M
arvelous masha'Allah


Wednesday, September 2, 2009

Scrapbook Builder

السلام عليكم و رحمة الله و بركاته

Just found an interesting site that helps u build a scrapbook.
I tried to design something on it
and I came up wiz...
FCIS Paradise DAY








This is a sample of what u can do wiz the site :)
Hope u find it useful :)

http://www.scrapblog.com/builder/



Emulator wiz Design

السلام عليكم و رحمة الله و بركاته


I had a nice experience last term wiz the Architecture project that I wanted to share here. We were supposed to make an emulator (for those who don't know the project, it's a simulation to what happens inside the processor).
The normal way to make this project is to use some IFs & ELSEs. My friend (who was a senior then) told me that it was so easy and that they called it "donkey work" :(
Since the emulator was my task in the Architecture, I got so frustrated to know this information and decided to think of a better way to do it.
My friend and I asked dr.Ahmed salah & he told us we could make it with components like what we did in VHDL and he left it open for us to know how this would be implemented in C#

First Milestone:

How to make a good design?

That was solved using design patterns. Here we used the observer pattern.

“ IObserver” was implemented by all the components & “ISubject” was implemented by the Clock.

interface IObserver

{

void Updateobject(ISubject subject);

}

interface ISubject

{

List ObserversList { get;}

void AttachObserver(IObserver observer);

void DeAttachObserver(IObserver observer);

void NotifyObservers();

}

Second Milestone:

How to connect all of these components?

We made a dummy class called processor, where all the wirings took place.

Third Milestone:

Same wire, 2 endpoints!

The same wire connected 2 components, and it doesn’t make sense to change the value on one endpoint without changing it on the other end.

We needed here a simple referencing to the values of the 2 endpoints of the wire. This wasn’t supported by the simple ref keyword in C#. I really can't remember why it had a problem. But I Do remember spending 2 sleepless nights trying to solve it, so it had a problem :D. Anyway we had to search for another way to do it.

We learned that when making an object of a class, we are given a pointer to this object & not just the value. We used this tip to implement our own passing by reference.

We made a MyString class, that didn’t contain anything but a string. And whenever we wanted to pass a string by reference we made an object of MyString & used it.

class MyString

{

public string str;

public MyString(string Str)

{

str = Str;

}

}

Here is a snap shot with all the classes we used in our project.

At last I wanna thank all the people who helped us.

Dr.Ahmed Salah & Dr.Karim Emarah for their support all the time.

Alaa Shaker for introducing us to design patterns.

And of course my team members: Sara (partner in this project), Menna & Mona for your help and ultimate trust :)

And for my team members, plz correct me if I said any wrong information and kindly add any missing ones.