Nerd wannabe

lazy weblog

Archive for the ‘morons’ Category

Gnome/Ubuntu NIH syndrome?

with 2 comments

There are at least 3 times when Ubuntu/Gnome teams* bit my user experience by:

– pushing alpha-quality technology

– taking a year to deliver a stable one

– just so that it can match a previous offer.

First: Totem

When I first tried it, it didn’t manage to play anything. When it did, it didn’t had subtitles. Or sound. Or it crashed. Or it crashed Nautilus. Or the browser.
However the Gnome Desktop kept on shipping it, even if 90% of people were using mplayer or xine or vlc. It doesn’t even matches these today, but I can call it stable. Why did they spent that much resources when they could have taken an existing, proven, technology?

Second: Network Manager

Ok, this is sad. Network manager started as an wifi deamon with a usermode icon panel. It didn’t even “speak” wpa_supplicant. Because of the deamon you cannot use wifi-radar an other decent solution. Even hamachi choked with it, because every new connection it sees, it tries to manage.

After one year of NM 0.6, the next version seems a little bit better. It even knows ppp and stuff. But the year with the network-manager 0.6 deamon, with prays for connections, I will never forget..:(

Third: Pulseaudio

First, I don’t even understand what’s that. From my point of view, it’s the thing that stops Audacity from working. And you cannot disable it (I mean, it was hard to find out it existed..)

Basically it locks your soundcard so that anybody should play through pulseaudio. Why the hell would something like that be pushed, along with programs known not to work with it??

I am beginning the wait for another year for a mature pulseaudio or a Gnome/Ubuntu Audacity replacement. “Not invented here” its the oposite of collaboration and hurts other OSs projects.

All these (3) technologies exist because of the Gnome desktop and the way it pushed them. With that “one-year-to-get-decent” policy, they would have failed in infancy.

Is this a bad thing?

update 05/07/2009: i reinstalled PulseAudio while trying to get my bluetooth headset to work (it didn’t). And now I am exposed to a ‘new’ bug, from 2008: I only hear static.

*Ubuntu/Gnome teams: what’s the relation between them?

Written by vlad

March 16, 2009 at 8:33 pm

Posted in morons

JavaFX: it’s JAVA!

with 3 comments

Edit (relevant quote):

When asked why developers and authors would want to choose JavaFX over other tools, such as Flex or Silverlight, Octavian summed it up in one word: Java

Before jumping there, remember: just because you can tell entire corporates that this is the ‘next best thing’, it doesn’t mean people will use it!

Just think ActiveX and their banishment from the Internet..,or, wait, you can think of the water applet!

Written by vlad

December 5, 2008 at 12:13 am

Posted in morons

Pointless update

with 5 comments

So.. I needed to re-cap a never-learned science, the computer one.

You see, when I joined a computer science university, I had no “official” CS background (math high-school, yadda-yadda).
I did had a computer at home in highschool – which allowed me to poke around with some ‘exotic’ VGA poking.. but never got into backtracking or other stuff my friends from CS highschool got.

Then, just when the 3rd year in university got to those subjects, I was _so_ employed I haven’t had the time to.. you know.. think before the exams.

So I bought some books now, that I am old enough to afford myself shopping from amazon (heh):
– the algorithm design manual – which I favoured over ‘CLR’ because everybody said CLR was ‘sooo basic’. Now I have to struggle with my english skills because the ADM is explained in plain english rather than scientific way
– the dragon book – yeah..
– learn to tango with D – the only D book available today (I love reading paper, you know..)
– erlang – the only book to – influenced by my reddit fellows

Soo.. I am planning re-writing gtkaml, the markup for UI that I ripped from my XAML/MXML/XUL experience.

But is it worth it?

I want to:
– stop using libxml2, switch to GMarkup, to minimize dependencies. But GMarkup doesn’t even discern CDATA from regular text (I need that for code in a gtkaml class)
– cleanly separate parsing from semantic analisys (lexing is XML).
– generate native Vala AST instead of text (I currently feed a generated source to the Vala parser)

Again.. why would I do it? It’s my first open-source attempt, I tried to announce it on vala list, I had as little as.. one user, then a couple of _month_ later tried to announce it on gnome-announce.

It seems like nobody’s getting where I’m going or doesn’t want to. Since I have this (mainly MXML) background, I concieved gtkaml as a shortcut for _me_ to learn the _Gtk_ UI widgets and their properties. I used it a couple of times to prototype UI for something that would have been to boring to write in C or in Vala.

I got at maximum 100 downloads per release, starring on gnomefiles and freshmeat. It lowers – the latest version, posted on gnome-announce, had less downloads.
Is it because, not having a well organized parser/code generator, every hacker scares away (from the error messages for example)??

I also get compared with glade/GtkBuilder that often that I explained in a previous post the differences. But still nobody cared.

Can somebody point me their open-source experience? is this normal? (i.e. to have an unique itch and scratch it?)

Written by vlad

August 21, 2008 at 8:00 pm

Posted in gtkaml, ideas, morons

Layout: Windows, Java and “Others”

leave a comment »

99% of visual application developers use some tool to draw/drag/resize or even dock/anchor their child widgets visually.

One of the first tools I used myself is Resource Workshop from Borland:

Borland Resource Workshop

Yes, the Win16 version:)

Anyway, it’s a visual WYSIWYG editor. Just like the current Microsoft tools from .NET (now they are integrated in the development environment). One difference is that instead of editing a simple .res/.rc file, now they edit a partial C# class)

Why partial? because initially it was editing your class. And since the code generated was awful, you had to scroll down (or collapse) entire pages of code before getting at your stuff.

Here’s how some of the ‘partial’ code looks:

            this.label1 = new System.Windows.Forms.Label();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.button1 = new System.Windows.Forms.Button();
            // label1
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(46, 14);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(46, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "User ID:";
            // textBox1
            this.textBox1.Location = new System.Drawing.Point(98, 12);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(51, 20);
            this.textBox1.TabIndex = 1;
            // button1
            this.button1.Location = new System.Drawing.Point(66, 65);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 2;
            this.button1.Text = "&OK";
            this.button1.UseVisualStyleBackColor = true;
            // Form1
            this.AcceptButton = this.button1;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(206, 104);
            this.Name = "Form1";
            this.Text = "Login Please";

Notice the number of integer literals used to represent screen coordintates: it can get better, if you use anchors, but still the default layout is ‘absolute’. And this is not resize-friendly (actually these kinds of dialogs always have resize disabled;))To make up for the DPI change in today’s monitors/resolutions, .NET provides a property named “AutoScale” for dialogs, with values “Font” or “DPI”. That is, keep your design absolute at this font/dpi and I will compute for you another size at the client’s font/dpi settings…

Java got further and reckon’d the need of relative layouts: the choices are many, BoxLayout, GridLayout, SpringLayout, FlowLayout and last but not least, GridBagLayout. None of them was usable for any serious stuff (oh, I forgot the ‘null’ layout) but GridBagLayout.

This layout is so complex that maybe one may think that nested GridBagLayouts approach the Turing-completeness of PostScript/PDF (they don’t). Here’s an example of parameters one must specify to add a component to a container that has the GridBagLayout:

public GridBagConstraints(int gridx,
                          int gridy,
                          int gridwidth,
                          int gridheight,
                          double weightx,
                          double weighty,
                          int anchor,
                          int fill,
                          Insets insets,
                          int ipadx,
                          int ipady)

Oh well. You have to call that constructor for each child add..Actually it does not resemble PS/PDF in any way, on second thought: it is HTML table layout or CSS layout (whichever, they are equally stupid).Ok, what did Others?

Well, others are (at least):

  • Qt
  • gtk+
  • wxWidgets (sortof)
  • Mozilla XUL
  • Flex

They proved that any layout can be expressed with only three simple constructs: VBox, HBox and Grid!

VBox is for laying childs vertically, HBox is for laying them horizontally, and, if you ever need something like “two HBox’s in a VBox” and you need each child of a HBox to be aligned with the same child in the other HBox, then you actually need a two-row Grid;)

Don’t believe it? just look at the source of the XUL Mozilla Amazon Browser (does it contain any integer literals?)

Written by vlad

February 15, 2008 at 11:10 pm

Posted in morons

developer-friendly distro

leave a comment »

(what, no links in this post? but you know what i’m talking about..)

I am currently running Ubuntu, and some months ago used to run ArchLinux. Some year ago I used to manually install everything in slackware, without package dependencies (swaret executed an ldd on the new binaries and searched another package to provide them;)

I quit slackware when, exasperated of building gnome with jhbuild, I tainted it with dropline and no way back was known but fresh install. It was the most developer-friendly distro I had: want to test some new library/compiler or anything? svn co && ./configure && make install and you had it. Same with all bleeding-edge packages.

Next, ArchLinux was a breeze: you did ‘pacman gnome’ (or something) and it listed you everything that will be installed (belonging to the group ‘gnome’). Installing bleeding-edge software in Arch was a 3-choices thing: you either already found the latest version in the testing repository, or you found a PKGBUILD script in the Archlinux User Repository (based on which you built your own package, maybe a new version if you wanted) or, in the worst case, you needed to write the PKGBUILD yourself.

The PKGBUILD was like a 5-liner with package name, version, dependencies and a build () function that did.. svn co && ./configure && make install.

Then there’s Ubuntu, where you can find Anjuta (for example) in Add/Remove Programs :D

Now I need the bleeding-edge glib 2.15.4.

  • With Slackware, I would have just installed it.
  • With ArchLinux, I would have had to write PKGBUILD files.
  • With Ubuntu, I made a ‘dist-upgrade’..

Wanna know how it looks? well, you run gksu update-manager -u and it tells you ‘Ubuntu 8.0.x is available’! Install?

upgrade your O.S

Isn’t it cool? Imagine how would it have been to have a ‘vista.exe’ to download from windows xp and it tells you this: downloading vista – installing vista – cleaning up – restarting the computer

I was able, just like from the livecd, to browse the web while the O.S. was updating. Till it upgraded firefox:D

Actually, restart is required mostly because of the kernel change (some executables won’t play at all).

This is one of the reasons ArchLinux is always releasing a ‘Duke Nukem’ release:

Sadly, Arch will never have a 1.0 release. It is, in fact, canceled. But this is for the best.

We’re changing gears and switching the way we do releases. Going forward, a new ISO will be released with each new kernel version. This will give us an easy milestone for us, and you, to follow.

That is, a new ISO with each ‘reboot required’.

I loove that, and I think the effort put into Ubuntu to ‘upgrade from XP to Vista’ is worth the pain only for a company that provides profession long-term support for the products.

But me, the developer, has to lose. The upgrade to the Alpha4 Hardy Heron made me spend 3 hrs of iwl3945 debugging. And it’s far from solved…

So, next time, pick a developer-friendly release!

*btw, you know what’s new in gnome 2.22? Alt-Shift-Tab for backwards switching of windows! yay!

Written by vlad

February 4, 2008 at 9:45 pm

Posted in morons

Why OOP failed on us

with 6 comments

[updated 21 Jan 2008: added more about vala]
[clarification: “us” = those hacking software in their spare time – except web software – and want to ship]

hack -> ship sketch

C++ was promising everything, 15 years ago. Over C, I mean.

Everybody started declaring the variables where it crossed their mind, overloading functions and giving default values, and from time to time they played with the class keyword. Oh, and operators, never forget!
When everybody started thinking in classes, they started to play with the template keyword.

Borland seems to have closed the Delphi business but freepascal and Lazarus are still alive nowadays.

In the other news, starting from ’95 there was Java, which was also OOP. The Smalltalk people were not that company-backed to be successful and nobody seemed to write in Objective-C than Steve Jobs for his NeXT computer. Simula.. I never heard of simula!

Then Web started kicking in, and php (3, then 4, then 5), perl, python all came along. Now ruby, and probably the next big interpreted language is right next door.

Then there’s C#. And J#, And F#, never mind VB (.net, not #). All running on virtual machines.

I will make a big step ahead and tell you:

All software on your machine is written in C.*

Or in C++/Delphi, but linked with C libraries.

* not all of it, but 99%

Nobody (that I know) ever downloads a program in python. Never mind Java, C#, or.. hell, desktop applications in PHP:) Even LISP lacks a great compiler – and nowbody downloads “runtime environments“.

This is OOP: no matter how much syntactic sugar you’re pouring into a language, it all boils down to interoperating with existing libraries, linking against them, calling them (and be called) using their calling conventions, registers, stack and even their byte order. OOP is none of these.

What OOP is is virtual tables, polymorphism, closures, multiple inheritance, reusability etcetera etcetera.

But nobody found a way to instantiate a class from a compiled library… It all boils down to processors, Turing/Von Neumann machines and assembler.

You can have this problem solved in two ways:

  • write an interpreter in C. This abstracts you from the environment soon enough. Re-invent all the basic functions of your environment in the interpreted language.
  • write your own abstraction layer as a runtime environment. You can do whatever you like in that environment, but not outside it. You end up re-writing 50% of the operating systems you’re running on .. in classes.
  • use an existing abstraction layer: use C to abstract away from system calls and use something different to abstract you away from C.

C++ did that (the last). The first C++ compiler was a C preprocessor. Because of the operator overloading, function overloading, classes and template crap, it had to do some name mangling, but it did it. Then along came true C++ compilers, then exceptions etc. Nothing was standard anymore, except the extern “C” { directive. It miserably failed to inter-operate with compiled libraries.

Java, C# did the second: they wrote their runtime environment just to cope with portability. Interoperatibility was penalized ( JNI? COM/Interop? ha.. ha.. ). Although calling native libraries was possible, the download for the runtime environment was a show-stopper: nobody wanted your kilobits of C# because of the hundreds megabytes of your supporting virtual machine..
Therefore they are used server-side.

PHP, perl, python, ruby chose the first: interpret for the masses! Basic did that, and it had the advantage of only two datatypes: string or number. But the costs.. Yeah, interpreted languages have their cost, like.. no threading machine – these (multicore) days.. Nobody wants to download perl.exe for their favorite money calculator..
Therefore they are used server-side.

So, what’s left? is winamp made in C? is Total Commander made in C? What about Firefox??

Tell you what: winamp is indeed C. TC is Delphi. and Firefox is XUL+JavaScript+XPCOM, where XPCOM is made in C.

What does C and delphi have in common? No name mangling. Delphi was proprietary, that’s why.. (VB6.0 didn’t have this problem either)

So how do you do to still program OOP and do it in C ? I challange you:

All your OOP code could be done in assembler (in C, however, it’s portable)

In the same way. Given that your runtime environment or your interpreter still runs on a Turing machine, the same thing can be done in C. Manually.Well, why would you do that??

Well, you may be Mozilla Foundation and you may be building browsers for all platforms. XPCOM is OO, of course.
Or you may be Jack the coder, and ‘you know jack’ about MacOS X, but would still want to compile there. Oh, and there’s an AI engine you’re doing that needs performance..

Why, why am I defending C? it’s 2008.. and processors aren’t speeding up anymore (acutally they are lagging up)

And there’s a library, yes right, that exports some symbols (C _cdecl symbols), and using it with a .h file can enable you to write OOP in C. It’s called GObject.

You can write shared libraries that export interfaces, abstract classes and classes for other people to use.

That is, C libraries, but without the burden of manually exporting “C” functions (this is the case with C++) or manually writing a wrapper library that initializes the .NET runtime environment or the JVM.

That means that you can build on existing software and software can build upon you, something other OOP solutions only do “entre eux“, in-house, in their own environment or even only with sources.

Also, GObject solves the name mangling problem, being in C, there is no name mangling. It’s just you that decides the names of the functions.

But how would you do that??

You could start to write boilerplate code like this header (scroll down over it, it’s just an example):

#ifndef __EXAMPLE_H__
#define __EXAMPLE_H__



#define TYPE_EXAMPLE (example_get_type ())
#define EXAMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EXAMPLE, ExampleClass))

typedef struct _Example Example;
typedef struct _ExampleClass ExampleClass;
typedef struct _ExamplePrivate ExamplePrivate;

struct _Example {
	GObject parent_instance;
	ExamplePrivate * priv;
	char* myfield;
struct _ExampleClass {
	GObjectClass parent_class;
	void (*myfunction) (Example* self);

void example_myfunction (Example* self);
Example* example_new (void);
char* example_get_myproperty (Example* self);
void example_set_myproperty (Example* self, const char* value);
GType example_get_type (void);



and this .c file:

#include "Example.h"

struct _ExamplePrivate {
	char* _myproperty;
enum  {
static void example_real_myfunction (Example* self);
static gpointer example_parent_class = NULL;
static void example_dispose (GObject * obj);

static void example_real_myfunction (Example* self) {
	g_return_if_fail (IS_EXAMPLE (self));
	fprintf (stdout, "myfunction got called\n");

void example_myfunction (Example* self) {
	EXAMPLE_GET_CLASS (self)->myfunction (self);

Example* example_new (void) {
	Example * self;
	self = g_object_newv (TYPE_EXAMPLE, 0, NULL);
	return self;

char* example_get_myproperty (Example* self) {
	g_return_val_if_fail (IS_EXAMPLE (self), NULL);
	return self->priv->_myproperty;

void example_set_myproperty (Example* self, const char* value) {
	char* _tmp2;
	const char* _tmp1;
	g_return_if_fail (IS_EXAMPLE (self));
	_tmp2 = NULL;
	_tmp1 = NULL;
	self->priv->_myproperty = (_tmp2 = (_tmp1 = value, (_tmp1 == NULL ? NULL : g_strdup (_tmp1))), (self->priv->_myproperty = (g_free (self->priv->_myproperty), NULL)), _tmp2);

static void example_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	Example * self;
	self = EXAMPLE (object);
	switch (property_id) {
		g_value_set_string (value, example_get_myproperty (self));
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);

static void example_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	Example * self;
	self = EXAMPLE (object);
	switch (property_id) {
		example_set_myproperty (self, g_value_get_string (value));
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);

static void example_class_init (ExampleClass * klass) {
	example_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ExamplePrivate));
	G_OBJECT_CLASS (klass)->get_property = example_get_property;
	G_OBJECT_CLASS (klass)->set_property = example_set_property;
	G_OBJECT_CLASS (klass)->dispose = example_dispose;
	EXAMPLE_CLASS (klass)->myfunction = example_real_myfunction;
	g_object_class_install_property (G_OBJECT_CLASS (klass), EXAMPLE_MYPROPERTY, g_param_spec_string ("myproperty", "myproperty", "myproperty", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));

static void example_init (Example * self) {
	self->priv = EXAMPLE_GET_PRIVATE (self);

static void example_dispose (GObject * obj) {
	Example * self;
	self = EXAMPLE (obj);
	(self->myfield = (g_free (self->myfield), NULL));
	(self->priv->_myproperty = (g_free (self->priv->_myproperty), NULL));
	G_OBJECT_CLASS (example_parent_class)->dispose (obj);

GType example_get_type (void) {
	static GType example_type_id = 0;
	if (G_UNLIKELY (example_type_id == 0)) {
		static const GTypeInfo g_define_type_info = { sizeof (ExampleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) example_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Example), 0, (GInstanceInitFunc) example_init };
		example_type_id = g_type_register_static (G_TYPE_OBJECT, "Example", &g_define_type_info, 0);
	return example_type_id;

But you may find it better to write the same boilerplate in Vala:

using GLib;
public class Example: GLib.Object {
public string myfield;
public string myproperty { get; set;}
public virtual void myfunction(){ stdout.printf(“myfunction got called\n”); }

So this is it: Vala is yet another C preprocessor (just like C++ was).Vala has a C#-like syntax and it spills out GObject code. That means that you can:

  • export clasess, interfaces from a shared library (so/dll) or (re)use existing classes/interfaces from another library
  • use your existing (optimized) compiler that’s been around for 15 years and it’s tested
  • forget about allocation/deallocation – Vala .ref ()’s and .unref ()’s for you
  • use lambda expressions
  • use existing GObject signals and properties painlessly
  • use a string class that can be passed/received to/from existing API functions unchanged (no ->c_str () needed)
  • fine tune your Vala object methods with [Import]s from manually crafted C sources
  • define a VAPI file for existing libraries so that you can use them directly as objects from Vala (they don’t need to be GObject libraries)
  • oh, and you can make some Generic programming. Just to make the collections work;)

Vala – the best thing since sliced bread? You decide: check out the tutorial:)

Written by vlad

January 20, 2008 at 10:57 pm

Posted in morons

what happend to overwrite mode?

leave a comment »

Two kinds of cursor image were used in the beginning of terminals:

Some may think that this is quite the opposite, since the command prompt from today’s and yesterday’s Windows is the other way around:

this is the insert mode And this is the replace mode: commandcomreplace.png

You can switch to the old-fashion prompt, in Windows 2000/XP by setting cursor size to Large in the window’s properties.

this is the insert mode And this is the replace mode:
insert-mode-2.png overwrite-mode-2.png

Although rarely used, this “overwrite” mode is very useful sometimes. This is why windowed application continued to provide it, signaled through a little status bar “led” like this one:


To activate “OVR” just press the Insert key..

Now for the question: what happend to overwrite mode in Word 2007?

First, it isn’t there: you type Ins and nothing happens. Nor does something else happen (Insert isn’t bound to another action).

Second, you can turn it on in only a 3 steps, but I’d recommend ticking “Use the Insert key to control overtype mode”

Third, if you want the “led” you have to right-click on the status bar and tick “Overtype”:


This is awkward: it’s like, what will be disabled next? the Del key? or the Tab one?

Written by vlad

December 17, 2007 at 10:46 am

Posted in morons, trivia