My posts and thoughts

aron.nu anew!

Drupal is too heavy. Went with Anchor this time.

Maven bash-completion entry on Gentoo

Put the simple file in "/usr/share/bash-completion" with the ones I use most.

#!/bin/bash

_m2_make_goals()
{
  plugin=$1
  mojos=$2
  for mojo in $mojos
  do
    export goals="$goals $plugin:$mojo"
  done
}

_m2_complete()
{
  local cur goals

  COMPREPLY=()
  cur=${COMP_WORDS[COMP_CWORD]}
  goals='clean compile test install package deploy site'
  goals=$goals _m2_make_goals "eclipse" "eclipse"
  goals=$goals _m2_make_goals "eclipse" "clean"
  goals=$goals _m2_make_goals "dependency" "tree"
  goals=$goals _m2_make_goals "dependency" "list"
  cur=`echo $cur | sed 's/\\\\//g'`
  COMPREPLY=($(compgen -W "$" $ | sed 's/\\\\//g') )
}

complete -F _m2_complete -o filenames mvn

And then the "eselect bashcomp enable " Will be overwritten the next time the gentoo ebuild for bashcomp is updated or reinstalled.

Custom keyboard layout variant

Since I normally use a swedish keyboard layout, writing braces, parenthesis and brackets kind of sucks. I decided to remap them to

leftbrace to AltGr+q  
rightbrace to AltGr+r  
leftbracket to AltGr+w  
rightbracket to AltGr+e  
leftparen to AltGr+a  
rightparent to AltGr+s  

The first method I tried was to run a script in ".kde4/Autostart" that runs "xmodmap" on a custom ".Xmodmap" where I captured the keypress event with "xev". This was quite easy and worked as expected in just a few minutes. However, once I logged out and the logged in again I noticed a severe delay before I could use the keyboard. After some thinking and googling I came to understand that the remapping of the keys was sort of tinkering with the keymap behing the X servers back which created a great deal of sync operations and used a lot of resources. The next strategy was to create the layout to be available before the X server starts. Here is how:

edit /usr/share/X11/xkb/symbols/se

add the following:

partial alphanumeric_keys
xkb_symbols "se_aron" {
    name[Group1]="Swedish (aron)";
    include "se(basic)"
    key   { [         7,          slash                        ]  };
    key   { [         8                                        ]  };
    key   { [         9                                        ]  };
    key   { [         0,          equal                        ]  };
    key   { [         q,          Q,      braceleft            ]  };
    key   { [         w,          W,      bracketleft          ]  };
    key   { [         e,          E,      bracketright         ]  };
    key   { [         r,          R,      braceright           ]  };
    key   { [         a,          A,      parenleft            ]  };
    key   { [         s,          S,      parenright           ]  };
    include "kpdl(comma)"
    include "level3(ralt_switch)"
};

Found the codes here Now the definition exists, but it also needs to be added to a list that the systemsettings in kde can select from:

/usr/share/X11/xkb/rules/base.lst

or with evdev

/usr/share/X11/xkb/rules/evdev.lst

Add the entry

se_aron se: Swedish (aron)

And also, not quite sure this is needed but for good measure if nothing else: Open

/usr/share/X11/xkb/rules/base.xml

or with evdev

/usr/share/X11/xkb/rules/evdev.xml

And, under the configitem with name 'se', add a variant like so:

<variant>
  <configItem>
    <name>se_aron</name>
    <description>Swedish (aron)</description>
  </configItem>
</variant>

Now, the next time you log on to a kde session (the X server needs to be restarted first) you will be able to select the custom variant. Update: when using fluxbox the xmodmap works just fine. .Xmodmap follows below. I also moved slash to AltGr+d:

keycode   8 =
keycode   9 = Escape NoSymbol Escape
keycode  10 = 1 exclam exclamdown onesuperior
keycode  11 = 2 quotedbl 7 ampersand at twosuperior
keycode  12 = 3 numbersign 5 percent sterling threesuperior
keycode  13 = 4 currency 3 numbersign dollar onequarter
keycode  14 = 5 percent 1 exclam EuroSign cent
keycode  15 = 6 ampersand 9 parenleft yen fiveeighths deadgrave
keycode  16 = 7
keycode  17 = 8
keycode  18 = 9
keycode  19 = 0 equal
keycode  20 = plus question 8 asterisk backslash questiondown
keycode  21 = deadacute deadgrave bracketright braceright plusminus notsign deadtilde
keycode  22 = BackSpace BackSpace BackSpace BackSpace
keycode  23 = Tab ISOLeftTab Tab ISOLeftTab
keycode  24 = q Q slash question braceleft GreekOMEGA
keycode  25 = w W comma less bracketleft Lstroke
keycode  26 = e E period greater bracketright cent deadabovedot periodcentered
keycode  27 = r R p P braceright registered
keycode  28 = t T y Y thorn THORN
keycode  29 = y Y f F leftarrow yen
keycode  30 = u U g G downarrow uparrow
keycode  31 = i I c C rightarrow idotless
keycode  32 = o O r R oe OE
keycode  33 = p P l L thorn THORN
keycode  34 = aring Aring apostrophe quotedbl deaddiaeresis deadabovering deadacute deaddiaeresis
keycode  35 = asciitilde asciicircum deadcircumflex deadcircumflex
keycode  36 = Return NoSymbol Return
keycode  37 = ControlL NoSymbol ControlL
keycode  38 = a A a A parenleft
keycode  39 = s S s S parenright
keycode  40 = d D d D slash
keycode  41 = f F u U dstroke ordfeminine
keycode  42 = g G i I eng ENG
keycode  43 = h H d D hstroke Hstroke
keycode  44 = j J h H deadhook deadhorn
keycode  45 = k K t T kra ampersand
keycode  46 = l L n N lstroke Lstroke
keycode  47 = odiaeresis Odiaeresis s S oslash Oslash
keycode  48 = adiaeresis Adiaeresis minus underscore ae AE
keycode  49 = section onehalf grave
keycode  50 = ShiftL NoSymbol ShiftL
keycode  51 = apostrophe asterisk backslash bar acute multiply
keycode  52 = z Z semicolon colon guillemotleft less deadogonek deaddoubleacute
keycode  53 = x X q Q guillemotright greater
keycode  54 = c C j J copyright copyright
keycode  55 = v V k K leftdoublequotemark leftsinglequotemark
keycode  56 = b B x X rightdoublequotemark rightsinglequotemark
keycode  57 = n N b B n N
keycode  58 = m M m M mu masculine
keycode  59 = comma semicolon w W deadcedilla deadogonek
keycode  60 = period colon v V periodcentered deadabovedot
keycode  61 = minus underscore z Z deadbelowdot deadabovedot
keycode  62 = ShiftR NoSymbol ShiftR
keycode  63 = KPMultiply KPMultiply KPMultiply KPMultiply KPMultiply KPMultiply XF86ClearGrab KPMultiply KPMultiply XF86ClearGrab
keycode  64 = AltL MetaL AltL MetaL
keycode  65 = space space space space space nobreakspace space nobreakspace
keycode  66 = CapsLock NoSymbol CapsLock
keycode  67 = F1 F1 F1 F1 F1 F1 XF86SwitchVT1 F1 F1 XF86SwitchVT1
keycode  68 = F2 F2 F2 F2 F2 F2 XF86SwitchVT2 F2 F2 XF86SwitchVT2
keycode  69 = F3 F3 F3 F3 F3 F3 XF86SwitchVT3 F3 F3 XF86SwitchVT3
keycode  70 = F4 F4 F4 F4 F4 F4 XF86SwitchVT4 F4 F4 XF86SwitchVT4
keycode  71 = F5 F5 F5 F5 F5 F5 XF86SwitchVT5 F5 F5 XF86SwitchVT5
keycode  72 = F6 F6 F6 F6 F6 F6 XF86SwitchVT6 F6 F6 XF86SwitchVT6
keycode  73 = F7 F7 F7 F7 F7 F7 XF86SwitchVT7 F7 F7 XF86SwitchVT7
keycode  74 = F8 F8 F8 F8 F8 F8 XF86SwitchVT8 F8 F8 XF86SwitchVT8
keycode  75 = F9 F9 F9 F9 F9 F9 XF86SwitchVT9 F9 F9 XF86SwitchVT9
keycode  76 = F10 F10 F10 F10 F10 F10 XF86SwitchVT10 F10 F10 XF86SwitchVT10
keycode  77 = NumLock NoSymbol NumLock
keycode  78 = ScrollLock NoSymbol ScrollLock
keycode  79 = KPHome KP7 KPHome KP7
keycode  80 = KPUp KP8 KPUp KP8
keycode  81 = KPPrior KP9 KPPrior KP9
keycode  82 = KPSubtract KPSubtract KPSubtract KPSubtract KPSubtract KPSubtract XF86PrevVMode KPSubtract KPSubtract XF86PrevVMode
keycode  83 = KPLeft KP4 KPLeft KP4
keycode  84 = KPBegin KP5 KPBegin KP5
keycode  85 = KPRight KP6 KPRight KP6
keycode  86 = KPAdd KPAdd KPAdd KPAdd KPAdd KPAdd XF86NextVMode KPAdd KPAdd XF86NextVMode
keycode  87 = KPEnd KP1 KPEnd KP1
keycode  88 = KPDown KP2 KPDown KP2
keycode  89 = KPNext KP3 KPNext KP3
keycode  90 = KPInsert KP0 KPInsert KP0
keycode  91 = KPDelete KPSeparator KPDelete KPSeparator
keycode  92 = ISOLevel3Shift NoSymbol ISOLevel3_Shift
The rest is default.

Gentoo automake - there can be only one

Just noticed that there is only one version. aron@raziel ~ > equery l automake * Searching for automake ... [IP-] [ ] sys-devel/automake-1.11.1:1.11 Can't remember when it was like this, if ever before. Progress, I guess :)

Glorious org mode (checkboxes)

Want a todo list with checkboxes? First make a new heading with the usual Alt+Enter Then, start a list by typing hyphen (-) Next, use S-M-Enter (SHIFT + Alt + Enter) for as many times as you need stuff to check off. Use the Ctrl-c-c to tick items off. Then you end up with pretty stuff like this:

** TODO stuff to act
    - [ ] add a schmerdiferd
    - [ ] to go the fafofa
    - [ ] make the ahaaa
All lovely colorized. I love this stuff! Thank you thank you thank you to the org mode devs! 

http://orgmode.org/

xorg 1.8

Upgrading to xorg-server with USE=-hal appeared to make things run a tad faster.
However, some really strange behavior with keypress events started to occur. I tried several different variants for keyboard layout, setting special keys etc but I still got stuff like "right ctrl is return" or "arrow down inserts a space and line down". Adding to xorg.conf:

Section "InputClass"
        Identifier "keyboard-all"
        Driver "evdev"
        Option "XkbLayout" "se"
        Option "XkbVariant" ",qwerty"
        MatchIsKeyboard "on"
EndSection
Section "InputClass"
        Identifier "mouse-all"
        Driver "evdev"
        MatchIsPointer "on"
EndSection
Section "Module"
        Load           "dbe"
        Load           "extmod"
        Load           "glx"
        Load           "evdev"
EndSection

Made it work again. I was under the impression that you would have to configure less in xorg.conf after upgrading. But hey X works all dandy now.

ScribeFire

Is quite nice I have to say. Still have to figure out how to make drupal allow for something else but filtered html.

Edit: Almost too easy: http://drupal.org/node/202947

http://www.similarminds.com

Main type

Variant

Take Free Enneagram Personality Testpersonality tests by similarminds.com

Pop goes the drive...

For about a year now I have had a very annoying problem with my file server. One of the two Seagate drives simply disappeared from time to time. It was never the same one and I couldn't tell what pattern the disappearances followed. The system log looked something like:

Jul 11 18:55:02 hostname ata5.00: exception Emask 0x10 SAct 0x1 SErr 0x190002 action 0xe frozen
Jul 11 18:55:02 hostname ata5.00: edmaerrcause=00000020 pp_flags=00000003, SError=00180000
Jul 11 18:55:02 hostname ata5: SError: { RecovComm PHYRdyChg 10B8B Dispar }
Jul 11 18:55:02 hostname ata5.00: cmd 61/80:00:a9:47:55/00:00:1b:00:00/40 tag 0 ncq 65536 out
Jul 11 18:55:02 hostname res 40/00:00:a9:47:55/00:00:1b:00:00/40 Emask 0x10 (ATA bus error
At first I assumed that it was due to a faulty SATA controller on my motherboard. I found a PCI-e card that I could fit into my motherboard. It seemed to work just fine for a while, apart from the hassle with motherboard not being able to boot directly from it and being forced to use a noisy old IDE drive for storing grub and kernel to boot from. After a month or so, one of the hard drives popped out again. Dang. This time I started trying to diagnose my Seagate discs. They have excellent diagnostic tools that runs under linux on their website. I even sent two of them back to seagate and got them refurbished. After a couple of months or so again it was time to resync the RAID due to discs popping out. Man, I was frustrated with this by now. Since the only things left was cabling and PSU by now and I found this. I decided to go for a new PSU, I ripped out the old FSP and put in a new Corsair. Corsair really has become my favourite ones over time. According to the info I found this problem should reappear during load. Since I've done a resync of the raid, have a couple of full backup jobs run and a bunch of my pictures uploaded to it, it really seems rock stable now =).

One thousand reads

Just noticed that for two of my posts, drupal reports 1000+ reads; this one http://www.aron.nu/?q=node/20 and this one http://www.aron.nu/?q=node/14. I guess that gives an indication as to what's more interesting posts.

Mess up drupal and back again

Sometime when I was updating drupal from 6.10 to 6.11 I thought I was going to be clever and update as soon at the core module was available upstream. Not to wait until it reached portage. I downloaded it and placed it in

$WEBROOT/sites/all/modules

and updated to that version of the core module. But thinking about it today I found it excessive and stupid to be doing manual updates =). Better let webapp-config handle it again as before. So how do I go about that? Just updating with webapp-config did not suffice since the running installation still refers to the one I manually downloaded and the update script didn't help either. After some searching in the database I found alot of references to my

$WEBROOT/sites/all/modules/drupal-6.10

directory. Some of the references resided in the cache_ tables as well. Well, I thought that truncating the cache tables couldn't hurt so I did that and then wrote a small routine to replace the references to not include the $WEBROOT/sites/all/modules/drupal-6.10:

<?php

$safe = true;

$link = mysqlconnect('127.0.0.1', 'drupal', 'password'); if (!$link) { die ('Error connecting' . mysqlerror()); } echo 'Successful connect'; mysqlselectdb ('drupal', $link) or die ("Error selecting");

// ======= fix menurouter ====== $sql = "SELECT * " ."FROM menu_router " ."WHERE file LIKE '%drupal-6.10%'"; $menuroutercontents = mysqlquery($sql) or die ("Error fetching values from menurouter".mysqlerror()); $row = 0; $i=1; while($row = mysqlfetcharray($menuroutercontents)) {

/* print_r($row); */

echo "\nResult no ".$i.": ".$row['file'];
$i++;
$newvalue = str_replace('sites/all/modules/drupal-6.10/', '', $row['file']);
$sql = 'UPDATE `drupal`.`menu_router` SET `file` = \''.$newvalue
.'\' WHERE CONVERT(`menu_router`.`path` USING utf8) = \''.$row['path'].'\' LIMIT 1;';
exec_sql($sql, $safe);

}

// ======= fix system ====== $sql = 'SELECT * FROM system WHERE filename LIKE \'%drupal-6.10%\''; $systemcontents = mysqlquery($sql) or die ("Error fetching values from system".mysqlerror()); $row = 0; $i=1; while($row = mysqlfetcharray($systemcontents)) { /* print_r($row); */

echo "\nResult no ".$i.": ".$row['filename'];
$i++;
$newvalue = str_replace('sites/all/modules/drupal-6.10/', '', $row['filename']);
$sql = 'UPDATE `drupal`.`system` SET `filename` = \''.$newvalue
.'\' WHERE CONVERT(`system`.`filename` USING utf8) = \''.$row['filename'].'\' LIMIT 1;';

exec_sql($sql, $safe);

}

mysql_close();

function execsql($query, $safe) { if ($safe) { echo "\nThis is the query: ".$query; } else { mysqlquery($query) or die ("Error executing query".mysql_error()); } }

?>

Still no cigar tough. The admin interface tells me that there are updates available. Using the database update script (update.php) puts me back to where I started. So off I go to examine that script too. I notice that it's using the POST variable to set some values that has to do with module versions. Intriguing. Next thing to try is to clear the browser cache, run the php script again and voila´. Now it's looking good. I had to run the update.php again and it didn't mess stuff up anymore either. NOTE: To make the script 'bite', set "$safe = false" at the top of it. Use at own risk ofcos =).

Lovely org

The editor emacs continues to amaze me. For some time now I have been using emacs as a day-planner in the excellent org-mode. Once you get used to the commands it's a breeze to create documents with structured headlines, internal and external links, etc. It's also very versatile in that it can export the same document to different formats like html or ascii. The stable version that comes with Gentoo unfortunately does not seem to support docbook format (latest upstream stable version does however and possible to use with Gentoo if you run the keyworded version at the time of this writing). You can find a nice screencast here. Org-mode was also featured with Google Tech Talk.

Renovate

So I decided to spice up my Gentoo work station a little. I was having a little too much crud lying around like ldap and mysql support anyways. To get a more complete control over what was installed, I started moving away from using a list of use flags in make.conf by doing a

 emerge -evp --columns world >> tmpfile

with that format it was easy to use an openoffice spreadsheet and insert from file with fixed width delimiters cut and then go through the file with emacs and do some search and replace to end up with the exact format that /etc/portage/package.use employs. Then, with the help of profuse and simple stuff like

sed -i 's/ ldap/ -ldap/g' tmpfile
I soon had the use flag settings I wanted. A nice side effect was that I also discovered the truetype flag which endowed me with pwettier apps on my desktop. While at it, I did a check for cflags and I noticed that since my gcc was now at a sufficient high level to be able to interpret the -march=core2, I put that in. Also found that my /proc/cpuinfo revealed the msse4.1 would be possible for my system. Good source of info this. Having done all that which took me quite a bit of time (there's probably a much more efficient way I reckon =/ ). It was time for the good old rebuild all-script (I had also a new linux-headers to upgrade to):

 #!/bin/sh

 PKGLIST="linux-headers glibc binutils-config binutils gcc-config gcc glibc binutils gcc system world"

 for i in $PKGLIST
 do
     emerge -q $i
 done

It's probably just my imagination but everything seems prettier and snappier =).

Don't extend

As I am nowadays using the keyworded gentoo-sources, I am already using the 2.6.29 kernel with promised updated ext4 stuff and some more goodies. However, after doing my normal upgrading routine with make oldconfig and sifting through all the new options, running my 'build kernel and drivers'-script, my system wouldn't boot =|. Unable to remount read-write dmesg said. A wee bit stumped, I went back to 2.6.28 for a few days but now I had a go again and took a look at my fstab. In the mount options, I had put "extents, barriers=0". Not sure why since none of the threads I found with google made those options look very promising. Particularly, when I found a note about deprecating extents, I figured thay have to go. Said and done, I have now booted with little devils peeking at me from the screen instead of penguins. I might have noticed a very slight speedup when starting programs too. Ah, portage tells me it's time to go xorg-1.5. Now where did I put the bookmark for the upgrade guide...

Creating software in a nutshell

It's been a bit too long since I did a post so I thought I'd post some thoughts about the creation of software and cooperation in a small group with tools we're using like UML, design patterns etc. I'm assuming that a sufficiently thorough analysis has been made and that the group comprises about two to four developers. This would be the optimal course of action for my personal taste and knowledge level at this time. Beginning Creating a design in face to face sessions dividing the software into components and then modeling the parts in UML with an occasional informal sketch not necessarily UML to get thoughts conveyed. Whatever floats your boat in this regard. It's highly preferable if all devs can retreat for a while (preferably more than a day), pondering. Pondering includes exercising, writing some documentation etc. Then the group meets again and continue to flesh out the details. Middle Individual preferences and consensus are used to divide the work in between developers. Design patterns are used for discussion thoughts about converting the design into code. They are also used at leisure in the implementations. Unit tests are being introduced. End Implementation details are sorted out. Unit tests are being finished and adjusted as stuff changes. Documentation ensues and finally for future reference, like when you get new additions to the group and want to explain the design to them you can generate or change the UML diagram to reflect changes and additions the group makes during the development process.

It's probably a rare case when everything is this straight forward and simple, but I think this would be specific enough to contribute to a discussion and not too heavy but still substantial enough to help. One caveat is that there's a bunch of assumptions about the devs in the group, that they do possess enough knowledge to be able to do OOA/D, test driven and UML.