Friday, November 20, 2009

MATLAB 2007a with JRE 1.6 to solve the "CANNOT PASTE" issue

Hi all!

After many posts, here we are speaking again about Mathworks MATLAB R2007a, a glorious version of this remarkable programming environment for Scientific Computing.

This version of MATLAB is now a bit old, but many universities and then professors, research teams and students are still using it. Also my famous neighbour is still using it with its awesome license and he is still so kind to let me use it in change of maintainance work on his Linux machine. ;-)

In older posts I already wrote about some solutions to issues about this MATLAB version in times when it was "too new", or "too humble" for Compiz...
This is, I think, the first post about an issue caused by the fact this version is now becoming "too old".

Recently, for some needs, I dropped from openjdk (on Archlinux) switching to the closed version of Java.

In the meantime I was playing with Emacs so I decided to change in MATLAB che "Copy and Paste" keybindings in order to learn better the Emacs ones.
They didn't work so well, especially the "Paste" command.. (but it was caused by Java).
Anyway, after a second, I needed suddenly to be more productive in order to finish a work and sadly I had to come back to the Windows-like keybindings CTRL-X CTRL-V and CTRL-C.

But what a surprise when I discovered that either in the Command Windows and in the MATLAB Editor a "Paste" was permitted literally only once per session 8-|

Since it was my fault playing with the "Copy and Paste" keybindings, I spent hours checking, patching, deleting and recreating MATLAB's preferences files in order to try to revert all the "Copy and Paste Universe" back its previous "Time's Arrow"!

After weeks using an external editor now I discovered another error dealing with a call to the Helvetica font I didn't set in any preference... so I started MATLAB with the debug option and I looked for some forum solution to cope with that further issue.

While reading I find an advice by a user suggesting to use the system's native JRE instead of the MATLAB's one. And then my eyes opened and I asked myself: "Could it be the copy and paste issue caused by the Java versione included in MATLAB?"
So I checked which Java version was embedded in MATLAB R2007a and I found it is the 1.5

After all this story here you are how to fix all the misterious errors you can experience in MATLAB due to its old Java:

You only need to create a custom script for launching MATLAB in order not to modify the native one (it's possibile but it's not adviceable):


# This was good for Compiz issues
# but I don't need it at the moment
# export AWT_TOOLKIT=MToolkit

# This is the magic environment variable to fill
# with your system's Java Installation directory
export MATLAB_JAVA=/opt/java/jre

# This is my matlab start command... probably only
# "matlab -desktop" on your system
/opt/matlabR2007a/bin/matlab -desktop

So that's all, if you start MATLAB with the MATLAB_JAVA environment variable pointing to your system's Java installation directory you (hopefully) will solve all the issues due to the old 1.5 Java embedded in the R2007a version.

At least, for me it worked, not showing anymore the Copy and Paste issue and the strange font issue at MATLAB's start.

Hope this will be useful for someone else ;-)

Keep on hackin'

Wednesday, November 18, 2009

Awesome: learning to use a tiled window manager

Awesome is a great, highly configurable and extremely lightweight window manager for X. There are many chances for you to find it already packaged for you distribution.
Awesome is a "tiled window manager" even if it has also a "float windows mode". Anyway in its default settings you won't find the actual windows titles and their usual functions because the windows are placed automatically for the best use of the screen. In this mode you will have a graphical interface you can master completely using nothing more than your keyboard.

In order to achieve any sort of "productivity" with Awesome the user has to get used to it and to configure himself some keybindings and functions, since the defaults settings don't cover everything (and this was intended in order to put the stress on customization).

In the coming posts I will explain the results of my usability experiments with this "awesome" window manager ;-)

At first I had to recreate my custom configuration copying the default rc.lua file to ~/.config/awesome/

There I put also the copy of the default theme folder with the themes I wanted to use. So in the end I had this directory structure:
~/.config/awesome/themes/default (with all its files and subfolders)
~/.config/awesome/themes/sky (my chosen theme with all its files and subfolders)

Then I started the customization and I fixed the Java non-reparenting-wm issue. This problem caused alla Java GUI windows not to be drawn correctly leaving them blank and therefore rendering useless their applications (like MATLAB... which GUI is written in Java too).

In the coming days I will try to explain better the steps that led to my present configuration.

I you like, you can have already a look on my configuration files at this page on the webpage I use as file download support for this blog:

Keep on hacking! ;-)

Monday, November 16, 2009

How to enable KMS on an Intel GM45 X3500HD

Hi all!

Here you are "Yet Another How-To" to enable KMS on an Intel board ;-)
... of course, on ArchLinux... but the instructions can be easily adapted for others distributions

The procedure to activate the graphics drivers on the adapter directly during kernel loading is simple:
  • modify the file /etc/mkinitcpio.conf having the MODULES string like this:
MODULES="intel_agp i915"
  • modify the archlinux kernel line in /boot/grub/menu.lst
kernel /boot/vmlinuz26 root=/dev/sd[x][n] ro i915.modeset=1
where /dev/sd[x][n] is your / partition and i915.modeset=1 substitutes any vga=NNN or video=... options that won't be supported by KMS which find itself for the best resolution.

That's all, now you should see the very first post messages of kernel startup in the very ugly and big "standard console character", but then you will see the rest of the startup messages in the correct (and autodetected) resolution.
Furthermore the switching between Virtual Consoles and the X server will be really faster than before.

So enjoy your Intel video adapter's capability with the new Kernel Mode Setting you just configured on you machine!

Keep on hacking! ;-)

Monday, November 9, 2009

Happy Carl Sagan's Day

Look again at that dot. That's here. That's home. That's us. On it everyone you love, everyone you know, everyone you ever heard of, every human being who ever was, lived out their lives. The aggregate of our joy and suffering, thousands of confident religions, ideologies, and economic doctrines, every hunter and forager, every hero and coward, every creator and destroyer of civilization, every king and peasant, every young couple in love, every mother and father, hopeful child, inventor and explorer, every teacher of morals, every corrupt politician, every "superstar," every "supreme leader," every saint and sinner in the history of our species lived there – on a mote of dust suspended in a sunbeam.

The Earth is a very small stage in a vast cosmic arena. Think of the rivers of blood spilled by all those generals and emperors so that, in glory and triumph, they could become the momentary masters of a fraction of a dot. Think of the endless cruelties visited by the inhabitants of one corner of this pixel on the scarcely distinguishable inhabitants of some other corner, how frequent their misunderstandings, how eager they are to kill one another, how fervent their hatreds.

Our posturings, our imagined self-importance, the delusion that we have some privileged position in the Universe, are challenged by this point of pale light. Our planet is a lonely speck in the great enveloping cosmic dark. In our obscurity, in all this vastness, there is no hint that help will come from elsewhere to save us from ourselves.

The Earth is the only world known so far to harbor life. There is nowhere else, at least in the near future, to which our species could migrate. Visit, yes. Settle, not yet. Like it or not, for the moment the Earth is where we make our stand.

It has been said that astronomy is a humbling and character-building experience. There is perhaps no better demonstration of the folly of human conceits than this distant image of our tiny world. To me, it underscores our responsibility to deal more kindly with one another, and to preserve and cherish the pale blue dot, the only home we've ever known.