too cool for Bill

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):

#!/bin/sh

# 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.



Sunday, August 16, 2009

Stellarium libjpeg microbug in Archlinux

Minutes ago "dreaming of a telescope" I did what Galileo did 400 years ago, when, in 1609, pointed one of the first basic refractors telescopes upwars to the sky, towards Jupiter, discovering its 4 main satellites (that afterwards were called after him as "Galileian Satellites").

I took my dear old scope and I aimed it to the brightest object of tonight's sky (even from this desert Milan but photo-polluted as usual): a great Jupiter of -2 mag and something more with Ganimede at mag 4 in the top left of the ocular.

Yeah... but for knowing it was Ganimede I needed the awesome Stellarium.

I started the program but it said that without libjpeg.so.62 it wouldn't start. :-(

Then I tried to symbolic linking as "libjpeg.so.62" the libjpeg I have installed by default in Archlinux that's version 7:

$ sudo ln -s /usr/lib/libjpeg.so.7 /usr/lib/libjpeg.so.62

No way :-(

So I had to remove the just created link to clean:

$ sudo rm /usr/lib/libjpeg.so.62

.. and search with yaourt if version 6 is still available on aur.

Luckily it is! Bingo! After building and installing "libjpeg6" package from aur Stellarium worked!

... and everyone lived in happiness even if with two versions of the same library installed :-)

Goodnight and keep on hacking ;-)

bYe,
Andy

Sent from my iPhone

Gimp Colorize: I couldn't get it

Last days I fought with Gimp's Colorize tool. To understand what was the generated color I studied again color spaces pages on wikipedia, as I already did some years ago.

The tool did't shocked me because its use of HSL color space (with google you can find many RGB, HSV, HSL converters, even online). I was disappointed because in this tool Luminance has a -100 - +100 grade instead of a 0 to 100 one.

So I tried to recover the "true" value by means of a proportion, after I tried with sums and differences, and at last I merged some HSV and some HSV values because HSV Saturation made more sense than the same saturation from HSL.

Anyway there was nothing to do: the recoloured region was of the same hue (so H parameter was right) but the resulting color was clearly differente with respect of my desired color.

The only solution I found to colorize the blurred pattern (so I couldn't use effectively the magic wand) I was interested in, was a mask creation on that layer using the image itself as source. After that I applied a convenient background color to all the layer and the mask did the rest.

In this way the result was what I wanted but this strategy worked only because of the kind of the particular image I wanted to colorize. Because of this, I'm really curious about to know where I made my color conversion mistake with the colorize tool and if some of you readers worked out this problem. ;-)

On the net there is not so much about this issue, since the problem reveals itself only when the user wants a specific color and tries to put it inside the tool via the HSL digits. It one works manually and "by eye" everything is acceptable but the "bug" remains.

Okay... I hope that someone could get through this issue, bug or simply mistery and tell me how much I am "idiot" GIMPly speaking :-P

bYez,
Andy

Sent from my iPhone

Wisdom pearls

Yesterday I had to rename with a unique and chronological code some photos made by different cameras but among the same holidays.

I remembered about the EXIF informaztion set which is inside any camera-generated jpg file... and I remembered of a tool to work with these information.

So I installed exiv2 on my Arch box and with a rapid sight to the "man" I was ready to batch renaming all the pictures. I thought I would have been quite complicated but it worked like a charm! Here you are the command:

On a terminal, once you are in the folder containing the photo to be renamed, you have to do only:

$ exiv2 mv ./*.jpg

It's incredible how rapidly is done a work that could take a full day for a human! All the pictures in the folder are now renamed witha strandard patterna like the following:

YYYYMMDD_hhmmss.jpg

So now instead of having different folder for different cameras to prevent to overwrite or mess up the pictures, you have all the photos in the same place and time-tagged.

But there is some issue because anything could be perfect.

First of all, this program doesn't work with the movie files, so you will have to rename them manually.

The real problem is, anyway, when we do more than 1 shot per seconds (multiple shot feature of professional cameras) or when we shot at the same time with the two different camera we are trying to merge.

However, being careful about these situations before the renaming and the merging of the folders the system works very well... if the time on set on the cameras is correct and more or less synchronized. If there will be a delay of some 5 minutes all the consequential order will be badly disrupted.

For the windows users: I didn't check if there is such an EXIF utility for your OS... but I'm quite sure I will be... at most it won't be free of charge... but that's your way to think sofware doesn't it? :-P

Make nice pictures and Have good holidays!

bYe,
Andy


Sent from my iPhone