Robins blogg

2009-04-16

Annual update

Filed under: — site admin @ 00:04

EGit logo
Seems I write a lot more code than prose. The road to getting the Eclipse plugin pass as an official Eclipse project is underway. See http://www.eclipse.org/proposals/egit/.

It is causing a lot of stir in the community and good reviews. Yeah, it’s not complete, but seems people like what they see.

Manuel Wolker though not officially a code contributor yet, he gathered a BoF session at EclipseCon and has written a blame that we hope to integrate soon.

For more info see and

Maybe it’s time to polish that logo. It took five minues in Inkscape.

2007-01-21

The Eclipse Git plugin project

Filed under: — site admin @ 23:01


First working version compare

Quickdiff in action in Git controlled repo

I don’t seem to be able to blog much. Last year I did som hacking on Git, the version manager originally written to manage the Linux kernel source code. I’m quite happy with the export to CVS now. For more details, just browse the history of git. The reason I got into git was that I wanted something better than CVS, something that could work locallly, so I wouldn’t need to pollute the main repository with all my mistakes. Subversion was the obvious first thing to check out, but that didn’t fit the bill. It is server based, but does renames nicely. At the downside it’s slower, it crashed during conversion of the CVS repo (leaving a defunkt repo). Now CVS is reliable, something I’m not willing to give up. I’ve never had any sort of stability problem with CVS and few other people had. It is also fast enough to work very nicely over a GPRS connection. Clearcase.. well. No thanks. Bitkeeper was an option, but then I stumbled over Git and especially Stacked Git. It’s just awesome. As all good software it needs improvements. The “float” command is my contribution. It allows simple reordering of patches.

Then I wanted to use Stacked Git with Eclipse for (non open source) development. This works fine, but you have to use the command line as there is no fully functional plugin. Shawn Pearce, an very very active contributor to the Git project had started a plugin for Eclipse, called EGit. It wasn’t much use per se, but it had the basic infrastructure needed for me to solve the most apparent needs when developing in Eclipse, i.e. a history browser and quickdiff support. After bugging Shawn with some errors, which he fixed faster than most MTA bounce mail, I could develop those features which Shawn the pulled into Egit.

To the right of this entry are the first two screenshot I sent to Shawn (on IRC, I think). These aren’t entirely up to date, but not too much off either.

2006-09-06

Bash-tips: #1 - e-flaggan

Filed under: — site admin @ 22:09

Ni känner säker igen det. Man skriver ett skript som gör nåt nyttigt, men en dag fallerar det och det tar en massa tid att stöda upp efter allt skriptet gjorde efter det fallerade.

För att skriva mera tillförlitliga bash-skript utan att ha överdrivet mycket felkontroller kan man använda en option som automatiskt avslutar skript vid fel. Då slipper man skript som går vidare och saboterar en massa data när nåt kommando går fel. Flaggan heter ‘-e’ och kan läggas på första raden i bash-skript eller senare, då med kommandot set -e

#!/bin/bash -e
trap 'echo "***error**"' 0

tar cvfz /tmpdir/arkiv.tgz *
rm -rf *

# Stäng av felhanteringen just före vi avslutar
trap 0

I detta exempel kopierar vi först en massa filer och raderar dem sedan. Men om arkivet inte går att skapa så vill vi naturligvis inte radera allt. Med felkontroll på allt blir skripten säkrare. Utan -e skulle skriptet radera allt och tyvärr är det så många skript gör eftersom det är så jobbigt att lägga in felkontroller. I ett stabilt skript är en stor del av koden explicita felkontroller. Trap-kommandot är ett inbyggt kommando som fångar signaler, man signal(2), men även några anda händelser, t.ex. när skript avslutas vilket vi är intresserade av här för att få ut ett felmeddelande när nåt går fel.

Sen inträffar det förstås att kommandon kan ge en felkod utan att man vill terminera direkt. Det kan finnas en alternativ väg eller så vill man anpassa felmneddelandet. Om kommandot är ett villkor i en if-sats bryts inte skriptet om kommandot går fel utan if-satsen får ta hand om felkoden.

#!/bin/bash -e
trap 'echo "***error**"' 0

if ! tar cvfz /tmpdir/arkiv.tgz *
then
 tar cvfj /tmpdir/arkiv.tar.bz2 *
fi
rm -rf *

# Stäng av felhanteringen just före vi avslutar
trap 0

I detta fall provar vi att komprimera hårdare (ifall disken inte räckte till för vanlig gzip. Om bzip2-komprimeringen misslyckas terminerar skriptet.

I slutändan hamnar man på att skriva ungefär like mycket felhanteringskod med -e, främst för att få fram bra felmeddelanden, men de tidiga versionerna, där logiken är vikitigast, kommer att vara mycket mer robusta och lättare att felsöka.

2005-05-15

KDE login with photos from LDAP

Filed under: — site admin @ 22:05

(Updated 2005-08-22)
KDM looked like this in the first version
If you are using LDAP for authentication users you also have to option of storing address book data, incliuding a photo, in the same record. Not all applications can use it, but KAddressbook can.

The KDE login manager (KDM) can show photos of users, but only locally stored photos. It doesn’t know of the ones in LDAP even if it PAM is setup to use LDAP.
(more…)

2005-04-22

Autoconf-magi

Filed under: — site admin @ 00:04

I öppen-källkodsvärlden finns svart magi. Namnet är autoconf.

För att vara komplett måste duoptimize-programmet byggas via configure. Här följer en kort historia. Det finns dokumentation i info format (info:autconf i Konqueror, info autoconfo på kommandoraden).

Här är en kort historik, med mina fel.
(more…)

2005-04-02

Disk usage optimizer

Filed under: — site admin @ 18:04

This program can reuse disk space in unix-style (e.g. Linux) systems by removing copies of files and replacing them with hard links.

Source (c++) at

USE AT YOUR OWN RISK.. and have fun!

phpBB2 ldap auth

Filed under: — site admin @ 18:04

Here is a patch for the LDAP auth mod for phpBB2. I made it a while ago so now I attempted to extract what I did.

The following archive contains patches (all mixed up, the split is chronological..)

- LDAPv3 (character set conversion on the LDAP data),
- Swedish translation of the LDAP auth mod.
- an update method for LDAP data (every login, not just the first time)
- support for using posixGroup in the LDAP server.

phpBB_LDAP_wrapup-0.1.tgz

Once more; it is an unverified change discovery so far and configuring the LDAP parameters require even more LDAP knowledge than before :(

If there is any interest I’ll may try to clean this up.

USE AT YOUR OWN RISK.. and have fun!

2004-11-09

C++ interpreter

Filed under: — site admin @ 01:11

Well, not really but for some uses it is handy. This little utility allows you to compile and execute simple C++ program by typing the essense of them on the command line. Download: cev script.

The argument --Iincludefile can be used to #include extra files.
Other arguments starting with a dash will be passed as compiler and linker options.

The arguments not starting with hyphens will be inserted into a temporary C++ program. The last argument will be wrapped in a main function.

Execute some code
cev 'double x=sqrt(3); cout < < x;'

Define a function and use it
cev 'int fak(int n) { return n==1?1:n*fak(n-1); }' 'cout < < fak(4);'

Note the use of simple apostrophes. You can use double quotes or none, but then you need to quote the C++ code in more complicated ways.

2004-11-08

CVS history file viewer

Filed under: — site admin @ 11:11

Here’s a history file browser for integration with ViewCVS. It is a patch against viewcvs per 20040223, i.e. the version included in the latest MandrakeLinux versions. It is based on a perl hack I made a long time ago on top of the cvs command. This is a rewrite in python started some time ago (hence the old baseline). It applies cleanly onto the corresponding cvs version. It is not complete though, maybe later.

MandrakeLinux RPM and SRPM. Patch here.

(updated version against head + RDF)MandrakeLinux RPM and SRPM. Patch here.

The browser works off the CVSROOT/history file and has the drawbacks that the user may force CVS not to update the file. Another drawback is that it does not scale well with since it reads the whole history file, which may be very large. Don’t use it as a security tools and don’t use it on high volume servers.

  • Features

    • Lists add/remove/modify entries
    • Direct access to difference for history entry
    • Restriction on history length, browser per date (not time yet), last week|month|year
    • Directory sensitive. Lists only history entries for the tree where the history listing was initiated
    • RDF
  • Non-features, I’ve thought about
    • Sorting by column
    • by upper andlower dates
    • Limit search by user
    • Subversion support

2004-10-11

PHeel the Power

Filed under: — site admin @ 22:10

Hittade ett radverktygg på lagom geeknivå på PHP PEAR-sidan. Packade som RPM:er på Mitt arkiv för den som vill ha. Filerna torde gå att installera på andra RPM-baserade distar också. Katalogerna är urpmi-arkiv för Mandrake också.

DB_DataObject är ett RAD-paket för PHP, dvs den genererar PHP-klasser för att accessa databaser från PHP. Till paketet hör bla. HTML-Quickforms för att snabbt skapa formulär. Det är kanske inget man använder för slutapplikationen, men det gör det enklare att komma igång för att prototypa en applikation. Det jag använder det för att hålla reda på testsviter och deras resultat över flera omgångar.

På PEAR-sidan hänvisas till en en PDF men delvis inaktuella exempel. Kolla FormBuilder.php för exakta namn på variabler som kan definieras i diverse klasser.

2004-09-23

ÅÄÖ-helvetet

Filed under: — site admin @ 14:09

Svarade på en fråga om åäö och Java som kan bita många. Svaret finns på SeLinux Dagen efter jag skrev svaret fick jag mer eller mindre samma fråga på jobbet. Då var det fråga om varför nattbyggena inte fungerade.

Svaret är att servern som körde nattbyggena inte hade lokale-variablerna satta, dvs tolkningen var LC_ALL=C och då tolkar javac det som att teckenkodningen är UTF-8. Tyvärr klagar inte javac (1.4) när ogiltiga tecken finns utan sätter in \uFFFD, som är en platshållare för ogiltiga tecken.

Med JDK 1.5 får man en varning.

Strunta i att strunta i blanka

Filed under: — site admin @ 12:09

Nu kommer vi till orsaken till att ha en blogg; att få uttrycka sin irritation. Förhoppningsvis kommer man på positiva saker också.

Jag gick ifrån explicit kodning av vilken klass som används för att konstruera ett DOM-träd för en XML-fil eftersom det gjorde mig beroende av java-version. Nu ville jag inte se alla blanka så trodde jag att metoden setIgnoringElementContentWhitespaceDocumentBuilderFactory skulle hjälpa. Men icke. På
http://forum.java.sun.com/thread.jsp?forum=34&thread=450699&tstart=30&trange=15 förklaras en del av problemet av nån som också stött på det.

Foo!
java.lang.AbstractMethodError: org.apache.xerces.dom.DOMImplementationImpl.getFeature

Hittade förklaringen till att parsern inte skippar blanka. Jag har ett XML-schema, inte DTD. Tyvärr har jag inte hela schemat heller så jag kan inte validera.

Powered by WordPress