Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Thursday, 24 January 2013

Upgrading to Subversion 1.7 in Ubuntu

Just a quick post this time. I recently had to upgrade the Subversion (SVN) software on my Ubuntu system to version 1.7. This version is (currently) not included in the regular Ubuntu distribution, but I found the solution in an Ubuntu forum thread - simply run this in a terminal:


echo "deb http://opensource.wandisco.com/ubuntu lucid svn17" | sudo tee /etc/apt/sources.list.d/svn.list
sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get dist-upgrade

Tuesday, 16 October 2012

Editing Grub boot menu order and changing default OS

I recently decided to try running a dual-boot system with Windows 7 and Ubuntu. I first installed Windows 7, and then installed Ubuntu. And with Ubuntu comes the GRUB boot loader, which pops up when I start the machine, and lets me choose which OS to use. If I don't choose anything, the item at the top of the list is selevted automatically after about 10 seconds.

I want to use Windows 7 by default, but unfortunatly Windows is at number 6 or 7 on the list. If I'm not paying attention when I start the machine, it boots into Ubuntu, and I have to restart it. How can I make Windows 7 the default OS?

The answer lies in reconfiguring the GRUB menu. There are several ways to do this, but I used the grub-customizer GUI app, which seems both very simple and flexible. Install it using the terminal:


sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer

In the grub-customizer, you can reorder the GRUB menu items, and for example check the option "Default OS: Last used OS". You can read more about the grub-customizer on the How-To Geek Blog.

Friday, 11 November 2011

Setting up Matlab mex compilation in Ubuntu


NOTE: This post was updated on January 16, 2012.

Recently I have been trying to compile some Matlab mex-files from the excellent Machine Vision Toolbox by Peter Corke. When I first tried to compile, I got the following warning:

Warning: You are using gcc version "4.6.1-9ubuntu3)".  The version
         currently supported with MEX is "4.3.4".

I tried several ways of "downgrading" gcc, but as it turns out, the newer version of gcc on Ubuntu 11.10 is backwards compatible and works fine. The message above is simply a warning, not an error, and there is no need to change gcc to an older version. However, my real problem was this: I got errors of the type

error: expected expression before ‘/’ token

I had no idea why this error was popping up, until I read a post on similar issues on xcorr. It turns out that C++ style "//" comments are not allowed in the standard mex configuration that is set when you run "mex -setup". To avoid the error, open the mexopts.sh file (mine is located in ~/.matlab/R2011b/mexopts.sh), and replace all occurences of "-ansi" with "-std=c99".

Thursday, 3 November 2011

Batch renaming files in Ubuntu Linux

I often deal with a large number of data files, for example files containing ultrasound data from experiments. Recently I had to rename about 200 files which were named something like this,

oldName001.mat, oldName002.mat, ..., oldName200.mat

to something like this:

newName001.mat, newName002.mat, ..., newName200.mat

Basically, I wanted to keep the numbering but change the base of the name. I found out that on Ubuntu 11.10, which I'm currently using, there are two different flavors of the "rename" command. One is a Perl script, and using this, the syntax for doing the above operation is

rename "s/oldName/newName/" *mat

To test without actually renaming, use the "-n" switch. Type "man rename" or have a look at these Webmaster Tips for several more examples of this usage. However, there is also a rename command as part of the linux-util package. To distinguish this from the above command in Ubuntu, call the command as rename.ul:

rename.ul oldName newName *mat

Notice that the syntax is simpler and easier to remember for this version. Type "man rename.ul" or have a look at this NixCraft post for more examples. 

Finally I found out that it is also possible to batch rename files using Thunar, which is the default file manager in Ubuntu 11.10. Mark all the files, right-click and choose "rename", and use the "Search and replace" option.

Wednesday, 26 October 2011

Installing Matlab with standalone user on Ubuntu Linux

OK, after doing this in an awkward manner a couple of times, here is how I install Matlab on Ubuntu with a standalone license:

  • Download the files from Mathworks
  • Run the install script with sudo (as root), but DO NOT activate the license yet. Choose custom install, use default install location, tick the box for creating symbolic links.
  • After installing, try to run Matlab (not as root). The activation procedure will start automatically. Register your own user name for the standalone license.
  • Matlab (with GUI) can now be run by calling the command "matlab -desktop". To create a application launcher for it, use the "Main Menu" program (also called Alacarte, can be installed with the Ubuntu Software Center). Get a logo for the launcher here, or put it right where it belongs by using this command:
sudo wget http://upload.wikimedia.org/wikipedia/commons/2/21/Matlab_Logo.png -O /usr/share/icons/matlab.png

I also recommend having a look at the Ubuntu Documentation for Matlab installation. It might not always be completely up to date, but the procedure doesn't change much between releases.

Wednesday, 6 July 2011

Setting up dual displays in Ubuntu (VGA & DVI)

For a time, I've been wondering how to set up dual displays in Ubuntu. I have two screens connected, one via DVI and one via VGA. Whenever I tried using both, the VGA screen would always be placed to the left, whatever setup I made in the display settings. Finally, I found the solution in Mark's blog post.

The key is the xrandr command line function. I first enabled both displays under the display settings, and then used the command

xrandr --output VGA1 --right-of DVI1

Note that you may have to call the xrandr function without any arguments first, to find the name for each screen.


Tuesday, 28 September 2010

Solving Ubuntu full disk problem related to SBackup

OK, so today I came to my office finding that somehow my Wubi Ubuntu installation had somehow filled up completely. There was absolutely no disk space left, and because of this, the whole system was so slow that it was unusable. Not really realizing how this could have happened, I tried to reboot. The log-in screen now looked different, and there was a warning about power management not being set correctly. When I tried to log in, the screen only blinked, before the log-in screen appeared again.

Getting pretty frustrated at this point, I started looking through forum threads for posts on similar problems. I found several tips on cleaning up a full partition, all of which involved getting into "terminal mode" by pressing Ctrl-Alt-F1 at the login screen. This made me able to browse through different folders, and check the disk usage using the command du, but I still couldn't figure out why the disk had filled up.

Eventually, I found this forum thread which suggested that the backup program that I use, Simple Backup (or SBackup) may have been saving backup files on my laptop's internal hard drive rather than the intended external drive. A blog post by rvdavid confirmed that several people have had this issue.

My external drive is called "Martins Backup", and when it is connected, it is usually mounted to /media/Martins Backup. It turns out that the backup program kept saving files to /media/Martins Backup EVEN WHEN IT WAS NOT CONNECTED (sorry about that), effectively storing them to the internal drive. Investigating this further, I found 20 GB worth of backup files clogging up the system. Luckily, they are all gone now, my Ubuntu system works as usual, and I'm changing my backup program as soon as I find a suitable alternative. Puh! :-)

Thursday, 29 April 2010

Problem loading Ubuntu 9.10 (Wubi) after update

Today I installed an Ubuntu update and rebooted the machine, only to find that I was unable to start Ubuntu. In stead, I was stuck within the "GRUB boot loader". After some intense frustration, followed by some grumbling research on another machine, I found the cause of the problem.

When I installed Ubuntu, I used Wubi, which installs Ubuntu as a Windows program. Wubi uses the GRUB boot loader, but there is a bug in GRUB which can potentially disrupt the Ubuntu boot process each time the linux kernel or GRUB is updated. The problem and its solution is described on this Sourceforge wiki page. In short, one needs to log into windows and replace the faulty file wubildr in the C:/ folder with this file.

Wednesday, 21 April 2010

Jagged text and graphics for scanned PDF documents in Ubuntu

I download a lot of scanned articles in my work. These are usually in PDF format, and the default viewer for PDF files in Ubuntu is Evince. However, for the scanned articles, the text is really jagged and hard to read. It seems that this is due to "missing anti-aliasing", and judging from this forum thread, several other users are having the same problem. A fix seems to be on its way, but while I'm waiting, I've installed Okular (a document reader for the KDE desktop), which renders the scanned text beautifully.

Monday, 19 April 2010

Comparing files in Ubuntu (graphical diff tool)

Today I found myself needing to compare two LaTeX files. I do my LaTeX editing in gedit, and was hoping that there might be a built-in diff tool. This is not the case (at least not yet), but after a bit of searching I found these programs:
  • Meld, for the GNOME desktop
  • KDiff, for the KDE desktop
Both programs can be downloaded from the Ubuntu repository (I was able to download it using the Ubuntu Download Centre), and both are able to compare and merge files and/or directories.

Note: There is also a command line diff tool (try diff --help), but I prefer a graphical interface for comparing files.

Friday, 16 April 2010

Browsing files in Ubuntu with superuser / root status

The file browser in Ubuntu is called Nautilus, and it works just like the Windows Explorer or Mac Finder. However, using Nautilus, I found that I was only able to move and delete files and folders within my home folder. To do anything outside this folder, I need "superuser" status. In the terminal, this "create folder"operation will not work:

mkdir /usr/share/newfolder

because I don't have write access to /usr/share. However, if I use "sudo" before the command, like this;

sudo mkdir /usr/share/newfolder

I am prompted for my password, and after entering it, I get superuser status and the folder is created. This works well for manipulating files and folders from the terminal, but I want to do the same using the graphical file browser Nautilus. The solution? Create a launcher on the desktop with the command

gksudo nautilus

gksudo is similar to sudo, but is used for graphical applications, as explained here. A window will pop up, asking for the password, and after entering it, Nautilus opens with superuser status.

Tuesday, 13 April 2010

Installing Spotify on Ubuntu

OK, maybe Spotify isn't a "tool" as such, but it was nevertheless one of the first programs I tried to install on my new Ubuntu OS. There is no Spotify application directly available to Linux users, but it is possible to use the Windows application through a Windows emulator called Wine. With Wine installed, Windows programs can be installed and used in Ubuntu, without having to install a complete "guest" Windows OS (as you would do with e.g. VirtualBox).

Installing Spotify under Wine was really easy, but when I tried to run it, the sound was kind of distorted, and it would only play one song and then freeze. It turns out that this is a common problem in Ubuntu 9.10. Luckily, someone has already fixed it! This post on Jens' codelog describes what to do. In short, I had to uninstall Wine and install a new, modified version made by Neil Wilson. Now Spotify works like a charm, finally bringing some music into my office. Great!

A litte detail: There are no shortcuts or icons automatically created for Spotify. To create a shortcut on the desktop, right-click on the desktop and choose "create launcher". If you want a "proper" Spotify icon, you can use this SVG file created by Kalle Persson.

You can find more information on how to install and use Wine at this Ubuntu documentation page. There is also some more information on using Spotify under Wine on this Spotify FAQ.

Monday, 12 April 2010

Switching to Linux

As a first short post, I'll just mention that I recently installed Linux (Ubuntu) on my work laptop (a ThinkPad T61). Up 'till now, I've been using Windows XP (work policy), but I have been curious about Linux for some time now, and wanted to give it a try. Seeing as I also constantly have to deal with servers running on Linux anyway, I saw this as a nice opportunity to learn something new.

I always assumed that in order to install a second operating system, a second partition on the hard drive would also be needed. I was pleasantly surprised to find that Ubuntu can actually be installed as a Windows application. That's right, a whole operating system can be downloaded and installed as a regular application, and if you don't like it, you can also uninstall it as an application. In stead of using a separate partition, the Ubuntu operation system is saved in one big file, which works as a separate disk/partition when you are inside Ubuntu. The Windows installer can be downloaded here.

After installing, I restarted my machine, and a "boot loader" pops up, asking if I wanted to use Windows or Ubuntu. Choosing Ubuntu, I was amazed at how fast the startup process was (20-30 seconds), and having logged in, I found a beautiful, responsive GUI with a very nice selection of preinstalled programs. Everything worked "out of the box", and I was connected to the internet (wifi) and surfing within half a minute.

This "Ubuntu Windows Application" is highly recommended for anyone curious about Linux. I will keep posting my experiences with it as I go.