Introduction About Site Map

XML
RSS 2 Feed RSS 2 Feed
Navigation

Main Page | Blog Index

Archive for the ‘Linux’ Category

Ginput in Octave

YESTERDAY I encountered my first major setback in Octave for Kubuntu. It was a bug, not a missing feature. It involved an outside library again. I tried installing a newer version of gnuplot (installing the latest one by compiling the source code), but this did not resolve the issue. All in all, over an hour was spent on it, first assuming that I was coding wrongly and later realising that the issue was upstream (there are many more threads like this and they dominate the discussion on the matter). Applying the patch manually would only be a short-term solution as it was already submitted for inclusion in future releases, so for the time being, where this function is needed, I will reluctantly be testing the code under MATLAB (for which I have an academic licence that everyone gets whether they want to or not). It was rather depressing to use MATLAB for a few hours yesterday. Compatibility will be assured again when the little issue (fixable with just a line or a few) is addressed also in the binaries offered by GNU/Linux distributions. Apart from that I’m having Fedora-Octave-ImageMagick compatibility issues [1, 2], which help not at all.

My overall experience with Octave is pleasant and it remains by far the primary choice for image analysis. But for others who insist on using MATLAB I must ensure cross-compatibility, thus the following (under Fedora):

MATLAB selection

The image shows the interface which now precedes the tracking phase. Points can be placed by the user with text guidance in the console. The interfaces were also improved to separate between rectangular, circular, and manual placements.

Here is an example image without the interface.

MR image 291

Tutorial: Installing GNU Octave in GNU/Linux

WITHOUT preparing any notes I’ve embarked on the task of making this first Octave tutorial, which hopefully helps show how to install it on a Debian- or Red Hat-based system.


Please bear in mind that this was done on the spot without rehearsals and future tutorials will hopefully be more organised.

Nearly Two Months With Fedora 14

Fedora 14 with browser

WHEN Fedora 14 was released there was a lot of excitement about it, more so than when previous releases of this leading GNU/Linux distribution came out. This was justified. After almost 8 weeks with Fedora 14 the only major issue I have had with it is conflicting packages, which would not really be Fedora’s fault. For the most part, when it comes to the experience on the KDE (4.5.x) desktop, everything is great. Some reviewers of Fedora 14 have been harsh and said that it would mostly suit advanced users; I’ve not yet found something which would justify a need for advanced skills though. Maybe once a week or so a technical issue may arise that requires technical understanding, but it’s never something critical.

All in all, having used Fedora 14 since it was released I can happily recommend it.

Visual Tour of QtOctave

People who say that nothing can replace Photoshop and nothing can replace Microsoft Office simply forget that the functionality they must be implicily referring to is hardly used by anyone among the entire userbase. As pointed out in the previous post, two months with QtOctave and other free/libre software taught me that there is no reason to deny that ~90% of MATLAB’s users can abandon it and use free/libre software instead, maybe more happily in fact (stability, program weight, and cross-platform with access to the source code count, it’s not just a matter of cost). I have used some of the most advanced functionality in MATLAB, so I do know what I am talking about here.

Today I present free/libre software called QtOctave, which is a graphical front end to Octave and it uses Qt, as the name suggests. Qt is cross platform, so as expected it runs on Windows too. Without further ado, let’s take an overview of what QtOctave looks like. I typically put QtOctave on my eighth workspace in KDE, which helps me remember where to find it. Here is my workspace 8 (screenshot, click to magnify).

QtOctave

This picture may be daunting, but QtOctave does a good job hiding lot of the functionality under menus, which reduces clutter. QtOctave uses Octave (CLI) as its engine, but it provides a friendlier face to it. Let’s break down this picture and explain what each component does, in turn.

Menu

The main menu contains many of the basic functions one ought to expect. By “functions” what I mean is either functionality like opening files or mathematical functions that are commonly used. Many options there control the appearance of the GUI, whose core component of the command line containing the core, Octave. QtOctave wraps it up nicely and provides tools to work with/around it.

Menu in QtOctave

Variables

Octave exposes names and corresponding values of variables it holds, but only upon demand. How about having a GUI component to keep track of these and display this information all the time. You want it? You got it:

Variables

Commands and Dynamic Help

The command pane is a companion tool which helps keep track of recently-used commands and makes these conveniently available. In my case, I added the “Dynamic Help” component, to help show what commands are available as soon as I start typing. The contents in the example below show what appears in the window as soon as I began typing “plot”. The namespace of commands can be highly populated if many modules are used (in session’s path), so this is a good way to keep track without looking elsewhere. Bash has a similar functionality which it makes available via the “Tab” key.

Commands and Dynamic Help

Directories

Directories and files are sometimes easier to approach and navigate though when they are quickly accessible through the main GUI. This has use in all sorts of circumstances as drag-and-drop functionality is broadly supported.

Directories

Terminal

In the main body of the program there is the terminal section (or other components, if one chooses to make them available there). Show below is an example of basic interaction with Octave.

Terminal

CLI

The command-line interface is an integral part of the above and it supports up/down arrow key for use of commands history.

CLI

Editor Menu

This editor can be made part of the main windows, but it does not have to be. I personally choose to make it an external window on a second monitor where it offers a lot of viewing space. The menu has all one ought to expect to find in a standard text editor, but it also contains program-specific buttons like execution and debugging.

Editor Menu

Code

Here is a simple code example. The fonts that I use do not look good because I favour monospace, which helps indentation and other tasks where each character is treated as equal.

Code

Breakpoint

Here is another example of code (further down from the top). This helps show how breakpoints are represented in the editor. Together with the variables panel this provides an excellent environment for debugging, so the editor is definitely not detached from the core components; It’s custom-made for it.

Breakpoint

More Components

There is a lot more under the menus, e.g. package management (see the image below). But that’s a subject for another day.

Octave packages

If you like what you see in QtOctave, then consider giving Octave a look. Both Octave and QtOctave are in the *Ubuntu and Fedora repositories, so they only take a moment to install.

Migrations From MATLAB to GNU Octave

Octave packages

THIS MORNING I spent some time helping others make the same migration which happily enough I made over a month ago (so far, so good!). It’s a migration from proprietary software (and BSA backer) to free-as-in-freedom software, which also happens to be a GNU project. It helps that the project is cross-platform because unlike myself and many others, there are still a lot more Windows users out there. Moving them to Free software on Windows is an essential step which removes barriers when they swap the whole platform. GNU works better on GNU/Linux than on Windows, for obvious reasons. Although it’s a matter of opinion, under KDE QtOctave looks better than MATLAB, as well.

Installing GNU Octave in GNU/Linux is very simple because it is packaged in the repositories of *buntu and Fedora. These are the two distributions where I have checked to verify this although I encountered bumps along the way in Fedora [1, 2, 3]. It is not entirely Fedora’s fault and it’s a known issue that affects many people who are Octave users.

The packages one need to fetch via yum/apt-get (or graphical front ends like Synaptic and KPackageKit) are “Octave” and “QtOctave”. They are not large packages and they should be able to fetch dependencies that are being determined and resolved by the packager/packaging process. Once these are installed, an icon will typically show up somewhere along/inside the menus. If not, run qtoctave from the command line and ensure it gets access to the octave executable (it usually works perfectly ‘out of the box’ based on my experience on multiple boxes). Yes, this should work by default without user intervention, but in case it does not, ensure octave is properly installed and put in the path.

I am unfortunate enough to have faced Windows for about half an hour just now (not my computer) because in some cases, for collaboration purposes, computers that run Windows also need to have Octave installed on them, along with QtOctave for improved ease of use. The way to get that installed is a lot more complex and time consuming because Windows does not have packages managers (this is one of the areas where GNU/Linux is ahead of its competition). In any case, here is how one should install everything and get it set up

Navigate to the downloads page of Octave. At the time of writing (and this may change in the future) there is a native build for Windows, which seems to work without any issues in Windows XP and probably predecessors too. Scroll down to part which says: “The Octave Forge project hosts a native Windows binary distribution of Octave built with the MinGW compiler.”

This leads to Octave-Forge. Near the top of the page there is a “Windows installer (Octave and Octave-Forge)” listed. Now, download the file which is an executable (.exe) and run that. Follow the simple process of installation until completion and at the end ensure that Octave is installed and then listed among the programs in the Windows “Start” (now just Windows logo) menu. The main program is just called “Octave”. When it’s executed it offers a command line prompt which is the Octave interpreter. If everything works fine at this stage, then Octave runs properly and it is time to install the graphical wrapper, QtOctave.

Qt is a cross-platform graphical toolkit and a front end for Octave was written with it not so long ago. The main build is for GNU/Linux with tendency towards KDE, but there is also a Windows port and the one which works best can currently be found in outsch.org. There is a ZIP archive in there, so download it with caution (it is not an official source). Finally, uncompress the file and install it in a suitable location of choice on your hard-drive partition (e.g. C:). When all the files are extracted from the ZIP archive find the qtoctave executable (qtoctave.exe) under the directory containing the DLL files and the other binaries. If necessary, create a convenient shortcut to this file. Unlike UNIX-type environments, paths in Windows are not quite as universal, so QtOctave may not have anything defined regarding the location of the octave executable. Depending on where it’s installed, it may need to be entered manually, otherwise QtOctave will not be able to access the very core and engine of Octave. If that’s the case, go to the “Config” menu (top menu), then “general configuration” (menu item), then “Octave”, “Octave path”. Put in the text field the full path to the Octave executable where you had it installed earlier. This ensures QtOctave knows where to find it. Restart QtOctave (for settings changes to take effect) and once the program can detect the executable ensure it can provide a command prompt for .m files to be run or for commands to be entered manually. If needed, run a basic function like plot just to ensure that graphical units of Octave are also fully supported and installed without any conflicts. QtOctave comes with several units including an editor and it integrates quite well, including drag-and-drop support.

The point of this whole exercise is to liberate users whose personal programs that they write are stuck in the “MATLAB trap”, so to speak (like the old “Java trap”).

If you are interested in converting fellow staff and their students to Octave, remember that it suits an educational environment much better as it encourages sharing and collaborating, not asking for permissions, paying heavy fees/fines, and begging developers to fix bugs rather than have access to the source code, which in turn enables participation. Additionally, most of the basic functions are truly compatible with MATLAB’s and the lack of JIT optimisation, for example, should not matter much in an educational setting. Not many people create MATLAB GUIs either, so there is hardly a need for such advanced functionality. At a later date I hope to make some screencasts about Octave.

Trying Linux Mint for Running GNU Octave

FEDORA 14 is an adorable distribution, at least on the KDE (4.5) side of it. I only had problems in the repository and ones that were not truly Fedora’s fault. Image-related functions gave me a hard time in Fedora because of a known conflict and version numbers. It was not simple to resolve even after hours of trying. I consider myself to be an expert user (not guru) and unless I start compiling from source code as I did 5 years ago, Octave will be a challenge to use. Over on a Kubuntu machine I had no such issues. As the pictures below show, things worked perfectly well without any effort at all. Say what you will about Ubuntu GNU/Linux, but it does tend to work rather well.

Octave tagging - synthetic

Octave tagging

My goal is to do my entire daytime job under a true GNU/Linux/KDE experience with Gnash, no proprietary codecs, and even Konqueror (KIO/kio and sftp/ssh support make it indispensable) as the only Web browser along with Okular, LyX (not OpenOffice.org), and other great Qt/KDE SC programs. There are some limitations in use, but there are usually ways around those (although never as easy to install as Firefox extensions for example). In addition, advances in the Web itself can prove a tad tricky. The nature of the World Wide Web and the Web browsers which change over time is not predictable, so presentations that worked alright with background pictures in the past no longer appear correctly, unless the code is redone (I still use S5 for presentations. It is an excellent presentation tool I’ve used happily for over half a decade).

The main issue I’ve had with Fedora is to do with Octave, which I hope to replace MATLAB with. MATLAB was the last bit of proprietary software I was still using on GNU/Linux (since I began using GNU/Linux exclusively at work, around 7-8 years ago). The problem is not at all exposure to Windows or Mac OS; I never need those, but proprietary software in general is the problem here because of lock-in (practicality), which makes it not a purely philosophical argument.

After wasting many hours trying to get Octave to work the way I want and need it to work under Fedora 14 I decided to just virtualise another distribution under Fedora. The first thing which occurred to me is that VirtualBox was not available (see below).

No virtualbox

In the mean time I also decided to give Mint a go for the first time (I was curious after doing a special audiocast about it). That was a smooth experience luckily. Debian makes it daunting for one to download, so after a couple of minutes I left their Web site. Here’s Mint’s less-than-perfect download experience, assuming one particular route:

Mint download

Fedora makes it a lot more user-friendly when one downloads an ISO. There are usability issues here as most people cannot tell the difference between the different files.

To run it I needed a hypervisor and here is what Fedora had under the virtualisation category (descriptions would help enw users):

Fedora virtualisation

In summary, it is a bit of a shame that one needs to have those barriers; using Octave is not a case of using basic applications, but I was hopeful that Fedora would make it easy. I still reject MATLAB at all costs and I avoid installing it because Octave is doing almost everything that I need. In a future post I hope to write about Linux Mint.

Scilab in Fedora GNU/Linux

Having encountered problems with Octave in Fedora 14, I decided to explore scilab, which I wanted to try about a week ago anyway (and canceled the process after being warned that it was not as complete as octave, at least not for my needs). Fedora does not appear to have scilab in its repositories (Ubuntu on the other hand does have it). A yum and kpackagekit search around “scilab” yields nothing, so I went to the official scilab Web site and downloaded the latest package from that nice Web site, then uncompressed it. This was not the end of it as far as Fedora was concerned because, due to it not being available in the repositories, dependencies could not be resolved, so I needed to also install java manually, then figure out that SELinux was standing in my way. This is the type of thing which would deter new users and as much as I would love to endorse Fedora 14, it is experiences like this which leads me to saying that Kubuntu is still a better choice. Here is a self-explanatory story:

[roy@blueberry scilab-5.2.2]$ ls
ACKNOWLEDGEMENTS  CHANGES_3.X    CHANGES_5.2.X  lib            RELEASE_NOTES_5.0.X  thirdparty
bin               CHANGES_4.X    COPYING        license.txt    RELEASE_NOTES_5.1.X
CHANGES           CHANGES_5.0.X  COPYING-FR     README_Unix    RELEASE_NOTES_5.2.X
CHANGES_2.X       CHANGES_5.1.X  include        RELEASE_NOTES  share
[roy@blueberry scilab-5.2.2]$ cd bin/
[roy@blueberry bin]$ ls
intersci  modelicac  scilab  scilab-adv-cli  scilab-bin  scilab-cli  scilab-cli-bin
[roy@blueberry bin]$ ./scilab

Could not load JVM dynamic library (libjava).
Error: libjvm.so: cannot enable executable stack as shared object requires: Permission denied
If you are using a binary version of Scilab, please report a bug http://bugzilla.scilab.org/.
If you are using a self-built version of Scilab, update the script bin/scilab to provide the path to the JVM.
The problem might be related to SELinux. Try to deactivate it.

Scilab cannot open JVM library.
[roy@blueberry bin]$ su
Password: 
[root@blueberry bin]# yum install libjava
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Install Process
No package libjava available.
Error: Nothing to do
[root@blueberry bin]# yum install java
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package java-1.6.0-openjdk.i686 1:1.6.0.0-44.1.9.1.fc14 set to be installed
--> Processing Dependency: jpackage-utils >= 1.7.3-1jpp.2 for package: 1:java-1.6.0-openjdk-1.6.0.0-44.1.9.1.fc14.i686
--> Processing Dependency: rhino for package: 1:java-1.6.0-openjdk-1.6.0.0-44.1.9.1.fc14.i686
--> Processing Dependency: tzdata-java for package: 1:java-1.6.0-openjdk-1.6.0.0-44.1.9.1.fc14.i686
--> Running transaction check
---> Package jpackage-utils.noarch 0:1.7.5-3.11.fc14 set to be installed
---> Package rhino.noarch 0:1.7-0.7.r2.fc12 set to be installed
--> Processing Dependency: jline for package: rhino-1.7-0.7.r2.fc12.noarch
---> Package tzdata-java.noarch 0:2010o-1.fc14 set to be installed
--> Running transaction check
---> Package jline.noarch 0:0.9.94-0.6.fc14 set to be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================
 Package                     Arch            Version                            Repository        Size
=======================================================================================================
Installing:
 java-1.6.0-openjdk          i686            1:1.6.0.0-44.1.9.1.fc14            fedora            27 M
Installing for dependencies:
 jline                       noarch          0.9.94-0.6.fc14                    fedora            88 k
 jpackage-utils              noarch          1.7.5-3.11.fc14                    fedora            60 k
 rhino                       noarch          1.7-0.7.r2.fc12                    fedora           775 k
 tzdata-java                 noarch          2010o-1.fc14                       updates          151 k

Transaction Summary
=======================================================================================================
Install       5 Package(s)

Total download size: 28 M
Installed size: 84 M
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
updates/prestodelta                                                             | 248 kB     00:00     
Processing delta metadata
Package(s) data still to download: 28 M
(1/5): java-1.6.0-openjdk-1.6.0.0-44.1.9.1.fc14.i686.rpm                        |  27 MB     00:10     
(2/5): jline-0.9.94-0.6.fc14.noarch.rpm                                         |  88 kB     00:00     
(3/5): jpackage-utils-1.7.5-3.11.fc14.noarch.rpm                                |  60 kB     00:00     
(4/5): rhino-1.7-0.7.r2.fc12.noarch.rpm                                         | 775 kB     00:00     
(5/5): tzdata-java-2010o-1.fc14.noarch.rpm                                      | 151 kB     00:00     
-------------------------------------------------------------------------------------------------------
Total                                                                  2.2 MB/s |  28 MB     00:12     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : jpackage-utils-1.7.5-3.11.fc14.noarch                                           1/5 
  Installing     : jline-0.9.94-0.6.fc14.noarch                                                    2/5 
  Installing     : rhino-1.7-0.7.r2.fc12.noarch                                                    3/5 
  Installing     : tzdata-java-2010o-1.fc14.noarch                                                 4/5 
  Installing     : 1:java-1.6.0-openjdk-1.6.0.0-44.1.9.1.fc14.i686                                 5/5 

Installed:
  java-1.6.0-openjdk.i686 1:1.6.0.0-44.1.9.1.fc14                                                      

Dependency Installed:
  jline.noarch 0:0.9.94-0.6.fc14                jpackage-utils.noarch 0:1.7.5-3.11.fc14               
  rhino.noarch 0:1.7-0.7.r2.fc12                tzdata-java.noarch 0:2010o-1.fc14                     

Complete!
[root@blueberry bin]# ./scilab

Could not load JVM dynamic library (libjava).
Error: libjvm.so: cannot enable executable stack as shared object requires: Permission denied
If you are using a binary version of Scilab, please report a bug http://bugzilla.scilab.org/.
If you are using a self-built version of Scilab, update the script bin/scilab to provide the path to the JVM.
The problem might be related to SELinux. Try to deactivate it.

Scilab cannot open JVM library.
[root@blueberry bin]# killall selinux
selinux: no process found
[root@blueberry bin]# ./scilab

Could not load JVM dynamic library (libjava).
Error: libjvm.so: cannot enable executable stack as shared object requires: Permission denied
If you are using a binary version of Scilab, please report a bug http://bugzilla.scilab.org/.
If you are using a self-built version of Scilab, update the script bin/scilab to provide the path to the JVM.
The problem might be related to SELinux. Try to deactivate it.

Scilab cannot open JVM library.
[root@blueberry bin]# ./scilab

This worked the second time only because I made SELinux more permissive, but this could have many users give up. Here is what I then got:

Scilab

As expected, there is no support for some fairly basic functions in scilab, which is not a complete octave replacement.

-->imshow('in')
             !--error 4 
Undefined variable: imshow

 
 
-->imread('in')
             !--error 4 
Undefined variable: imread

I do not want to install MATLAB or Fedora (although we do have an academic licence), but experiences with Fedora so far may drive me towards installing proprietary software or simply working from another box which happens to be better equipped and work perfectly well with Octave. That box runs Kubuntu.

Retrieval statistics: 21 queries taking a total of 0.112 seconds • Please report low bandwidth using the feedback form
Original styles created by Ian Main (all acknowledgements) • PHP scripts and styles later modified by Roy Schestowitz • Help yourself to a GPL'd copy
|— Proudly powered by W o r d P r e s s — based on a heavily-hacked version 1.2.1 (Mingus) installation —|