Category: Student guides


A lot of entertainment news has hit Linux over the years.
From XBMCbuntu some years back to the up and coming SteamOS, Linux is the place to be.

But as I was watching boring old standard TV a few weeks back, with my laptop by my side and the Wii (yes, I like the Wii) next to the TV, I thought to myself: ‘What if I had one place that would rule all of these’.

I mean, XBMC is great for all those movies, and the Wii is great for the old reliable games, and those great titles for the PC are on steam, why don’t I combine that.
The thing is, all of these products are perfect in what they do, but they don’t do all of it (though modern consoles have tried).
But ultimately, all of these can run on Linux. This would be the glue that would bind them.
So if you are intrigued into building the perfect entertainment system, then please read on and follow my journey.
Please note though, that this isn’t a guide, more of post that should spark some inspiration (though there may be an actual guide in the future.)

 

So my goals were simple.
1) I should be able to watch movies
2) I should be able to watch TV Shows
3) I should be able to listen to music
4) I should be able to play console games
5) I should be able to play PC games
6) All should be integrated
7) All should be controlled with a controller (wherever possible)

The first few goals are very simple to do, but the latter (controller), that would be a real challenge, especially considering not all PC games are controller compatible, especially when things must be typed in.
The main aim with the controller would be to play Crusader Kings II with a controller (note that this game is entirely played with a keyboard and mouse for obvious reasons).

Before I begin, it’s worth noting that you need to have some hardware, but the limit is entirely up to you, just note that the better hardware, the more you gain.
In my case I had a spare all-in-one computer, since I wanted to just have that by the bed to be lazy. But, if you are going to use your widescreen TV (you want that right?) then you might opt for a fairly small and not so noisy computer. Something you can hide away behind the TV.
For what I will describe, the Raspberry Pi won’t cut it, unless you are willing to sacrifice some things.

For my Linux platform, I chose Ubuntu 13.04.
My reason is that it is out of the box compatible with most Linux applications, requires least amount of set up and I’m a big Ubuntu fan.
You could also opt for XBMCbuntu which is an Ubuntu spin-off with XBMC as it’s focus. It uses XFCE as it’s Desktop environment (which you will almost never see), so you save on that juice.

After I installed Ubuntu, my first step was to install XBMC.
If you don’t know what XBMC is, let me give it a well-deserved introduction.
XBMC stands for XBox Media Center, and started life of as that, a media center for the original Xbox.
But it soon stood all on it’s own, and is the best (in my opinion) open-source media center which sports not only those features you expect out of the box, but also add-ons created by many people to make it even more powerful.

XBMC is available for free here: xbmc.org

Once XBMC was installed, I first created two folders inside my Videos folder: ‘Movies’ and ‘TV Shows’.
I threw my collection of Movies into the movies folder, and TV shows into it’s corresponding folders, and each individual movie was placed in it’s own folder bearing the name of the movie. For instance ‘Zodiac.mp4’ would go into a folder called ‘Zodiac’ which was located in the Movies folder I had created earlier.
For TV Shows it was essentially the same, except, all episodes of a season were all dropped into a folder with the name of the TV show, not in separate season folders.
I will explain why in a moment.

After this, I dropped all my Music into the Music folder.
I didn’t bother with Pictures.

Once that was done, I selected Movies on the main screen and was asked for a ‘source’ for these files.
At this point, I used XBMC’s file manager to navigate to the Videos>Movies folder, and then, I selected the option that the movies were in the folders by their respective name.
I did the same for TV Shows.
After that was done, it automagically added the movies and tv shows to the list and they were now selectable through the ‘Movies’ or ‘TV Shows’ option at the home screen. And because the titles were in their right folders, it got all the information from the internet, so I was able to see a screenshot, and description of the movies in the list. NICE!

My next step was gaming – retro-style!
I wanted to be able to play all those old classics.
From the original Mario on the NES, Final Fantasy III on the SNES, and even Gran Turismo II on the original PlayStation.
For this to work, I began with the easy bit.
I created a folder in my Home folder called ‘ROMS’, and in there I created the folders ‘NES’, ‘SNES’, and ‘PS1’.

The next step was to get the emulators.
There are a lot to choose from, and to find the one best suited for you, have a look on Google, but here is what I used.
For the NES I installed FCEUX.
For the SNES I installed ZSNES.
And for the PlayStation I installed PCSX.
For more emulators, try this site: http://www.zophar.net/linux.html

Whichever emulator you install, please make a note of where the binary gets placed. They tend to install them in a few different places but if you are unsure, try searching for it using the search feature in Nautilus File Browser, or Google. You will need to know this later.

Ok, so next we go into XBMC and I then selected Programs, then Add-ons.
A list appeared with a few add-ons that were installed, but I selected ‘Get more…’
In that big list that appears, you will want to look for ROM Collection Browser.
Select it, and select install. That’s it.
Next time you go to Programs, it will appear in the list.
So, that’s what I did next.
The thing is, right at that moment, we have no games, and no emulators to even run them on, so it will be blank.
You probably will find that on the first run, it will ask you to create a collection. If not, press ‘c’ on your keyboard and create a new collection.
Here it will ask you some questions, most of which you can leave empty, but you will want to select the correct collection type (NES, SNES, PlayStation) and select the source.
One thing I found unclear, so I will try and save you some confusion is that the screens for the location of the emulator and the roms is identical, and it makes you think it didn’t take your first imput.
So, keep a close eye on the top when you get to this step.
If it asks for the emulator, then that location of the binary you wrote down comes in here, just browse down the location of the binary and click it.
Then when it asks for the location of the ROMS, select ~/ROMS/NES for instance. This is where our games will be.
The rest can be left as it is for now.
It will also ask you for extensions of files.
Have a look through the ROMS or copies of the games you have, and type the asterisk (*) followed by a dot (.) and finally the extenstion. Do this for both upper and lowercase. So for instance, I had two type of files, ones that ended in .bin, and those that ended in .img.
So, here I entered this: *.bin, *.BIN, *.img, *.IMG
Linux is case-sensitive, so by having added both the upper and lowercase, I stop the chances of the files not being added.
Any files inside the ROM folders that don’t have these extensions, will NOT be added to the list.
To add a game at a later date, press ‘c’ on the rom list screen and select ‘import games’, then click on the down arrow on the small box that comes up to change from ‘ALL’ to either ‘NES’, ‘SNES’, ‘PLayStation’ or whatever list you have added and whose game types you want to add.
To make a new list for a new type of console, press ‘c’ and opt for a new collection.

But, the console games aren’t entirely ready just yet.
The problem is that if you start the game now, you might find the controller not to work.
So that’s what I tackled next.

Outside of XBMC, open the emulator, and usually at the top where you have file, edit etc, you want to look for an option for joypads.
Open that up and configure your joystick.
I can’t really help you here since I don’t know which emulator you use, but it should be straight forward.
Whilst you’re there, also set the option for full-screen mode since that was my next step.

Okay, at this point, go on, test it out.
Inside XBMC, open ROM manager, press up on your keyboard to set filtering options, select a game and press enter.
If all was well, like with me, XBMC should go into windowed-mode and a full-screen game should appear.
If you want to go back, simply hit ESC and XBMC goes back to full-screen.

Okay.
Next step was for all those PC games.

This is easy, install Steam if you haven’t already done so, and click on ‘Big Picture’ in the top-right hand corner.
Now Steam looks more like a media center, and next I clicked on the gear at the top to enter the settings, clicked on controller, and then the option to edit the controls.
Just click on the list and configure each button, and at the end click done.
Steam is now compatible and can be controlled with your controller.

But I still have to use my keyboard and mouse when using Crusader Kings II.
I went ahead to fix that next.
For this, I went for AntiMicro.
This application basically maps controller buttons to keyboard input, or mouse input.
I simply created a ‘Crusader Kings II’ profile, then pressed a button on my joypad to see which button that was (it lights up the button you pressed), and mapped that to keyboard keys. I did the same for the digital sticks to map mouse movements, tested, and done! Then saved the file.
Now Crusader Kings works perfectly fine (still not the same as keyboard and mouse but that’s expected).
I could do this for every game I want and fire it up when I play.

The exciting moment came when I installed AutoKey for XBMC.
With this add-on, I was able to start Steam right from XBMC, and when it closed, it would come back to XBMC. Therefore, all integrated.
The details of which I got from here: Integrating Steam and XBMC

But for some bonus points, there was one factor that would limit people, so allow me to share.
I am obliged to say that I tell you this since knowledge is power and all that.
So that out of the way, let’s add even more crunch.

What you might want to do next is add 1Channel to XBMC.
1Channel is an add-on that allows you to watch any movie, or TV Show through XBMC from the internet.
It saves space on your hard-drive, and it still has support of those descriptions and pictures.
If you want to add it, it’s probably better to follow the guide here since it has pictures and does a great job at explaining.

With all this done, I accomplished all my goals.
And since I also mapped AntiMicro for XBMC, I can stay in bed and watch a movie, play a game, listen to music and even talk to my friends without leaving my bed.

Now all I need to do is build a servant robot and I’ll never see daylight again.

I hope to find the time to actually build this again and record the steps, but this was more a sharing of my ramblings.

So, why not have a go too, and show all your friends

Advertisements

In part 1 we looked at how to write a bash script.
We looked at the basics including the importance of shebang, how to clear your screen, take user input and evaluate it.
We also looked at how to use IF, FOR and WHILE loops in your bash script and how you may use these loops with applications or commands.
For our example we looked at how you could use a FOR loop to batch convert wav files to mp3 files.

In this part we are going to look at how you can make your script or simple programs run by themselves at given intervals.
We will also be looking at how to make your bash script look more appealing and easier with a nice GUI using Zenity.
Kdialog is also available for KDE users, but we won’t be covering them here as Zenity is the default for Ubuntu desktops.
For information specific to Kdialog check out http://mostlylinux.wordpress.com/bashscripting/kdialog/ which has great examples of using the different options for all you KDE users.

Let’s begin!

1. Full automation with Cron

Cron is a daemon used by Linux and Unix like systems that allow programs and scripts to be ran at certain times.
The Cron daemon will run constantly to check whether any cronjobs are scheduled and then run them.
This is particularly useful when you need a certain action to be performed at a certain time.
Such actions could be scheduled updates or maintenance for system administrators.
But, they could be anything you desire.

Cron and crontabs are simple to configure and once you understand how they work, you will be ready to go in no time.

Crontabs are the programs used in order to keep cron organised.
There are two types of crontabs, one is for system functions and root privileged actions, the other is for users and does not require root.

The best way to explain crontab and cron is to use it, so let’s use it.

I have a little script which will automate the update and upgrade actions of apt-get. I want this to run at 10 minutes past midnight every day.
The script is located in a directory inside my home directory called scripts/ and the script is called upgrade.sh

To begin, I want to edit my crontab.
I do this by opening a terminal, and typing ‘crontab -e’ without quotes.
Because this is the first time I’m using cron, it will ask me which editor I would like to use.
If you are unsure which to use and you’re a relatively new user, then you want to avoid vim (or vi) and pick nano.
Nano works most like a regular text editor in the terminal, and whilst most people will most likely shout at me for not using vim, I don’t think this is a good time to throw you in the deep end, so go ahead and select nano.

Once selected you will be presented with a file that looks like this:

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use ‘*’ in these fields (for ‘any’).#
# Notice that tasks will be started based on the cron’s system
# daemon’s notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)

#
# m h dom mon dow command

Wow, this might look like double Dutch to you, so let’s explain what it wants us to do.
First of all, all those lines starting with a hash (#) are comments, so they aren’t read by the system and are for your benefit.

Let me explain the structure of a cron command.
Crontab is divided in two parts. The first is the time for something to be run at, the second is what is to be run.
An example we are provided is:

 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/

Note the first 5 fields before the command ‘tar’: 0 5 * * 1
This tells us when it is to be ran.
They are ordered as follows from left to right:

Minute, Hour, Day of the Month, Month, Day of the Week

By entering a number on any of these places, you are entering a value to that time.
By entering a asterisk (*) on any of these places you are leaving that blank.
So looking at our example, it is is stating that it wants the minutes to be 00, hour to be 05, every day of every month on a Monday to be run.
This is unusual especially since the comments state every day.
Either way, it’s clear this must be run at 5am each day.
Let’s look at how I want my script to be ran.

My script must be ran at 10 minutes past midnight or 00:10 each day.
Therefore the number sequence should be: 10 0 * * *
If I only wanted it to run every 13th day of the month it would be:
10 0 13 * *
Or if I only wanted it ran the 13th of July it would be:
10 0 13 7 *

But let’s stick to my original plan of 10 past midnight each day.
Next would be to tell cron what I want to run, in this case it’s my script upgrade.sh.
This uses absolute pathnames and I also want to tell it to use bash, so I would say:
‘bash /home/me/scripts/upgrade.sh’ (without quotes)

So my crontab should look like this:

10 0 * * * bash /home/me/scripts/upgrade.sh

After that, I am done.
You can add more by placing each individual job on a new line.
Once I’m done, I can save the crontab using Ctrl+O and then Ctrl+X to exit.

Then to list all the jobs type ‘crontab -l’, and to remove a job ‘crontab -r’.
If you want to remove a job for a particular user use ‘crontab -r user’ (replace user with username)

See how simple that is?

2. GUI-dify Bash with Zenity

GUI’s make applications a lot more attractive, and Zenity can do that with bash scripts.
You don’t even need to install another application for it. So if your friend uses Ubuntu or another Linux distribution with Bash and is based on Gnome, then he/she could use the GUI application after you sent it.

Zenity has lots of dialogs it can present to the user, these include (from the GNOME page):
* Calendar Dialog
* Color Selection Dialog
* File Selection Dialog
* Forms Dialog
* List Dialog
* Message Dialog
* Notification Icon
* Password Dialog
* Progress Indicator
* Scale Dialog
* Text Entry Dialog
* Text Information Dialog

We are going to use some examples to create a small little application that has a few of these features.
This is the plan:

We want to create an application with bash that will ask for a password, it will then check if it’s the same as in the script, then if it is, we will ask for a favourite colour.
After that we will ask for a favourite quotation, and finally, we will let bash save them all in a nice little file and place it on the desktop.
If the password was incorrect, we will show a warning dialog box.

So let’s begin by opening Gedit.
First we use the shebang (#!/bin/bash)

Our first zenity dialog should ask for a password, so let’s begin with the following command:

password=`zenity –password`

That’s all that zenity requires for a password.
What happens here is that we created the variable password.
Inside that variable in the sideway quotes (above tab key) we put the command zenity –password.
This tells zenity we want a password dialog.
All the information that is typed in the password dialog then get’s saved in the variable password.

We can now use an IF loop to check whether the password is correct or not.
This is definitely not the way to ask for passwords but it is a good way to show how it works.

We will use the following IF loop:

if [ “$password” == “password123” ]
then
zenity –info –text “Correct!”
else
zenity –error –text “Incorrect Password”
fi

As you can tell by now we first ask to compare the text in variable password, with ‘password123’.
If that is correct, we create an information dialog with zenity’s ‘–info’ argument and use –text to tell what we want to display.
If it is incorrect, we create an error dialog using –error and use –text to display that it is incorrect.

But we want do other things when the password is correct, so let’s remove the info dialog, and start work here.

Now let’s ask for a favourite colour.
Instead of plain and simply asking, why don’t we use a radio list, where a user can pick one.
Let’s begin.

colour=`zenity –list –radiolist –text “Please choose your favourite colour:” –hide-header –column “Choice” –column “Colour” FALSE “Red” FALSE “Blue” FALSE “Green”`

First what we did was create the variable colour.
then in the sideway quotes (is that the right name?) we told zenity we want a form of –list, and we selected the –radiolist, we want the text displayed to be “Please choose your favourite colour:”.
After this we gave –hide-header, that will ensure you don’t see the column names which we also provided. After that we gave the options available, and set them all to FALSE, meaning that none were selected by default.

Since we don’t need to do anything with this, let’s leave it just as it is for now.

Finally we want to ask for a nice quotation, for this all we want is a text entry dialog.
So we could use:

quote=`zenity –entry –text “Enter your favourite quote:”`

What we did here was select –entry for our type of dialog, and provided the text “Enter your favourite quote”, and all this is saved in the ‘quote’ variable.

Now we get to do some bash behind the scenes, and this gives me a chance to show you one more little feature of bash.

What I want to do is make a file with all this information in and place it on the desktop. But considering everyone has a different username, we need to make some small changes.
First we need to create a variable to place the current username in:

user=`whoami`

Whenever you need to put the result of a command in a variable, you need to use sideways quotes.
The whoami command usually displays the current username, but we are going to use it in a moment so we just want the current username inside the variable ‘user.
Next we are going to make another variable to save us time writing out a text file location like this:

outputfile=/home/$user/Desktop/colours_and_quotes.txt

This is more to save time but notice how we use the variable ‘$user’.
Because we saved the current username in that variable, we know it will always be correct.
Please note you would usually just use $HOME, but this was a good excuse to show you how you can really utilize variables.

The chances are, colours_and_quotes.txt does not yet exist on the desktop, and if we want to write anything to it, it will just give us errors saying it doesn’t exist.
Now would be a good time to create it, so our next command is:

touch $outputfile

Touch creates an empty file by whatever name you gave it, here we used the ‘outputfile’ variable to tell touch where we wanted it placed and by what name.
Now we are ready to send our information.

echo “Colours and Quotes” >> $outputfile
echo “—————————–” >> $outputfile
echo “Favourite colour: $colour” >> $outputfile
echo “Quote: $quote” >> $outputfile

The >> simply sends the strings to colours_and_quotes.txt.
A single > will mean it will overwrite whatever was already there, which isn’t handy if we have a few lines to send, but >> will just write one line after the other.
What we also did was use the ‘colour’ and ‘quote’ variables inside the string to be sent over. This will mean that whatever choices were made and quotes were typed in, they will be sent nicely to the text file.

If all went well, you should have a script like this:

#!/bin/bash

password=`zenity –password`

if [ “$password” == “password123” ]
then
colour=`zenity –list –radiolist –text “Please make a selection:” –hide-header –column “Choice” –column “Colour” FALSE “Red” FALSE “Blue” FALSE “Green”`
quote=`zenity –entry –text “Enter your favourite quote:”`

user=`whoami`
outputfile=/home/$user/Desktop/colours_and_quotes.txt
touch $outputfile
echo “Colours and Quotes” > $outputfile
echo “——————————” >> $outputfile
echo “Favourite colour: $colour” >> $outputfile
echo “Quote: $quote” >> $outputfile
else
zenity –error –text “Incorrect Password”

fi

If this renders wrong, please note that I put a tab (8 spaces) worth of white space inside each loop.

If you run this bash script, you will notice that at the end you have a colours_and_quotes.txt file with all the information in.

I’m sure you can find far better uses for Zenity, but I hope that you will have learned something and are able to make creative and interesting scripts.

For more information on Zenity, visit the Gnome site here: https://help.gnome.org/users/zenity/stable/

If you have any interesting and useful applications you want to share, let me know about it.

We all know how tedious it can be to perform the same long command over and over again.
And sometimes you might not even know how to issue commands or know how they work exactly.
And when this needs to be performed the same way it might just be better if you could make a script specific to your needs.
But you may have other preferences too. Perhaps you need to perform this task at certain times, or perhaps you need to have it performed by someone else who isn’t very confident on the command line.
Luckily enough, Linux has Bash as the main scripting language built in, which is perfectly suited for just such cases.
You could write a Python script, but if it’s basic system maintenance then Bash will get the job done. And because of it’s scripting nature, it means you can write the code needed once, and perform it whenever you want, much like Batch on MS-DOS used to be (remember that?).
But Linux has more tools at your disposal which can all be combined to make your life so much easier, and I will be using all the ones that will be most useful to you.

Take for instance the Cron utility.
Cron is a utility which will run certain programs, scripts or anything for that matter, at certain intervals, in a way that is simple but very powerful.
And when you write a small script to perform a certain task and hand it over to Cron, it will carry that out at the moment you have specified. Whether once a day, once a week or even once an hour. You can forget setting your alarm to perform the task, and just let Linux deal with it.

And thanks to the great efforts of the GNOME team and KDE team, we also have great programs like Zenity and KDialog at our disposal.
These programs allow you to create a nice neat GUI for your bash script depending on which desktop you use (GNOME/Unity using Zenity, KDE using KDialog).
Unlike using Glade in combination with Python for instance, you can issue the GUI building commands directly into your script in an easy to understand way, which means you have one file which produces both the GUI and carries out the command you need.
Very handy for those who don’t feel comfortable with the command line, and if you just want a script to look nice.

In part 1 we will be looking at the absolute beginners steps.
How to write a basic bash script, then spice it up with some user input, and finally make it smart with some conditional for, while and if loops.
And at the end we will see how we can use that to automate a task. In our example we will make a 4 line script (or 1 line if you want to use semi-colons) to batch convert WAV files to MP3s.

But let’s start at the beginning, and write a couple of small bash scripts.

1. Writing a small Bash script

Bash scripts can be as complicated as you make them, but also be extremely simple.
And if you are comfortable working in the terminal, can navigate through the filesystem using the terminal, and issue commands there, you already know a lot of the basics. The simple commands ‘cd’, ‘rm’, ‘mkdir’, ‘touch’, and ‘ls’ are all bash commands, so you can use them inside your script as if you were on the command line.
But there may be some commands that you rarely use whilst working on the command line which you might require in a script.
Such examples may include ‘echo’ for displaying information, variables, and ‘read’ to take input.
As is tradition, we will begin with a simple Hello World script.
All that this script will do is clear the screen and show the text ‘Hello World’

So start by opening a text editor like Gedit and copy the following text there, once pasted, save it in your home directory under the name ‘hello_world.sh’:

#!/bin/bash

# This will display Hello World

clear
echo “Hello World!”

Then, simply open a terminal and navigate to the directory in which you saved this script, in our case we should be in that directory already. Then issue the command (without the quotes) ‘bash hello_world.sh’

See what happened? The screen cleared and it displayed ‘Hello World!’ after which the application quit.
So, what did we do exactly?

The first line in this script is known as the shebang (#!/bin/bash).
What this line does is tell where it can find the bash program to run this script in.
This is particularly handy when we forget to give the script a .sh ending and then it can still be run as normal.
The /bin/bash element is the location of bash on the filesystem.

The next line begins with a hash (#) which denotes a comment line.
Anything written after the hash will not be interpreted by bash and is used to leave a comment about what something does.
It’s quite irrelevant here, but in a long script that can be complicated, it is useful to explain what each part does, making it easy to make changes and simply to understand.

The first real command we have issued is the ‘clear’ command.
This command will fill the screen with enough whitespace to appear as if the screen has been ‘cleared’, this makes it much cleaner than a cluttered program.
As with all commands, you can try it out in a terminal outside of a script and it will still do the same job.

Finally the line ‘echo “Hello World!”‘ displays Hello World!
Echo is the command that simply tells the system that the following string (or variable) has to be displayed, and a string can be put in either single or double quotes.
If we replace the word World with You, and save it, it will display ‘Hello You!’.

2. Bash with interactive input and variables

The example above was simple enough, but sometimes we require some input from the user.
For that we require variables, and in the next example the ‘read’ command.
The read command will take user input and store it in a variable.
If you don’t know what that is, imagine a box. You can then take information, and store it in that box. Whenever you reference that box, you take what’s inside it out. That is how variables work, but a variable can only contain one piece of information at a time, make sure to remember that.

In the next example, we transform our Hello World script to instead say hello to whoever is using the script.

#!/bin/bash

# Asking for user name

clear
echo “What is your name? ”
read name
echo “Hello $name!”

Please note there is a space between name? and the double quotes.
If you run this script it will ask for your name and when you have given it, it will say Hello and then your name and an exclamation mark.
For instance if I give my name as Arthur, it will say ‘Hello Arthur!’.

The first line is the shebang as we previously discussed.
After the comment it will once again clear the screen.
Then it will simply display the question ‘What is your name?’, but by having a space behind it, it means that your answer won’t appear right behind the question making it look clearer.
Next we get the command ‘read name’.
What happens here is that the command read knows to take input from the user, and the ‘name’ behind it is the variable. Therefore, the user input gets stored in the variable ‘name’. We can later call upon ‘name’ to get the input.

The next line ‘echo “Hello $name!”‘ does that.
As we discussed earlier, echo displays a string on the screen, but we did something clever here. We first provided Hello as part of the string, but right behind it we put $name. Whenever you call upon a variable you have stored something in, you place a dollar sign in front of it, so the variable ‘name’ get’s called using ‘$name’, or if you used the variable ‘hello’ it would be called upon using ‘$hello’ etc.
What it therefore does is take the information stored in ‘name’ and displays it as part of the string.
Clever isn’t it?

3. Meeting conditions with IF, WHILE and FOR loops.

If you aren’t a programmer, then this bit may have seemed confusing in the past, so I will try my best at explaining what this is.
Within programming and scripting, there is a lot of loops being used.
What these do is check for a certain condition to be met.

The IF loop may for instance ask for your age, and then it checks IF a person is below 18, it will run a certain command, but IF a person is above 18 it will run a different command altogether. ELSE if a person didn’t give an age, well, then a totally different command gets issued.

The WHILE loop checks if a condition is still the same as before. So WHILE something is the same, the same command gets issued, ELSE, it may quit.
This is handy if we want to keep a program running about 5 times. So WHILE we are only on run number 4 we keep going, ELSE we stop.

The FOR loop runs similar to the WHILE loop, but a little more specific at the basic level
For instance, we can specify certain numbers we want the FOR loop to run in, it will then keep going through the loop trying to meet what we specify and stop when it’s done. Hopefully the example for this later will give some clarification to this difficult to explain loop.

Why not use these examples altogether to see how we can use them with our Hello World example script to make it more and more detailed.
This is going to look overwhelming to the previous examples, but don’t worry, all will become clear.

#!/bin/bash

# A more detailed Hello World script

clear
end=0

while [  “$end” -eq 0 ]
do

echo “How old are you? ”
read age

if [ “$age” -gt “17” ]
then
echo “What is your name? ”
read name
for i in `seq 1 $age`
do
echo “Hello $name, you are $1 years old!”
end=1
done
else
echo “You are too young to run this!”
end=1
fi
done

First of all, this is not really the most beautiful of code and things could have been done differently, but, it illustrates the loops perfectly, whilst still being somewhat useful and easier to understand what each bit does.

The first lines are the familiar shebang, comment and clear lines.
But then we get ‘end=0’.
We use this for our example while loop, since we could use this to keep a program running (we aren’t in this example). We place the number 0 in a variable called end for later use.

Now we arrive at our first loop, the WHILE loop.
‘while [ “$end” -eq 0 ]’ looks scarily complicated, but really it isn’t.
let’s first deal with the ‘-eq’ bit.
It is simply short for ‘equal to’, and since we have place the conditions of a loop inside these brackets “[ ]”, it translates to:
While the information stored in variable ‘end’ is the same as 0.
So the script will keep checking to see if indeed ‘end’ is still a 0.
And then the next line states simply  ‘do’ to finish of our command.
So, while ‘end’ is a 0, do….

The next line is just a printed line that asks for your age.
And right below that, we are asking for user input and storing that in the variable ‘age’.
Notice how inside a loop, we leave a gap of space (just press tab), to make it easier to read.

Now we arrive at our next loop, this time the IF loop.
We are now going to see whether a condition is met or not.
‘if [ “$age” -gt “17” ]’
As before, let’s first look at -gt.
This simply means ‘greater than’, or bigger than.
As I mentioned before, we put the conditions that have to be met inside the brackets and we quote both the variable to match and what to match it to in quotes.
Then it translates to:
if the number we stored in ‘age’ is bigger than the number 17.
And the next line states ‘then’, to tell what is to happen.
So as you can see, it simply checks the number that we type in and checks to see if it is bigger than 17, if that is the case, then we go to the next bit.
But beware, greater than, does not mean including a number. For instance if you wanted to check if it was less than (smaller than) with -lt on 17, then it would not include 17, it would mean 16 and below. To include 17 you would then use, less than and equal too, in bash that would be -le (Less and Equal).

Inside that loop if the condition was met we arrive at our next part.
We first display the question of your name on the screen. Then, on the next line, we take the user input and place it in the variable ‘name’.
So far so good.
But now we arrive at our final loop, the difficult to explain FOR loop.

for i in `seq 1 $age`
Looks intimidating doesn’t it? And where did that ‘i’ come from.
Well it’s actually fairly straight forward.
The ‘i’ is a temporary variable we are going to use (could be anything but ‘i’ tends to be the traditional variable to use).
Then the seq is short for sequence. What For loops do is run through a sequence until the conditions no longer apply.
After having stated ‘seq’ we give our starting point at which to loop, in our case: 1.
After that we give our end number at which to stop, in our case we gave the variable ‘age’.
All this inside quotes (the ones on the key above the tab key, not regular quotes).
Let me replace the variable so you can see what it does.
Say we gave our age as 19.
What it then really says is ‘for i in `seq 1 19`’
And if we translate that, it means, that it will run in a sequence from 1 to 19, every time using the variable ‘i’, which becomes clear in a moment.
After the do command, you see ‘echo “Hello $name, you are $i years old!”‘

As you can see, it displays ‘Hello’ and the name given, after that it displays ‘you are … years old!’.
Remember how we gave the variable ‘i’ to the for loop?
What it now does is it begins with giving variable ‘i’ the value of 1 (since that’s where we said we want our sequence to begin), it then runs through this loop and then displays ‘you are 1 years old!’, then it goes back to the top and reaches number 2 in the sequence, and changes variable ‘i’ to 2, and then displays ‘you are 2 years old!’.
This will happen all the way until it reaches the last number in the sequence. In our case it’s in a variable, so whatever age we gave in. After that it stops. Therefore, you will see a fair few lines with ‘You are … years old!’ each line 1 year up.
We also added ‘end=1’.
Remember right at the beginning that we gave ‘end’ the value of 0? And how we told the while loop to keep running this entire program as long as ‘end’ was equal to 0?
Well, at this point the variable is changed to 1, so the while loop condition is no longer met, and the program is allowed to quit.

Since the For loop is done, we have to close it off, we do this by using the ‘done’ command.
Now you see ‘else’, if you look carefully at the structure, you will notice it is in the same line vertically as the beginning of our IF loop, this means that the ELSE condition is part of the IF loop.
Inside of ‘else’ we simply display that you are too young to run this.
We knew this because we told the IF loop to check if the variable ‘age’ was greater than 17.
And the ELSE statement acts when that condition isn’t met (in this case when ‘age’ is smaller than or equal to 17).
After that, it changes the ‘end’ variable to a 1 to allow the while loop to finish and stop our program.

If you took out all the ‘end=1’ parts, then the program would keep running.
At the end of the IF loop, we put ‘fi’ to end the loop, and at the end of the while loop, we use ‘done’ to close it off.

4. Using loops with commands

But this is all about automating tasks, not hello worlds.
We can use these loops to automate a task however, in little ingenious ways.
For instance, have you ever had a .wav file that you wanted to change to an MP3 file?
That’s all fair and well, but what if you had 100’s of them?
The annoying bit isn’t only the manual conversion, but you have stupid new names like 1.mp3, 2.mp3 3.mp3 etc.
What if you wanted to batch convert the whole lot, and keep their original names while you were at it?
Well, why not use the FOR loop for this?!

Say you have the command  ffmpeg -b 192k -i abc.wav abc.mp3 which converts the abc.wav to abc.mp3.
Handy right?
We can make it a batch conversion command using a for loop.

for i in *.wav
do
ffmpeg -b 192k -i “$i” “${i%.wav}.mp3”
done

Instead of giving a number for a sequence in a for loop, what we did is say *.wav.
The asterisk (*) means anything or all. So in this case it means any file ending in .wav.
So what we are doing is we are telling the script to run through all files that end in .wav.
The first file it encounters automatically gets placed in variable ‘i’.
Then it runs the ffmpeg command on it, and if you replace all the variables ‘i’ with what is contained in it, you will get something like the following, if your file was abc.wav:

ffmpeg -b 192k -i abc.wav abc.mp3

You might be confused by the whole ‘${i%.wav}.mp3’ thing.
This bit basically removes the .wav bit and replaces it with .mp3, so the name stays in tact but instead it’s an mp3 file.
You could also put it all in one line. Just place a semi-colon (;) behind the end of every command.
This one would become: for i in *.wav; do; ffmpeg -b 192k -i “$i” “${i%.wav}.mp3”; done

Try some out for yourself

Why not try some out for yourself
In part 2 we will be looking at introducing Cron.
We will try and automate our scripts even further by letting the system take care of them. Write it once, never need to run it again by hand will be the motto.

I hope you have enjoyed this tutorial, and keep an eye out on part 2

If you are getting a little bored by the ‘Steam posts’ lately, please do let me know, but I thought it would be nice to be ahead of the game.

If you are one of those people who is super-excited about Steam natively on Linux, then you will soon run out of excitement when you realise that most games, and the really popular ones, are not yet available for us Linux users.
So how cool would it be if we could play Windows games through Steam on Linux so you have all those features of Steam whilst playing those games, and having your Steam friends know that you are playing those games?

As you can imagine, we will be using Wine for this to be possible, and in particular: PlayOnLinux, when you are done you should have something like this:

As the screenshot above shows, here I have Europa Universalis III inside the native Steam client. This obviously isn’t an official Steam game, therefore it is limited. However, when you play the game, you still have the Steam features

And when you are playing this Wine game, it does show up in chat exactly what you are playing:

Note how it states that I am playing the non-Steam game Europa Universalis III.

Funny enough, this isn’t difficult to do, and has many advantages.
Rather than having your games scattered around, you can have all your games, Linux or Windows inside one client: Steam.
So let’s look how I did it.

For ease and convenience, I used PlayOnLinux.
This is a pretty Wine GUI and allows you to make seperate Wine bottles and install games from a list or manually with minimal effort. For more information on PlayOnLinux, have a look at another post as I won’t be covering that here.

If you have PlayOnLinux installed and have some games running on it, you are ready to go. I do recommend having a few games (or just one) installed through PlayOnLinux before you begin.

Begin by creating a directory in your home folder which I am calling ‘.POLGames’.
I am using the .(dot) in front of the folder name to keep it hidden and keep my home directory clean.

Next, you will want to keep that folder open, then fire up PlayOnLinux.
Select the game you want to add to Steam and click on ‘Create a shortcut’ on the right-hand panel.
This should have created a shortcut to that game on your Desktop.

Right-click on the shortcut and click on ‘Properties’ and then you should see ‘Command’ under the name, and description. This should be filled in by a line typically starting with ‘/usr/share/playonlinux –run …’.
Select that entire line and copy it (Ctrl+C) as we will need this later.
Then close that window and drag the shortcut to the directory we created, in my example ‘.POLGames’.

Now open Steam for Linux.

Click on ‘Library’ and at the bottom click on ‘+ ADD A GAME’ and then ‘Add a Non-Steam Game’.

You should have a window open which takes a moment to populate.
When it is done, look through this list and see if the game is listed and add it, if it is not listed, don’t worry, we will add it manually.

Click on ‘Browse’ and go to ‘/home/USERNAME/.POLGames/’ (if you used .POLGames, otherwise whatever you called the directory). You can move up a directory by clicking on the icon of a folder and an up arrow at the top.

You should find all the .desktop files of games you have added there earlier from the created shortcuts you placed in there earlier.

Select the game you want to add and click ‘Open’.

If all went well, then you should have it at the bottom of your games list.
If the name is incorrect, you can change it in a minute.

Next we need to change the run command since it will just open PlayOnLinux if you click ‘Play’.

Now right-click the game you added to the list in Steam and select ‘Properties’.
This should open the ‘shortcut’ menu.

Here you should see a button named ‘CHOOSE ICON…’, the name of the game, ‘Target’, ‘Start In…’ and a button named ‘CHANGE…’.
If the name of the game was incorrect, change it in the text-box underneath ‘CHOOSE ICON…’.
Now then, underneath target you need to remove what is in that box and replace it with the line we copied earlier from the PlayOnLinux shortcut command.
We can leave the rest alone, just click ‘CLOSE’.

Now you can click ‘PLAY’ and you are able to play the Windows game inside Steam.

Have fun!

I am slightly behind with this news article, but if you weren’t yet aware let me explain about the news.

As you might be aware, Valve has begun their work on a Linux client for the popular game service Steam.
And not too long ago they were looking for experienced Linux users for their closed beta.
I signed up like thousands of others but did not make the cut.

The beta started a few days ago and some users on Reddit have already breached it.

This breach allows non-beta accounts to access the Steam client and use it.
BUT, before you get too excited, Valve already discovered this breach and it’s not much use anymore.
You are able to use this client to run games you already have installed on your system using the ‘Add non-Steam Games’ feature. But games on Steam for Linux are unavailable for those who do not have a non-beta account.

The question has become whether this will have repercussions or not.
Will this breach make Valve think again about Linux and it’s users?
My personal opinion is that this will make no change to their idea of Linux users at all.
The reason for this is that anyone who signed up for the beta will have been asked how many years experience they have with Linux, and those with longer experience had more of a chance to gain access. Also, those attending Ubuntu Developer Summit gained automatic entry.
Therefore, for Valve to be annoyed by this seems illogical, after all, any Linux user with more than 7 years Linux experience will be a hacker.

Then the question becomes, was this a publicity stunt?
Yes, this question has also come up, and I think it has already been answered.
I don’t think it is, purely because they closed this loophole very quickly and if it was a publicity stunt, they would have allowed it to be used, or at least by a few more people.

But, regardless of the limited functionality for non-beta users, let’s have a look at what to expect and what is already available.

Finally we can have our own Steam icon on the panel as expected, which integrates perfectly with Ubuntu, allowing you to access your friends list, store, library and more by a right-click on the icon. Unfortunately I couldn’t show you the quick-list, but here you see the icon in full glory on the bar.

"The Steam Icon"

Once you click it however, you get an error because you are not a beta user (at the bottom you will find the work around) as you can see below.

After you run the command from the terminal to gain access you will find it in it’s full beauty.
This is exactly the same as you can see in the Windows client.

What you will notice is in the top right corner you see ‘Big Picture’.
This allows you to switch to a full-screen mode which is similar to what you expect from a console version or a media center like XBMC or the like.
It was a little laggy at loading (Intel integrated graphics) but once you get to the main screen it was very responsive and fluid.
This feature is absolutely gorgeous and I can imagine many will use it a lot.

As part of the work around it was initially possible to install games like Team Fortress 2 using a terminal command. However, whilst it begins installing, it will stop with an error about the servers being busy.
I suspect that this is a polite way of Valve telling the hackers they won’t get very far.

 

 

 

 

 

 

 

 

 

All in all, this is not going to allow you to download and install Games.
However, it is a nice glimpse into what we can expect from Valve very soon.
And if (like me) you want your games that you already own organised neatly, then you will find some use in Steam now, as you are able to play games you have added manually.

To install Steam Beta, get access, and attempt to install TF2 yourself:

Firstly open up a terminal and you can install the client by using these commands:

wget http://media.steampowered.com/client/installer/steam.deb

This will download the client, to install:

sudo dpkg -i steam.deb && sudo apt-get install -f

If you are using 64-bit Ubuntu, you will need the extra 32bit library and run the following command:

sudo apt-get install libjpeg-turbo8:i386 libcurl3-gnutls:i386 libogg0:i386 libpixman-1-0:i386 libsdl1.2debian:i386 libtheora0:i386 libvorbis0a:i386 libvorbisenc2:i386 libvorbisfile3:i386 libasound2:i386 libc6:i386 libgcc1:i386 libstdc++6:i386 libx11-6:i386 libxau6:i386 libxcb1:i386 libxdmcp6:i386

Once you have done that, you can run steam by using this command (please do not run it from the icon as this will not work):

steam steam://open/games

This will allow you to enter Steam without errors about being a non-beta user.

If you want to have a go at installing TF2 or at least trying, the command is as followed and needs to once again be entered in a terminal:

steam -dev steam://install/440

This resulted in a failed install for me, but feel free to try yourself.

Since there seems to be some misinformation, misunderstanding and general confusion about viruses on Linux, I hope to be able to explain a few things.

As we all know, a virus is a program that has malicious intent.
There are many forms in which they appear, but there is not reason for me to explain the ins and outs of virii, so let’s crack on with the issue at hand.

I will be looking at the difference between the Windows OS and Linux OS (specifically Ubuntu). I would use Mac OSX too, but eventhough it’s a Unix operating system, I have not used it enough to be able to speak about it confidently.

Let me start off by dispelling one common held belief.

It’s often said that the reason for a lack in viruses on Linux is because such a small amount of users worldwide use Linux, it is better for virus programmers to target Windows than it is Linux.

Every part of this statement is false.
If you are a clever virus programmer, you are better off targeting Linux than you would be Windows.
Windows is a Desktop operating system which could render home users and businesses useless.
Whilst this seems a great idea, it’s not very clever.
Since the majority of worldwide servers run a Linux distrobution, targeting them would be far more interesting, since they are connected more vitally to others than any home computer or single business.
For instance, if you were to target a virus to the server of a major internet company, instead of it irritating the people in head office, you are now shutting the company down.

But Linux isn’t just servers and a few home computers. There is the Android OS, many car computers, robots and even space systems are running Linux.
In fact, I actually believe more people on this planet use Linux than any other OS.
Actually, if you are anti-Linux, I think you most likely are using Linux many times a day.

So with that myth dealt with let’s actually look at the real issue.

Let us look at the system structure on a Windows OS and it’s security, or lack of.
And I’m not just talking about anti-virus here by the way.

At it’s core, the file structure begins at the hard drive on which the OS is installed, this is usually C:
For comparison purposes, we will call this point ‘root’. Since everything starts from this point, root is possibly the best word for it.

From root, you typically find (on a 32bit system) the Windows folder, Program Files folder, Users folder, and perhaps some others.

When you enter the Windows folder, and head on over to the System32 folder, you will find a lot of files.
These files are the core of a Windows system.
If you have ever encountered the annoying Blue Screen of Death or unrecoverable system crashes, the most likely place where things have gone wrong is in this folder.

Now simply open a file which is vital to the system with Notepad, and change something and save it, or delete a few files (by the way this is for illustrative purposes, DO NOT DO THIS, I will not be held responsible) and congratulations, you have just broken Windows.
Simple isn’t it?

Let me just say before I get told how wrong I am, that I am building this on Windows XP and perhaps Vista. I have never used Windows 7, and Vista was extremely brief, so I expect things to have changed.

What this comes down to is simple security.

It’s all well having anti-viruses but if your system is so easy to tamper with, it’s like lying awake at night with a baseball bat in case burglars come in whilst leaving your front door open. You are more or less prolonging the inevitable.

Now let us look at Linux.

Linux begins at it’s root, actually known as root.
Root in Linux is not given a letter like in Windows, rather it’s symbol is a forward slash (/).
From this point, all the file structure starts.
Linux does not like to throw every important file in one general folder.
Every type of folder holds it’s specific type of file.
For instance, all the configuration files are held in /etc, and /usr hold application files.

However, it gets a little more complicated than that.

For those folders you always need an administration password.

There is also a folder in the root directory called /home.
Within this folder you will find folders named after the different users of the computer.
Going into these folders will hold all the personal files such as pictures, music, videos, etc etc.
But typically, hidden away are separate copies of configuration files and applications.
These do not require a password.

This serves multiple purposes.
Firstly, if for an application such as Emesene (a Linux Windows Live Messenger application) you have individual configuration files within your own home folder, it means that each person has their own login name shown, and other users aren’t shown.
Secondly, if something does not require the use of important administrative programs, then it would make more sense to have it in the home folder.

So let’s now look at how viruses can be made and how easy with each OS.
Technically speaking, if I wanted to just cause damage and nothing else, all I would need to do for Windows is to create an application that deletes files in the Windows folder.
Then I would have achieved my goal and usually without problems in security.

With Linux it’s a different story.
If I wanted to create damage, I would first have to think of where the damage has to be done.
If I simply wanted to damage users files, then I could write a script that deletes things in the users directory because that requires no administrator passwords.
However, it would make no change to the OS which would still run just as well.

If I wanted to damage the system and render it useless, then I rely on skill and the user being somewhat naive.

Firstly, I could write a script that would empty the harddrive.
Funnily, if you are running Linux, whilst still using it, you could empty the harddrive, although most Linux distributions no longer allow you to run the script needed, which for obvious reasons I’m not going to supply.

The issue with this is no matter whether you create a cunning app, or a script, it requires administration rights. Which in debian based systems is sudo and more server style OS’s as su.
They will then be asked for their password.

Now if someone is naive and hasn’t checked the code and just runs it, of course it will do damage.
But usually someone will have checked the code and warned others.
If they aren’t naive they won’t run it.

Also an added bonus that Linux has is their ideals for OpenSource.
Most software is written using scripts (like Bash) or languages (like Python) which most times have the sourcecode easily obtainable and open to scrutiny.
Meaning that the chances in passing a virus in even complex applications is very very small.

But you might also be wondering how anti-viruses work.
Even though that is slightly irrelevant to this article, I do want to explain.

Anti-virus software is not all magical with it’s ability to know what a program does and therefore stop it in it’s track.
In fact, it works totally different than that.

If you have anti-virus software you will have noticed that you hear that a database has been updated, or is not up to date.
What happens is the people who work for companies like Norton, and AVG, find out there is a new virus on the loose.
They scrutinize a copy of this virus and how it reacts.
Then they record it’s patterns in a database which is sent to you.
If you catch that virus it checks the database to see if it matches any in the database and then stops it.
So this also means that if you are the first person to get the newest most evil virus ever, your in trouble since it isn’t in the database.

Now there are many anti-virus software on the market for Windows, but only a couple for Linux.
Most of the basic reasons why I have outlined.

But there is also the point of arrival for the different OS’s.

Windows users are used to getting their software from a website, where, if we are honest, anybody could have created it for whatever purpose and even under different guises.

Linux doesn’t approach software this way.
Linux uses package management. Ubuntu uses the Ubuntu Software Centre, and Debian uses Synaptic for example.
These package managers are thoroughly checked so that you know that whatever software you download is safe.
Sometimes you download software from websites but this isn’t always encouraged, and usually someone warns you if it’s not safe.

Now these are not all the reasons for the reason why Linux viruses are rare, for they do exist.
But they are the most basic reasons.

My advice:
If you cannot find a piece of software you are after in the software centre or Synaptic, and have to download from a website.
First ensure it is safe by seeing what others have to say about it.
If someone promotes a script (as I have for Paltalk and Lotro) first see what others have said about it, and then if you have not enough information, read through the code, or have someone else read through it, to ensure that it’s safe to use.
And obviously, if a script or program asks you for your password, don’t just jump in and give it, find out why it needs it.

N.B. Unfortunately this guide no longer works.
Paltalk now does not work due to the discontinuation of Prism.
Also, Wine no longer works with the latest version of Paltalk.

I seem to be writing a lot of tutorials on possible fixes for Paltalk on Linux.
It seems to be a big issue as most of my traffic shows thats the number one topic.

Unfortunately, the people at the top of Paltalk seem to have a real dislike to the Linux community, and it’s not exactly a smartly built application.

First of all, Paltalk has a reliance of Internet Explorer. Without having that installed, you cannot look at the chatroom lists, or enter the rooms.
Luckily, Wine has this issue fixed since Winetricks allows you to install IE on Wine.
But it seems that whenever a new version is released (which lately NEEDS to be updated), it no longer works with Wine.

The current state of Paltalk through Wine is as follows, it will install, it will run, and if you followed my other tutorial on getting it to run, you can enter rooms and do what you do on Windows.
However, it’s very unpredictable as it seems to crash randomly.

Paltalk will not support Linux, and their answer to a Linux version is that Paltalk Express is a perfect version for us.
Yeah right!

I have given up on trying to get it stable on Wine, and now I am going to leave it with Express.

Paltalk Express

You are probably wondering why on earth I am providing a tutorial for a browser based service.
Firstly, we might aswell make it look partly app-like, and secondly, a lot of people have issues with it I have a fix for.

You can use your browser to go to Paltalk Express, but I would recommend downloading Mozilla Prism.
Opening Prism will allow you to create a webapp from a site. Simply enter Paltalk as the name, and the url as http://express.paltalk.com.
Tick the box to create a desktop shortcut and that’s that.

Now let me adress a problem a lot of people have.

The mic or camera feature does not work!

This is incorrect, and easy to fix.

The problem is that Flash does not always ask you whether you give permission for cam and mic, so we need to tell Flash it’s fine to use.

Go to this site: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager06.html

You will see a long list of websites in the box, scroll down until you get mentions of ‘express.paltalk.com’.
Highlight that and tick the box saying ‘Always allow’…do not select ‘Always Ask’ since this will NOT work.
Go to the other tabs and do the same.

Now when you log into Paltalk Express, you can use mic, and cam.

Enjoy

Another holiday over, a new year begins.

As I face my second year in my quest for an ICT degree, I recapped and learned from the past mistakes.

Here in Holland, as well as a lot of other countries around the world, Windows dominates the education sector.
This is kind of annoying as the ICT sector more than any other education knows the importance of an open selection of software.
The problem arose last year when I turned up with my Linux laptop ready for the course only to be warned that if I turned up with my laptop needing to be repaired, they couldn’t due simply to the fact that I did not run Windows.
Encountering some problems which caused me to not get the grade I needed for a particular subject was also down to me having Linux (not because it didn’t run well, but more because the teacher refused to help me since it wasn’t Windows).

The problems didnt stop there.
There was also some aspects of the course which required Windows specific software which at the time I had no alternative for.
One such example was the ‘Database’ part of my course in which we HAD to use Microsoft SQL and Visual Basic. Don’t ask me why they didn’t instead use MySQL but my guess has to be that Microsoft may be a sponsor of the education sector here in Holland.

This meant that for a big part of the year I was running programs on XP through VirtualBox which was not really what I wanted, as I want to use my diploma to work with Linux.

To stop potential students from having the same trouble as me, I am now going to list the software I used, and will use which allow me to do all these things without having to use Windows.

Web Development

This was my first subject and for this I had to be able to build a website in HTML, CSS and PHP.
Luckily there was a long list of tools at my fingertips and I use BlueFish Editor, which is available in the repositories.
The beauty of Bluefish is that it is a HTML and PHP editor with an option to preview your code and also uses some intelligence to guess what code you are trying to use whether this be bolding of text, padding or type of text.

In order to use PHP it had to be switched on and Windows users were told to use a local server by means of Xampp. Well, Xampp for Linux is also made by the same people as the Windows version and can be found on this site: http://www.apachefriends.org/en/xampp-linux.html

Make sure that you switch it on though, as I made the mistake of forgetting to switch it on during my presentation resulting in a failure. Please learn from my mistake!

If you are not a big fan of the terminal, then you can create a GUI as followed:

1) Download the latest version of xampp for Linux through the link above

2) After having installed it according to the instructions on the site, run the following command in a terminal

'gedit ~/.local/share/applications/xampp-control-panel.desktop' (Without Quotes)

3) In the empty gedit page paste the following once again without quotes and save it:

[Desktop Entry]
Comment=Start/Stop XAMPP
Name=XAMPP Control Panel
Exec=gksudo "python /opt/lampp/share/xampp-control-panel/xampp-control-panel.py"
Icon[en_CA]=/usr/share/icons/Tango/scalable/devices/network-wired.svg
Encoding=UTF-8
Terminal=false
Name[en_CA]=XAMPP Control Panel
Comment[en_CA]=Start/Stop XAMPP
Type=Application
Icon=/usr/share/icons/Tango/scalable/devices/network-wired.svg'

Once that is saved you will find it under Applications > Other > Xampp control Center.

Thank you Petervk from the Ubuntu Forums for providing this information.

Embedded Applications

In this subject we looked at Java and eventually had to create a hangman game on a Java Mobile Device.

We were instructed to use BlueJ IDE first and later on Eclipse IDE.
BlueJ is available here: http://www.bluej.org/download/download.html and download the .deb file.

Eclipse is available on the repository and you will need the Mobile Eclipse tools from the EclipseME site here: http://eclipseme.org/
The site also gives instructions on installing this. Please note however that this is not for the faint-hearted. However, if you are stuck you can even ask Windows users for help as they have to use the same tools.

Database Applications

As mentioned before, we had to use MS SQL and VB.

If you are allowed to use MySQL then that is available in the repositories, if like me it HAS to be MS SQL then there is something for you.
An incredible tool which looks like the twin brother of the MS SQL Management program is available for Linux through this site: http://www.aquafold.com/
This program connects to many different types of databases including MSSQL, MySQL, and Oracle to name a few. If you are familiar with the MS SQL Management then you will find this program just as good. Only one downside, it isn’t free.

I also installed Mono from the repositories to fill the VB gap.

Game

For game we had to once again create a game on a mobile java device but this time it had to be complicated and self-thought up. For this I just used Eclipse and EclipseME.

Infrastructure

This subject was about security and lay out of a network and it’s protocols. If you are a power user then this shouldn’t be too difficult but unfortunately eventhough my teacher was very sympathetic to Linux users and went out of his way to show Linux users how to achieve the same results as Windows users and giving the Linux equivelant commands to type in, he was forced to give the assignment to set up Active Directory and a client on Windows within VirtualBox or VMWare. This was something we couldn’t get around. The positive is that even Windows users had to use VMWare to do this assignment, therefore it was something not caused by ‘having Linux’

Some useful additional software

I used the following software to make life easier during the course. It wasn’t compulsory but it did help me enormously.

GIMP: For designing a website and game elements this was very handy. Please note, you are probably better off downloading the latest version from the website  than to download it from the repository due to the fact that it has a one-window mode making it identical to Photoshop.

Wine: Well this is simply for running Windows programs just in case

Rednotebook: An odd choice perhaps but switch it on and save all your lesson notes there, it is good for later reference and you know the date too!

I hope this helps people in their quest and proves that even if your told you can only work under Windows, that this is simply not true.