Thursday, February 26, 2009

CXF - How to set a custom endpoint address

For some reason it is rarely straight forward how to configure a Java Web Service framework to use a custom endpoint address (one that is not in the WSDL). Anyway, here is how you do it in CXF:


URL wsdl = getClass().getResource("myservice.wsdl.xml");
MyService service = new MyService(wsdl).getMyServicePort();
BindingProvider bp = (BindingProvider)service;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, URL);

Thursday, February 19, 2009

Linux one liner: When did I come to work today?

I'm usually quite tired when I get up in the morning. Beeing a consultant with flexible hours, it is often easy to forget exactly when I got to the office in the morning. So I figured i had to write a script to check when I started my computer. What it does is checking the syslog for the first occurence of todays date. I'm running Ubuntu linux and the syslog file is rotated a while after my computer has started. This is why I'm checking syslog.0.

The magic one liner:

date "+%b %d" | xargs -i grep -m1 -i {} /var/log/syslog.0
|awk '{ print "Today I got to work at " $3 }'

(Syntax plugin didn't handle long lines properly. Remove the and put the entire thing on one line.)

Tuesday, September 23, 2008

PS3 - Streaming and transcoding xvid on the fly with fuppes on linux

I recently bought myself an PS3 and I'm very happy with it. Except for one thing, the built in support for streaming video is not the best. Currently it only seem to support some types of mpeg or wma files. This is not satisfactory since I've ripped most of my dvds into xvid.

Finding a upnp streaming server for linux wasn't easy. After trying many different upnp streaming servers with DLNA support (ushare and mediatomb among others), I finally found fuppes. It supports streaming and transcoding of media files on the fly. And it works great with PS3 :)

This thread will get you started. But it is filled with xbox 360 questions and other issues:

My setup:
PS3 - firmware 2.43
Ubuntu 7.10 Server (gutsy)
fuppes - svn revision 578

To make it short I did the following to get it to work:
Note that the apt-get install line has been escaped with slashes '\'. Remove them and put everything on one line if you encounter any problems.
sudo apt-get install ffmpeg build-essential libavutil-dev libavformat-dev libavcodec-dev
\ subversion libtool automake autoconf libsqlite3-dev libpcre3-dev libxml2-dev
\ liblame-dev pkg-config

wget http://heanet.dl.sourceforge.net/sourceforge/fuppes/fuppes-SVN-578.tar.gz
tar xvzf fuppes-SVN-578.tar.gz 
cd fuppes-SVN-578
autoreconf -vfi
./configure --enable-video-transcoding
make
sudo make install
sudo ldconfig


Download my fuppes.cfg and put it in ~/.fuppes/fuppes.cfg

If you wish to use init.d to control your startup take a look at this howto.

UPDATE - 23. May 2009: Check out my silver bullet post about the ps3mediaserver-project

Thursday, March 22, 2007

Remove .svn directories from a project

SubversionSometimes when you work on a project or checkout the source from an existing project you get stuck with a lot of .svn directories. This is quite a hassle to remove if you want to hook the source up to another subversion repository. Removing the files manually is quite tedious since every single directory that is under version control has its own .svn directory. This quick one-liner can help you:

find . -type d -name .svn | xargs rm -rf


(this is no magic really, just writing it for myself to remember.)