Thursday, 28 July 2011

Use Compiz to annotate your screen

There are times when it can be really useful to draw on your screen, like when making a tutorial for example. You can draw around important features to highlight them and help people see what they need to do. Because Ubuntu uses Compiz to decorate the windows this functionality is already there, you just need a way to access it.

Install compizconfig-settings-manager and start it up (a shortcut is to type ccsm). Click the Extras button on the left and choose Annotate, then click Enable annotate to activate it. If some of your panels mess up at this point, open a terminal and run "compiz --replace" to restart Compiz and fix them.

As will all Compiz features, annotate is very customisable and you can change key actions, colours and even how shapes behave. Try it out, it's easy to do!

Wednesday, 27 July 2011

Recover forgotten passwords with Evolution mail

Once you've received mail with Evolution you'll have entered your password for your email account, which you may have chosen to save. The thing is though, where does it save?

Old versions of Ubuntu used to save into a file in ~/.gnome2_private/ which stored base64 encrypted passwords (which was very insecure). If you're using a later version (which you probably are) then passwords are saved in a different way. The Gnome Keyring Manager now handles encrypted data on Ubuntu to provide a secure way of storing sensitive data.

To view your saved passwords, run the application "seahorse" which will open the password manager, double click the "Passwords: login" folder, and scroll down to your email account. Double click that and you can view your password for that account.

Easily view your saved passwords with Seahorse and Gnome Keyring

You'll also notice that browser passwords and some other keys are stored here too as it is used for all passwords.

Tuesday, 26 July 2011

Extend laptop battery life with CPU scaling

If you have a laptop with poor battery life, it is really annoying to have it run out when you're doing something important like word processing. Many computers support CPU scaling however, which is a way of making your processor use less power.

(Note that this post might look a bit intense, but it really isn't, it just has a few terminal commands)

The first step of this is to see what modes your CPU can use, so type
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
in a terminal. You should see a range of options, if not your CPU may not support scaling. My options are: "conservative ondemand userspace powersave performance".

At this point you should check the default for your CPU with:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
this will tell you which mode your computer is currently using so you can switch back to it later.

You can then tell your computer to use a certain mode on the CPU. If you're just taking notes at work you probably need no more than powersave (or your CPU's equivalent).
cpufreq-selector -c 0 -g powersave
Note that you must put your core number after the -c. If your CPU has a dual-core processor (2 cores), run this twice with "-c 0" and "-c 1" (and do the appropriate for triple/quad cores).

And that's it! You can check how your CPU is doing with
cat /proc/cpuinfo | grep "cpu MHz"
Try comparing it with performance mode to see the difference.

Monday, 25 July 2011

Battle for Wesnoth

Battle for Wesnoth is a full turn based strategy game, available on a number of platforms. Notably on Linux because we don't get many games here!

You can get it in the repositories be installing "wesnoth".

The graphics are well drawn and it has the sense of a game that you would pay for. There are loads of different character types and each one has a different image, they're not just edited with different colours.
Wesnoth has great level designs, despite being limited to a hexagonal grid

As a turn-based strategy, Wesnoth has lots of different factors in gameplay. Units level up, and have various statistics, multiple weapons (which also have lots of stats). Playing in the night changes your units abilities, or playing on different terrain. At first it can seem a lot to get your head around but it really makes playing more fun when you have to review all the stats before you make a move. It's also got a battle calculator so you can predict the possible outcomes of each battle before you attack.
Level, HP, XP, MP, Defence, Allegiance and weapon stats all to consider

Game time:
Wesnoth has a extensive single player campaigns and and multi-player over the internet, so it doesn't get old. Single player will last you a while if you play a few hours a day and once that's done you can have countless battles over the internet (which is even more exciting, in my opinion).
There are 15 campaigns, most with over 10 scenarios

In conclusion, Wesnoth is an amazing game which, being free, is something you really should try because on Linux it's one of the best games available.

Saturday, 23 July 2011

Geany text editor

Anyone who has done programming on Ubuntu has probably used Gedit. It's the pre-installed text editor that does a pretty good job, with numerous languages for syntax highlighting and a range of features to make programming easier.

Recently I discovered another editor, Geany. This is basically a vastly improved version of Gedit, and I can see why it's not installed by default as a standard user wouldn't need to use half the features. For developers on the other hand, Geany is way more useful then Gedit, let me show you  a few of the reasons why.

Built-in terminal:
Geany's terminal lets you run your code without switching windows.
At the bottom of the Geany window is a row of tabs, for various functions. One of these is the terminal, which stays visible when you edit your code up top. Using a normal terminal window can be a pain because it covers the editor and you have to Alt-Tab or the like between windows. The built-in terminal is completely unobtrusive and allows you to quickly test and fix bugs in your program.

Smart home key:
If you like to keep your code neat, you'll be used to nesting lines of code. Especially in HTML and Python, it's not uncommon to get over 3 tabs in and you find yourself using the left and right arrow keys a lot. The smart home key fixes this by jumping to the start of the text, not the start of the line, saving time having to adjust the cursor.

Indexing your code:
Quickly navigate your code with Geany's tree
The Geany window has a tree down the left hand side which contains all of the functions, classes, definitions etc in your file. When you have a large file that becomes hard to navigate, it might be time to use this because it really saves time scrolling through to find what you want. Simply clicking the entry in the tree jumps to the right place in the file without any unnecessary searching.

Geany also has support for compiling (though I use Python so I haven't tried this out) and hosts a load of other amazing tools, so try it if you haven't yet! If you don't use Gedit or Geany then what's your favourite editor?

Thursday, 14 July 2011

Firefox 4, 5 and Chromium

It's been a while since I posted due to exams and whatnot. While I was out, Firefox got 2 major releases: 4 and 5. (5 is out in the repositories, so an update will get it for you) Currently Mozilla's plan is to release smaller updates much faster, so you don't have to wait half a year to get the latest technology.

The strength of this plan shows up when compared to a browser like Internet Explorer, which is only released every few years. It lags behind other browsers because it rarely gets updated. Firefox's new release schedule aims to overcome the delays Firefox experienced by getting the new updates out on a new "Major" release, which used to happen once or twice a year.

If you had the misfortune to use Firefox 4, I'm sure you'll agree it was quite a flop, especially on Ubuntu. The layout and GUI is clunky and slow and the browser uses excessive amounts of memory. Rather than waiting for FF5 to fix it, I took the opportunity to use Chrome/Chromium. I was thinking of using Chrome before, but didn't want to transfer everything from Firefox, however because FF4 effectively forced me to, I decided it would be worth it.

Chrome works well on Ubuntu, the only issue I have is the window decorations going out of Chrome's own fancy window, though I run it maximised usually, so it's generally not noticed. Chrome looks much more smooth than Firefox, even FF5 and has useful features like switching tabs by scrolling over them and a slick way of dragging a tab into a window. Not to mention it runs quickly.

When FF5 got released I downloaded the binary before it got into the main repositories and had a look. The GUI isn't much different from 4, but the browser itself is more stable and optimised. Firefox 5 generally uses slightly less memory then Chrome, but Chrome is slightly faster, so it's pretty neck and neck which to use. In the end I stuck with Chrome because I find it easier to use. After the Firefox 4 fail, FF5 is also an awesome browser that I find myself opening every now and again as well as Chrome.