Sunday, December 31, 2006

يوم العيد

دايما بيبقى في حاجه مختلفه يوم العيد. معرفش حد غيري بيلاحظ الكلام ده و لا لأ.
مهما كان الجو مهبب فبل و بعد يوم العيد, دايما تلاقي بوم العيد شمسه طالعه و جوه معدول.
و كمان دايما بتلاحظ ان كل الحاجات اللي حواليك مشرقه و كانها فرحانه. دي مش اول مره الاحظ الكلام ده, دانا بقالي اكتر من 4 سنين بلاحظ كده.
و كمان ايه. بتلاقي الحاجات متسهله كده يوم العيد. بعتي مثلا لو عندك
error
تلاقي ربنا فتحها عليك كده و اتحل.
سبحان الله فعلا.
عارفين بقى اكتر حاجه بحبها في العيد ايه؟ اني بلاقي الناس كلها فرحانه و مطرح متبص تلاقي ابتسامات؛ حاجه كده على غير العاده. انا بحسد اليابانيين علي انهم مبتسمين دايما طول السنه. نفسي نبقى زيهم و خصوصا ان البسمه في وجه اخيك صدقه.
اما اكتر حاجه بتغيظني ان في راجل مستفز مصر يقول "الله اكبر الله اكبر ولله الحمد" في الميكروفون لوحده و يلغوش على صوت الناس. اصل انا بالنسبالي افضل اسمع صوت الناس بس و افرح لما الاقيه مسمع, مش صوت مكروفون لما يقف تلاقي الناس ولا كأنها بتكبر في سرها. حلمي: اسمع مصر كلها و هيا بتكير كده من غير ميكروفون؛ زي الحج كده.
معلش كان نفسي ال
post
تكبر عن كده لكن انا مش متعود اكتب عربي. :)


Saturday, December 30, 2006














[Click to enlarge]
This is the most recent Screenshot on Bochs.
It shows in the first 8 lines, the GRUB output. After that the components status. Also A gray line to indicate that the lines before it was before paging, and lines after it was after paging. Then a test of the panic() kernel function :D.

ArOS, what to do now ?

Well,
http://www.osdev.org/osfaq2/index.php/HigherHalfKernel
http://www.osdev.org/osfaq2/index.php/HigherHalfBareBones
http://www.osdev.org/osfaq2/index.php/BareBonesC%2B%2B

I should before implementing the memory manager (just bare kernel allocators for now), to move to the higher half memory, and to enable C++.
I have to move to the higher half now because doing so later will be harder. Also I really have to enable C++ so I'd write a decent infrastructure of the HAL (H/W Abstraction Layer) below the memory manager, so It becomes much easier to develop and maintain the memory manager. Or if it is not a full HAL, it just can encapsulate the annoying-to-handle bit-fields of the flags in the Page Table Entries of the Page Table.
What I should do exactly now isA is to read those links and see how I can integrate them into my code. The integration would destroy half of my code since it requires paging to be enabled from the very start; which I don't do. I still don't get what the status of the GDT if the paging was applied so early, I know it still have to be there, because at least of the IDT, if it wasn't for Call Gates or TSS.
About the C++ thing, I am thinking of integrating libgcc/libsupc++. (see http://www.osdev.org/osfaq2/index.php/Doing%20a%20kernel%20in%20C%2B%2B section: Full-runtime support). It is because I want to enable Full-runtime support so I don't have to worry about it later.
It's some painful tasks to do, but we've gotta do them sometime :(. I hope I get them done some time soon, because they are just standing in my throat and I am almost choking :S.

Wednesday, December 27, 2006

Allocators' World Party!

In this link http://www.cs.rochester.edu/u/scott/252/assignments/A7.shtml, an interesting assignment. In short, you should do you allocator. malloc/free is an allocator. You should do you own version. Say, my_malloc/my_free. The interesting part that in our faculty, we didn't hear about the word "allocator" in the first place, how about making one! Also notice how well-defined the requirements are. Correctness/Performance/Style has well-defined points per each. In our faculty, and I assume in most FCIs in Egypt, the requirements are according to the doctors mood, i.e. not well-defined, ambigious, or undefined at all. Also there is no clear point-per-requirement mapping, in best cases, it is clear only in the evaluator's head, i.e. students have no idea about them. Also there is no reserved points for bonus; like Performance. The style part has no attention at all. Baseline, get me one student in Egypt who can make that assignment and take at least half the points (success ratio). Also note that in such an assignment(project ?) there is support routines, a library, or a framework to help students do the part that matters, not donkey-work's parts, irrelavent parts, nor time-wasting parts, i.e. goal of such project is well-defined and should not be distracted. Also, the person who set the project have an idea how it can be made in the first place ;) which is not always the case here!
Can anyone who went to Egyptian FCI (not even a student) do this assignment ? I am sure there is but they will be very few, it is a shame that such an assingment is very popular in such courses and we didn't even hear the terminology!

Monday, December 25, 2006

How to never lose ?

What's a loser ? And what's a winner ?
Traditional answer :
A loser is a person who lost something; a game, a compitition, someone etc. A winner is the one who won what a loser lost.
A loser looks down to himself in most cases, feels angry and thinks he must win in another time to have a value.
No one wants to be a loser.
But, look at it from another angle.
You lost, so you learned there is something you did that was wrong, then you learned a new thing, then you've won something that the other winner didn't win. Strange viewpoint, and I am almost sure it didn't convince you.
Ok, let's change the viewpoint even more. If you lost something, then you have less ways of losing it again! :D. Clarifying that, let's say that there is n ways you could lose a runnig race, you don't know all of them yet, so you aren't prepared for each one. So one of these ways have made you lose. The next time you know that way, so you are prepared for it, so you now have n-1 ways of losing ;). One after another, you'll eventually have zero ways of losing.
The inventor of the electrical light bulb, Thomas Addison, who performedthousands of experiments until achieving the desired result. "Who here has made that many attempts to succeed in something? Do we try more than two or three times before we give up?", "there is no such thing as 'I can't do it', there is 'I can't do it yet, and I have to keep trying'".

So personally I see each failure as a step towards success. Perhaps programming have tought me so, fixing an error after anothet till the compiler is shy from saying another error cuz keda 7aykoon beystahbel :D.
A real loser is the one who don't learn from his failures. And a real winner is the one who keeps learning till he reaches. A real loser is the person who stops trying. And a real winner is the person who never stops.
One last word, A real winner of winners, is the person who is not satisfied with the desired result after he achieves it and keeps trying to improve it further and further till he makes the best result in the history and possibly for several centuries to come. That is a real scientist mind.

So, people who read this post, if you have failed in something, don't get stuck at that and keep crying about it forever, get over it and just try another way. It is the same concept as lighting a little candle is better than damning the darkness thousand times. Don't be just optimistic, believe in your capability to do it and foresee the expected ways of failure to decrease the times you have to try.

A side note, there is a group (osra) in our college, that had failed many times, but personally, I never gave up on it; believing that as we keep trying we sure will reach isA. Even if we just reached experience of how to avoid such failures again, that would be enough. But what did I say above ? If you actually reached that, there is nothing called 'enough'.

keep in mind
ان الله لا يضيع أجر من أحسن عملا
و لا تنسوا التوكل على الله
و لا تنسوا حمد لله علي كل حاجه عشان اللي بيحيبوا ربنا هوا اللي فيه الخير بعد ما تكون طبعا عملت اللي عليك

Friday, December 22, 2006

Java :(

In our Java project, I had some frustrating errors that I can't figure out till now.
The project is video streaming and I am using JMF.

I tried to send frame by frame at first. The client only displayed the first frame and stopped althought the server is showing the video correctly. I discovered after five days of tracing and testing the BufferedImage and ObjectStream and BufferToImage, that the problem was solved when I reallocated the byte array every time instead of reusing it!

Another one, using the RTPManager of JMF, both the server and the client was on the same machine, the program never worked when using 127.0.0.1, I had to use the actual IP of my machine (I wonder what if I was disconnect and don't have an IP ?)

Today I had a strange error too, I still didn't trace it. I initialize ActionEvent(this,0,"GotPlayer"), I get an exception telling me the the source (this) is null. I tried to ActionEvent(new Object(),0,"GotPlayer"), I got the same error too!

Please somebody have an answer tell me, I really got tired of that.

Ah, by the way, sometime we got an error in our MFC project, a line that assigns a function to a function pointer, we traced it, the funtion pointer is still = null after the assignment although the watch of the function itself (the right hand side of the assignment) was not null.

Either, the evil forces of darkness has conspired upon us, or this is really some programming myths that should be reserved for history cuz maybe after 1000 years the sercret will be unvield!

Sunday, October 22, 2006

C++ in the kernel

Welcome again, it have been a long time since i wrote here, cuz my pc was damaged and etc... a long story.
Anyway, I wanna write a little about my adventure for enabling C++ in the kernel. C++ isn't like C, it needs some runtime support, for calling constructors and destructors of static and global objects, also for exceptions, RTTI, thus dynamic_cast (which is btw is like the 'as' operator in C#) , and new and delete. Just compiling C++ without giving support you will end up only having namespaces, classes and templates and other features I don't remember now.

You have 2 options either ignore those features, or integrate a standard C++ library in your kernel. Sure you won't create your own. You can use newlib, or libgcc along with libsupc++. You still have to support several functions for them, like malloc and free and abort etc. This won't call constructors for you. I found a trick but I don't know yet if it will work. To make GCC generate the _init function that does that, which is supposed to get called b4 main, and call it myself. I will try it after recompiling those libs to allow them to have weak pthread symbols so I don't have to implement pthreads now.

Sunday, August 20, 2006

Organizations Death and Life

Hello,
This post is gonna be boring, I don't even know how to start it.
Anyway, it is about how organizations die, and how they keep living. It's gonna cover a small part of leadership aspects.
Well, you are a leader of an organization, you have a vision, you have a goal which you have created that organization for. You see that goals clearly, you know what should be carried out to achive it. You have got 'employees', although I wouldn't prefer that term for NGOs (non-govermenta organizations) and volunteer organizations but I don't know what they call them in those, maybe members?
Anyway, you have had circumstances and left that organization, there will be 2 scenarios. The first one, the organization falls, and the second one the organization keeps workin fine and maybe outcome your own expectations or visions. You as a leader did compare what's happening to your vision, and telling ppl what to do. After you leave, they won't be able to continue without your vision and directions. So you can not leave them and take your vision away with you. You can't just depend on yourself and no one else in thinking and giving orders. You have to make EVERY member see you vision exactly (or even better) like you see it. Actually, no member should have joined until he sees the vision and BELIEVE in it and live for it, this is the only way for your organization to stay up, from the smallest NGO to the government it self. This shall keep government employees from taking bribes or from dropping effecient ppl for 'wasta' or so. Because they care about the success and achivement of the goal that they see and believe in.
My words are not just for leaders, it is for 'employees' too, don't join an organization unless you know,believe, and live for its goal, or your will be a useless member and don't deserver your salary (if the organization gives salary). And for leaders, appreciate who beleives and makes the most good for the organization. Healty organizations for you ;).

Thursday, August 10, 2006

Remember how your memory works

I was thinking about Neurel networks and memory an human brain. And about how humans can remeber stuff. You can easily remember stuff in your short-term memory. But remembering sruff that is not in it, requires a stimulus. In my perception (I don't know whether it is right or wrong), you can do so cuz you can make a loop on all the stuff in your short-term memory cuz it is small enough. But your long-term memory have incridible amount of data, as proven a human never forgets anything, you remember every smell every event every picture, even if you saw it for less than a second, you just don't know that. So it is impossible to traverse it unless the part you are traversing are well structured (from understanding), or from a stimulus from the short memory. To see that, see what you do when you try to remember something, you always try to remember something you aculally remember then see if that recalls something, if not, you remember the second thing and so on, till you find what you want to remember or you fail.
I am still thinking, what that have to do with a neural netword representation ? I don't think it is simple as simple recursive neural networks. As in NERO game (http://nn.cs.utexas.edu/NERO/about.html) skills are encoded in the neural netword structure. What is the difference between skills and knowledge in the storage context ?
Another thing, neural networks and genetic algorithms have united in that game (and long time before it too, that game's just testing modifying the net structure not just the weights), but I think there must be a way to involve SWARM in a more sophisticated way to enhance learning. I am also thinking about some informed neuroevolving agorithm, not only making offsprings by random mutations and combinations, but by have an insight about the neural network way of working, although humans don't know it yet; a neural network, in my perception, is just a big generic boolean formula.
This is all ideas of research, which I hope it wasn't made before.

Wednesday, August 9, 2006

Programming riddle 1

I have needed to do this for a topcode.com problem, the problem was to rotate an integer, so 78 becomes 87 and 40098 becomes 984. I have sloved it (numerically, not as string). But I am gonna give you a part of it to solve, get me the highest significant digit. In 78639 the highest signigicant digit is 7. It is the left most one. Anyone have an idea :) ?
You are to solve it numerically, not by converting it to string and getting the first character.

(hint: highlight the text to see the hint
consider using logarithms
)

Tuesday, August 8, 2006

Is this called a chat bot or it is more complex 1

The Arab OS now is at the phase where it is ready to integrate with a memory manager and a process manager. So since the memory manager phase are somohow separated from the previous bootstrap phase, I decided to have a break from the OS for now (it have been a month and a half, I think). I am some how considering a new name, since ArabOS is just a development name, I thought about ArOS, what do you think ?
Anyway, in the break I have been interested in a new field, Natural Language Understanding. After I have seen a Question Answering System (QAS) in the ESEA Job Fair. Not all NLP applications are NLU, in my perception. Anyway, I thought about an application that can learn by itself from the web, or from you, and you can ask it for information, and personal opinions, and exchange jokes, and you can give it orders, like open that media player, play that song, or if it is a robot, move that TV, etc. I don't think this is just a chatter bot. chatter bots techniques are somewhat hardcoded answers or behaviours for certain patterns. There is A.L.I.C.E chatter bot, which depends on a large XML database of hardcoded-templated answers which he chooses an answer at random (it seems good at low level of complexity in the input). There is also encarta@conversagent.com which depends on an SDK which maps behaviour to certain templates.
Anyway, a chatter bot is desgined for making coversations, it won't be able to summerize information on its own. But an information retrieval application can like http://start.csail.mit.edu. Although that 'Start' can make very basic context tracking and a dialog answering skills, it is not in the same level as the previous too; it is not much of information retrieval system as it is of a QAS. Information retrieval (or information extraction), in my perception, is more complex than a QAS. It is the same difference between "get me info about cooperation between Masers and Lasers, and the relation between those and the hypersymmetry theory", and "how can Masers and Lasers cooperate?".
In the Artificial Intelligence, structures and strategies for complex problem solving, George F. Luger, chapter 13, "understanding natural languge"; it mentioned that SHRDLU block world's application have showed that a 100% knowledge of the world, can make natural language communication possible.

to be continued...

Saturday, July 22, 2006

Long way to go OS

While I was searching on how to switch to graphics mode so I can support Arabic text in the console, I ran into the Linux Framebuffer project. It makes their console supports graphics and unicode - and evening basic windowing and events. I looked a little into the source, basically they implemented tens of times, each for a specific VGA vendor or so. The important thing is that they really have a biiig work to support text on that "console" - A whole folder. While there were hundreds of files in that project, I saw only two or three. Each one not less thant 3000 lines. Especially the fbcon.c :S. I checked what stuff they call in the kernel, they at last include 20 header files of linux kernel, so porting is not an option. They also call semaphores and other stuff. So I think it is still too early for this kind of work for this OS - at least to be such integral and perfect. Maybe basic support for arabic character will be much simpler - I hope!

It is - as I seen in the linux kernel - a long way for us, but we will never arrive there if we didn't move - even if a cm per year. By saying "oh, it too long way, I won't do it" we are going no where. I believe in that integration over a very tiny development produces a big piece of work, but if there is no tiny development -"continuously" by the book - it won't be integrable and nothing would be produced.

For now I am still working on the low-level allocator. I think we're past the phase just-do-something-that-just-works. Making such thing will make it harder to optimize and maintain. So I am taking the very slow careful way. Maybe even at times leaving it and returning to older parts of other modules. At this time I am seeking code consistency and maintainability. Making something that just works and returning to make it better later means that you *will* rewrite it, it is a fact. The only problem here is that we didn't make an OS before we don't know how maintainability needs at this level. We yet have to keep going till we know, which is bad thing. The only thing that can make that better is to go for new modules and return to older code, and so on for every new aspect of the system to insure integrity and consistency and expected behaiuor is really what is expected.

Do you think I should move all this OS stuff to a seperate blog ? I am thinking in it.

Friday, July 21, 2006

ArabOS Road map

Enable A20 line ( to address the full 4 GB): done by grub
Switch to protected mode and 32 mode: done by grub
VGA Memory text mode management: done
GDT,IDT,PIT,IRQ Remapping: done
Paging: done ;)
Memory management: under development
multitasking: under development
-security,users,sharedpages,priority,copy-on-write
IDE drive: future work
File System
Porting LIBC and Bash and GCC: future work
Executables loader
Inter Process Communication IPC
VM disk swapping
Device support
- DMA
- PnP
- Device drivers
--- MicroKernel

Thursday, July 20, 2006

ArabOS design decisions 1

Design decisoins is something that SW developers do when they program. But OS design decisions have a big influence that one decision can remove and add thousands or even millions of lines of code. Anyway this article is mainly about the design decisions of ArabOS and what I did choose and a rationale.

The first decision is to use a premade bootstrap loader, or a custom one. I read that for new OSs it is better to use a premade loader so one can focus on the development of the system rather than reinventing the wheel. Although I have made the bootstrap loader a long time ago, I decided to use GRUB (Grand Unified Boot Loader). It makes so many things for you. It supports Multiboot, loading from a CD or a flobby. It initialyzes 32-bit protected mode for you. It also queries the BIOS for the reserved memory areas.

The second decision is to use GCC or MSVC. Well, I didn't choose; I tried. Some stuff didn't work with MSVC, especially the multiboot support thing, and special functionality only provided by the linker script of GCC(LD). So I had to move to GCC, since having problems from that early stage, what whould happen after a long time ? (Also GCC have support for OS development)

The third one is to use NASM or GAS. After trying, especially I am not professional in GAS, I had to do stuff in NASM (long jmp didn't compile with GAS, I don't know why). I am using most of the asm files as NASM, but I am intending to move to GAS later.

Next is to develop under Linux or under Cygwin. Actually, Cygwin is PAIN. I can't use ELF file format which prevented me from linking my kernel to run in the upper 2 GB VM (Thanks to GRUB which didn't understand PE file format). But I used Cygwin because I used VMWare. Now using Bochs which run under Linux, I can move to Linux anytime. But I'd rather after a while.

After that paging VS segementation; Upper half VS lower half; has predefined answers. Paging and Upperhalf. Search for them.

C VS C++. Well, C++ in an un-hosted environment is a pain. I have to make the runtime support my self, not even the whole thing. So using C99 is actually fine and comfortable as long as I don't need namespaces, templates, and non-singleton classes.

VGA VS Text-Mode. Text mode. There is tons of VGA drivers out there, XServer+KDE will do it all.

Monolithic VS Microkernel VS Exokernel. In the current phase of development, I am going for monolithic cause of simplicity. Later I can switch to Micorokernel. I don't think Exokernel is an option.

Single or mutiple platforms. Not now, it's too early, so I'd go for single. Same for multiple CPU support.

Monday, July 17, 2006

C# is subway, C++ is automobile

I've been thinking of an analogy between C# and C++ to the real world. Suddenly It popped into my head when I was in the subway. I was thinking of comparing the user of the subway to the driver of a car but it didn't seem fair so I decided to compare the subway driver to the car driver.

As a subway driver you don't have to steer, nor watch for intersections. In C# you don't have to make hard design decision, not to watch for platform support. But as a car driver you have to steer, change gears, and watch your sides even not in an intersection. Likewise in C++, you sometimes have to decide whether to sacrifice one thing for the other, usually memory VS time, or flexibility VS simplicity. You also have to watch different platforms Endianess, int size, and such stuff.

In subway you have predefined stations, and the path is optimized to fit for those, it would be costly to head somewhere that is not near a station. In C# you have predefined intentions in the language and the framework design, you would suffer if you decided to do something that wasn't intended to be done. For example, C# is business-oriented; its classes are best fit for common business tasks; would you consider doing a NASA space shuttle software using it ? In a car, you can virtually go anywhere, provided you have the right directions- and enough gas. Not always the paths will be perfect but some paths can be even shorter than the subway path, If you were an experienced driver or you have a good GPS map. In C++, you can do anything, provided you have the theoretical knowledge- and a linker that can link to ASM in case of system programming. You can do stuff in C++ by nature needs efficiency. Try to write a memory manager (in the system programming context) in C#, it is possible but it would take more time than to do it in C++ WITH the same efficiency.

Driving a subway is boring by nature, but it can be fun if you have a big speed. In C#, you do nothing special, every thing is ready for you. It would be fine in case you are making an enterprise-scale project. In a car, driving is boring and hell for people who can't drive well, they will keep banging in every turn, but if you know the tricks of it, and fair knowledge of the motor and its capabilities, you can do magic- see NFS: Underground 2. In C++, it is hard and ugly code if you don't have the essence of mastering it. If you do, you Will enjoy it, and can do software you never imagined it is possible- read for an example about loop-unrolling.

You would absolutely use subway if you are gonna a predefined place and you don't want to make a lot of effort. But you would use the car for a custom path that is not in the subway's map. Same in C# and C++, you don't have to use only one for all of the time. Just use what is suitable for what you wanna do. And remember, knowing only how to use the subway or the car, is not good enough, cuz at some point you will need the other.

Finally, some points here may have personal influence because I like C++. I admit I hate using C++ for some tasks, but I like its power and flexibility regardless of its complexity.

If you have another opinion or seeing something missing, you are welcome to comment.

Friday, July 14, 2006

ArabOS news 1

Hiiii again :D
Finally I have managed to fix some annoying bugs about the cursor update and the programmable interval timer. I also have added a starter basic keyboard support. It seems clear now how to support DMA, and support devices. I am now being busy in reading about paging and virtual memory. Process management needs memory management. And virtual memory needs a file system. So I will not support VM now, just physical memory. You can visit http://del.icio.us/meemoxp for links about all that. I add each link I see interesting to it.
A quick summary about the OS state:
PIT: working fine.
Terminal: very basic but working fine.
KB: very basic and working fine.
I mean by very basic that the H/W stuff is working and all the remaining features are software stuff.
And by the way, another killer bug was also for using && instead of & !!!
The most of the past weeks was mainly for cleaning the code, setting constants instead of magic values, commenting on code, editing the makefile and well-structuring it, modifying the linker script, and fixing some bugs.
The main problem that you can't count on the code working well for being bug-less, and that you can't count that there is no better way of doing things. You also can't count that you know all features provided by each of the chipsets on the mother board, like APIC etc. You also can't count that you can catch and solve all the exceptions (especially hardware ones) because some may only occur at very rare occasions. Some exceptions once discovered might make you change more than 3 files and change a big structure of the system, especially at this early stage of development.
I am now going for monolithic kernel, not microkernel, and going for stack-swapping for process scheduling, not TSS.

Thursday, July 6, 2006

Japanese section 1

I have attended my first section yesterday, and the instructor was nice :D.
We have taken 15 characters and about 6 words. The characters are 5 vowels, 5 k, and 5 s:
あa
えe
いi
うu
お0

かka
きki
こko
く ku
けke

さsa
せse
そso
しshi
すsu

The words is:
うえ
こえ
あし
and some other words, kefaya 3leekom keda :D

Wednesday, July 5, 2006

Japanese How to program, er, how to learn

I finally got the opportunity to join a Japanese language course with A.Mohamadeen. I am really happy as I like that language very much. I have been trying to self-study it a year ago. It is easy, but self-studying it will take a really long time. I wonder if blogger.com supports Japanese, as I think I will isA occasionaly blog using it(for practicing). I am so exited that I will attend my first section today :D I hope the instructor is nice :).

Monday, July 3, 2006

The bright side(Masr lessa be7'eer)

I have seen a good commercial on MBC, showing the dark side then its bright side. Like, failure then ambition, dispute then democracy, I don't remember them all. I have really been sick from the pessimistic environment around us. I want to look to the good side a little. This article is about some of the good sides of the current situation of Egypt.

The education in our schools and universities at the average level dosn't seem to be quite comparable to other educational systems. Some students graduate not knowing even how to write correct Arabic, not mentioning English; how would there level be in other academic subjects they studied then! The bright side is that some students refuse to be graduated-ignorants, they study and study by them selves, maybe even reaching higher levels than other educational systems. There is also students who try to help younger students instead of leaving them by their own.

As proven, higher density of population causes aggressive manners. That's why you always see a man yelling from his car at other cars' drivers for the least cause, if not physically hitting them with the nearest piece of metal. The bright side is that if you fall out of sickness suddenly in the street you will find thousand hands helping you out. Maybe one of these hands is the hand of the person you've been yelling at. El masryeen ged3an ya3ny.

If you are for example making an OS, you will find people saying “Will you do something new, it is useless, you can't beat the XYZ's OS, you better learn something to help you in your career, etc,..”. You will hear a lot of this discouraging statement for making an RDBMS too. People who say that in my opinion discourage development of our country. Because this statements are applicable to any industry in the world from creating a pen to creating a satellite. El mafrood en e7na nas3a wel tawfi2 3ala rabena. The bright side is, as you find these people, there is other poeple who encourage development and ready to support it at any cost. I have encountered appoximately the same number of both sides. I have been recieving several emails offering to help in the OS (Thank you all Very much, your offer are greatly appreciated wa gazakom Allah 7'ayran).

Banks theifs, stole billions from this country. And bribees who take illegal extra money for making you a civil service. The bright side is that I have seen people in responsibilty position refusing to take their right so other people can take their right in full; because of lack in resources. I also have seen people who can make you a service for free to help this country(For my arabic teacher in my pre-high school who repeated the lessons that I didn't understand for me after school for free, not even knowing my name).

I have a read an article describing the environment of Al-Andalus. Arabs and Muslims was the top of science. And non-arabs was racing to learn Arabic they even couldn't write in Latin correctly. El Basra had 11 universities people come to it from every where. I think this is the reversed image of what's happening now. If they could reverse the picture so can we.

As bad things exist, good things also exists, how ever big the bad side seems. As bad things get bigger, the good side gets bigger as equal, even if we don't see it.

If you see the bright side in something please send it for all of us to feel optimistic :).

Saturday, July 1, 2006

ArabOS v 0.003 - IDT : ISR and IRQ

It's been a long time since I wrote in this blog. I needed to have a rest after the projects.
Anyway, I have finally managed to handle interrupts. Loading the IDT (Interrupt descriptor table). Remapping of the IRQs to avoid conflicts with the reserved interrupts.
It was too tiring since this is actually the first time I need serious debugging. I had a strange problem the OS re-executes when any interrupt happens. It took me two months to know where the bug was, I had no way of debugging cleanly. Finally I sent to alt.os.development news group to discover that I just used && where I should have used & so that the address of the handler was the entry point of the OS; whay a coincidence! I couldn't have discovered this if they didn't give me a hint on how to debug. I used VMWare to test the OS, and I used messages to see where the execution went. They told me use the Bochs virtual machine because it has a debugger that lets you see the IDT, set break points and step. It helped me very much. But I was freaked out from myself. Staying awake two days, in 3:30 AM, having a screen with a lots of green data moving fast (seemed like The Matrix), reading assembly code, and counting how much bytes that instruction takes, and what's on the stack and what's bits are set in the machine Flags! I felt like a real nerd :(.
Anyway, the next step in the OS isA is to set the PIT (programmable interrupt timer) for the process manager, enable paging for the memory manager, handling keyboard and tty's, and start designing the architecture for the OS. I am leaving the File system for the end; the Dessert :D. After loading bash successfully, detecting devices comes after, then virtual memory.
All that will come in details in it's time. That was only the rough plan.

Tuesday, May 30, 2006

Thursday, April 27, 2006

Seminar: The battle

I've been spending the last few nights planning what I will say in the seminar and how. But, unfortunately, it was aweful.
...

If I wasn't the worst ever then I'm lucky. I am not sad because it went that way, not at all, it is natural. But all that I am sad about is that I couldn't deliver the scientific material as I wished. I've had better plans and interactions than what actually happened.
I don't know what happened really, all I know is that once I was up there I started normally then after exactly 3 or 4 words I got a heart attack !! My heart beat accelerated, and I couldn't breath and hardly could say a word. But thank Allah I managed after a battle to start again. And when I got to some points where I planned to say extra information or interact, I just skipped, like I wanted to finish as soon as I can. Even a lot of people didn't understand what the program does. The program, anyway, did a random substitution cipher, then, not knowing which character was which, it analysis the ciphertext to break the cipher and obtain the original text. Many people thought it was only a normal encrypt-decrypt program, which really frustrated me because I spent weeks on that program.


Moving on, the second seminar was perfect (Physical computing). Really those people spent a lot of effort on it, and it was worth it :). Really congratulations for them and always for the best.

Tuesday, April 25, 2006

ArabOS finally I'm back!

I was planning to send an article about things that you don't know in C++, but I chnaged my mind to talk abt OSs. I promise I will send that article about C++ some time later.
...

I was working in OS in first year summer vacation, but the development stopped for some reasons. What was partially done is a boot loader and we faced a problem of how to load the kernel.
Recently I've found a site about OS development for dummies ( men 3'eer tarya2a !! ). Anyway, that site said that the last thing you should do in an OS is the loader. You better use a premade loader like GRUB.
Other problems we faced was about that the first thing must be setup is the Global Discriptor Table (GDT). I found that link to be pretty useful.
Well this is great news because at least know I know where to start, it took two years, but being late better than never.

Tuesday, March 28, 2006

True

If you want to read this post, decrypt it!

Hossam Sadik has broken the encryption, so I have changed the encryption method to some other method ;). Good luck every one :).

I have changed the text to another article I have written earlier in my old blog : my MSNSpaces, don't forget they archive old articles, to see old articles click on the month you want (in the right). My MSNSpaces is of the email meemoxp@msn.com.
...
Q swo wbswuo vkdt kv ykifebaho, kda kv jxa hawokdo e zkedat Rwyqbju kv ykifqjaho wdt edvkhiwjekd swo jk ra ra wrba jk ykdojhqyj w ykifebah.
Kkifebaho jk ia iawdo ouirkbey fksah kv jxa wrebeju kv qdtahojwtedc jxa qoah edfqj. Idt xks jk ra wrba jk qjebepa jxa ykifqjedc fksah kv jxa iwyxeda jk tk anjhaiabu bwhca jxedco jxwj daato jatekqo skhg kv w xqiwd; ru yxwdcedc w vas bedao, ukq ywd tk w rec tevvahadya - eiwceda tkedc ej sejx dk ykifqjaho wj wbb - bega ikledc w ikqdjwed wbkdc w fwjx sxeyx vkbbkso w ywh! Qj'o w ojhwdca etaw rqj ej okiaxks havbayjo iu etaw kv jxa fksah kv ykifqjaho.
Q wbswuo swo jhuedc jk bawhd ikha wrkqj ykifebah oedya jxa ikiadj - kh alad ravkha - e zkedat jxa ykbbaca. Ak e swo wrba jk cwjxah w bkj kv gdksbatca wrkqj jxai ravkha sa ojqtu jxa Kkifebaho ykqhoa. Fxkqcx ej swo dkj adkqcx jk qdtahojwdt jxai sabb adkqcx jk ra wrba jk wyjqwbbu ykdojhqyj w ykifebah, Q cwedat adkqcx gdksbatca wrkqj sxwj sa oxkqbt ojqtu ed jxwj ykqhoa anwyjbu. Peowffkedjedcbu, sxwj sa wyjqwbbu ojqteat swo kdbu 30% kv sxwj sa oxkqbt, wdt sxwj wbb kjxah ykqhoao, kqjoeta Mcufj, tet ojqtu.
Ea xwla ojqteat Dacqbwh Mnfhaooekdo, PRI, wdt Kkdjanj vhaa chwiiwho, wdt XX fwhoedc. Dacqbwh Mnfhaooekdo wdt PRI swo oqffkoat jk ra ojqteat ed wdkjxah ykqhoa ( dwiat - wo ed kjxah ykbbacao kqjoeta Mcufj : Iqjkiwjw jxakhu wdt Rkhiwb bwdcqwcao), bawledc ikha jeia jk vkyqo kd ykifebedc habwjat jkfeyo - Aqffkoatbu, fwhoedc kdbu eo w Bwhoedc jxakhu, ok sa tet ojqtu Bwhoedc jxakhu, Zkj ykifebaho. Ea alad tetd'j ojqtu jxa vqbb fwhoedc jxakhu; sa oxkqbt xwla ojqteat XD fwhoedc, wo XX eo xeojkhu, wdt dkjxedc ykifwhat jk XD. Ea oxkqbt wbok xwla ojqteat Kkdjanj oadoajela chwiiwho, wdt wjjherqja chwiiwho, sxeyx eo aooadjewb vkh oaiwdjey wdwbuoeo. Wqjoeta fwhoedc jxakhu, sa oxkqbt xwla ojqteat Dqd-jeia adlehkdiadjo, jxa bedg rajsaad Ihyxejayjqha wdt Kkifebah, wdt w swu jk adbecxjad qo kv xks jk fhktqya
anayqjwrba vebao, wdt wbok kv xks kqh ykta sa ykifeba alahutwu tkao wyjqwbbu hqd.
Idkjxah jxedc jxwj hawbbu iwta ia iwt, eo jxa fhkzayj. Qd chwfxeyo ykqhoa sa tet qoa PehayjJ wo w jkkb jk eifbaiadj okiajxedc rec. Nqj ev sa tet eifbaiadj jxa bks-balab chwfxeyo kqhoablao, ej skqbt xwla bawt qo dksxaha wdt sa skqbt xwla fhktqyat okiajxedc jxwj eo qoabaoo wdt ok bejjba. Fxa owia vkh ykifebaho, sa oxkqbt xwla qoat w Bwhoah, wdt Xanah cadahwjkh jkkbo, ok sa ywd fhktqya okiajxedc rec, wdt wyjqwbbu aifbku kqh - oqffkoat - gdksbatca kv oaiwdjey wdwbuoeo wdt hqd jeia wdwbuoeo ok jxwj sa ywd wyjqwbbu fhktqya w vqbb skhgedc ykifebah vkh w rec bwdcqwca wdt wbok kqjfqjo wd anayqjwrba veba. Nqj sxwj xwffadat swo jxa kffkoeja; sa ofadj jeia wdt avvkhj eifbaiadjedc w banah wdt w fwhoah, xwhtyktat, sxeyx dk kda ed jxa skhbt tk wduikha; alad jxa Vwlw KCB fwhoah cadahwjkh bwoj lahoekd swo
1999.Redwbbu, Q skqbt hawbbu vaab okhhu vkh raedc ok xabt rwyg, jxwj kjxah fakfba tet jxaoa ojqvv 20 uawho wck, wdt sa wha ojebb tkedc jxa owia. Fxa ykifebah edtqojhu wha swu bkkgedc ok iqyx vwh, kd jxa bkkoabu jufat bwdcqwcao, wdt Iofayj-Wheadjat Bhkchwiiedc, wdt Lahk-ykta twjw-redtedc, sa tetd'j alad xawh wrkqj Wrzayj-Wheadjat Bhkchwiiedc ed jxa ykifebaho ykqhoa. Tkfavqbbu, ed 20 kh 30 uawho, Q sebb ra wrba jk vaab Tkfa wcwed

Note : It was not encrypted using DES, so it is easy ;).

Saturday, March 25, 2006

Talking with the future

Me: Hey, did you see the new graphics effects in Need for speed most wanted :| ?

Future: What are you talking about ?!! This game even doesn't have the least physics effect my physics card supports!

Me: uh..! Ok, regardless of that, Google search really changed the searching experience, I can get the most relavent documents to my search.

Future: So what ? I can just talk with my friend Lilo and he is the one who reads and understands and summerizes the information I need according to my personality and interests, I don't even need to tell him my interests, he figures it out from chatting with me.

Me: Lilo ? What is that ?
...
Future: My companion computer, it flies near me every where I go, and casts a friendly holographic image of a person so I can see him. He aslo understand my gestures.

Me: How big is it ?

Future: No no no no, it doesn't have volume! It just uses air particles as a meduim of computing. It is pure energy.

Me: But you talked before about a physics card! Isn't that hardware ?

Future: Nope, it is the energy reaction schema. The word "card" is used for historical reasons.

Me: How then you play a game ??

Future: We don't "play" games, we "live" games.

Me: ...

(Readers : can you think of a continuation for this conversation ?, I can, but I leave it for you, so PLEASE comment and send your ideas!!. Hints: Can you imagine how programming or 3D design will look like in the future ? )

Monday, March 13, 2006

10 reasons why you should blog

1- Helping others with your experience.
2- Group intelligence phenomenon.
3- Healthy speaking about yourself and your feelings.
4- Socializing, in case you were a nerd.
5- Recieving feedback on your opinions. (well, disregarding my blog, there is a lot of blogs with a lot of comments in it)
6- Sharing ideas with interested people.
7- Personality representation.
8- Hobby and a "social" activity. (maybe you can even write it in your CV)
9- Timewasting if you have nothing to do, or if you are just bored.
10- (this one is left for the reader, com'on; use your imagination.. ).

(note : please just 1 comment, I want to see a comment before I die, pleeeeease!!)

Monday, February 13, 2006

“Hello World” proofed it can make you Roll on the floor laughing!!

While doing my daily websurfing, I ran into a page showing Hello World implementations by many languages. I found another link to a page showing the implementation by some class of languages called Esoteric languages. These languages are used mainly by hobbyists and to test limits for programming languages in general. They are never meant for real-world use.
Look at these implementations and laugh with me.

Saturday, February 11, 2006

Nerd, Not Nerd, Nerd, ...

I found this Nerd test on M.A.Meligy's blog. I didn't think I was as nerdy as the test showed.
It shows that:
4% scored higher (more nerdy), and 96% scored lower (less nerdy). All hail the monstrous nerd.
I guess then that I have to work more on my other non-nerdy skills, be more social and .. hmm .. forget all about computers for some while!!
My result picture is here
What about you?

Perfect website design : Watchmaker’s

I've seen a great website design. Really awesome. The colors, pictures and overall look and feel is perfect. Makes you feel relaxed just by pausing and looking at the page .
See the Watchmaker project.

Friday, February 10, 2006

The biggest number used in mathematics

Well, It is smaller than infinity, but it is larger than any number you have ever imagined.

It is the Graham's Number.

Let's first talk about a relativly small number, a Googol.

A Googol is larger then the age of universe in seconds almost 6 times larger, so you know you can't count a Googol, although a very small number. It is actually equivalent to 10100, e.g. 1 and 100 zeroes next to it.

...
A googol is greater than the number of particles in the known universe, which has been variously estimated from 1072 up to 1087.

If you drew a regular polygon with a googol sides that was 1027 times the size of the known universe, it would still appear circular, even on the scale of a Planck length. Planck length is smaller than 10^-39 of a meter.

There is Googolplex which is 1 and a googol zeroes next to it. And a Googolduplex which is 1 and a goololplex zeroes next to it. And there is a Googoltriplex which is 1 and a googolduplex zeroes next to it. There is also a Googolquadriplex which is 1 and a googoltriplex zeroes next to it.

The smallest one, googolplex, to write it under the following conditions: a printed page can hold 100 rows of 100 chars. 104 characters. Suppose we have a billion (109) of printers, each one printing a billion of pages each second. Then, after one year we could have printed 104 × 109 × 109 × 365×24×60×60 = 10×22 × 31536000 ~= 3.2 × 10×29 digits. After one billion years of printing, we'll have about 3.2 × 1038 digits. We still have 10(Googol-38) digits to write.

Thinking of this another way, consider printing the digits of a googolplex in 1-point font. 1pt font is .3 mm per digit, which means it would take about 3.5 × 1096 meters to write it in one point font. The known universe is estimated at 7.4 × 1026 meters in diameter, which means the distance to write the digits would be about 4.7 × 1069 times the diameter of the known universe. Regardless of the time needed to write it in the first place. Imagine how many light years you have to travel to write it. It would be larger than a billion (much larger) years if you are travelling at light speed.

That was a googolplex. So what about a googolquadriplex ? Seems a funny question. Actually the Graham's number is so larger than a googolquardiplex. It, as a matter of fact, can't be written using standart “exponentiation'' convention, like ab. It needs a special notation so that we can express it. If we used normal conventions, it would take more than it takes to write a googolplex, I assume.
I can't really discribe it better than this page.

Graham's number is related to a problem in a branch of mathematics called 'Ramsey theory'. Here's the problem:
Consider an n-dimensional hypercube, and connect each pair of vertices to obtain a complete graph on 2n vertices. Then colour each of the edges of this graph using only the colors red and black. What is the smallest value of n for which every possible such coloring must necessarily contain a single-colored complete sub-graph with 4 vertices that lies in a plane?
Although the solution to this problem is not yet known, Graham's number is the smallest known upper bound.
Martin Gardner wrote “Ramsey-theory experts believe the actual Ramsey number for this problem is probably 6”, making Graham's number perhaps the worst smallest-upper-bound ever discovered.
At end, the funniest number name I ever “read” is “Novemnonagintanoncentinonmillinovamyriadecemyrillion”!

Sources :
http://en.wikipedia.org/wiki/Graham_number
http://en.wikipedia.org/wiki/Googol#Trivia
http://en.wikipedia.org/wiki/Other_names_of_large_numbers
http://en.wikipedia.org/wiki/Moser%27s_number
http://www-users.cs.york.ac.uk/~susan/cyc/g/graham.htm
http://en.wikipedia.org/wiki/Knuth%27s_up-arrow_notation
http://en.wikipedia.org/wiki/Hyper_operator
http://en.wikipedia.org/wiki/Conway_chained_arrow_notation
http://en.wikipedia.org/wiki/Skewes%27_number
http://en.wikipedia.org/wiki/Large_numbers#Approximate_arithmetic_for_very_large_numbers
http://home.earthlink.net/~mrob/pub/math/largenum-2.html
http://mathworld.wolfram.com/GrahamsNumber.html
http://www.madsci.org/posts/archives/oct98/905633072.As.r.html
http://en.wikipedia.org/wiki/Googolplex
http://wiki.tcl.tk/13471

To blog or not to blog!

I still don't understand how people who blog write some personal information about themselves and publish the URL of the blog everywhere. It is unsafe if someone gained so much information about you. Imagine for example someone who wants to deceive people in some email by representing himself as you and confirming that with some information he got from your blog. Yeah, it is the Conspiracy Theory. But it might be true. Imagine also one who is collecting information about your personality so he can know how to deceive you.
...
These reasons keep me from converting my blog into a sort of a diary. I am restricting my blog only to theoritical discussions and technical opinions only. So you might feel that this blog is sort of “dry”.
No blogger can ever know who is reading his blog. It might be your future boss or your future friend. And this is actually happened. I was reading someone's blog. And after 2 days, I've met him as a total conincedence. I didn't show him that I know him, it will be a strange situation —especially that he doesn't know me—, although I actually knew about him what can fill 2 pages. I knew his birthdate, his favorite topics and his friends. He was really a sincer blogger, he almost wrote his life day-by-day in his blog. Funny it was like I lived each day with him like a close friend just by reading his blog. I don't like this type of blogging.
Although blogging comes from “web log”, but i don't see why not specialize blogging as each blogger wants about his blog. Of course this does not mean that I convert a blog into a forum for example!
I don't think that you will reach this line. You will get bored and leave before completing. Anyway this is my blog and I write however lengthy posts as I like. It is up to you to read a whole post or not, but please do not comment on a post you didn't read it all.
I blog only when I have nothing else to do. So you will always find the posts lengthy. Presumably, it is not because I like torturing the reader. But because I like to write my whole point of view as a block.

Ambaba War

I have heard about 'Ambaba war' from someone who I can't remember now. I searched for it and found it. It is a nice game, although not a 3D game. I have suffered until the link opened becuase the MegaUpload site give Egypt only 100 concurrent downloads, no more. So I had to wait until there was an empty place for me. The game is about 36 MB. I would like to upload screen shots, but I can't ignore the fact that I am a lazy blogger.

Edit: Note: I have discovered that it is an english game called 'Heavy Weapon Delux' and that guy only arabized it and claimed that he made it on his own!!
source : http://heavyweapongame.com/


Download link: http://www.megaupload.com/sa/?d=41HPI40I

Original posts : http://www.bramjnet.com/vb3/showthread.php?t=35577
http://vb.vip600.com/showthread.php?t=68094
I was thinking of re-posting posts from my old blog here, but it looks like i will never make it. It feels like a duty and that is not my point of view of blogging. So, sadly, I guess i will start over in this blog.

Friday, February 3, 2006

OldPosts: Programs Digest

Like the links digest.
OllyDbg http://www.ollydbg.de/ - A really great (assembly-level) debugger, I used it to patch WinRAR 3.51

OldPosts: Links digest - Volume 1

http://channel9.msdn.com/ - Channel9, not sure what it is, but it looks good
http://geekswithblogs.net/Mohamed/ - Mohammad A. Meligy's Blog
http://rewayatmasreya.com/ - Rewayat Masreya, has very good articles
http://www.hackr.org/ - Test your hacking abilities
http://www.try2hack.nl/ - A harder hacking test
http://wikipedia.com/ - Really great site to search for anything about programming (or about anything)
http://www.devx.com/tips/Tip/12582 - new Operator usage (there is information you might not know anywhere else)
http://www.zaon.com/company/articles/3d_rendering.php - How to choose a 3D Application (for designers)
http://c-faq.com/ - A must-visit site for any C/C++ programmer
http://www.cuj.com/documents/s=7998/cujcexp1902alexandr/ - Using 'volatile' keyword in C++ to develop thread-safe applications
This is a new idea. Instead of keeping URLs unvisited in my Bookmarks/Favorites, I just keep them here, for me to check them later or for anyone who wants to visit them. Unfortunately adding them day by day will create too much entries. So I will just modify a sinlge entry to add new links, when the entry is big enough i will create the next Volume.
Hope you find it useful.
Note: once I repair my old PC, and have access to my 'old' Favorites you will find thousands of links here :D

OldPosts: My Blogging Type

I've got the link from Mohammad el Meligy's Blog http://geekswithblogs.net/Mohamed/ .
Quote:
***Your Blogging Type is Pensive and Philosophical***

You blog like no one else is reading...
You tend to use your blog to explore ideas - often in long winded prose.
Easy going and flexible, you tend to befriend other bloggers easily.
But if they disagree with once too much, you'll pull them from your blogroll!
EndQuote
Finally, I have moved here :).

Wednesday, February 1, 2006

OldPosts: Time travel

Quote from http://forums.lycaeum.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=9&t=000979 :

How can something move in time? It can move along the x-axis and it's velocity is dx/dt. If it moved along the time axis it's velocity would be dt/dt or 1. dimensionless one, at that. There can be no time travel.

(IMHO = in my humble opinion / OTOH = on the other hand)

Defining Travel : travel is a movement in some dimension. A movement is a change in the position of that dimension(s). A change can't happen on it's own; it must follow some external change. One would ask, the external change would need another change too. Yes, IMHO that it is an infinite loop. The change in X would affect Y which will affect Z which on the end would affect X and so on.

So to describe movement, we need to describe what changes can affect it. Before we do that we must say how was the movement described before. It was described in terms of displacement. But displacement is not enough. Because it does not uniquly identify a movement. I can move 10 meters north, or west, each is a different movement. So we need to make it more specific. We add direction. Which as may jump to the readers mind as a vector of X,Y and Z. Yes. But this is also not enough. One moving to USA in a plane at 500 KM/H and one is also moving but in a boat of 50 KM/H. Is not analogous types of movement though at the end will be the same place. At this point we needed velocity (speed). First, we ask, now we have that movement depends on displacement, thus if change in displacement = 0, there will be no movement. Direction depend on movement; if there is no movement there is no direction. Velocity introduces a new parameter. Time. If change in time = 0, there will be no displacement. But what does changes time ?

So far we defined Movement as undirectly depending on changes of time. Thus time restricts movement. There is some different argument : if movement = 0, will time change ? Some one will say 'Sure'. It may be changing. But how can you tell ? Movements will exists as long as time changes. So, if one can STOP movements, all movements. He theoritically will STOP time. OTOH, argument would say : which by contradiction, is proved if larger changes of Movement will cause time to change with the same amount. Einstien proved that, as one approaches light speed, time will shrink until it reaches zero. This is contradictory. As meaning if you are Moving in light speed, you will STOP time. But as concluded earlier this will make Movements = 0. As far as i conclude, this means that once you reach light speed, your speed will equal zero. OTOH, as your speed increase, time changes will dicrease. which lead to dicreasing in your speed. Actually time shrinking will not make your speed dicrease. If speed = dx/dt, as dt approaches zero, speed approaches infinity.

From the above one can conclude that if your speed increase then the displacement is still the same. Directly from what did Einstein proove. Given that time changes depend on the speed, and speed depends on the displacement per time unit; meaning that speed is inversly proportional to time unit. That is true if Displacement per time unit is constant. But in real life, speed only increases when the displacement per time unit increases. Which means that if we can increase the speed, while keeping the same displacemnt per time unit, then we can decrease the time unit. which will force us to recursivly decrease displacement to keep the ratio constant. When displacement reaches zero, time unit will equal zero. This is undefined as displacement zero is undefined. This was to shrink the time unit. Shrinking the time until means that we move faster relative to other slower entities. Ironically, in a race moving faster means that you reach the finish line first, which is other racers future . Meaning if you can increase the speed and decrease the displacement you will move to future. Descreasing the displacement is only meaning to decrease the new disp/t after t decrease, so it means slowing down while you increase your speed. This is moving to future. Moving to past means jumping over the zero time barrier, which is met when you are moving at the speed of infinity and not moving out of your place (note that this means going to infinite future). Jumping over the barrier requires you moving at negative infinity , while you are moving "inside you place" (displacement zero). As you reach -n speed where n <>

This all is an argument which expresses the conditions for Time travel IMHO. It shows a lot of contradictions. Which if sometime is solved it might happen to travel through time.

Thursday, January 26, 2006

OldPosts: RDBMS - a 'sql' server of my own

RDBMS : Relational Database Management Systems.
Actually this idea came to me while i was thinking of what project to do in the compilers course; that was last summer. It was orignally about parsing SQL, but it was extended to a full idea of a DBMS.
I liked the idea. Overtime, ideas to implement and how to implement it started to accumulate. Until it had to burst out. Knowing how to do something, and wanting to do it, is a powerful force. So i started seriuosly thinking about implementing it this vacation. I started by reading some book called "Database management systems, 2nd edition". A great introduction which gave me a great backgroung on the basics of the database theory and Relational algebra and calculus ( search for it in http://wikipedia.com ).
There is different kinds of DBs, i will mention the names only, not diving in details. Old systems includes Navigational databases. Then about 70s they invented the well-known commonly-used Relational databases. Now there is Object Databases, supporting OOP. This is NOT the whole list, it is just what i could remember for the moment.
What really made me think seriously about making one myself, is an articel i read on Mohamed Meshref's Blog about one student who made one server which can -under some circumstances- execute some queries faster than Oracle's.
With all that information on my head, i opend Visual C++, created an empty header file, gazed at the screen for about 10 minutes trying to figure how to start. As from experience i knew that all systems starts small, i did that. I made a small program that saves an array of structs in a file. And then focused my "grey brain cells" -like Agatha Christie said- on how to generalize that to any user input; on the same struct ( username, pk, and age ). I figured it needs a SQL parser, so i left that part, and went in the other direction, how to generalize the struct contents first ?. I found a great one here http://groups.google.com/group/comp.lang.c/browse_thread/thread/527b451b96ce957a/d612253f370e6aab?q=variable+length&rnum=3#d612253f370e6aab . So i started designing the datastructures required.
I forgot to mention that in coincidence i read in "Introcution to Algorithms" about B-Trees and how they are used in DBMS to index tables in order to minimize disk I/O. Imagine thay can minimize disk I/O for a billion-record table from 32 IO read ( using binary search ), to only 3 IO reads ( of course it traded-off to 3000 comparisons ).
The second step after designing the data structure is defining the way of altering a table's content. Then after that build a way to handle 'parsed' queries and mapping them to these APIs. Parsing SQL is not an issue, some hours with Yacc/flex, and BOOM we have one.
The only remaining part, is what is required "exactly" from a DBMS. The basic implementation/engine is defined by Relational calculus. Other parts will just complay to any SQL standard, i have chosen SQL-92.
As usual i feel this is too short article, maybe i will follow up sometime with part2 or something continuing the in-depth details of the data-structures and how i 'will' -isA- handle the data integrity checks, and table altering, and the indexing problems - B-Trees is not easy to implement yo know !
I'll just go complete the data-structure heirarchy now, wish me luck!

Wednesday, January 4, 2006

OldPosts: A new programming language

I've recently discovered a new programming language called Ruby ( in Arabic it means ياقوت ) http://ruby-lang.org. It have a very easy and intiuitive syntax. As it follows the POLS : Principle of Least Surprise its output is bug-free most of the time and you rarely need to debug.

A RAD ( Rapid Application Development ) web application framework for it called Ruby On Rails ROR is comparable to Apache Struts for Java. Using ROR you can be highly productive, a complete weblog system, like this one ( MSN weblog ), can be completed entirely from scratch including testing and administrative interface in 15 minutes. I did not believe this at first until i downloaded the movie in http://rubyonrails.org/screencasts .

ROR, just like Struts, employs MVC ( Model-view-controller ) pattern for its web applications. And one of its powerful features is that it automated ORM ( Object relational model ) for you. For example, after you create the database and create your web application ( not by typing anything, just by one click ) you'll find the web pages which displays the content and the pages modifies it is ready. If you added a column in a table in the database and just refreshing the page in your browser you'll find a new text area ( or the corresponding control to the new column data type ) is added and fully working in both the view and the edit pages!

All of the typing you will ever do, if you wanted, is that you'll just rename the page title,or reorder how the data is displayed only. Validations is declarative, not imperative. You just say "validate_exist field_name". Same with special relations like one-to-many you only say "has_many object_name". After that you will never have to write any SQL query, well, any SQL at all.

In the sample weblog he only wrote 58 lines of code. with 45 of them auto-generated. Which reminded me of a system i worked on before. It was a J2EE web application which handles the registration of a credit-hours college system. It was 3 months, 37 classes, and more than 2300 lines of code. I had to hand it with some known bugs because the college started and i had no time to fix them. After I've seen that ROR sample I estimated that all the work can be done in 30 minutes. This seems unbelievable, I know. Although I didn't actually rewrote it using ROR but we can count the time estimated. I will not include the time for database because it is already made. Say 1 minute to "click" to generate the solution, 10 minutes to navigate in the generated solution and change the "order" and "place" of data. Another 10 minutes to correct the "validations" and "test" them. This is total of 10+10+1 = 21 minutes. The other 9 minutes is for "yawning" and grabbing something to eat or drink a hot drink !! Now let's compare that to if it was done using J2EE ( not Struts ). First, create a list of the actions in the system ( 2 days ). Write the model - including a loooot of SQL statements and interfacing Java Date with SQL Data ( 3 weeks ). Implement the actions ( 2 weeks ). Implement the view - HTML/JSP pages ( 1 week ). Test ( 2 weeks, there is a lot of data to test ) [Note: ROR can generate tests for you too ]. In total of 3 + 2 + 1 + 2 = 8 weeks = 2 months ( and 2 days ). The other month was for learning Java and JSP and MVC. To be fair, i think using Struts it would take less than a week, excludsing the time needed to learn Struts. In ROR i didn't have to learn MVC nor JSP, and Ruby is so intiuitive that you can learn it in 15 minutes See: http://tryruby.hobix.com/ for a 15-minutes tutorial. Conclusion, the system can be made in 45 minutes, INCLUDING learning the langauge and ROR! ROR is so simple that it can be learnt from a few examples not even a tutorial.

I would like to write more about the origin of the language and its history with a detailed list of programming langauges popularity and Ruby's place in that list but i am really busy with the exams so I think I can add that later. Thanks for reading.