Skip to main content

Ralsina.Me — Roberto Alsina's website

PlanetKDE, point me in some direction, please!

I have been try­ing to fig­ure out how to use lib­smoke from kde­bind­ings for a few hours.

So far, I have been un­able to find any kind of doc­u­men­ta­tion what­so­ev­er.

If any­one knows of some­thing (short of read­ing the ru­by bind­ings, for in­stance ;-) I would be thrilled.

Ad­den­dum: I just found on google that there is a whole lan­guage with Qt bind­ings I had nev­er heard of!

http://www.­clif­ford.at/s­pl/

Xen on CentOS4

Just in case any­one is won­der­ing if you can in­stall the Xen hy­per­vi­sor on a Cen­tOS box:

  1. Sure. It works just fine.

  2. Ok, there are a cou­­ple of glitch­es in the in­­stal­l.

Here's how I did it, on a Cen­tOS 4.2 box:

  • Get the in­­stall script for RHEL 4.1

  • Fix the val­i­­date_os_ver­­sion func­­tion:

validate_os_version() {
    #grep "Red Hat Enterprise Linux AS release 4 (Nahant Update 1)" /etc/redhat-release 2>/dev/null >/dev/null
   true
}
  • Run it

  • Fix your grub.­­conf adding this :

title Xen 3.0 / XenLinux 2.6
  kernel /boot/xen-3.0.gz dom0_mem=262144
  module /boot/vmlinuz-2.6-xen root=/dev/hda1 ro console=tty0
  module /boot/initrd-2.6-xen.img
  • Fix your glibc by do­ing this:

mv /lib/tls/ /lib/tls.disabled
  • Boot on the Xen op­­tion from Grub, and you al­ready have a Cen­­tOS Dom0. Quite sim­­ple, was­n't it? :-)

Main prob­lem: The Xen ker­nel you are boot­ing suck­s, be­cause it sup­ports no un­usu­al hard­ware. So, it would be a good idea to hack a de­cent Xen-lin­ux-k­er­nel sim­i­lar to Cen­tOS un­sup­port­ed one.

Now it's time to start toy­ing with Cen­tOS par­ti­tion­s, but they are sup­posed to be sim­ple.

vmysql: sql error[3]: MySQL server has gone away

Well, I am in the mid­dle of mi­grat­ing a rather large mail server, us­ing qmail+vpop­mail+mysql+­couri­er-imap.

And just when it's start­ing in­to pro­duc­tion us­age, we find the er­ror in the ti­tle.

A lot.

Sad­ly, since that er­ror in­di­cates a failed MySQL query, it means you get stuff like ran­dom auth fail­ures. Which sucks a lot.

Googling gave a lot of hints. But noth­ing would fix it.

Un­til.... lucky strike.

So, I will put my so­lu­tion here for fu­ture googler­s.

If you see this:

vmysql: sql error[3]: MySQL server has gone away
vmysql: sql error[3]: MySQL server has gone away
vmysql: sql error[3]: MySQL server has gone away
vmysql: sql error[3]: MySQL server has gone away
vmysql: sql error[3]: MySQL server has gone away

Do the fol­low­ing:

  1. Check if you are ex­ceed­ing mysql's max_­­con­nec­­tions pa­ram­e­ter. The de­­fault is 100.

  2. Check if your cpu can take the load. (No, don't look at the load av­er­age. Look at the CPU us­age).

  3. Make re­al­­ly sure that vpop­­mail and couri­er-au­th­lib are built us­ing the ex­act mysql you have in­­stalled. No, it does­n't mat­ter if it's the same ver­­sion. Go, and re­build the things!

That fixed it for me.

On oth­er bizarre news about this server, I have low CPU us­age (95% idle), low IO (io­stat re­ports un­der 1M­B/sec, 40 tp­s), yet I have a load that can go up to 120.

Yet, in­ter­ac­tive re­sponse is fine.

Weird.

A simple question

I was try­ing to do some­thing weird: take one of my PyQt prog­gies, and com­pile it in­to a stand­alone bi­na­ry us­ing Jython, koala/qt­ja­va and gjc.

Sad­ly, it does­n't work :-(

Has any­one ev­er got­ten a rather re­cent gjc and jython to work to­geth­er?

The best I can get is this:

[ralsina@monty jython]$ gcj -fjni /usr/lib/lib-org-*.so.* --classpath=/usr/java/j2sdk1.4.2_08/jre/lib/ --main=org.python.util.jython /usr/share/java/dom3-xerces-j2.jar /usr/share/java/ant.jar /usr/share/java/servlet.jar /usr/share/java/oro.jar /usr/share/java/jython.jar  -o jython
org/apache/html/dom/HTMLAnchorElementImpl.java:0: error: cannot find file for class   org.w3c.dom.events.EventTarget
org/apache/html/dom/HTMLAnchorElementImpl.java:0: error: cannot find file for class org.w3c.dom.TypeInfo
org/apache/html/dom/HTMLAnchorElementImpl.java:0: error: cannot find file for class org.w3c.dom.html.HTMLElement
org/apache/html/dom/HTMLAnchorElementImpl.java:0: error: cannot find file for class org.w3c.dom.html.HTMLAnchorElement
org/apache/html/dom/HTMLAnchorElementImpl.class:0: confused by earlier errors, bailing out

This is us­ing gc­c-­java-3.4.3-22.1 and jython-2.2-0.a0.2jpp

I mean, this is com­plete­ly un­nec­es­sary, but it would be a nice hack :-)

A *real* programming challenge.

A long time ago, I wrote a piece about how I did­n't like kcal­c. It con­tained a very lame pyqt script show­ing a (IMHO) nicer cal­cu­la­tor. Strange­ly, that lead to two very cool im­ple­men­ta­tions of the con­cep­t!

One of them was writ­ten in Ruby, the oth­er one in C++. I think that has some po­ten­tial.

A few months lat­er, I wrote a spread­sheet based on the same con­cep­t. Al­so based on PyQt.

This Stupid­Sheet has some con­cep­tu­al prob­lem­s. Like, if you want to im­port Ex­cel sheet­s, you would have to re­write ba­sic in python, so it's not a prac­ti­cal pro­gram, but it is a rather nice ex­am­ple show­ing pro­gram­ming us­ing dy­nam­ic lan­guages.

In fac­t, I used it as such last week at Cafe­Con­f.

Now, here's the chal­lenge. If peo­ple that know how to write Ru­by or Ja­va apps us­ing Qt (or KDE, why not) could write a sim­i­lar ap­pli­ca­tion, we all could write a com­par­a­tive guide to Qt/KDE pro­gram­ming on dif­fer­ent lan­guages.

Since we would all be start­ing with a not-­too-­com­plex, but re­al­ly non-triv­ial ex­am­ple, and we would all do the same one, it should be pret­ty un­bi­ased.

In fac­t, if you think this ex­am­ple is bi­ased, please pro­pose an­oth­er one, and do this thing any­way.

You can find Stupid­Sheet here

It has some small bugs (try set­ting B1 to A1+1 with no val­ue in A1 ;-) but they are easy to fix.

We could re­move some fea­tures (like the weird past­ing stuff) to make the ex­am­ple more di­dac­tic.

I hope this gets some an­swers :-)