Hi all :)

     My name is Moustafa Mahmoud ( you had probably discovered that already ) . I am crazy , i am enthusiastic and i am dreaming . I believe that if it is not crazy enough , it doesn't  worth to be done.



   I have graduated from Computer Department, Faculty of Engineering Cairo University in 2014, I enjoy visiting new places , reading, I also love and enjoy Martial Arts, Specially Aikido .

I love to write too :)
hope you enjoy your time here :)

Becoming the Devil 0.1


Every 24 hours each and every one of us takes a small step in our 365 day trip around the sun. With each new day we receive new memories, experiences and social interactions that change our identities, how we feel about ourselves and how others see us, one step at the time.
With that said, It is an easy to comprehend fact that all the demons in the world were born as pure little  inexperienced and memory less angles.They are born with no social interactions too. How did they grow up to become these monsters ? how do pure little babies grow up to become the monsters that they have always feared, the demons that bring pain and suffering to all of us ? how do we ourselves change into the demons that we have always despised, hated and feared?

I have had my heart broken many times, yet recently I did break a heart, I have learned how to lie, deceive, manipulate the truth to my own advantages. I have hurt people, looked down onto people and wished and planned evil for others,. I have developed an evil character that have no feelings, no mercy and is bound by very little moral rules, when I look back to see how the little frightened and pure heat child, who have always cried when put in a tense situations, or when any one just hinted harm towards him started to develop this demon character and becoming everything he once feared and was hurt from, I can only relate that to my 24 hour trips around the sun.

To be continued...



Happy 2015

     Happy new year 2015! This is how I started my new year, with a wish that it becomes a happy year, but I really wonder if  it will really be a happy year for me. I have a very long journey ahead of me, three years of military service, starting a career and maybe even starting a family, will I be able to make this journey ? I really wonder how will this journey leave me, or if it will leave me at all, as it may seems this might be it, the long journey that will take me straight to my grave, it will be the journey that will tie me to my Noria to secure a place for me and my successors in this world.

Thank you 2014 for what you have done to me,
your 356 day trip broke and left me with a lot of debris,
A Liar .. Heart breaker .. Deceiver ..  Cruel,
Step by step you turned me into what all people of the world should be,
My once pure blood and bones became  the tools for my trip into the black sea,
I go into the darkness with no fear of hurt or the scream of a waiting banshee.

I was once a pure heart seeking love and freedom,
My heart was tender I am now called a daemon,
I have done the worst of things I never imagined myself doing,
Hurt, Lies, Pain has been brought by me in my turning season,
I began turning into a monster and I am not wondering the reason.

2014 has been for me a very big year of success.
Graduation, being loved, Aikido achievements, it was really a bless. 
I was then hit by a very dark storm of cruelty that should have broke me,
Instead of falling and dying I decided that all I hold dear, I shall dispossess,
From all my humanity and feelings I did undress.
Instead of doing all the sufferings, I became the one to oppress.

If you ask me I don't really feel that bad,
I became a person that a year a go I hated which should be sad.
I feel stronger, more powerful that should make me glad,
but I do miss the old me , I miss being pure and without sins,
I wish this year will have nothing more bad for my character to add.

We are all captives of our own imagination living in prisons of own creation. We can run from our fears but surely we can’t hide. The longer we run the more we will find ourselves looking over our shoulders in fear. Stop running. Take matters back into your own hands, that is your play your only play. & just remember if facing your fears will kill u at least die like a man taking it in the face...


Aikido Terminology - مصطلحات الايكيدو




General Terms


Aikidoka 
One who practises Aikido
ممارس الأيكيدو

Dojo 
Training Hall
قاعة التدريب

Kamiza 
Place where the spirit sits
مكان راحة الروح

Tatami 
Training mats
بساط التدريب

Gi 
Training suit
بدلة التدريب

Obi 
Belt
الحزام

Hakama 
بنطلون الايكيدو التقليدي
Traditional pleated trousers
Sensei 
Teacher, instructor (one who goes before)
المعلم - المدرس - من سبقني

Dan 
Black belt level rank
درجة الحزام السوداء

Kyu 
Lower levels in ranking system
درجات الاحزمة الاقل

Sempai 
Senior level student
التلميذ القديم


Onegai shimasu 
If you please
من فضلك
Domo arigato gozaimashita 
Thank you very much
شكرا جزيلا

Rei 
Bow
انحني

Keiko 
Practise
تمرن

Hajime 
Begin
ابدا

Yame 
Stop
توقف

Mate 
Wait
انتظر

Mokuso 
Meditate
تامل

Taijutsu 
Body arts
تكنيكات الجسد

取り tori, / shite 仕手 / 投げ nage
Person carrying out the technique
منفذ التكنيك

Uke 
Person receiving the technique
مستقبل التكنيك (المهاجم)

Tegatana 
Hand blade
سيف اليد

Giri 
Cut
قطع

Ken 
Japanese sword
السيف

Tanto 
Wooden knife
السكينة الخشب

Bokken 
Wooden sword
السيف الخشبي

Jo 
Wooden staff
العصا الخشبية

Suburi 
Solo cutting exercise
تكنيك القطع المفرد

Kata 
practicing pre-arranged forms
التمرين علي اشكال مرتبة من قبل (عكس الايكيدو الحر)




Concepts and Principles



Ai 
Harmony
تناغم

Ki 
Energy/life force/spirit
طاقة او روح

Do 
The way
الطريق

Reigi 
Etiquette
الاتيكيت

state of awareness – of relaxed alertness. A literal translation of zanshin is "remaining mind"
حالة من الصحوة المصحوبة بالاسترخاء (مش متنشن )


Maai 
Combative distance
مسافة قتالية

Awase 
Blending
امتزاج

Hara 
Physical and spiritual centre
مركز الجسد و الروح 



Attacks


Katate dori 
One wrist held
مسكة الرسغ الواحد

Sode dori 
Sleeve hold
مسكة الكم

Kata dori 
Shoulder hold
مسكة الكتف

Eri dori 
Collar hold
مسك طوق الثياب

Mune dori
Front chest grab
مسك الصدر من الامام


Ryote dori 
Two hands take both wrists
مسك اليدين 

Ryotemochi 
Two hands take one wrist
مسك الرسغ باليدين

Morote dori 
One wrist held by two hands
رسغ ممسوك بيدين

Kubishime 
Strangle
خنق

Ushiro ryote dori 
Both hands held from the rear
اليدين ممسوكين من الخلف

Ushiro kubishime 
Choke from the rear, while holding one wrist
خنق من الخلف مع مسك احد الرسغين


Shomen uchi 
Strike to the top of the head
ضربة اعلي الراس

Yokemen uchi 
Strike to the side of the head
ضربة الي جانب الراس


Chudan tsuki 
Punch to the stomach
لكمة في البطن

Jodan Tsuki 
Punch to the head
لكمة في الجزء الاعلي (الوجه)

Mae geri 
Front kick
ركلة امامية

Randori 
Multiple attack
هجوم متعدد

Uchi 
Strike
ضربة

Tsuki 
Thrust
طعنة باندفاع

Dori 
Grab
مسك

Geri 
Kick
ركلة

Jodan 
High level
المستوي الاعلي

Chudan
Mid level
المستوي المتوسط

Gedan 
Lower level
المستوي الاسفل


Techniques



Kihon waza 
Basic techniques
التكنيكات الاساسية

Osae waza 
Pinning techniques
تكنيكات التثبيت

Katame waza 
Immobilisation techniques
تكنيكات شل الحركة

Nage waza
Projection techniques
تكنيك اسقاط - رمي

Kansetsu waza 
Joint locking techniques
تكنيك غلق مفصل

Atemi waza 
Striking techniques
تكنيك ضربات

Suwari waza 
Sitting techniques
تيكنيك جلوس

Tachi waza 
Standing techniques
تكنيك وقوف

Hanmi handachi waza 
Techniques with tori sitting and uke standing
تكنيك جلوس المدافع ووقوف المهاجم

Henka waza 
Varied techniques
تكنيك مختلف

Kaeshi waza 
Counter techniques
تكنيك مضاد

Ikkyo 
1st application
التطبيق الاول

Nikkyo 
2nd application
التطبيق الثاني

Sankyo 
3rd application
التطبيق الثالث

Yonkyo 
4th application
التطبيق الرابع

Gokyo 
5th application
التطبيق الخامس

Rokkyo 
6th application
التطبيق السادس

Shiho nage 
Four directions throw
رمية الاربع اتجاهات

Kote gaeshi 
Outer wrist turn
لف المعصم للخارج

Shomen Irimi nage 
Front approach entering throw
اقتراب امامي و رمي بالدخول

Sokumen irimi nage 
Reverse entering throw
رمية الدخول المعكوس

Tenchi nage 
Heaven and earth throw
رمية السماء و الارض

Soto Kaiten nage
Outside rotary throw
رمي بالدوران الخارجي

Uchi kaiten nage 
Inside rotary throw
رمي بالدوران الداخلي

Sumi otoshi 
Corner drop
الرمي في الركن

Juji nage 
Cross arm throw
رمي اليد المتقاطعة (المصلوبة )


Jujigarami 
Arm entanglement
تشابك الزراعين

Udekimi nage 
Arm pin throw
رمية تثبيت الزراع

Hiji jime 
Elbow lock
غلق الكوع

Aiki nage 
Aiki throw
رمية تناغم الطاقة

Koshi nage 
Hip throw
رمي الورك

Kokyu nage 
Breath power throw
الرمي بقوة النفس

Kokyu ho 
Breath power exercise
تمرين قوة النفس

Jo dori
Techniques applied against attacks with jo
تكنيكات تنفذ ضد العصا

Tanto dori 
Techniques applied against knife attacks
تكنيكات تنفذ ضد الخنجر

Tachi dori  太刀取り
Techniques applies against attacks with a bokken "Sword Taking"
تكنيكات اخذ السف



Numbers


Ichi One 1
Ni Two 2
San Three 3
Shi Four 4
Go Five 5
Rokku Six 6
Shichi Seven 7
Hachi Eight 8
Ku Nine 9
Jyu Ten 10




20 Jo Suburi 

Five Thrusting (tsuki?) Movements
تحركات الطعن الخمسة
1. Direct thrust (choku-tsuki?)
الطعن المباشر

2. Counter thrust (返し突き kaeshi-tsuki?)
الطعن الدفاعي

3. Rear thrust (後ろ突き ushiro-tsuki?)
الطعن الخلفي

4. Thrust, low counter (突き下段返し tsuki gedan-gaeshi?)
الطعن و الدفاع لاسفل

5. Thrust, high counter strike (突き上段返し打ち tsuki jōdan-gaeshi-uchi?)
الطعب بالدفاع لاعلي

Five Striking (打ち uchi?) Movements
تكنيكات الضرب الخمسة

6. Front-of-the-head stepping strike (正面打ち込み shōmen'uchikomi?)
ضربة مقدمة الراس بالتقدم

7. Repeating stepping strike (連続打ち込み renzoku uchikomi?)
الضرب بالتقدم المتكرر

8. Head strike, low counter (面打ち下段返し men'uchi gedan-gaeshi?)
ضرب الراس و الدفاع لاسفل

9. Head strike, rear thrust (面打ち後ろ突き men'uchi ushiro-tsuki?)
ضرب الراس و الطعن الخلفي

10. Reverse side-of-the-head strike, rear thrust (逆横面後ろ突き gyaku-yoko'men ushiro-tsuki?)
ضرب الراس العكسي و الطعن الخلفي

Three One-handed (片手 katate?) Movements
تكنيكات اليد الواحدة الثلاثة

11. One-handed low counter (片手下段返し katate gedan-gaeshi?)
الدفاع المنخفض بيد واحدة

12. One-handed distant-interval strike (片手遠間打ち katate tōma-uchi?)
الضرب البعيد بيد واحدة

13. One-handed "figure-eight" counter (片手八の字返し katate hachi-no-ji gaeshi?)
الدفاع علي شكل 8 بيد واحدة

Five "Figure-eight" (八相 hassō?) Movements
التحركات علي شكل 9 الخمسة

14. "Figure-eight" counter, strike (八相返し打ち hassō-gaeshi uchi?)
الضربة المضادة علي شكل 8

15. "Figure-eight" counter, thrust (八相返し突き hassō-gaeshi tsuki?)
الطعن بالدفاع علي شكل 8

16. "Figure-eight" counter, rear thrust (八相返し後ろ突き hassō-gaeshi ushiro-tsuki?)
الطعن الخلفي بالدفاع علي شكل 8

17. "Figure-eight" counter, rear strike (八相返し後ろ打ち hassō-gaeshi ushiro-uchi?)
الضربة الخلفية بالدقاع علي شكل 8

18. "Figure-eight" counter, rear sweep (八相返し後ろ払い hassō-gaeshi ushiro-barai?)
الكنس الخلفي بالدفاع علي شكل 8

Two Flowing (流れ nagare?) Movements
تكنيكات التدفق الاثنين

19. Flowing counter strike (流れ返し打ち nagare-gaeshi-uchi?)
الضربة المضادة بالتدفق 

20. Right flowing counter thrust (右流れ返し突き migi nagare-gaeshi-tsuki?)
الطعن المضاد بالتدفق ناحية اليمين

Introduction to Cyber-Physical Systems [5] : Modeling Discrete Dynamics

A discrete system is a system that  operates in a sequence of discrete steps, it is said to have discrete dynamics.
Example : counting the people that enter and leave a company building.


here we see the actual-model for personnel counter, starting from the left we see sensors that detect the arrival or departure of personals, on the right we see the output that shows the number of people in the building and in the middle we see the core logic for this personals counter.
for each actor the ports to that actor are labeled, example the arrival detector has a sensor that detects the arrival of a person and there is going to be some encoding of that signal so the output of this actor is connected to the input of the counter actor which is labeled up which is responsible of increasing the internal count likewise the counter actor has an output count which is connected to the display.
if we want to describe the types of these input / output ports, if we take for example the up port we are going to define it as of type pure and more formally we say that up takes one of two values either absent / present. We define it as a signal that maps the real values which represent timeline to one of two values absent  and present.

that is
up : R → {absent,present}
that is
up(t)∈  {absent,present}

and now if we focus on the entire counter we find 
Counter : ( R→ {absent,present})^p  →  (R → {absent}∪N )

So count is a signal mapping the reals to the set absent union n. So n here as commonly used, denotes the set of natural numbers, so the set of numbers starting with 0,1, 2 3, 4, et cetera.And we include that also the special value absent.And this is to indicate the fact that if you
sample the value of the single count at arbitrary times,you may not always get a legal value, which is a natural number.
Count is not a pure signal because it's not just taking two values, absent and present.
It can take either absent or any natural number.And now, given the type descriptions of the input ports and the output ports of the counter actor,we can write down the overall type of the counter actor as follows.So the counter actor is something that takes
in two signals, that are pure signals, so they map r to absent, present.And the way I indicate that these are two signals is to write this notation where it is, the type of each signal raised to p, which is the set of port names for the two inputs.

Visual representation of the state machine



State machine is a way of describing the discrete behavior of systems. it represents the transitions between states of the system. Here we see the states that the count variable can be at ( 0 , 1 , 2 , .. M ) where M is the maximum value that the counter can take. the arrows represents the transition between states. for example the transition between state 0 , state 1 occurs when up counter is active and down signal is not active ( notice the logical notation for and and not and how it is used )  the input that triggered the transition is written on the arrow (also called the guard ) followed by  a forward slash which is used to indicate the output produced from this transition ( the count variable here ). there is two types of state machine available :

MEALY machines

Mealy machine are ones in which the output of the state machine occurs on the transition and associated with the transition.

MOORE machines

Moore state machines are machines where the outputs of the state machine are associated with states rather than transitions.

Our choice of using the Mealy machine is somewhat arbitrary. You could use either one, depending on which better fits your modeling context.
In a lot of situations, the output value of a system doesn't always have you legal or a consistent value. And so usually when the transition is made, you set the output value. And then when you're in the state, it may be the case that you don't want to regard that output value as being something that's legal. And in such a situation it make sense to have a Mealy machine. And so really the convention of using the Mealy versus the Moore machine depends on the reality of the system that you are modeling.

Introduction to Cyber-Physical Systems [4] : Introduction to sensors & actuators



Embedded systems interact with physical world through the process of  sensing and actuation, which we will illustrate with an example embedded systems : Car. There are many physical quantities of  interest while driving your car both to the car and the driver as well such as the speed of the vehicle, temperature of the engine block, voltage of the battery as well as safety considerations like pressure of the tires. a modern car will have dozens of these sensors that measure these physical quantities by converting them into electrical signal , commonly a voltage. An actuator does the exact opposite, it takes electrical signal and converts it to a physical process.
If we consider the Cruise control system of a car for example. We have a sensor that measures the speed of the car, it produces an electrical signal that is read by an embedded computer through the process of measuring, the computer will make decision based on the current speed of  the car and whether the car is going slower of faster than the preset speed by the driver and will produce and electrical signal that is fed back to an actuator which takes this electrical system and produce physical process on the throttle of the car thus adjusting its speed. This is known as a feedback control system and it is a very common way of controlling physical processes.

Feedback control system


Sensors can be combined to help us better understand the physical world outside of the embedded computer. An example is an inertial measurement unit something like a 3-axis accelerometer which measures acceleration across 3-axis or 3-axis gyroscope which measures about 3 rotational axis or 3-axis magnetometer which gives you orientation with respect to earth's magnetic field and can be used as a compass. Combined together these three sensors can form a 9-degrees of freedom inertial measurement unit that can fuse all these data to give a better understanding of orientation, rotation and acceleration. Inertial systems like those are used in aircrafts which enable them to navigate on their own without communications with high level of required precision (error of less than 0.6 nautical miles per hour of flight and less than 1/10 of a degree of orientation per hour of flight).

Design Issues with sensors

  • Calibration
    • Relating output voltage to physical quantity that is being measured.
    • Increasing manufacturing costs.
  • Nonlinearty  
    • Measurements might not have a linear relation with physical quantity.
    • May require correction.
    • Feedback can be used to keep operating point in linear region.
  • Sampling
    • How frequently are we going to sample sensor value by embedded computer.
    • Aliasing : an effect that causes different signals to become indistinguishable (or aliases of one another) when sampled. It also refers to the distortion or artifact that results when the signal reconstructed from samples is different from the original continuous signal.
    • Missed events : our sampling rate might  make us lose important events.
  • Noise
    • Analog signal conditioning : Do we need to condition measurement using analog circuitry ?.
    • Digital filtering : Do we need to filter produced signal.
    • latency : Does conditioning and filtering introduce latency in response to physical change ?. 

Interfacing with sensors

General purpose I/O pins GPIO

usually a micro controller interfaces with sensors and actuators with general purpose I/O GPIO connectors . they are digital pins that can be set to high/low depending on the voltage. In case of GPIO they often use a technique called an open collector circuit that allows that pin to be used as input pin to sense a sensor / output pin to drive an actuator
open collector circuit

Interpreting sensor data


Introduction to Cyber-Physical Systems [3] : Inturrupts

In this article we are going to discuss some low-level concepts. in embedded systems and cyber-physical-systems activities are oriented around I/O, input received from environment and output given back to the environment. the mechanisms that we will discuss may not be directly used as you will often find libraries that handle them for you but it is important to understand how these concepts work because they greatly affect the behavior of the applications at minimum they affect the timing of programs.
Lets look at two input and output mechanisms that are commonly used with embedded processors.

Polling



  • Main loop checks each I/O device periodically
  • If ready for output, produce output.
  • If input is ready, read input.

Polling is considered the simplest and easiest to control, in many safety critical systems it may be the only available option that can be used. If you were designing a safety critical system like for example a flight control system for a commercial aircraft you will be restricted to use mechanism like polling because it is very easy to analyze and assure that its behavior is completely characterized . Polling is however rather inefficient in doing things and it can be rather difficult to make effective use of your processor with polling.
In polling you will reach a point where you simply check each I/O registers for the status of the first I/O device that you are going to read.
I/O registers are memory mapped registers so they are memory addresses, they tell you the status of the I/O device, or they provide the data for the I/O device or they can control the device. so the processor starts checking the devices if any of them are ready it operates on its data, else it goes to the next device, eventually when it completes the loop, it loops back and start the whole process again, so there is no concurrency in the program.
There are certain disadvantages to this mechanism. for example you cannot proceed with your program until you get data from the device you are currently inspecting. so your program is blocked while it is accessing the device and cannot see the status of the other devices which may have new data available to them. this creates a robustness  problem as your program could block as a result of a failure in one of the devices.

Now, let's look at a concrete example.So this is a processor that we looked at before in the memory module.So this is an Atmel AVR 8-bit microcontroller.This is a microcontroller that's typical, for example, of the processors in the Arduino open-source hardware platforms.

while(! (UCSR0A & 0x20) );
UDR0=x;

this is a simple polling mechanism for accomplishing a write to the serial port. the empty while loop will continue executing until the memory mapped register UCSR0A anded with the hex value 0x20 evaluates to true then it will exit the empty loop and send data using the memory mapped register UDR0 . the loop will continue to execute until the device is ready. let's suppose that serial port transmits at 57,600 baud (baud means bits per second ) so it is going to transmit 57600 bits per seconds at most , transmitting 8 bits takes 139 microseconds but it will take a while longer because it has to transmit start, stop bits. if the processor operates at 18 megahertz it will execute 18 million instructions per second. you can do the math to discover that you wasted 2500 cycles for each iterations of the loop. and you are wasting valuable processor time here. this is one of the disadvantages of polling.

Interrupts

interrupts give us a mechanism that is more concurrent and enables more effective use of processor time and more responsive applications. You don't have to block the processor while it is waiting for activities. instead when and only when a device needs serving it will notify the processor that it is ready to be served and the processor will proceed to serve it without wasting time in polling the device for its status periodically. in our previous example of writing to a serial port the steps will be quite different. you will have to do some setup which involves setting the peripheral devices by registering the interrupt service routing for your device , the interrupt service routing is the code which will be called when the device notifies the processor that it needs serving. You then just begin executing your application code, when an interrupt request occurs, the program that is executing is suspended, and you do what is called context switch (switching the context of execution to another context to save the old state of the processor) and then you execute the interrupt service routing, then you resume executing the code you were doing after restoring the processor state to before executing the interrupt. The program that is executing and the interrupt service routing in effect execute concurrently, they are not really executing in parallel certainly not in the case of single core processors but they are said to be executing concurrently because they are executing in the same time in the sense that you cant actuall tell which  one is executing at any given time and the interleaving of the two programs is really quite arbitrary. it is going to be determined by external timing and rather difficult to control precisely. It is very difficult to tell at what point in the execution of the program this interrupt service routine will be active.

Let's look at an example from the AVR processor, the Atmega168 reference maual that explains that there are a set of memory addresses that are devoted to handling inturrpts. the atmega168 is an 8-bit microprocessor so that data is handled by data path is 8-bit and it has 16-bit addresses so the addresses in the table is 16 bit.



you can see that the addresses for IRQ handlers which are called automatically when an interrupt occurs at these devices, a device can raise an interrupt by changing the voltage on one of the interrupt pins which jumps to a designated address that contains an instruction to jump to an external code ( Interrupt service routine ) that will be be executed to handle the corresponding interrupt request. you will notice that at address 0 the code jumps to a Reset Handler, this ISR is responsible of resetting the system it is called when system is restarted either by power failure / shortage or by requesting physical reset of the system. you will notice that the addresses are interleaved by 2 which is fairly logical as 16 bits are required for the address but because both the jmp instruction itself and the address has to be encoded in the 2 bytes, not all addresses are reachable.

 Normally you would override these addresses with your interrupt service routine to determine their behavior, this behavior depends on the processor. A typical response in a processor might be to first disable further interrupts by setting a pin in a control register, second the processor has to push the current position of the program counter to the stack to be able to continue executing from the point it stopped at. then it copies the program counter with the address corresponding to the particular interrupt that occurred then it will begin executing the ISR finally it returns from interrupt by retrieving the old program counter and continuing to execute the old program. It is important to save the old state of the processor before executing an ISR so it is the responsibility of the ISR to save and restore the values of any registers that it is using. and to re-enable further interrupts once it finished executing the ISR. Depending on the processor there may exist a return from interrupt instruction which automate this procedure.