30 July 2009

Set up wireless without KDE nor Gnome

One of the first problem faced when going away from KDE, Gnome or XFCE is that you have to set up your wireless connection manually.
If you have 10 minutes, it can be done once and for all: just follow this how to HOWTO: Wireless Security - WPA1, WPA2, LEAP, etc..
Then you can remove the NetworkManager startup script : "sudo update-rc.d -f NetworkManager remove".
Keep in mind to launch a "sudo /etc/init.d/networking restart" in case of problem.

Update: I just found a solution to automatically start Network Monitor Applet (nm-applet) with Awesome Window Manager. But I am quite happy with my current setting, it just connect when it starts.

Java GUI application in Awesome Window Manager

There is a known problem with Java and the non-reparenting Window Managers like for example Awesome.
Java applications which use the XToolkit/XAWT backend may draw gray windows only. The XToolkit/XAWT backend breaks ICCCM-compliance in JDK 5 and 6 because it assumes a reparenting window manager.


There are a number of places where this is described:

To sum up:
  • it doesn't affect version Java 1.4.2 and before.

  • it doesn't affect version Java 1.7 and hopefully after.

  • the best workaround by far, is to set a name to the Window Manager, so it is recognise by Java as a non-reparenting Window Manager. A simple utility allow to set this name. Just add 'wmname LG3D' to your .xinitrc or simply run it.

  • Here are other workarounds left here for reference:

    • launch another X server, like Xephyr

    • set the following environment variable (to use the older Motif back-end instead): AWT_TOOLKIT=MToolkit. But this won't work in the following cases :
      • OpenJDK/IcedTea doesn't include the Motif toolkit.

      • doesn't work for x86_64 Java, for whatever reason.


Lightweight OS : Awesome Window Manager

Some year ago I used to try all kind of Window Managers on Linux and basically loosed a lot of time for nothing. I never though that I would fall back again, but having just 1Go RAM and running JetBrains MPS forced me to consider lighter alternatives than KDE.

First I tried XFCE, but it wasn't enough: too close to Gnome, too traditional. So I tried Fluxbox, didn't like the menu, RatPoison too simple and finally: Awesome. As usual, I found the Wikipedia list very useful.

And so far it is the best Window Manager I ever used.
- Fast, clean and simple, even their Web site is well designed.
- No more loosing time resizing the windows ! At about 98% I just need to have the applications full screen.
- But still it is easy to resize, typically popup window are often too small.
- No waisted screen space : no desktop.
- an unified way to close applications (no more Ctrl-Q, Ctrl-E, Ctrl-X ... one Mod4-Shift-c for all !)
- easy shortcuts
- search through the menu. It is not as good as Spotlight on a Mac or the KDE4 launcher, but I guess it can be configured.

It may sound enough, but there is more:
- highly and simply configurable with a scripting language: LUA. I already known LUA for being used in SciTE a very good code editor.
- it isn't a general purpose Window Manager, it targets my profile. It suits me: a bit cutting edge but not bleeding.

I always though that the "Desktop" was not a good abstraction, unless you have at least three 22' monitors. It becomes often a trash bin and is almost always covered with the application you are working with anyway. That is why I kind of like the KDE4 approach of a desktop that is more than a folder.

29 July 2009

DSL and Meta Programing System

As a regular Software Engineering Radio listener, JetBrains MPS 1.0 release came to my attention.
I read articles, watched the screen-casts and downloaded the beast to put my hands on.

I have a mixed feeling: on one hand, it is a step towards higher abstractions. From bare metal to assembly to C to C++ to Java, this is where we are doomed to go.
But on the other hand, the tool and the concepts are really complex. It is not the kind of tool that you download and play with before digging the manual ! With MPS, I have been following the tutorial carefully, step by step. It won't be mainstream yet.

Nonetheless, it opens a whole new landscape. I guess that there will be DSL users, DSL developers and of course DSL architect !? The tool is already very powerful. The samples with complex numbers and mathematical notation are impressive: the readability is way better.

It remind me the idea that code isn't meant only to compile, but its most important purpose is to communicate its intent to other developers and designers. I could not find back the reference to the specific article where this idea was exposed, but anyway, this concept concern all DSL.

It remind me of the JBoss approach to BPML: they didn't try to do everything with the "graphical designer". They kept it simple and provided a way for the developer to deal with the implementation details. So "Graphical DSL" is more a collaboration tool between the analyst and the developers, than a bloated UML/OCL do it all thing. (Note: I like UML.)

No doubt that there is a strong need to reduce the gap between functional/business analysts and developers. Even worse with offshore developments. Agile is mostly about getting developers closer to the client, DSL are coming along. Will linguistic be the next buzz ?

21 July 2009

UMLgraph and Maven

Just a quick note on how to setup UML Graph in Maven.
{plugin}
{groupId>org.apache.maven.plugins{/groupId}
{artifactId>maven-javadoc-plugin{/artifactId}
{configuration}
{excludePackageNames>com.comp.proj.internal.stuf{/excludePackageNames}
{doclet>org.umlgraph.doclet.UmlGraphDoc{/doclet}
{docletArtifact}
{groupId>org.umlgraph{/groupId}
{artifactId>doclet{/artifactId}
{version>5.1{/version}
{/docletArtifact}
{additionalparam>-attributes -enumconstants -enumerations -operations -types -visibility -inferrel -inferdep -hide java.*{/additionalparam}
{destDir>withUML{/destDir}
{show>public{/show}
{/configuration}
{/plugin}

The only trick is that all the additional parameters must be set on one line ! This doesn't appear in the documentation nor on the web. Quite the contrary, I found a lot of bad examples on the web !
This POM configuration simply works great. I noticed a new UMLGraph version 5.2. I didn't try but it should work also.

There is a tiny example in the Maven documentation about Using Alternate Doclet.
There is a dead project to create a plugin for Maven: DotUML. No updates since 2007.

Maven how to set the Main-Class in the Manifest

In Java, for a jar to be executed, the easiest way is to set its entry point. This is done by setting the Main-Class in the Manifest. Easy.
Now let's do it with Maven !

First you use your jar, in Maven, you can to configure it this way:
project/build/plugins/plugin
artifactId maven-jar-plugin
version 2.2
configuration
archive
manifestEntries
Main-Class com.comp.proj.main

Now you would like your jar to contain all the dependencies, then you use the maven-assembly-plugin. But it won't take the configuration set in the jar plugin. You have to reconfigure the exact same main-class again. It is redundant OK, but why should it have a different syntax !?!
project/build/plugins/plugin
artifactId maven-assembly-plugin
configuration
archive
manifest
mainClass com.corial.cosma.apptest.apptest

OK, the point is that there are at least two way to configure the Manifest. Either with a free key/value syntax, with Manifest Entries. Or with the class Manifest which has a mainClass element. So it is up to you to be consistent in your POM and not copy everything found on the net ...

Notes:

07 July 2009

Store Flac, broadcast MP3 : mp3fs and Ampache

Lets say that you keep your music with the best quality while still consuming very little disk space : flac (lossless audio compression).
Now that is fine for PC, but most portable players (iPods) doesn't support flac, but MP3, MP4 and other .
You could duplicate your whole collection in two formats, or transcode as needed, but that would be painful. (Even if some application like Amarok are able to transcode on the fly the music or podcast transfered on an iPod.)
A solution for me is to use mp3fs. Mp3fs takes a directory full of flac and present it as another directory full of ... MP3 ! That is very useful for FTP, NFS or Samba shares.
So your Flac music can now be copied on your ipods easily.

One caveat: unless you have a powerful PC, don't expect to listen directly the mp3: the transcoding take some time. It is fine to copy, but not to stream !

Lastly, I didn't find package for Kubuntu nor Fedora. You just have to compile, which is very simple. The only problem being to get the libraries !
There are some hints for Kubuntu. But for Fedora, the library's names are not exactly the same. After a little "yum search ...", I installed: libid3tag-devel, lame-devel, flac-devel, fuse-devel, libogg-devel.

But still, I don't see the point of having different packages, as if Linux needed to be fragmented !

Ampache is another project that can provide transcoding over the web and essentially much more, but see for yourself.

October summary - 2017-10

10 October Science Looks like the p-value has been under fire for years. https://www.nature.com/news/one-size-fits-all-threshold-for-p-value...