Wednesday, 23 December 2009

Why can't icefaces give proper error messages? II

After days of searching and experimentation it seems that its not possible to dynamically import
a .jspx file into another (one which is loaded from a jar, and the src location is supplied by the backing bean).

I'm trying to embed iframes now, but as soon as the iframes render, icefaces freezes up and does not send any events again. The only clue was this javascript error:
Error: no element found
Source File: http://localhost:17080/EbrWeb/block/receive-updated-views
Line: 1

After searching and a hunch that concurrently loading jspx pages breaks icefaces, I looked at the portlet sample

I found that if I include the following in my web.xml, it works! Hurray!

This makes sense because I want to load several iceface pages in iframes in my main page.

Thursday, 10 December 2009

Why can't icefaces give proper error messages?

SEVERE: StandardWrapperValve[Persistent Faces Servlet]: PWC1406: Servlet.service() for servlet Persistent Faces Servlet threw exception
java.lang.Exception: javax.faces.FacesException: Problem in renderResponse: null

was trying to tell me:

<ice:tree> needed to be encapsulated inside an <ice:form>.

Tuesday, 1 December 2009


"a plus", short for "a plus tard" (French, pronounced ah-plu-tar), that is "see you later".
Used to end an informal email, or a chat. Equivalent to "C U"

You can listen to the pronunciation here:

Monday, 30 November 2009

pycurl does not like bad certificates

I keep on hitting this once in a blue moon (maybe after dist-upgrading), pushing to a smart server over https I get the following:

bzr: ERROR: Connection error: curl connection error (server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none)        
on https://mycompany/bzr/aprojectrepo/mybranch/.bzr/smart

And every time it takes me some time to figure out how to fix it, so I'm noting it here for future reference:
* remove python-pycurl
* or use "http+urllib://"

I suppose I should help fix this, but I don't see myself getting round to that any time soon.

Tuesday, 24 November 2009

happy karmic day

My upgrade from jaunty to karmic was not quite rosy.
My man two problems were that my sound and touchpad stopped working.
Thankfully its all sorted out now (I hope).

My touchpad wasn't working because of using the wrong kernel - after upgrading to karmic, it didn't boot using the karmic kernel by default, I had to use grub editor to change that.
But then I could not boot. I had to go fix up my grub menu:
sudo vim /boot/grub/menu.lst
I had

title Ubuntu 9.10, kernel 2.6.31-14-generic (recovery mode)
in stead of

title Ubuntu 9.10, kernel 2.6.31-14-generic (recovery mode)
root (hd0,0)

(it was complaining that it could not find a kernel image at the specified location or something)

the sound was also related to using the wrong kernel, but also due to some pulsaudio issues see HOWTO: PulseAudio Fixes & System-Wide Equalizer Support - Ubuntu Forums

mmm... the first kernel update broke it again :(
I finally heeded Robert's advice to do:
sudo update-grub
My menu.lst looks fine now, but still need to reboot and test it.

Saturday, 21 November 2009


I found this cool package today:
sudo apt-get install kalternatives

From the package info:

Kalternatives offers a GUI to configure the alternative systems (a
system that allows you to select one alternative file for many in the
Kalternatives is available as KDE configuration module, integrated by default
into KDE's System Settings.

This is an advanced GUI of the update-alternatives program shipped with dpkg.

Some of the options I wanted to customise:

usplash-artwork (usplash-theme)

Saturday, 31 October 2009

Project Lombok: Put an End to Java Verbosity

If you're interested in java programming involving lots of beans, this is a crazy cool tool.

Its a combination of a compile-time and a development-time code generator, which has made Java POJO verbosity history.
It uses annotation magic to implement all the repetitive boring bean methods (getters, setters, equals, hashCode, toString)
without them actually cluttering your classes. Thats right it generates invisible code!

Now you have to watch the video at:

You can reed this introductory article:

See some other cool examples to look at: (I was trying to implement this one just a couple of weeks ago)

I came across lombok while trying to figure out if I can get eclipse to also generate the .equals and .hashCode methods
on new JPA entities like netbeans does. turns out it I don't really need that any more.

Saturday, 17 October 2009

Saving a list of your Ubuntu packages and installing them again somewhere else

When you have to leave your old installation behind and have to move to a new installation of Ubuntu. You can install all the packages you used to have in 3 easy steps. Then you just need to copy over your home folder and voi-la your new installation is almost exactly like you used to have. On other operating systems this takes a week or so, and you keep on discovering things you forgot.

So for the packages you do on your old install:
dpkg --get-selections > installed-software

copy the installed-software file over to your new install and:
dpkg --set-selections < installed-software 
Like magic. And if you have a local apt-cacher-ng, you don't even need to download everything again. Alternatively you can copy over your /var/cache/apt/archives/ before doing the second part.

Tuesday, 13 October 2009

(Ice)faces hates me and Richard

After Richard Kolb and I have struggled with this for days, I finally cracked it.

We defined some dropdowns, and radio buttons in icefaces eg:
<ice:selectOneRadio id="reportColumnIndexRadio"
value="#{scratchPad.reportColumnIndexSelectItemList}" />

<ice:selectOneMenu id="reportColumnIndex"
value="#{scratchPad.reportColumnIndexSelectItemList}" />

but when a new item was selected nothing happened, we just got this VERY cryptic log entry e.g:
sourceId=reportEditorForm:j_id14[severity=(ERROR 2), 
An error occurred when processing your submitted information. ),
An error occurred when processing your submitted information. )]

After hours of (debugging, guessing, googling, repeat) loops,
I finally found this link which explains it a number of times:

Faces or icefaces does not automagically serialise or cache objects when sending it to the browser!
It converts to/from Strings if it can
and tries to waste as much of your time as possible if it can't!

So my fix was setting the selectItem's value to our DB Id in stead of the object,
using the Id property for the SelectOne value.
Then on partial submit when the setter gets called,
we have to iterate through the cached list to find the one matching the Id to set the real property.

<ice:selectOneMenu id="reportColumnIndex"
value="#{scratchPad.reportColumnIndexSelectItemList}" />

Tuesday, 29 September 2009

Publish failed using Ant publisher - duplicate entry

I got so frustrated this week with the eclipse + maven + glasfish combo.
It kept on refusing to publish my web project to glassfish with some lame excuse:
Publish failed using Ant publisher
unable to assemble module
duplicate entry: some.file

In any case I figured out a workaround (lucky guess):
Right-click on your project -> Maven -> Disable Workspace Resolution

Voi la. I can work again and debug my web apps.

Wednesday, 26 August 2009

rocketfuel-setup could not retrieve key

I'd like to try out a in-house launchpad at some point,
so I thought I should get it.
But for some reason the rocketfuel-setup couldn't download
the keys it wanted for the dependencies it needed to apt-get:

Retrieving key 0A5174AF.
gpg: requesting key 0A5174AF from hkp server
gpgkeys: key 0A5174AF not found on keyserver
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
Could not retrieve key 0A5174AF.

So after mucking around trying to tell it to use my proxy,
I just commented out the relevant exit 1 lines.
This worked great, I just got prompted to confirm I want to install these packages.
I suppose the better solution would have been to try harder to manually install
the keys, but I didn't want to think about it too much.

Friday, 14 August 2009

how to use apt-key so apt-get stops complaining

Use the last 8 digits apt-get gives you when it complains about keys eg.:

sudo apt-key adv --keyserver --recv-keys 5ADC2037

(I'm just pasting it here so I can find it again)

Sunday, 9 August 2009

xfce=a new lease of life for my not-so-old laptop.

Yes kde4 made my 64bit, 4GB mem, Core2 Duo 2.4GHz (kubuntu 9.04) laptop cry and die on me. For some reason it made X use a lot more memory than I would like.
So a couple of weeks ago I tried out xfce and I can be productive on it now. Although I miss a lot of features, at least I'm not running out of memory so easily and it does not crash so often anymore.
It may not strictly be Kde's fault, but by experimentation I found that xfce is better for me at the moment.

Saturday, 25 July 2009

Yet another juicy Alfresco Labs 3.1 stacktrace...

...which kept me busy for a couple of days.
I dumped it here for in case somebody else hits it.
So if you didn't find this post by googling an alfresco exception, you need to move along people, there is nothing to see here.

Without further ado, if you get the following exception:

javax.faces.FacesException: javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/dialog/container.jsp][Class: javax.faces.component.html.HtmlForm,Id: dialog][Class: javax.faces.component.UINamingContainer,Id: dialog-body][Class: org.alfresco.web.ui.common.component.UIPanel,Id: users-panel][Class:,Id: users-list][Class:,Id: _idJsp33][Class: javax.faces.component.html.HtmlOutputText,Id: _idJsp35]}
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(
at org.apache.myfaces.lifecycle.LifecycleImpl.render(
at javax.faces.webapp.FacesServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
Caused by: org.apache.jasper.JasperException: javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/dialog/container.jsp][Class: javax.faces.component.html.HtmlForm,Id: dialog][Class: javax.faces.component.UINamingContainer,Id: dialog-body][Class: org.alfresco.web.ui.common.component.UIPanel,Id: users-panel][Class:,Id: users-list][Class:,Id: _idJsp33][Class: javax.faces.component.html.HtmlOutputText,Id: _idJsp35]}
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(
at org.apache.jasper.servlet.JspServletWrapper.service(
at org.apache.jasper.servlet.JspServlet.serviceJspFile(
at org.apache.jasper.servlet.JspServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.ApplicationDispatcher.invoke(
at org.apache.catalina.core.ApplicationDispatcher.doInclude(
at org.apache.catalina.core.ApplicationDispatcher.include(
at org.apache.jasper.runtime.JspRuntimeLibrary.include(
at org.apache.jsp.jsp.dialog.container_jsp._jspService(
at org.apache.jasper.runtime.HttpJspBase.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.jasper.servlet.JspServletWrapper.service(
at org.apache.jasper.servlet.JspServlet.serviceJspFile(
at org.apache.jasper.servlet.JspServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.ApplicationDispatcher.invoke(
at org.apache.catalina.core.ApplicationDispatcher.processRequest(
at org.apache.catalina.core.ApplicationDispatcher.doForward(
at org.apache.catalina.core.ApplicationDispatcher.forward(
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(
... 19 more
Caused by: javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/dialog/container.jsp][Class: javax.faces.component.html.HtmlForm,Id: dialog][Class: javax.faces.component.UINamingContainer,Id: dialog-body][Class: org.alfresco.web.ui.common.component.UIPanel,Id: users-panel][Class:,Id: users-list][Class:,Id: _idJsp33][Class: javax.faces.component.html.HtmlOutputText,Id: _idJsp35]}
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderOutput(
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(
at javax.faces.component.UIComponentBase.encodeEnd(
at org.alfresco.web.ui.common.Utils.encodeRecursive(
at org.alfresco.web.ui.common.Utils.encodeRecursive(
at javax.faces.component.UIComponentBase.encodeChildren(
at javax.faces.webapp.UIComponentTag.encodeChildren(
at javax.faces.webapp.UIComponentTag.doEndTag(
at org.apache.jsp.jsp.users.users_jsp._jspx_meth_a_005frichList_005f0(
at org.apache.jsp.jsp.users.users_jsp._jspService(
at org.apache.jasper.runtime.HttpJspBase.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.jasper.servlet.JspServletWrapper.service(
... 42 more
Caused by: javax.faces.el.EvaluationException: Cannot get value for expression '#{r.sizeLatest}'
at org.apache.myfaces.el.ValueBindingImpl.getValue(
at javax.faces.component.UIOutput.getValue(
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(
... 57 more
Caused by: javax.faces.el.EvaluationException: Exception getting value of property sizeLatest of base of type : org.alfresco.web.bean.repository.MapNode
at org.apache.myfaces.el.PropertyResolverImpl.getValue(
at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(
at org.apache.commons.el.ComplexValue.evaluate(
at org.apache.myfaces.el.ValueBindingImpl.getValue(
... 59 more
Caused by: java.lang.NullPointerException
at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.beforeCommit(
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
at $Proxy176.getUserUsage(Unknown Source)
at org.alfresco.web.bean.users.UsersBeanProperties.getUserUsage(
at org.alfresco.web.bean.users.UsersDialog$1.get(
at org.alfresco.web.bean.repository.QNameNodeMap.get(
at org.alfresco.web.bean.repository.MapNode.get(
at org.apache.myfaces.el.PropertyResolverImpl.getValue(
... 62 more

nice, hey.

I think its reported here

To fix it, I built a newer version of from the svn sources, and dumped it in the alfresco/WEB-INF/classes and it works!

Thursday, 23 July 2009

get rid of glassfish master password

I've set up a webapp to be able to create-domain, deploy, test and delete-domain using the maven-glassfish-plugin.
The problem is that it insists on setting the master password.
Now its not possible to set the master password being used by the eclipse JavaEE glassfish plugin.
So when you try to start it from eclipse it asks for the master
password in the background:
Please enter the master password
After a while it times out and it says:
Server GlassFish at localhost failed to start.

I found out that you can tell glassfish to not ask the password anymore by doing:
asadmin change-master-password --savemasterpassword domain1

However, I changed my admin password maven uses,
to be the real defaut master password: "changeit",
and now eclipse can start maven-created domains without me
having to --savemasterpassword

Tuesday, 21 July 2009

more alfresco pain

This time I tried to send e-mails when new documents are added. I thought this would be simple. (With Alfresco labs 3.1)
First I got errors like:
20:08:32,529  ERROR [action.executer.MailActionExecuter]
Failed to send email to 'amanica@localhost'
as the address is incorrectly formatted

Eventually I figured out my test addresses are not acceptable to javamail. I had to setup before it worked.

Next I got the following:
20:08:33,310  ERROR [action.executer.MailActionExecuter]
Failed to send email to [root, test]
Could not prepare mail; nested exception is java.lang.NullPointerException
Caused by: java.lang.NullPointerException
at com.sun.mail.smtp.SMTPTransport.sendMessage(
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(
at org.springframework.mail.javamail.JavaMailSenderImpl.send(
at org.springframework.mail.javamail.JavaMailSenderImpl.send(
at org.springframework.mail.javamail.JavaMailSenderImpl.send(
at org.alfresco.repo.action.executer.MailActionExecuter.executeImpl(

And I think setting a e-mail address for the admin user fixed that.

Thirdly it only wanted to send these rule e-mails from, but if I copy slightly newer versions of
MailActionExecuter$1.class and MailActionExecuter.class into
it works. I don't know if that breaks anything else in the process.

And finally, I'm still unhappy that they don't ship with oracle hibernate mapping files in the community edition, even in version 3.2 .
Caused by: java.lang.RuntimeException: Error occurred.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException
: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.sqlmap.client.SqlMapException: The <sqlmap> resource is missing: alfresco/ibatis/#resource.
at org.alfresco.ibatis.HierarchicalSqlMapConfigParser.parse(
at org.alfresco.ibatis.HierarchicalSqlMapClientFactoryBean.buildSqlMapClient(

Like eclipse and maven, its painfull but theres nothing better :(

Wednesday, 8 July 2009

explore bazaar

The up an coming bzr explorer is really promising to become: version control for human beings!

I tried to do a commit in it today and the following was very nice:
  • I can have the diff and the commit windows open simultaneously to be able to referback. (this was a problem before for me because both wants to lock to branch)
  • The auto-completion of words and filenames is awesome.
I tried to take a snapshot but [fn]+[prt_sc] launched infinite ksnapthots :( (but thats another story). After some reboots, I tried again:

  • trying to find related revisions is almost impossible on the commandline (i.e. it took too long), but its so nice with qlog.
  • The commit progress is also ultra cool

  • Save draft commit messages eg. every 30 seconds (like gmail). Anything can happen while or after you typed the message and before you hit commit eg. a power failure.
  • In my case, my computer basically crashed when I tried to make a snapshot and it launched the infinite ksnapshots. (bonus points for a [save now] button!)
  • [esc] should close qdiff windows
  • qannotate
    • ctrl+G should go to a line (like gannotate)
    • ctrl+F should start a search (like gannotate)

So far I made an alias to be able to launch it while at the branch in a terminal:
alias be='bzr explore . &'
But I suspect I'll have a bzr explore icon on my application launcher soon.

Version control is getting so cool that I'm be tempted to quit coding and become a full-time version-controllist. :-P whooa endorphin rush..

Monday, 29 June 2009

eclipse galileo maven plugin

I tried to install the maven plugin from on the new eclipse today, but I got the following error:

Error unzipping org.maven.ide.components.maven_embedder Unexpected end of ZLIB input stream

Then I tried the dev version from and that seemed to work fine.

[edit 2009-07-15] Since then the dev version started spewing out null pointer exceptions when using the maven-assembly-plugin,
so I reverted back to the stable version and that seems to work now... Early adopters burn their fingers...

Saturday, 6 June 2009

Split local/international network traffic between different adsl accounts on kubuntu.

I was able to setup my internet on my laptop so that my local internet traffic gets charged at local rates (1/4 of the price for me).
This page helped me but it's a bit old and a little different to what I needed, so I thought I'll write down my steps (mostly copied and adjusted from said page).

My setup:
os = kubuntu 9.04 jaunty
isp = webafrica and I'm very happy with them
router = Mega 105 WR

  • Some tutorials say you need to change your router mode to be bridged, but I found out that mine is automatically in semi-bridge mode: I setup my main account on the router which can be used by all the computers in the house, but on my laptop I can setup an additional connection which gets bridged through the router.
  • sudo apt-get install ppp pppoeconf
    (ppp includes, which is installed manually by the original instructions, but I didn't have to since its in ppp)
  • Run pppoeconf
    • Accept the defaults provided by pppoeconf and say yes to the start at boot option.
    • I just answered yes to the "'noauth' and 'defaultroute'" question, since I changed it later in any case.
    • It asks you for a username/password, this is your local adsl account authentication parameters as provided by your ISP.
    • Now test the connection with sudo pon dsl-provider
    • If you list the interfaces with ifconfig you should see ppp0 listed (and it should get an ip address).
    • Disconnect ppp0 before continuing. sudo poff dsl-provider
  • Edit /etc/ppp/peers/dsl-provider by hand.
    Only the parameters that you need to check are listed.
    A hash before the line means the line is commented out.
    sudo kate /etc/ppp/peers/dsl-provider
    # defaultroute
    # replacedefaultroute
    # usepeerdns
    So be sure that the above 3 parameters are commented out.
    (We only want to use the DNS servers provided from the ISP from the international traffic.)
  • sudo kate /etc/network/interfaces
    At the bottom of it you should have something like this:

    manual ppp0
    iface ppp0 inet ppp
    provider dsl-provider
    pre-up /sbin/ifconfig wlan0 up # line maintained by pppoeconf

    #auto wlan0
    #iface wlan0 inet manual

    • I make ppp0 manual since I need to wait for my wireless lan to connect before I can connect to the local internet. With this I can have full control, which is good since I don't want to leave it on too long because you are directly on the internet now and you're router's firewall isn't protecting you from local traffic.

    • I comment out the wlan0 section so that the network manager won't ignore it. You can remove it completely.

    • Test the connections to make sure there are no problems.
      sudo ifup ppp0
      ifconfig should list ppp0
      sudo ifdown ppp0

  • Static routing
    Now the fun part where we actually get the traffic flowing.
    We need to tell the system to route all the South African traffic through the ppp0 interface instead of the wlan0 or eth0 interface.
    We'll use static routing to do this.

    Download Armin's list of local routes from
    The list is updated every 24 hours and we'll use it instead of duplicating his work.
    It contains all the network addresses that are specific to South Africa.
    Save the file in /tmp and then move it to /etc/ppp/ :
    sudo mv /tmp/localroutes4.txt /etc/ppp

    We need to create a small script that tells the system to add the routes to the interface when if comes up.
    Create a file in /etc/ppp/ip-up.d/ called "zanet".
    sudo kate /etc/ppp/ip-up.d/zanet

    Paste the following in the file :

    #!/bin/sh -e
    # Called when a new interface comes up

    # add custom routing for zanet (local South Africa) on ppp0 device
    if [ "$PPP_IFACE" = "ppp0" ]
    cat /etc/ppp/localroutes4.txt | sed s/'\$LOCAL'/$PPP_IFACE/ | while read localroute
    # Change net to host for /32 addresses
    # This is a bug workaround - Armin must fix his list script.
    if [[ $localroute =~ "/32" ]]
    localroute=`echo $localroute | sed s/net/host/`

    # We need to route DNS lookups via ppp0 (SAIX) instead of ppp1 (IS)
    # The static routing will cause the DNS lookups to be made through the local IS
    # connection and the SAIX network will block the lookups because they don't originate
    # from their network.

    #uncomment the following if you are using different isps:

    #if [ "$PPP_IFACE" = "wlan0" ]
    #cat /etc/resolv.conf | sed s/nameserver// | sed s/' '// | while read nameserver
    #route add -host $nameserver $PPP_IFACE

    Make sure you can execute it:

    sudo chmod a+x /etc/ppp/ip-up.d/zanet

    Static routing should now work unless you made a mistake or I forgot something.
    Test it by starting ppp0. (sudo ifup ppp0)
    If you run route -n you should see huge list of static routes for the ppp0 interface and only a few when it is not started.

  • Automatic localroute updates
    You could get wget to retrieve a new list of local routes every so often manually or with a cronjob. You can stick the following script in a executable file in /etc/cron.monthly/ eg. /etc/cron.monthly/update-local-routes:


    cd /etc/ppp

    # If there is already a localroutes file replace it with the new one.
    if [ -f /etc/ppp/localroutes4.txt.1 ]
    # Make sure that we didn't get an empty or nearly empty list
    # More than 1000 characters will qualify as a valid amount of local routes
    # Rather keep the old list if the new one is too small
    if [ `cat /etc/ppp/localroutes4.txt | wc -c` -gt 1000 ]
    mv localroutes4.txt.1 localroutes4.txt

    Make sure its executable:
    sudo chmod a+x /etc/cron.monthly/update-local-routes

  • Lastly I use iftop -i ppp0 to monitor and make 100% sure where my traffic is being routed.

Thursday, 4 June 2009

Howto setup up a queue in glassfish.

This is my first attempt to setup queues on glassfish, so its probably not the best way, but its simple and it works for me for now.
Using the glassfish admin console:

* Configuration -> Java message Service -> Physical Destinations
- [New]
- Give it a name eg. my_test_queue and select queue.
- [Ok]
* Resources -> JMS Resources -> Destination Resources
- [New]
- JNDI Name: queues/my_test_queue
- Physical Destination Name: my_test_queue (must be the name you set above)
- Resource Type: javax.jms.Queue
- [Ok]
* Resources -> JMS Resources -> Connection Factories
(you only need one connection factory per type, not one per queue)
- [New]
- JNDI Name: connectionfactories/queueconnectionfactory
- Resource Type: javax.jms.QueueConnectionFactory
- [Ok]

Saturday, 23 May 2009

Amarok 1.4 for me on Kubuntu Jaunty

After playing a little with the new shiny Amarok 2 in Kubuntu 9.04,
I decided to go back to 1.4 for now.
I have been using Amarok to subscribe to podcast rss feeds
to download the latest episodes, and then to transcode
it to my ipod (it was a gift which I wasn't going to look in the mouth ok). This functionality did not seem to be in the shipped Amarok2 so I needed to go back.

Its quite easy to go back, just add the following source to your sources.list, update and install amarok14:
deb jaunty main

For more info see:

Wednesday, 20 May 2009

Hibernate freeze

All of a sunday my hibernate queries started to freeze when I try to run my unit tests at:
SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method]
Turns out I had the table or something locked in Sqldeveloper. I killed that session and everything started to work again.

Monday, 11 May 2009

Bazaar on

I've bean looking for a place to host a modular project which is being version controlled with Bazaar. I would have loved to use Launchpad, but I can't because of the following:
  1. Launchpad only allows one level of branches (no hierarchy). My project is made up of a lots of sub-projects: I have a main branch which controls the sub-projects as bzr-externals.
  2. Launchpad does not have a nice project wiki or any custom web content.

I saw that now supports Bazaar, but I was a bit worried when I saw on their wiki that they only support Bazaar version 1.10 . It turns out that it is thankfully only an outdated doc:
[me@shell-21002 ~]$ bzr --version
Bazaar (bzr) 2.1.1
Python interpreter: /usr/bin/python 2.4.3
Python standard library: /usr/lib64/python2.4
Platform: Linux-2.6.18-...

(I don't seem to have rights to correct the wiki and I could not google the current version, so I'm documenting it here for you.)

I did test that I could upload nested branches. But unfortunately the code browsing tool on Sourceforge (loggerhead) does not display the nested branches :( Hopefully that is fixable..

Thursday, 16 April 2009

Word of the week: Slack

This one was inspired by my friend Richard Kolb's favorite distro:
which by the way has a new South-african derivative:
This may not be that informative, but its still fun to call slackware lazy, weak, tardy, late, idle, quiet and slowing :)


1. not tight, taut, firm, or tense; loose: a slack rope.
2. negligent; careless; remiss: slack proofreading.
3. slow, sluggish, or indolent: He is slack in answering letters.
4. not active or busy; dull; not brisk: the slack season in an industry.
5. moving very slowly, as the tide, wind, or water.
6. weak; lax.
7. Nautical. easy (def. 15a).
8. in a slack manner.
9. a slack condition or part.
10. the part of a rope, sail, or the like, that hangs loose, without strain upon it.
11. a decrease in activity, as in business or work: a sudden slack in output.
12. a period of decreased activity.
13. Geography. a cessation in a strong flow, as of a current at its turn.
14. a depression between hills, in a hillside, or in the land surface.
15. Prosody. (in sprung rhythm) the unaccented syllable or syllables.
16. British Dialect. a morass; marshy ground; a hollow or dell with soft, wet ground at the bottom.
–verb (used with object)
17. to be remiss in respect to (some matter, duty, right, etc.); shirk; leave undone: He slacked the most important part.
18. to make or allow to become less active, vigorous, intense, etc.; relax (efforts, labor, speed, etc.); lessen; moderate (often fol. by up).
19. to make loose, or less tense or taut, as a rope; loosen (often fol. by off or out).
20. to slake (lime).
–verb (used without object)
21. to be remiss; shirk one's duty or part.
22. to become less active, vigorous, rapid, etc. (often fol. by up): Business is slacking up.
23. to become less tense or taut, as a rope; to ease off.
24. to become slaked, as lime.
25. take up the slack,
a. to pull in or make taut a loose section of a rope, line, wire, etc.: Take up the slack before releasing the kite.
b. to provide or compensate for something that is missing or incomplete: New sources of oil will take up the slack resulting from the embargo.

bef. 900; ME slac (adj.), OE sleac, slæc; c. ON slakr, OHG slach, L laxus lax

slack⋅ing⋅ly, adverb
slackly, adverb
slackness, noun

1. relaxed. 2. lazy, weak. 3. dilatory, tardy, late. 4. idle, quiet. 11. slowing, relaxation. 17. neglect. 18. reduce, slacken. 21. malinger.

sweet ubuntu commandline network trafic monitor

sudo apt-get install iftop
sudo iftop -Bp

I looked at the other recommendations at:
but I thing I prefer iftop at the moment.

I wish I could see which processes are using the bandwidth,
but that would probably involve a lot of magic.

Tuesday, 14 April 2009

Alfresco pain

After struggling a lot, I finally got Alfresco running on my Glassfish (v2ur2-b04),
for a couple of minutes then it broke again. I'll update this if I get it working one day.

First of all, look at the following for how to install using an oracle db.
Which worked mostly, except it seems like you have to use the AlfrescoOracle9Dialect eg.:

Initially I got the following exceptions:
Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(Z)V
Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.

Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Lj
Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit
This was fixed by putting the correct hibernate jars in the domain1/lib and domain1/lib/ext folders.
I put asm-attrs.jar, cglib-2.1.3.jar, ojdbc14_g.jar (for oracle) in domain1/lib and
asm.jar, serializer.jar, xalan.jar in domain1/lib/ext

Next when I tried to log into the share webapp, I got the following:
"The remote server may be unavailable or your authentication details have not been recognized."
Thanks to the following link I figured out that alfresco does not like to run on a different port the server port is hardcoded into the war files in several places:

Since I'd like to run it on a non-default port, I updated the port number by replacing all occurrences of 8080 with 12080.

I'm lazy so I did it like this:
$ cd domain1
$ replace 8080 12080 -- `find -iname "*.wsdl"`
$ replace 8080 12080 -- `find -iname "*.xml"`
$ replace 8080 12080 -- `find -iname "*.ftl"`
(btw this replace command I used is part of mysql-server-5.0: /usr/bin/replace)
See for more info.

Next I got this exception in my logs:

org.alfresco.web.framework.exception.RendererExecutionException: Unable to execute 'body' JSP include: /site-index.jsp
Caused by: java.lang.ClassCastException: cannot be cast to org.apache.coyote.tomcat5.CoyoteResponseFacade

I found a fixed up version of alfresco-web-framework.jar which goes in domain1/applications/j2ee-modules/share/WEB-INF/lib on this forum:
Now I could actually log in.

But somewere along the line I got the following:
org.alfresco.web.framework.exception.RendererExecutionException: FreemarkerProcessor failed to process template: org/alfresco/global/slingshot-login.ftl
Caused by: freemarker.core.InvalidReferenceException: on line 32, column 70 in org/alfresco/global/slingshot-login.ftl link not found.
on line 32, column 70 in org/alfresco/global/slingshot-login.ftl link not found.
The problematic instruction:
==> user-directive link [on line 32, column 70 in org/alfresco/global/slingshot-login.ftl]
in user-directive template.body [on line 6, column 1 in org/alfresco/global/slingshot-login.ftl]
and what fixed it for me AFAICT is to add the sun-web.xml described here:

mm.. seems like everything is not working for me yet. I have to switch between the patched and the original versions of alfresco-web-framework.jar (i.e log in with the one and play further with the other)

I'm doing a svn checkout at the moment to see if the developent verion works better on glassfish.
Maybe I can submit some patches if necessary.

Wednesday, 8 April 2009

Looking for unread gmail

I was trying to get look at only my unread e-mail under a particular label. It turns out you can search your mail with is:unread

There are other tricks too, have a look at this:

Jaunty Jackalope (Ubuntu 9.04) is coming soon

It is expected to be released on the 23rd of April 2009.

Tuesday, 17 March 2009

Put persistence.xml in the war

I've been trying for days to get jpa, jndi, glassfish, hibernate and oracle to play together.

The main problem turns out that you have to put the persistence.xml file in your war file (project/web-root/WEB-INF/src/META-INF) not in your jar file.
I'll probably investigate more to see if it is somehow possible to put it in the jar, but for now my problems are solved.

... after some further experimentation I was able to put it in the jar, but I'm using <mapping-file>xx_orm.xml</mapping-file> now.

Saturday, 14 February 2009

No PasswordCredential found

I got the exception below while trying to set up a JNDI database configuration in glasshish to point to my local Oracle XE installation. Google didn't help so I'm posting it here for in case it happens to me again.
I didn't actually figure out how to resolve it. I fiddled around in domains/domain1/config/domain.xml a little, but in the end I think restarting Glassfish did the trick for me.

INFO: RAR7099: The mcf being used to allocate the connection and the MCF in the pool are not equal.
WARNING: RAR5038:Unexpected exception while creating resource for pool aum_pool. Exception : No PasswordCredential found
WARNING: RAR5117 : Failed to obtain/create connection from connection pool [ aum_pool ]. Reason : No PasswordCredential found
WARNING: RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: No PasswordCredential found]
WARNING: java.sql.SQLException: Error in allocating a connection. Cause: No PasswordCredential found
at com.sun.gjc.spi.base.DataSource.getConnection(

Friday, 13 February 2009

Eclipse Dynamic Web Project + Maven2 = initial pain

Eclipse 3.4 ganymede gave me a VERY frustrated day yet again :(
I spent most of the day convincing it to to install the m2eclipse plugin.
It kept on telling me:
No repository found containing: org.maven.ide.components.dependency_tree/osgi.bundle
So after updating all my eclipse plugins and also using the Maven Integration for Eclipse Dev Update Site and restarting Eclipse, it finally decided it will install.
(You almost want to swear at it and call it M$ Eclipse. Ok it wasn't that bad.)

Next I came to a painful catch 22: I want a Dynamic Web Project so that my code can be automatically deployed on my Glassfish server. But I also want it to be a Maven project for all the maven goodness, without changing the standard maven code layout.

I googled for hours but I only found my worst fear to be true: The only way to do it is to make it a web project, changing its structure to be in the maven layout and then activate it as a maven project. I improved on this site's methods a bit by doing some configs up front and thus avoiding to mess with them later. Here are my steps as good as I remembered:
  1. (I created a reference maven web project in eclipse, but it turned out that I didn't actually need it)
  2. Create a new Eclipse Dynamic Web Project. Don't click finish, click [next].
  3. Set the 'Content Directory' to 'src/main/webapp' and the 'Java Source Directory' to 'src/main/java'. Now you can click [finish].
  4. Right click on the project -> Maven -> Enable Dependancy Management.
  5. Set the packaging to war, [finish].
  6. You can delete the build folder now since maven already started to use the target folder.
  7. If you need the other standard maven source and target folers, you can add them manually or directly in .classpath:
    <classpathentry kind="src" path="src/main/resources">
    <classpathentry kind="src" output="target/test-classes"
    <classpathentry kind="src" output="target/test-classes"

  8. From there I just had to set maven to use Java6 in pom.xml:

  9. Right click on the project -> Maven -> Update Dependancies.
  10. I removed the following from .settings/org.eclipse.wst.common.component:
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/>
  11. Then I could run maven tasks and also deploy it to my glassfish server (already set up to be managed by eclipse the normal JavaEE way (run as -> run on server))
sweetness! I love Eclipse+JavaEE+maven again.
I think the WTP or whatever does the new 'Dynamic Web Project' wizard would do well to have a checkbox which can setup the web project in the maven sturcture for you.
tomorrow (aka later today) I have to do the real work of actually putting an application into this empty shell.


Sunday, 25 January 2009

Putting God first.

Putting God first is my other new-years resolution/calling for 2009.
I believe God is telling me the first step towards that is to start
spending some time with Him and His Word in the mornings.
I'm not a morning person so this is hard.

I found this Psalm very inspiring, especially verses 2 and 8:

Psalm 101

A Psalm by David.

{101:1} I will sing of loving kindness and justice.
To you, Yahweh, I will sing praises.
{101:2} I will be careful to live a blameless life.
When will you come to me?
I will walk within my house with a blameless heart.
{101:3} I will set no vile thing before my eyes.
I hate the deeds of faithless men.
They will not cling to me.
{101:4} A perverse heart will be far from me.
I will have nothing to do with evil.
{101:5} I will silence whoever secretly slanders his neighbor.
I won't tolerate one who is haughty and conceited.
{101:6} My eyes will be on the faithful of the land,
that they may dwell with me.
He who walks in a perfect way,
he will serve me.
{101:7} He who practices deceit won't dwell within my house.
He who speaks falsehood won't be established before my eyes.
{101:8} Morning by morning, I will destroy all the wicked of the land;
to cut off all the workers of iniquity from Yahweh's city.

(from the World English Bible: )

it is time to seek Yahweh, until he comes and rains righteousness on you. - Hosea 10:12

Or don’t you know that your body is a temple of the Holy Spirit which is in you, which you have from God? You are not your own, for you were bought with a price. Therefore glorify God in your body and in your spirit, which are God’s.
1 Corinthians 6:19-20

Friday, 16 January 2009

vsftp is reporting times as GMT

It has baffled me for days that my ftp (vsftp) server shows
file timestamps in the wrong timezone: UTC
After some searching I found that there is a hidden option
for setting it.
(it isn't in the default config file /etc/vsftpd.conf)

Q) Help! vsftpd is reporting times as GMT times and not local times!
A) This behaviour can be changed with the setting "use_localtime=YES

After adding that to the end of /etc/vsftpd.conf, and doing:
sudo /etc/init.d/vsftpd restart
it works now!
Now why isn't this the default???

This got me thinking is it some sort of a standard that ftp servers return timestamps in utc?