Tropenhitze

Kannst du das spüren?

Archive for January 2010

Installing msttfonts MS True Type fonts ( Georgia, Trebuchet, …) on openSuSE 11.2

with 8 comments

This tutorial will help you with installing MS true type fonts like Georgia, Arial, Trebuchet etc…, which are not installed in openSuSE by default. To do this, first you have to install a package through YaST Control Center and then run a shell script manually. Read the instructions below

  1. Open YaST Control Center and click on Software Management
  2. Search with the keyword fetchmsttfonts
  3. On the results pane, if package already appears installed, go to step 4. Otherwise install it and go to step 4.
  4. Click on the package name and on the pane directly below, click on the tab File List
  5. Scroll down to the bottom of the File List and you’ll find something like /var/adm/update-scripts/fetchmsttfonts-11.2-6.6.12-fetchmsttfonts.sh.txt. Make a note of it.
  6. Open Terminal and type
    sudo su -
    
  7. Enter the root password when prompted and type the following commands in succession
    cd /var/adm/update-scripts/
    chmod 744 fetchmsttfonts-11.2-6.6.12-fetchmsttfonts.sh.txt # refer to step 5 for this filename
    sh fetchmsttfonts-11.2-6.6.12-fetchmsttfonts.sh.txt
    
  8. Sit back and relax while the fonts are being downloaded and installed.

Please leave a comment if this tutorial was helpful to you.

Installing opera 10.10 on openSuSE 11.2

leave a comment »

Installing Opera on openSuSE 11.2 is so simple that it doesn’t even need a tutorial to explain it. However, I’ve decided to write one for those who need it.

  1. Go to http://www.opera.com/browser/download/
  2. Select SuSE under the field Select distribution and vendor
  3. Select the option openSuSE 11.2 if that’s what your openSuSE version  is.
  4. Select RPM package under choose package format.
  5. Click on Download opera and save the .rpm file.

After the download is completed, open Terminal and go to the download location. For the purpose of this tutorial, I assume that you’ve downloaded the file to /home/username/Download/

type in Terminal,

cd ~/Download/
sudo rpm -i opera-10.10.gcc4.qt4.x86_64.rpm

Enter the root password when prompted and wait until the prompt reappears.

Installation of Opera 10.10 is now complete and you can access it from

Application Launcher -> Applications -> Internet -> Web Browser -> Opera

Please leave a comment if this tutorial was helpful to you.

Installing Firefox 3.6 on linux openSuSE 11.2

with 9 comments

The best way  is to install it through YaST control center.

  1. Open YaST control center and click on Software Management
  2. If you already have firefox open, close it before proceeding.
  3. From the menu select Configuration and then select Repositories (or type CTRL + R to get there)
  4. Click on the Add button on the bottom of the window and select Specify URL in the window that opens and  click on  Next
  5. Under the Repository Name, type Mozilla and enter the URL http://download.opensuse.org/repositories/mozilla/openSUSE_11.2/ under the URL field and click on Next
  6. If you get a warning like the repository has already been added, click No and click on the Abort button on the corner of the window.
  7. Otherwise click OK on the bottom of the Add Repository window and wait while the repository is being downloaded and added.
  8. Now on the Software Management window enter the phrase firefox and click on search
  9. Click on the result that has the summary as “Mozilla Firefox Web Browser” and click on Versions which appears directly below the search results pane.
  10. if you are running x86_64 (open Terminal and type uname -i to find out what version you are running) select the following option displayed under the Versions tab

3.6.0-1.2-x86_64 from openSuSE Buildservice — Mozilla with blah blah blah..

or

if you are running i586

3.6.0-1.2-i586 from openSuSE Buildservice — Mozilla with blah blah blah..

if you can’t find this,  it means that you’ve added the repository manually as I’ve said before. If so, then choose the version corresponding to your OS against the phrase Mozilla (if that’s what you mentioned in place of repository name while adding.. Read step 5)

You may get some warning regarding dependency issues while changing the version. Just go ahead and click on ok. Trust me, it wouldn’t cause you any problems later on.

Now open firefox, click on the Help menu and click on About, and confirm the version.

Please leave a comment if this tutorial was helpful to you or if you faced any problem during installation.

Protected: Steinhaus Johnson Trotter – Permutation algorithm – Java code

leave a comment »

This content is password protected. To view it please enter your password below:

Steinhaus Johnson Trotter permutation algorithm explained and implemented in Java

with 43 comments

Johnson Trotter Algorithm

In this tutorial I’ve explained how this algorithm works. Please feel free to give your feedback and let me know if you want any other algorithm implemented.

About the algorithm

Given a positive integer n, this algorithm generates a list of permutations of {1, … , n} in non-lexicographical order.

i.e. given an input of 3, this algorithm would output

1 2 3
1 3 2
3 1 2
3 2 1
2 3 1
2 1 3

Terms used in this algorithm

Direction

First the numers 1…n are written in the increasing order and a direction is assigned to each of them which is initially LEFT. Note that the < symbol in front of each number below indicates that the direction associated with it is LEFT

<1 <2 ❤

Similarly a number followed by > symbol would indicate that its direction is RIGHT. In the below example, number 3‘s direction is RIGHT.

3> <1 <2

Mobile integer

This algorithm uses a term called mobile integer. An integer is said to be mobile, if the adjacent number on its direction is smaller than this.

Note:-

If an integer is on the rightmost column pointing to the right, it’s not mobile.

If an integer is on the leftmost column pointing to the left, it’s not mobile.

The Algorithm

  1. The algorithm works by placing the numbers 1…n in the increasing order and associating LEFT < as the direction for each of them

  2. Find the largest mobile integer and swap it with the adjacent element on its direction without changing the direction of any of these two.

  3. In doing so, if the largest mobile integer has reached a spot where it’s no more mobile, proceed with the next largest integer if it’s mobile (or with the next …). There’s a catch. Read step 4.

  4. After each swapping, check if there’s any number, larger than the current largest mobile integer. If there’s one or more, change the direction of all of them. (see the example shown bellow for clarity).
  5. The algorithm terminates when there are no more mobile integers.

The Algorithm in action

1.  <1  <2  ❤
2.  <1  ❤  <2
3.  ❤  <1  <2

Now 3 is no longer mobile as it’s in the leftmost column pointing to the left. Therefore proceed with the next largest mobile integer which is 2.

4.  3>  <2  <1

Now, number 3 has changed it’s direction due to step (iv) of the algorithm stated above. After three iterations in this step, as shown, when <2 was swapped with <1, the algorithm checks to see if there’s any number (not only mobile integers) larger than 2. Because there’s <3, it’s direction gets changed making it 3>

The algorithm now proceeds with 3> as it’s become the largest mobile integer again.

5.  <2  3>  <1
6.  <2  <1  3>

The algorithm terminates now as none of the integers are mobile any longer. The reason as to why they are not mobile is explained below.

<2 is no longer mobile as it’s on the leftmost column pointing to the left.
<1 is no longer mobile as there are no numbers on its direction smaller than itself.
3> is no longer mobile as it’s on the rightmost column pointing to the right.

Therefore the algorithm generates permutations in the non-lexicographical order as shown in steps 1 through 6 above.

Shown below is an example with n=4.

1.  <1  <2  ❤  <4
2.  <1  <2  <4  ❤
3.  <1  <4  <2  ❤
4.  <4  <1  <2  ❤

<4 is no longer mobile as it’s on the leftmost column pointing to the left. Swap <3 with <2 and change 4‘s direction to 4>

5.  4>  <1  ❤  <2
6.  <1  4>  ❤  <2
7.  <1  ❤  4>  <2
8.  <1  ❤  <2  4>

4> is no longer mobile as it’s on the rightmost column pointing to the right.  Swap <3 with <1 and change 4‘s direction to <4

9.  ❤  <1  <2  <4
10. ❤  <1  <4  <2
11. ❤  <4  <1  <2
12. <4  ❤  <1  <2

<4 is no longer mobile as it’s on the leftmost column pointing to the left
<3 is no longer mobile now as there’s no number smaller than itself on it’s direction
swap <2 with <1 and

(a)change 4‘s direction to 4>
(b)change 3‘s direction to 3>

Note that when a number is swapped, the direction of all those numbers that are larger than this number has to be changed

13. 4>  3>  <2  <1
14. 3>  4>  <2  <1
15. 3>  <2  4>  <1
16. 3>  <2  <1  4>

4 is no longer mobile as it’s on the rightmost column pointing to the right. Swap 3> with <2 and change 4‘s direction to <4

17. <2  3>  <1  <4
18. <2  3>  <4  <1
19. <2  <4  3>  <1
20. <4  <2  3>  <1

4 is no longer mobile as it’s on the leftmost column pointing to the left. Swap 3> with <1 and change 4‘s direction to 4>

21. 4>  <2  <1  3>
22. <2  4>  <1  3>
23. <2  <1  4>  3>
24. <2  <1  3>  4>

No numbers are mobile anymore (I hope you can understand why. If not, leave a comment and I’ll explain it too) and therefore the algorithm terminates after having generated 4!=24 permutations.

(I originally planned to publish my  Java implementation of this algorithm, which is unlike the  other quick and dirty types available across the web, but  later decided against it as I did not want my code copied elsewhere). However, upon reasonable request, I can provide you a password protected link to my code.

Please leave a comment if this tutorial was helpful to you, or if you’ve problems understanding this tutorial, or if you have any suggestion on improving this.

Installing German/other language dictionaries on openSuSE 11.2

leave a comment »

If you are a language enthusiast, stardict.sourceforge.net provides you with tons of dictionaries under GPL, which you can install on your Linux machine. The first step is to install QStarDict, which has a wonderful interface to browse those dictionaries. You can install QStarDict through YaST after including the following repository (discussed below) in the list of Software Repositories.

open YaST Control Center

click on Software Repositories and click on the Add button on the bottom

click on Specify URL and click Next

Under the field Repository Name enter QStarDict installation source and under the URL field, paste the following URL (Don’t  remove the colon in the URL, just paste it as it is)

http://download.opensuse.org/repositories/KDE:/Community/openSUSE_11.2

Click on Next and click on OK. While the repository files are downloaded and added you may get some warning regarding untrusted source. Just click on Import without worrying about it. This has got nothing to do with compromising your system.

Now go to YaST click on Software Management, search for qstardict and install the package.

Downloading the dictionaries

Now download the dictionary you want (Some dictionaries have rpm download as well as tarball download. Always download the tarball. In this tutorial I’ve only talked about the tarball installation, as not all dictionaries below provide an equivalent rpm version). Each of these links have different set of dictionaries.

Langenscheidt Großwörterbuch Deutsch als Fremdsprache – ein einsprachiges Wörterbuch (German)

http://stardict.sourceforge.net/Dictionaries_de.php

Several English dictionaries

http://stardict.sourceforge.net/Dictionaries_dictd-www.dict.org.php

Chinese dictionaries

http://stardict.sourceforge.net/Dictionaries_zh_CN.php

Taiwanese dictionaries

http://stardict.sourceforge.net/Dictionaries_zh_TW.php

Japanese dictionaries

http://stardict.sourceforge.net/Dictionaries_ja.php

French dictionaries

http://stardict.sourceforge.net/Dictionaries_fr.php

Russian dictionaries

http://stardict.sourceforge.net/Dictionaries_ru.php

Korean dictionaries

http://stardict.sourceforge.net/Dictionaries_ko.php

and many more bilingual dictionaries

http://stardict.sourceforge.net/Dictionaries_dictd-www.freedict.de.php

http://stardict.sourceforge.net/Dictionaries_dictd-www.mova.org.php

http://stardict.sourceforge.net/Dictionaries_Quick.php

http://stardict.sourceforge.net/Dictionaries_misc.php

The next step is installing these dictionaries (I assume that you’ve already installed QStarDict, as I’ve explained above).

Go to the location where you have downloaded these dictionaries.

Let’s say you’ve downloaded stardict-ldaf-2.4.2.tar.bz2 to ~/Download/dictionaries

then go to ~/Download/dictionaries and type

tar -xjvf stardict-ldaf-2.4.2.tar.bz2

now you can see a subdirectory created automatically under the name stardict-ldaf-2.4.2

Extracting multiple dictionaries at once

If you have downloaded multiple dictionaries from the above links and if you don’t want to run the above command for each and every file, you can put the following lines in a shell script and execute it. I hope you don’t need a how to on this one, but if you do, please leave a comment and I’ll include it too.

for i in *.tar.bz2; do
tar -xjvf "$i"
done

Adding the dictionaries to QStarDict

Create a symbolic link to this directory (in this example it’s ~/Download/dictionaries) on the directory /usr/share/stardict/dic/ as shown below

sudo ln -s ~/Download/dictionaries/* /usr/share/stardict/dic

Enter the root password when prompted and you’re done. Now you can find QStarDict installed at

Application Launcher -> Applications -> Office -> Dictionary -> QStarDict

Have fun learning!

If you are benefited from this tutorial or if you have any suggestion on improving this, please leave a comment.

Installing aircrack-ng on openSuSE 11.2 for Wi-Fi hacking

with 11 comments

Disclaimer:-

I neither do nor encourage breaking into other’s wireless network. You can install this tool to understand or to learn about the vulnerabilities of the different encryption schemes the Wi-Fi specification supports today, and how easy it is for a hacker to break into them. How to is out of  scope  of this tutorial. You can get complete information from aircrack-ng website. Having said that, let’s go ahead with the installation procedure.

Download aircrack-ng from here

http://download.aircrack-ng.org/aircrack-ng-1.0.tar.gz

Open Terminal, go to the download folder and type,

tar -zxvf aircrack-ng-1.0.tar.gz

After this command is run, the files will be extracted to the subfolder aircrack-ng-1.0 (created automatically). Now execute the following commands in the same order

cd aircrack-ng-1.0
sudo make
sudo make install
sudo su -
airodump-ng-oui-update

The last command will take a few minutes. You have to be as root for the Terminal to recognize this command. That’s why you type sudo su – before this command.

Now you can execute the following command to verify if the installation is successful

airmon-ng

which will display the list of wirless interfaces detected on your system.

Note that Terminal would recognize this command only if run as root user. For this to happen you need to execute the command

sudo su -

before executing airmon-ng or any other aircrack-ng commands. Merely saying sudo airmon-ng wouldn’t suffice and you’ll get some error like

sudo: airmon-ng: command not found

Please leave a comment if this tutorial was helpful to you or if you have suggestions on improving it.