Tuesday, July 20, 2010

file permissions and chmod

When you "ls -l" you get some crazy symbols on the left similar to "drwxr-xr-x". These represent the file permissions. Here is how they work.
You have 10 letters: "0123456789"
0 will be 'd' if it's a directory and '-' otherwise
123, 456, 789 correspond to the rights for "owner", "group" (owner's group), "every body else"
so, 1,4,7 are for the "read" right
2,5,8 are for the "write" right
3,6,9 are for the "execute" right
If you have the right, there will be an 'r', 'w', or 'x' respectively, otherwise a '-'
The command to change those is chmod. To change something, you must have a "write" right, or be a root.
chmod works in 2 ways:
- Either write "chmod xxx file" where x is a single octadecimal digit corresponding to the rights you give to each group, where the 1st x is for the 1st group and so on.
As a side note, here is a table for octadecimal transformation into binary:
0 -> 000
1 -> 001
2 -> 010
3 -> 011
4 -> 100
5 -> 101
6 -> 110
7 -> 111
so, now map the 3 binary digits to "rwx" and you get your rights for one group. For example, 5, which is 101, represents r-x rights.

- the other way to use chmod is to do use some letters
'u' = user (owner)
'g' = group
'o' = others
'a' = all (the 3 permissions)
'r' = read
'w' = right
'x' = execute
'-' = remove
'+' = add
and you write it such as "chmod [a|u|g|o]+ [+|-] [r|w|x]+". What this means in english is, write chmod, then write any combination of "augo" then write '+' or '-' then write any combination of "rwx". So u+x will give the owner execute right and og-rw will remove the read and write from others and group.
Take care because sometimes a-r or a-w or u-r or u-w can be dangerous if you don't have root access. There are a lot of other options, consult the chmod manual (man chmod) for the full details.


Saturday, July 10, 2010

kturtle scripts

I modified the leaf script from http://www.medphys.ucl.ac.uk/~mbanaji/recreation/kturtle.html to work with kturtle and I wrote my own Mandelbrot set tutrle script. I thought this might be useful for someone else.

Here is the code for the mandelbrot set. The code can scale to very high resolution but you will face terrible problems with kturtle speed. For best performance, select full speed (No highlight) from the Run menu.



Here is the code for the leaf. It is a modified version to work with kturtle as well as some fixed logic mistakes. Again use the same running environment as mandelbrot for best results.

Forgot to say, these files will not work if you just copy/paste them in the kturtle editor, you should .turtle files then open them from kturtle. This is because the turtle script is different from what is saved in the file and when you save/open it translates back and forth between both.

Wednesday, July 7, 2010

Cranking to power a laptop

I was watching a guy talking about that they want to create a laptop that gives you a 1:10 ratio of cranking vs. operation time. A human cranking with a good generator that doesn't lose a lot in the process of converting the energy could give a 100 watts output for a few minutes after which he will start getting tired and the output will decrease. So what this guy is talking about is only achievable if you can get your laptop to function under 10 watts. Which is a feasible number, and actually it is currently at 8 watts with a target of 2 watts. Now the other option is mentioned was to hang a heavy rock on a pulley that would rotate your generator and you would just pull the rock up when it's approaching the ground to sustain the electricity generation. Here he has done a lot of imagination. Let's say you have a 5 kg rock, you hang it 2 meters high. The energy you stored in that rock is mgh which is 5*10*2. This is 100 joules. If you even have the 2 watts laptop, 100 joules will sustain you for 50 seconds. So it seems you need a 100kg rock, along with a pulley and a rope that could support that, and even then, it would give you roughly a quarter hour of operation time.

I believe that our devices had gone far beyond our capability to generate their power by pedaling. We either need extremely power efficient devices that operate in the range of 0.1-0.5 watts, or we need to generate the power in another way.

Monday, June 28, 2010

I wanna go to MIT

I am astonished at the HUGE difference between the way I was taught in Egypt and the way things are done at MIT. Believe it or not, at the GUC I couldn't stand a lecture, I slept in or didn't attend at least 60% of all lectures, and now I cannot stop watching MIT video lectures. I watched 4 lectures in a row, and I really cannot stop although I know most of the information there.

So, I really really wanna go to MIT.

Quantum Physics

I remember very clearly that it was part of our curriculum in the 3rd semester at the GUC that we should have done an introduction to quantum physics. Our luck was out enough that we had a professor that decided to skip that out when he didn't have enough time to explain it. What stupidity that was. For the professor, watch and learn how it's done.

Friday, June 18, 2010

Try Linux

Hello People,
now, I've been using Linux or GNU/Linux for quite a long time, and it is quite clear to me that it is much more superior to Microsoft Windows. For me, the superiority lies in one perticular aspect, I have control over my hardware. First of all, Linux is quite rich with tools that gives you the needed flexibility to do most of the things you want to do with your hardware. Second, the tools perform the way they are supposed to.
Away from all reasons why you should use Linux, which is not the purpose of this post, I would like to make a tiny commitment. For all of you out there that really want to use Linux, or at least try, and don't know where to start. I am willing to provide the needed assistance and put you on the right track at least to try using Linux for a few months.

If you are someone who wants to use linux, or who already does but has problems somewhere, just leave me a comment on this blog post (preferably stating your e-mail address) and I will contact you back and we will get your system running in some way or another.

Just give it a try, it's really worth it.

[UPDATE] If you need a Linux CD, almost any Distribution, please leave a comment below. I will either provide instructions on how to download and burn one yourself, how to order one for free (not recommended as it puts more financial burden on the distro), or I will burn you one myself.

Thursday, June 17, 2010

Earth Resources

I have been thinking for a while about the exploitation of earth's resources. We're consuming oil, coal, forests, water, fish, etc at an extremely fast rate. We far exceeded earth's capability to re-produce those resources. Even something like nuclear energy sources, they seem to have no side effects, but in fact, we are releasing huge amounts of energy. Think of it like that, there is a certain amount of energy trapped in the doomed uranium atom that went into the reactor, that energy was released, part of it is released as heat, and is dumped into water or air, and the rest is converted to electricity. But the story doesn't end there, this electricity eventually finds its way to someone's home, where he will use it to generate heat, or turn a motor. Even the energy that goes into turning a motor or lighting some place, this eventually is absorbed by something that transforms that into heat.

We need concrete, we need food, we need wood, we need iron, we need .... And the world population is so big that we are using the resources faster than they are generated. I personally don't see any way out of this death trap except by decreasing the population of earth. Countries don't only need to maintain a stable population, they need to decrease their population. I believe that some studies should be done to estimate the optimal population for earth that grants a decent quality of life and at the same time consumes resources at a pace less than or equal to earth's capability of reproducing those resources.

Wednesday, June 9, 2010

What is Expo in RC airplanes


It seems to me through the many videos that I watched that many people don't really understand what the "Expo" (Exponential) function does on an RC transmitter. Most people believe that the expo will smoothen/dampen out the movements of the airplain and make it not so sensitive, which is not true, in fact, partially, the expo will MAKE the airplane more sensitive and twitchy. As I am studying engineering, I see exponential curves almost everyday, so I will try my best to explain how they work.

First of all, let's start by showing the difference between an exponential and a linear function. An exponential function is on the form y=e^x (^ means "to the power") and if we draw x vs y on a curve, here is how it will look like.
Opposed to exponential functions, there are linear functions whose graph should look like a line. Here is an example of how they look.
You should naturally be wondering now, what the hell does this have to do with RC flying. I will explain that right now. Imagine that your control sticks are the X axis of the graph, when you move your stick to a certain position, your transmitter translates that into the y value of the curve, and that's the value that's actually sent to the receiver and thus to the servos.
Now let's see how each graph affects the airplane. The linear function, which is the default one, if you tilt (move) your control stick 1 degree (think of it as 1 mm), the servo moves 1 degree in that same direction (think of it also as 1 mm). Let's say you "really" want to dampen your airplane movements. This you can do by going to your airplane's curves and just making then look like a line that is not very steep, a little closer to the horizontal, this means that now, if you tilt your stick 1 degree, the servo will move only 0.5 degrees, which is "damping/smoothing" the movements. But this has a disadvantage, let's say that when you tilt you stick to the max it goes 10 degrees. Now your servo will go 5 degrees. When in fact, your servo can physically go up to 10 degrees. Thus you are using some maneuvrability, and actually some capability to recover from a possible crash for example.
The expo now comes in handy, let's see how the expo function behaves. In the expo function, the amount that the servo moves does not depend only on how much did you tilt your stick, but also on where it is. So for example if you center your stick to zero and then tilt it 1 degree, the servo will move 0.5 degrees. Now, take your stick and tilt it 9 degrees and consider that your new starting position. If you tilt your stick 1 more degree, the servo will react to that with a movement of 2 degrees now. I know it might be a little hard to grasp, just sit and look at the curves and think about it. What the expo function now does for you is that it makes movements near the zero position of the stick move the servos less, while movements near the extremes of the stick move the servo more. This is very useful because small movements near the center are usually used when you are hovering a helicopter and just making small adjustments to keep it in place, or flying and air plane on idle and also making small adjustments to keep it streigt or make a wide bank or something like that. At the same time, movements near the extremes of the stick are used when you are making stunts or trying to recover from a possible crash. In those situations, sensitivity doesn't really matter since you are already making big movements and jamming the stick left and right all the way.

So, to sum it up, expo doesn't decrease the twitchiness or the plane or dampen the movements, it does that only near the center of the stick, but compensates for this by making movements near the end of the stick more twitchy and sensitive to give you the full range of your control surfaces/servos. A linear function is just an almost direct map between your control sticks movement and the servo movement, which means, if you move your control stick 1 degree the servo will move 1 degree not depending on whether the stick moves near the center or near the extremes. (Please note that it doesn't necessarily mean that your servo will move 1 degree for each 1 degree tilt of the stick, the servo could move 2 or 3 degrees for each 1 degree from the stick... this was just an example to demonstrate. But you can change the amount the servo moves for each "x" movement of the stick in your curves or there was another place where you could set the throws or something like that. I just don't remember the name in the menus, you would specify how much % of the servo movement should correspond to your 100% stick movement, and the computer calculates everything else for you. Note, you have 2 settings for this, one is called Normal-Rates, and the other is called Dual-Rates, so basically you can configure 2 sets of curves, one for each.)

I hope this little article was helpful for somebody out there, please let me know if you like it.

Sunday, June 6, 2010

Only she looks at me that way


Taken in Wuerzburg, Germany on Saturday 5th of June 2010.

Image Type: jpeg (The JPEG image format)
Width: 3872 pixels
Height: 2592 pixels
Camera Model: NIKON D60
Date Taken: 2010:06:05 15:24:16
Exposure Time: 1/125 sec
Aperture Value: f/4.5
ISO Speed Rating: 100
Flash Fired: Flash did not fire
Metering Mode: Pattern
Exposure Program: Aperture priority
Focal Length: 32.0 mm
Software: Ver.1.01

Tuesday, April 13, 2010

In Egypt

I am sitting right in my room in Egypt now. Will be there for the next 23 days.