Monday, February 27, 2012
Funny Quote of the Day
Thursday, February 16, 2012
Sunday, May 9, 2010
How to know what version of ubuntu you are running
sudo cat /etc/lsb-release
your output should be somethinglike that:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=$version
DISTRIB_CODENAME=$codename
DISTRIB_DESCRIPTION=$description
thats it, peace of cake ha...
Wednesday, March 31, 2010
How to disable the your linux firewall(iptables)
I tried the hg serve command and it worked but only locally on my machine and it didnt work with any of my local network machines, so i found out that my firewall(iptables) is on and a colleague helped me to turn if off, here is the How ?
sudo service iptables stop
sudo iptables -F
sudo service iptables save
thats it, hope it helps
Friday, February 5, 2010
The difference between staticmethod and classmethod in python
So today i will explain the difference between staticmethod and classmethod in python, lets start..
You may have read a couple of python books/tutorials and i think that none of them mentions the difference between the staticemethod and classmethod decorator, even some tutorials says that there is no difference at all !!!
Why would i need to use static/class methods?
Example of static method:
class FactoryClass(object):
@staticmethod
def createObject(objectType):
do some stuff
Wednesday, January 13, 2010
[CES 2010] RCA Airnergy Charger Harvests Electricity From WiFi Signals
well this is very cool stuff...
the idea here is that the device is kind of circuitry that harvests the WiFi energy out of the air and convert it to electricity.
The device(Airnergy) has a small battery in it, so you can just carry it around and as long as there is a WiFi near you, it charges itself.
The great news is the device will be out in the market soon for 40$ !!!
for more info check that blog
Wednesday, January 6, 2010
Google wants to administer the first white spaces database
pretty cool..
Saturday, August 15, 2009
How to decode a URL using python
since i used urllib.urlencode before i was sure that i will find urllib.decode method as well, but i didn't.
Here is the result of my search, to decode a url into dictionary of parameter and its values user the cgi module as the follwoing:
import cgi
import urllib
url = 'http://www.test.com/test?%s'
params = {'param1': 'value1', 'param2': 'value2'}
urlParams = urllib.urlencode(params)
url = url%urlParams
resultParams = dict(cgi.parse_qsl(url))
print result_params
Enjoy
Sunday, July 19, 2009
Notes on REST Architecture
the main characteristics of REST are:
- Distributed Network of interlinked documents
- Client-server architecture
- Stateless Server
- The concept of Resource and Resource Representation
From "Beginning Python 2005"
Wednesday, July 1, 2009
My trip to my hometown
I am traveling to my home city and while i am at the train i see the life of the way to the upper egypt and i wonder how ignorant i was, how much i dont know about my own country and the people who i share with them a religion , home and a future.
the thing that striks me is how different the life here from the crowded city of cairo, how peacefull the people are and how beautiful our upper egypt is.
Today i visited my grandparents grave and i got a feeling my words cannot help me explaining them, but one of the feelings is definitaly sadness, i was sad because the memories that suddenlly became like reality, i got the feeling that my grandfather have past away only yesterday and there is nothing compared to that feeling, those kind of feelings that makes even taking your bearth very defficult process.
and there were the part where i just sat there at this beautifull place outside the mosque, where the wheher cannot be better(the weather was one of the things that made me hisitate going on this trip).
Saturday, March 28, 2009
Google engineers takes python to the next level
The project called Unladen Swallow and promises a five time faster python.
you can read more details about this great news here
Sunday, March 22, 2009
Linux Tips
- using pips
- using xargs: $ ls /bin/b& | xargs -t dpkg-query -S
- $ watch -n 10 'ls -la'
- $ watch -d 'ls -la'
- $ history
- $ ! 33
- $ ! !
- $ ! ls:s/CF/1
there are two types of files holding the bash settings, startup files and initialization files
- startup files: runs for any shell that is a login shell (/etc/profile/.bash_profile, .profile, and .bash_login)
- initialization files: runs for interactively running shells (not shell scripts) (/etc/bash.bashrc, ~/.bashrc)
sudo:
- every use of sudo gets logged in /var/log/secure
Monday, October 20, 2008
Back with some Networking
- Confidentiality: only the sender and the intended receiver should be able to understand the content of the transmitted massege
- Authentication: both the sender and receiver should be able to confirm the identity of the other party involved in the communication
- Message integrity and unrepudation: making sure that the content of the communication estalished between to authenticated entities has not be altered
- Availability and access control: making sure that legitimate user can access the network services(Denail of service attacks prevention)
Sunday, September 28, 2008
Today's mix: Geography, algorithms,....
What is a Recurrence Equation?
it is a mathematical equation where the value of the function at a given n is given in terms of the value of the function in a smaller value of n
recurrence equation is used in algorthmis analysis to represent recursive functions,like a recursive function, a recurrence equation needs an intial condtion where the call stack will stop evenually at.
Example Fabonanci function:
input: non-negative number n
output: n!
Algorthim:
int fact (int n) {
if (n == 0) return 1;
else return n * fact (n - 1);
}
suppose that t(n) is the number of multiplication done for a given value of n:
t(n) = t(n-1) + 1 where n >= 1
t(0) = 0
The above equation is a Recurrence equation it conforms the tow conditions stated in the definition mentioned earlier:
- it have an initial condition --> t(0) = 0
- the value of the equation at n is in-terms of the value of the same equation with a smaller n (n-1 in out example)
Wednesday, September 24, 2008
Stuff l learned today
it is the process of converting a recursive function call to an iterative procedure providing that the recursive call is the last call in the function with no other operations after it.
Tuesday, September 23, 2008
Napoleon and Divide-and-Conquer
It was December 2, 1805 on the battle of Austerlitz when Napoleon was faced with an Astro-Russein army which out-numbered his with 15,000 solider, so Napoleon drove right into the middle of the enemy's army to splite it into a tow smaller armies which each of them is weaker than his army.
The Astro-Russein two splitted armies each suffered heavy losses and were compelled to retreat.
From the previous story the technique of Divide-and-Conquer were developed that for some instance of a problem, if the instance can be divided into smaller instance of the same problem, then the solution for the original instance can be obtained from the solution of the smaller one's
Monday, September 22, 2008
Today it is AJax
it is the illusion that data being pushed from the server.
for example:
a web aggregator that fetch feeds from different sources and view it to the user, the data may viewed as it is being pushed from the server using Comet
How it works ?
a separate process is responsible for fetching data from the server perodically, then it pushes these data to the aggregator
Sunday, September 21, 2008
Today's new stuff
Why the ocean colour is blue?
it is the transmission of energy that makes the ocean colour blue, how?
when the sunlight which contains colours hits the oceans surface, the water molecules scatter the light rays.This scattering causes the water to appear blue because the blue light of the sun rays scatters more than any light of other colours.
source "HowStuffworks.com"
Saturday, September 20, 2008
Thursday, September 18, 2008
Stuff l learned today
Signals - A means for customization of object behavior and a general purpose notification mechanism "GObject Signal API"
The older man alive:
Tomoji Tanabe is the older alive man, he is celebrating his 113th birthday today :)
