Categories
Linux / Gentoo Linux

Why Pulseaudio sucks…

A while back, I got really annoyed from the fact that when I was running Gentoo and I decided to play a game (Wine/Cedega) like EVE Online, I either have the sound from EVE-Online, or from my desktop – but not both.

This is usually due to a crappy sound card (no hardware mixing) and a driver which fails to fix this. I knew ALSA had dmix for software mixing but I read somewhere that pulseaudio was the new hot shot in the mixing scene. I was wrong.

You see, after enabling pulseaudio in Gentoo, rebuilding a number of packages to support it (Xine-lib for example) and following the guides to make ALSA-only applications use pulseaudio as well (in fact by looping the sound back from ALSA to pulse and again to ALSA), it should just work ™.

My first attempts were fine, I used aplay to select the pulse channel, played 6 songs at once and all was well. When it was time to make Phonon (KDE4) use the new pulseaudio sink, nothing happened. I even used the workaround as explained on the pulseaudio page – but nothing helped. I finally made the default audio-sink pulseaudio.

Next up: Wine. The first attempt to start Winamp went fine, except for the fact that I didn’t hear no sound. Looking in the logs, I see wine attempting to open the ALSA/Pulseaudio library from ‘/lib32’. For the more perceptive of you: yes, it want 32-bit libraries on my 64-bit system. Normally this is handled by a emulation package but guess what? The Gentoo emulation packages don’t feature these only slightly vital libraries.

After reading the bug page which explained the problem, I found a site of someone who provided the 32-bit binary drivers for ALSA/Pulseaudio. And indeed, after extraction into ‘/lib32’, sound came to life from the mysterious world inside Wine.

Then I tried to start World of Warcraft. The stuttering sound of a screwed up sound mixer emerged from my speakers and no matter how I started the game, the sound was useless. Finally I gave EVE-Online a try and it had the same, horrible sound output…

So I reverted everything I did, read up on how dmix was supposed to work (which seemed like a lot less work after following the ‘simple’ guide on the pulseaudio site), set up a software mixer and made it default and there we go – audio output for all!

Now I don’t know who decided that pulseaudio was ‘lightweight’ and ‘fast’ but I know for sure that its neither – the default dmix extension for ALSA works a million times better…

Categories
General blog entries

Review of Ergo Proxy

Last week I finished watching Ergo Proxy, an series of 23 episodes and I just can’t resist to put up a small review about it.


Click for full version

The story begins in a futuristic domed city called Romdo, built to protect its citizens after a global ecological disaster. In this utopia, humans and androids coexist with each other peacefully under a total management system. For some reason, some androids go on a killing spree. Re-l Mayer (see image) is assigned to investigate some of the murders with her android partner Iggy.

Ergo Proxy has it all: dark, sinister surroundings, animation which is far above standard – I dare say most of the time on par with Ghost in the Shell 2 (which I consider the ultimate anime style, a mix of computer generated and good old hand work). The main character has a gothic like appearance and she is just plain hot. During the series we get a few shots of the female lead in her undies, even a short flash of some under-boob but nothing more than that: kiddy-save and not even close to the ecchi category.

So far, its all the ingredients far a kick ass show… But wait, it gets even better. During the series we get some awesome action scenes and all of the eye candy is accompanied by a truly awesome soundtrack. Actually the production team of Manglobe did pretty much everything right to create a truly fantastic series.

So here comes the ‘but’. The animation, sound, characters – all great, but the story just blows… Its horrible: the first half of the series everything slowly becomes clear and everything is peachy – no even better than peachy as I was sitting on the edge of my seat. But after 14 or so episodes you get this uneasy feeling that something is off.

I still can’t pinpoint it but by the time it goes really off the rails you have been watching for some time while having this suspicion that its all wrong – just plain wrong. I still had high hopes right up until the end – I mean, a show which has such outstanding looks can’t just suck, right?

Unfortunately the ending does not safe this sinking ship. I have to applaud the creator of this masterpiece of an ending: it was certainly nowhere near what I would expect. I’m still pondering if I think it makes sense – so far I concluded the beginning and the end must be the product of different writers while a 3rd attempted to link the 2 together.

To be honest, this show is one of my biggest disappointments: I randomly ended up with Ergo Proxy and after 2 episodes I was hooked and expected a treat like GITS was (which one? Pretty much all GITS series/movies) but was seriously let down. I’m giving the show a 5 out of 10 rating for the simple fact that it was cool to watch (most of it anyway), but for the shear lack of a decent story it doesn’t get a single point more…

Rating:

  • Animation: 9 / 10
  • Sound: 8 / 10
  • Characters 7 / 10
  • Story: 3 / 10
  • Overall: 5 / 10
Tags van Technorati: ,
Categories
Linux / Gentoo Linux

Postfix Queues and Amavis trouble

After I had not received mail for a couple of days I suddenly started to receive postmaster errors from one of the servers I maintained. The message told me the mail could not be delivered. On further inspection it seemed that this was a problem because postfix could not connect to [127.0.0.1].

This meant of course that some daemon on the server was out for lunch and it was screwing up the mail deliveries. Using ‘postqueue -p’ to inspect the queues I found out that 4000 messages where packed up in the queue, filling her up to the maximum I allowed.

After running ‘postsuper -r ALL’ (which means, re-queue all messages for instant delivery) I tailed the ‘/var/log/mail.log’ file to find out that 20% of the messages got delivered and the rest wound up back in line.

One error that kept flashing by was: ‘TROUBLE in check_mail: parts_decode_ext FAILED: run_command (open pipe): Can’t fork at…’. It had something to do with the FileIO class. Now the message came from Amavis and in fact, amavisd is nothing more than a Perl framework, hooking all kinds of filters together. This means its memory hungry but won’t totally crash upon hitting the floor.

This explained why a part of the messages made it through: a few threads fitted in memory, allowing for completing the delivery, however most mail got rejected once again and returned faithfully to the waiting queue. Another inspection of the queue confirmed this: after 2 attempts 3200 messages where still there.

Then it dawned on me: I had not enabled the swap memory! After fixing this (and adding 1GB swap to the 256MB of RAM) and reloading Amavis I tried once again to requeue all mail. This time the mail got through the filters in one piece (and well within the memory boundaries). I wish all issues with servers were as simple as this ^-^.

Categories
How-To's

Windows Live Writer and Linux, How To Do It

I’ve seen lots of discussions floating around the internet, talking about people attempting to install Windows Live Writer. Some are using Mono, others the .NET Framework – all of them are using Wine. In this article I’ll explain How I Did It.

In this case the limits of Wine and Mono become visible. The .NET frameworks work partially in Wine so relying on them is useless (to be precise: all the external libraries needed in this case screw up this valiant attempt).

In the other corner we have Mono. Because WLW is in fact a Win32 executable, we have to use Mono in Wine (install the Windows version of Mono using Wine) but even the big anti-Microsoft framework fails here.

To be honest, Mono keeps failing every time for me. This is because Mono can run managed (byte-code only) executables fine, even the ones compiled for .NET (unless I’m mistaken). However, the windows in a GUI program are drawn using a native interface for .NET, one that Mono does not have as it uses a cross-platform windowing toolkit called GTK#. In short: any program that is used in a modern desktop environment and which is designed for .NET will not run on Mono. Thanks for the effort there guys…

So WLW on Linux is a no-go. And every other blogging tool out there for the Linux platform pretty much sucks or costs muchos dineros. I still have hopes for KBlogger but after 3 months its still at alpha 2 – so I stopped hoping that would be any help any time soon. I was using Bleezer before but it keeps screwing up source code which I am trying to post (I am hoping WLW will do this a LOT better). But how do we get out of this dark age, you might wonder? The solution? VirtualBox!

Categories
General blog entries

Integrity issues

That’s what I get for toying with stuff I should leave alone… I tried to merge the articles from my other Joomla installation back into my main site. After clicking around for a bit it seemed like the manual database merge worked out.

Next I found a number of modules with version number 1.0.x – assuming these were remains of the original 1.0.x installation I selected them all and hit delete. On the page refresh I noticed something was off… The menu was gone! Most of the Joomla Administrator panel was working but without a menu, a lot of sections are unavailable…

After installing a second installation over the existing one I managed to get the missing modules back (note to self: make sure to download the full package AND copy all the files…) by copying tables between the 2 installations. Finally I had a working installation again but now the other users (a.k.a not me) did not show up anymore…

After Googling for weeks I finally found a thread in which somebody made a whole database schema for Joomla! 1.5. The schema can be found here.

Even though I had restored most of the key references within Joomla! I somehow missed the ‘jos_core_acl_groups_aro_maps’ table – this only had one entry: for admin only. As soon as I realized my mistake, I manually added the missing rows and everything started working properly again.

Note to self: stop breaking the site…

Categories
Programming

Matlab and C++

Wouldn’t it be cool to use native code in Matlab? You can ^-^.

I started out by writing a small hello world program to test C++ but every time I ran it against GCC I got funky errors. After a while I found out why: g++ is the C++ compiler, GCC only does old-skool C. D0h!

This is the crap you would see:

# gcc test.cpp
/tmp/ccrnZKfr.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccrnZKfr.o: In function `__tcf_0':
test.cpp:(.text+0x66): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccrnZKfr.o: In function `main': test.cpp:(.text+0x76):
undefined reference to `std::cout' test.cpp:(.text+0x7b):
undefined reference to `std::basic_ostream<char, char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccrnZKfr.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

 

The guide I found even explains how to make a small Makefile to speed up the process of compiling (and testing). The (short) guide is here.

Right now I’m waiting for Matlab to finish installing and then I’ll try to test my Hello World from within Matlab. More info how that works can be found here.

Technorati:

Categories
Programming

Matlab grammar

I described in a previous post how I was trying to parse Matlab code. I’ve given up on this endeavour because it is way too much work (we designated a Matlab compiler as a last resort to get everything stand-alone, we will require Matlab in our project to speed up development).

I will however provide my incomplete and broken grammar, as promised. I hope somebody can use this later on as we have dropped the compiler approach completely.

On a side note, we figured out why nobody has a complete grammar for Matlab: its too darn difficult – if you manage to somehow describe the syntax, implementing it (type checking and internal Matlab functions for example) will be a heck of a lot of work. But it can be done, that much is obvious by now.

matlab.g

// Simple grammar for interpreting Matlab files for the MDDP project.
// Written by Berend Dekens
//
// Note: this part of the project is abandoned and will not be completed. The grammar is mostly working in Antlr except
// for some dodgy errors. If you find this usefull and/or manage to fix the parser errors, please let me know so I can
// fix the problems.
//
// Known limitations:
// - No function calls without parenthesis
// Matlab allows function calls in the form of 'function_name arguments'. This is annoying and thus not allowed.
// - No functions calls (period)
// Currently we do not allow function calls at all. Implementing this means supporting a large portion of basic
// Matlab functions and support for declaring new functions across files. This is beyond the scope of this project.
// - No characters or strings in variables
// Our application is matrices and vectors (integers). Boolean logic is included for the sake of logic blocks and loops.
//
grammar simplematlab;
options {
output=AST;
backtrack=true;
}

// Grammar rules below, start the grammar with a list of statements
statementList
: statement (lineSep+ statementList? )?
;

lineSep
: ';' | '\n' | ','
;

statement
: 'if' parExpression statementList ( lineSep 'elseif' parExpression statementList)* ('else' statementList)? lineSep 'end'
| 'for' Identifier '=' (Identifier | integerLiteral) ':' (Identifier | integerLiteral) (':' (Identifier | integerLiteral))? statementList 'end'
| parExpression
;

// Expressions
parExpression
: '(' expression ')'
| expression
;

expression
: conditionalOrExpression (assignmentOperator expression)?
| '(' conditionalOrExpression (assignmentOperator expression)? ')'
;

assignmentOperator
: '='
| '+='
| '-='
| '*='
| '/='
;

conditionalOrExpression
: conditionalAndExpression ( '||' conditionalAndExpression )*
;

conditionalAndExpression
: equalityExpression ( '&&' equalityExpression )*
;

equalityExpression
: relationalExpression ( ('==' | '!=') relationalExpression )*
;

relationalExpression
: additiveExpression ( relationalOp additiveExpression )*
;

relationalOp
: '<='
| '>='
| '<'
| '>'
;

additiveExpression
: multiplicativeExpression ( ('+' | '-') multiplicativeExpression )*
;

multiplicativeExpression
: unaryExpressionNotPlusMinus ( ( '*' | '/' ) unaryExpressionNotPlusMinus )*
;

unaryExpressionNotPlusMinus
: '~' unaryExpressionNotPlusMinus
| '!' unaryExpressionNotPlusMinus
| primary ('++'|'--')?
;

primary
: parExpression
| literal
| Identifier (identifierSuffix)?
;

literal
: integerLiteral
| booleanLiteral
| 'null'
;

integerLiteral
: Digit+
;

booleanLiteral
: 'true'
| 'false'
;

identifierSuffix
: ('[' ']')+ '.' 'class'
| ('[' expression ']')+ // can also be matched by selector, but do here
| arguments
;

expressionList
: expression (',' expression)*
;

arguments
: '(' expressionList? ')'
;

Identifier
: Letter (Letter | Digit)*
;

Letter : 'a'..'z' | 'A'..'Z';
Digit : '0'..'9';

 

Categories
Programming

I Hate Grammar

I hate grammar. I learned the English language when I was 9 years old (as it is not my native language) while trying to read the manual of QuickBasic under DOS. By the time we actually got English lessons in school I was years ahead of most people in my class and even up to the end of high school I never had to read the books we used in school. Instead I read a lot of English books which provided enough sence for the language to stay clear of any official grammar.

But I am drifting here. The problem in computer land is that we use grammar. Every programming language uses a grammar to allow a human to tell the computer what it should do.

Right now I am working on a project where we want to compile Matlab code into C or C++, feed it to GCC and finally upload it into a Virtex IV FPGA. The FPGA has a Sparc V8 compatible CPU (the Leon 2 to be exact) and has a number of auxiliary processorswhich are dedicated for mathematical calculations. For those who care: we are using Montium cores for the calculations.

Even though we pretty much have solved how to drive the whole thing in theory (not in real life as we are just starting), putting it all together is a bit harder.

It starts with the Matlab interpreter and the grammar needed for the interpreter. I’ve been working with ANTLR in the past to generate a compiler for my own toy language. It supported pretty much everything the old QuickBasic language did except the syntax was much more like Java.

I installed ANTLRWorks to use the shiny new GUI to speed up stuff and immediately ran into a wall: Matlab uses a syntax which sometimes end a statement with a semi-colon (‘;’) and sometimes not, depending if the programmer wants to see intermediate results. I am trying to base my grammar on Java here as it is nice and strict – but stuff like this is rapidly making the adaption a pain in the …

Another hair puller is the syntax of the ‘if’ statement: no block structure… Another one lacking the block structure is the function definition. As we are targeting mathematical speedup here and our Virtex board has no display, I will probably sacrifice some stuff to simplify the compiler.

Right now I’m keeping integers and booleans, logic structures like ‘if’-‘else’ and ‘for’ loops. Floating points, bit operators, function definitions and calls – all have to go. Perhaps I will re-add them later on when needed but right now I don’t see any reason to keep them around.

As soon as I got my sub-set grammar complete I will put it up on my site as nobody on the internet seems to have done this before (I found posts from 1992 with no solutions…).

Categories
How-To's

How to make Bleezer look good

Like I posted in a previous entry, I hate the way Bleezer looks on linux. The screenshots look great but I guess the author is using MacOS.

Personally, I like the Substance Look and Feel, even if its a bit heavy to render (the GUI gets a little sluggish if the windows get complex). I downloaded the 4.3 release from the Substance site and used the docs to figure out what argument to feed Java.

Note that Substance has multiple skins, all are a little bit different from eachother. This is why the Substance package has multiple classes you can select for the L&F.

Back to Bleezer. I tried making Bleezer use the Substance L&F by means of the command line. Something like this was supposed to work:

java -Dswing.defaultlaf=org.jvnet.substance.skin.SubstanceBusinessLookAndFeel -cp .:substance.jar -jar Bleezer.jar

However, it did not. For some reason you get this:

Exception in thread "main" java.lang.Error: can't load org.jvnet.substance.skin.SubstanceBusinessLookAndFeelat javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1337)at javax.swing.UIManager.initialize(UIManager.java:1418)at javax.swing.UIManager.maybeInitialize(UIManager.java:1406)at javax.swing.UIManager.getUI(UIManager.java:1003)at javax.swing.JPanel.updateUI(JPanel.java:109)at javax.swing.JPanel.<init>(JPanel.java:69)at javax.swing.JPanel.<init>(JPanel.java:92)at javax.swing.JPanel.<init>(JPanel.java:100)at javax.swing.JRootPane.createGlassPane(JRootPane.java:527)at javax.swing.JRootPane.<init>(JRootPane.java:347)at javax.swing.JFrame.createRootPane(JFrame.java:260)at javax.swing.JFrame.frameInit(JFrame.java:241)at javax.swing.JFrame.<init>(JFrame.java:164)at com.bleezer.Bleezer.<init>(Bleezer.java:112)at com.bleezer.Bleezer.main(Bleezer.java:1556)

After trying a million tests to make sure the JAr file was included I finally ran a decompiler over Bleezer and it looks like Bleezer will only attempt to set the L&F on Windows and MacOS. This means the linux users are stuck with the Metal L&F and Bleezer does not provide an option to change the skin.

In a previous post I showed how you can override the L&F for Bleezer using the command line. For some reason, that same trick won’t work here so we’ll work around it.

The solution is to add the Bleezer JAR to the class path and then manually specifiy which class should be run. Using this trick, you can make Bleezer use the new L&F.

Putting it all together you could make a launch script to fire up Bleezer using the new Look and Feel:

#!/bin/bashjava -Dswing.defaultlaf=org.jvnet.substance.skin.SubstanceBusinessLookAndFeel -cp .:substance.jar:Bleezer.jar com.bleezer.Bleezer

And here is the end result, before:

…and after:

Technorati:

Categories
News

Status update

A small update from the battle front: I’m trying to find a blog editor which I like. Like I stated before, I need something like Windows Live Writer for my 64-bit Gentoo system. I’ve been hitting the search engines with every phrase I could come up with and so far I only found a random blog about editors for the Free Desktop. Even though the author seems to find a lot more than I do, of the 5 (or actually 10 if you count the options from the linked article) only 3 keep up with my list of demands.

I’ll skip the first 5 (because those plain suck) and skip to the last (and best) 5 options. First up is Thingamablog. This one has a decent interface, is written in Java and resembles a news client. Cool as it may be, it does not support XML RPC style postings, only direct uploads to ftp.

The next one is JBlogEditor. This one is also written in Java but is no longer actively maintained. I had a hard time getting it to run in the first place as the native SWT libraries in there are meant for 32-bit systems. I tried to get the source from SVN but they have no docs on how to build from source and after finally be able to compile it by writing my own compile and run script (which grabs all dependencies) I found out they use a launch system from Eclipse which I don’t know.

After all the effort I finally came up with the brilliant idea to use Wine to run the Windows binary. It finally worked but then I found out they only support WordPress for custom sites, the Blogger API does not wants to play with a third party website (it does not ask for a URL so it ends up at blogger.com).

The 3rd option it QTM for KDE and I can be brief: it looks way to simple for my taste. I will look into it later on to see if its any good as the version reviewed is way older than the current version.

Next up is Flock. Flock is not so much a dedicated blog editor as a fully intergrated package with a Firefox browser and loads of extra stuff, being the "Community Browser" or something. It works straight out of the box on my system but it is way to heavy for just blogging.

Last up is Bleezer, another Java based blogging client. I’ve actually used that one before so I know it works. The interface is a bit wonky at times but it works fine. The main issue I had in the past is the fact that on linux, it used the default Look and Feel from Java, which is at this time with Java 1.6.0 still Metal. If you don’t know it, it looks horrible – something escaped from a Windows 3.1 system or perhaps ancient Solaris.

I finally found a solution for the skinning problem though: use the command line to tell Java to switch the default L&F. I’m currently using something like this:
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -jar Bleezer.jar

The only thing driving me nuts at the moment is the fact that the GTK skin is all wrong. Its a lot better than Metal but the fonts are way too small. I have the feeling that this is an issue with the fact that the Qt-to-GtK bridge that I have on my computer is broken because of KDE4 (and thus Qt4.x). At least it is better than nothing and right now I’m even typing this using Bleezer so everything is all good.

I still have high hopes for KBlogger but as long as the 1.0 branch is alpha I will stay clear as it seems to have loads of issues and I can’t get it to compile at all.

Technorati: