Spring3-Interceptor

Spring 3 – Interceptor to push Attributes in the Model
When you have a lot of Controllers, you’ll come to the need of a general point to push attributes like locale, login-data, user information to your Model.
There are other ways to do this, but i’ll show the Spring way.
First of all you need this entry in [...]

Flot – a plotting library for jQuery

After some research for a jquery library to present some charts on a website I found this one.It is very configurable and also looks good.
Just set your datapoints and fire Flot up.
123456$(function () {
    // a null signifies separate line segments
    var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];
  [...]

UIActionSheet with dynamic entries

Sometimes you want to present some options to the user that come from a dynamic datasource.In other cases you could use an UITableView, but if you need to show a modal dialog, you can just use UIActionSheet
Here comes the sample code to build it:
1234567891011121314151617181920212223UIActionSheet *viewSetMenu = [[UIActionSheet alloc]
initWithTitle: @"Select a news-page"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];

//dynamic build of buttons
//you could [...]

Wordpress Post-Kalender mit Fullcalendar und jQuery

Das Fullcalendar-Plugin für jQuery ist ein voll konfigurierbarer Kalender mit Schnittstellen für den Abruf von Daten von einem Server.
Ausserdem können Events von einem bstehenden Google-Kalender abgefragt werde.,
Im einem meiner letzten Projekte, habe ich nach einer Alternative zum WP Kalender-Widget gesucht.Dabei bin ich auf dieses Plugin gestossen.
Die Abfrage der Daten erfolgt im JSON-Format.
Hier der PHP-Teil um [...]

X11 forwarding on SSH after su

before you become su,get your MIT-MAGIC-Cookie
xauth list $DISPLAY
you’ll see an output like
myhost.mydomain:21 mit-magic-cookie-1 4d22408a71a55b41ccd1657d377923ae
switch to root (’su’)
add your cookie to the session
xauth add myhost.mydomain:21 mit-magic-cookie-1 4d22408a71a55b41ccd1657d377923ae
that’s it, now you can start your forwarded X11-Application
sometimes you have to set your $DISPLAY variable,so copy the value from ‘echo $DISPLAY’ before su and set export $DISPLAY=”myhost:XY” when [...]

The find fiasco

If you want to be sure you don’t delete files you wanted to keep (like root-directory)
never use: find /my/directory * -mindepth 1 -exec  rm -r {} \;  (VERY  BAD)
if it doesn’t find any files in your given path it will try to delete the filenames expanded by ‘*’ AFTER your given path
better use: find /my/directory [...]

metaMatic beta-Release

metaMatic ist a small piece of software to help you managing your music metadata and artwork.
because it’s written in pure java you can use it on every OS with an installed runtime > 1.5, on OS X you’ll need Leopard and Java 1.6.

dynamic Hibernate criteria query

123Criteria criteria = new GenericDAO(entityManager, utx).getHibernateSession().createCriteria(DateEntry.class)
.createAlias("user", "user")
.createAlias("employee", "employee");
if (employee != null) {
criteria.add(Expression.eq(“employee”, employee));
}
if (customer != null) {
criteria.add(Expression.eq(“user”, customer));
}
if (category != null) {
criteria.createAlias(“categories”, “category”).add(
Expression.eq(“category.id”, category.getId()));
}
if (pending != null && closed != null) {
criteria.add(Expression.eq(“pending”, pending));
criteria.add(Expression.eq(“closed”, closed));
}
if (date != null && dateTo != null) {
criteria.add(Expression.between(“time”, date, dateTo));
}
if (orderParam != null) {
String orderParams[] = orderParam.split(“,”);