Thursday, April 30, 2009

Learning BASH (part 1)

What's BASH?

BASH (GNU Bourne-Again SHell) is the scripting language used in mostly Linux Environments. If you don't know what Linux is or don't have a Linux based OS installed on your computer right now visit: http://www.linux.com/whatislinux/114354. For this blog post, I will recklessly assume that you are using Ubuntu, as that's what I'm using right now. If you're not using Ubuntu, things will hopefully work out anyway (they should, at least). BASH and Linux can be compared to DOS and Windows.

Why Learn It?

If your Operating System doesn't boot any more, booting into a BASH console (Ubuntu recovery mode) instead into an X Window Server (the thing which manages the windows which you're probably looking at) is a great and easy way to recover your files and fix your booting process. BASH can also be an easy and quick way to get things done around your great open source OS.

How to Learn It:

Now that I've (hopefully) convince you to learn BASH, let's learn it =D

First of all, you will need to find a way to access a BASH console. In Ubuntu such a terminal can be found under: /usr/bin/gnome-terminal (navigate to /usr/bin/ and double click on gnome-terminal to open it). I suggest you create a shortcut to it by dragging it onto your Desktop while holding CTRL + SHIFT.

Once open, you will hopefully see this (if Simon is your name and Simon-Ubuntu-8 is your computers name):



Want to change the Colors to something (hopefully) better looking? Click on "Edit" in the toolbar, then click on "Profile Preferences" on the drop down menu. Finally click on the "Colors" tab on the window which just opened. After changing the colors to what you want them to be, close the options window and lets get started =D

Do you see the "$" at the end of the first line on the terminal? That means the terminal is waiting for you to command it. Let's not make it wait for too long =D

Make sure the terminal window has your mouse focus by clicking on it, then type:
man
Hopefully the terminal replied like this:
What manual page do you want?
And then displaying your name and the "$" sign once again, ready for the next command.

Now what have you just done? You have told the console to run a file called "man" (stands for manual) and to display the results. Do you want to know where the "man" file is located?

Type in:
which man
And here's what I got:
/usr/bin/man

As you can see, typing in "which" and then a command name will tell you the file where that command is stored. Now let's go back to the "man" command. Typing in "man" and then a command name will tell you everything about that command.

Try typing:
man ls
You will get something which looks like this:


If you look at the bottom left corner, it will tell you what you are looking at and the line you are currently on. You can navigate up and down by using (Surprise!) the UP and DOWN arrow keys. Once you are done reading about the "ls" command you can press Q (as in Quit) to go back to your familiar console. The "man" command is VERY IMPORTANT, use it to check up on commands you don't know about before you use them. ALWAYS.

As you have hopefully figured out by now, the "ls" command lists the files of the directory you are currently looking at. Try it out if you want to =D

That's all nice and good but how do you know in which directory you are at the moment, and how do you change it?

Do a man look up on "pwd" by typing:
man pwd
After reading, press Q to exit, as I told you above.

Hopefully you have figured it out by now, the "pwd" command Prints the Working Directory, so the directory you are currently in.

Try it:
pwd
I got:
/home/simon
Now you could type:
ls
To get a list of files in the /home/simon directory.

Now how do we navigate around our directories?

Use the "cd" command. Typing in "man cd" gets you: "No manual entry for cd", so don't even bother. Instead, read this: Typing "cd" and a sub-directory name will change your current directory to that.
Let's try it =D

Find your current directory by typing:
pwd
Here's mine:
/home/simon
Now type "cd" and a sub-directory:
cd Desktop
Then find your current directory again by typing:
pwd
And be surprised, it changed:
/home/simon/Desktop

Here are some other useful things you can do with the "cd" command:
Type in "cd /" to navigate to the root directory.
Type in "cd .." move to the parent directory.

The End (for now).

What, but there is so much left to learn?!
Yes, there is. I will write more later this week (hopefully). This tutorial was quite fun to write so I think I will make a tutorial series.

In the mean time, look up these basic commands (using "man" or Google):
  1. echo
  2. sleep
  3. su (useful)
  4. true
  5. false
  6. netstat (useful)
  7. ifconfig (useful)
  8. ping (somewhat useful)
  9. open (useful)
  10. cat (useful)
  11. mkdir (useful)
  12. rmdir (useful)
Have Fun =D

Thursday, April 16, 2009

Myself in Code

// I was bored so I tried to define myself in Java-like Code

while(alive)
{
if(challenge)
{
workhard(challenge);
fun = true;
}
else
{
System.out.println("Bored!");
fun = false;
}
if(getNewIdea() != null){challenge = getNewIdea();}
drinkCofee();
Ego++; // according to my friends =D
}

Thursday, April 2, 2009

Finishing

I almost never finish any of my projects. The problem is that the only thing that excites me about a project is the challenge, as soon as I solve the problem associated with the project I get bored and start doing something else. Another problem is my constantly working imagination, I often get new and of course great (as of the moment) ideas during a project which make me start another, assumingly better, project.

So now I'm going to try to actually finish one of my existing projects. By "finish" I mean to create a workable and nice looking standalone executable (JAR counts as executable for me) which can easily be used by other people. It means something polished and published, something finished =D

I won't start any new projects until I finish an already existing one, instead, I will write down my great ideas on a piece of paper (or text document) so I can come back to them when I really have nothing to do, which I'm sure will never happen during my life =D

Wish me Luck =D

Monday, March 23, 2009

PSP WiFi & Promiscuous Mode

I've recently started developing for the PSP. The programming language I use is C, it's syntax reminds me a lot of Java and it's quite simple, but more complicated than Java, once you get the grasp of it. It was quite easy to install PSPSDK (PSP development libraries for C) on my Ubuntu and it took me only one day to create and run a Hello World application =D

I'm now trying to create a WiFi Sniffer for the PSP. It's based on the WLAN Scan example which can be found in the PSPSDK. Unfortunately it only runs under kernel 1.50 as some commands need kernel mode. I've managed to create a PRX for the kernel functions but I can't seperate the Kernel and the User code correctly, the EBOOT.PBP and the PRX just don't work together as they should. Comment/Email me if you feel like helping me on this.

Anyway, instead of developing my application for the newest firmware I'm now trying to develop it for Kernel 1.50. Fortunately there is a way to run an Eboot in a 1.50 environment even if your firmware is 5.00. Visit Here to find out how.

Until now the closest anyone has got to a PSP WiFi Sniffer is an application which lists the surrounding WiFi hosts. No one has ever managed to put the PSP's WLAN card into promisc mode or anything even closely representing it. Unfortunately I don't think I will be the first to do this but I can atleast try, and share my results.

I started gathering information on the PSP's WLAN card. After googling for over three hours I had a pretty decent idea:

PSP has two WiFi chips:
* Marvell Libertas 88W8010 - RF Transceiver
* Marvell Libertas 88W8380 - ARM9 Processor
Found Here

A quick visit to the producers homepage reveals nothing usefull:
http://www.marvell.com/products/wireless/index.jsp

After some more googling:
PDF on cracking WEP and WPA

Another very nice idea here.

FOUND IT!

Hidden in a very deep corner:
A very useful handbook written by Marvell
It explains all about the WLAN Subsystem: Host Driver, Firmware, and Interface

This is what everyone has been searching for! It's a 142 page handbook explaining WiFi cards built by Marvell. Guess what? It even explains how to turn on/off promiscous mode (page 36&37) =D

Now I just need to find a way to do what it tells me to do and I'm on my way =D

Edit:
Another nice find:
"This file contains definitions of WLAN commands"
Here's the Readme by Marvell, unfortunately not for PSP =/

Sunday, March 15, 2009

Utilising Various Volume Controllers

Warning: Sarcasm

There are way too many ways to control volume on modern computers. What are they and how do we use them?
Lucky for you I have donated hours of my precious time to find out the answer to this questions of utmost importance.

The topmost way of controlling volume can be found on your loudspeaker:

This one is very easy to use; don't use it. Set it to about a quarter to half of it's capable volume and leave it there. Forever.

Actually there is one exception. In case of an emergency you may turn it down for a short time. An emergency may be if the sounds emited from the speaker are so high that your house might fall apart any second. In which case you should turn down the volume on the speaker to avoid total obliteration. As soon as the volume is survivable for more than 5 minutes, adjust the volume on another volume controller and set this one back to it's original.

This is the most dangerous way of controlling volume and it should only be used in rare occasions as the power of this controller can easily be misused. If you use this way of controlling volume too often you might become addicted to it's power. Don't join the dark side, they always lose (infact that's why they are the dark side).

The next lower level of controlling sound is on the system level:

The above picture is from the Ubuntu operating system (the superior one). On Windows this volume controller can be found on the bottom right of the screen (it's this little icon desperately trying to imitate a speaker).

The system volume controller should be set on a level which makes the system sounds sound good. Each system has it's own unique way of playing system sounds. In Ubuntu for example you could go to System>Preferences>Sound>Sounds(tab) to listen to various system sounds. For Windows you could wait for the occasional error to pop up. For a Macintosh you could repeatedly restart the system to listen to the beautiful starting up sound provided by the system.

Whichever way you choose, every time you hear a system sound, adjust the system volume controller a little until the system sounds have a reasonable volume which you like.

As in the previous controller, leave this controller alone once it's set to make system sounds sound reasonable. Don't even touch this one in an emergency, it's quicker to use a physical way of adjusting volume than a virtual one.

The lowest way of adjusting volume can be found on individual music/video players:

The above picture is from the YouTube video player, and yes, they are also trying to imitate the beautiful speaker icon used in Ubuntu by rotating a UFO by 90 degrees.

This way is the lowest way and that is why there are the most of them. Almost every respectable video/music player has one of these little volume controllers. This way is also the most used way of controlling volume. Every time you listen to a different movie/sound track you should adjust this volume controller to make the sound coming out of your speakers a reasonable volume. This is the most important way of controlling volume, use it.

Along with the above three ways of controlling volumes there are many more but they are too minuscule to mention here. They include: cloth in front of speaker, overclock speaker, drown speaker, earplugs, become deaf, increase distance between ears and speaker, and finally my favorite, decrease blood flow to brain.

With the above expertise you can become a master of volume =D

Monday, March 9, 2009

Old Memories

I'm currently digging through my old files and I'm finding many small applications. All of them have a history, they all make me smile =D

I'm going to upload all the ones worth uploading here. I found twenty so far so I think it's better if I don't do this at once. This post will be edited every time I prepared a program for upload (readme.txt, screenshot, etc.) so check back regularly.

Remember that these programs where made in a very early stage of my life, some even dating back to third and fourth grade. Most of them serve no real purpose but just looking at them makes me want to improve them. I'm uploading the originals here before I do anything so that I will have an almost complete history of my programming activities. These are just the programs from my current hard drive, I still need to go through my old hard drive, probably going to find a lot more.

Here's the list so far:

1. Simons Simple Calculator
2. 3*3 Magic Square Solver
3. DOSer
4. ScreenShot Shower
5. Website Saver
6.

edit: doing minimum one daily, have little time

Sunday, March 1, 2009

5 Easy Things to do to Improve Your Life

The following five things are all very easy and quick things you can do to improve your life. They might have a very big impact on your mood and productivity so make sure that you do all of them.

1. Clean your Room

Keep a clean room/environment. Try to keep it clean once you cleaned it up to save future time and energy. Even if you like things messy it's no excuse to let dust gather and to leave uneaten and uneatable food lying around.

2. Open the Windows

Opening the windows is something simple but very effective. If you haven't let fresh air in for more than a day chances are that you're breathing air of bad quality right now. Breathing fresh air can improve your mood and health a lot. Read more here.

3. Get enough Exercise

Exercise is a crucial part of staying healthy. Walking around outside can easily clear your head and inspire new ideas. It also may keep you from becoming fat.

4. Eat well

Eat well. Make very sure that you have all the vitamins, minerals, and calories you need. Eating well can improve about everything happening in you life. It can help you think clearly and can even improve your IQ.

5. Have Fun

Relieve your stress somehow and set aside some time everyday to do what you want.

Have fun =D

Sunday, February 15, 2009

Blogging Schedule

I have noticed that my blog is causing me some stress and time loss. The problem is that I feel like I need to post something as soon as possible so that I won't disappoint you people reading my blog. What makes this problem a real problem is that I have other things to do besides blogging. I need to go to school for example.

Well the solution I came up with isn't really great for you readers, but it's great for me. From now on I'm going to post once every week, either on Saturday or Sunday. This doesn't apply to holidays of course. This way, I can't disappoint anybody since they don't expect me to write anything during the week. The positive point for you readers is that my posts will be of a much higher quality than my previous posts, so don't be too sad.

I'm mostly writing this because I have lost 10 RSS subscribers since my last post and I really don't want to lose any more. Please think of my blog as something you read weekly, not daily.

If this post makes you sad, comment.
If it's fine with you, comment and tell me so =D

I would also like to thank the Holy Chris Pirillo and Zaibatsu and all the other people for sending 1191 views to my previous post =D

Saturday, February 14, 2009

Automatic Following Systems for Twitter: Death of Twittter

Post inspired by: http://tweetergetter.com/

I'm quite angry at Tweetergetter. Systems like the one
Tweetergetter uses are probably going to ruin Twitter. Here's why:

How would the Future look like?
Think for a second about the future of such systems.
Tweetergetter is actually quite a limited system, it only makes you follow a percentage of the people using Tweetergetter. Lets imagine the perfect auto follower system for Twitter. People would enroll in the system and hand their Username and Password over to it. The system would then make all of it's users follow all of it's users. This means that enrolling in the system would be the equal of everyone in the system following you and you following everyone in the system. This is the ultimate auto follower system for Twitter, lets call it the MagicSystem for now.

So what?
The chance that a system like the MagicSystem will gain the upper hand in the "market" is huge. Thousands of people will follow the
MagicSystem while being followed back by each and everyone using the system. Over time almost everyone using Twitter will use the MagicSystem due to the huge advantage you gain over other Twitter users. If someone decides not to use the MagicSystem he isn't going to survive among all the other giants, besides it would be just stupid to miss an opportunity to gain thousands of followers for free.

Whats going to Happen once all the people use the
MagicSystem?
Well there will be a perfect equilibrium between every Twitter user. Everyone will follow everyone else, no one will have less or more followers than any other person. No one will be special. This effectively ruins the entire point of the follower/following system twitter uses.

What is Twitter without a
follower/following system?
Nothing.

What's Twitter doing against this?
Nothing: http://twitter.com/terms
No mention of auto-follower systems or anything like them.
Really sorry, I was too rash. Didn't read This (Scroll down to: "What is follow spam?"
").
Even thought Twitter is doing something against Follower Spam I don't think they have any rules in place against auto follower systems like the MagicSystem.

What can we do?
Bring attention to this topic. Link to this article from anywhere you can. Let's hope Twitter will see the problem and do something against it. Please don't create the MagicSystem in search for power, I didn't.


Think I'm Correct/Wrong?
Comment and state your opinion.

Edits made in this Colour

Monday, February 9, 2009

Autorun.inf Dissarmer

So the other day my friend figured out a way to put a program I made (it shakes the mouse, maybe going to upload it some other time) onto his USB and do something as close to autorun as possible. Since there is no such thing as autorun for USB, he used the action attribute in the autorun.inf file.

Autorun.inf (in USB root):
[autorun]
icon=Start.ico
open=Start.exe
action=Run Mouse Shaker

This way when after he had inserted the memory stick, he would just have to press enter when the autoplay menu popped up. He was pretty successful at it and it kind of got on my nerves to have my mouse shaking all over the place.

Since I was in a restricted environment (school) and I couldn't access any files without any "bad" activities I had to create my own little solution. My solution:


This little Program memorizes all the drives when it is initialized. These drives are listed under "Original". Every Millisecond it updates the drives, the current drives can be found under "Current" and "Info". If the program finds a new Drive it deletes the autorun.inf file on it if one is found. The Progress bar then goes to 100% and everyone worth talking about is happy =D

I'm going to improve this program once I have more time. I'm thinking of a System Tray icon and some more options. I also really need to find a better way to get feedback on my programs than Blogger. I'm thinking of something like a five star rating system on my website for all my apps. This way I can see which ones are worth the time improving.

The program should work on Windows XP/Vista/98/95. It was only tested on Xp however. On a rare streak of luck it also works on Ubuntu with Wine if some Linux geeks are out there =D

(Download Here)