Archiv der Kategorie: Common

Everything

tonidoplug 2 and Western Digital Blue Scorpio 1TB

I just bought a 2,5″ Blue Scorpio from Western Digital. Basically I thought that it is 2,5″ and should fit into my Tonido Plug 2. Unfortunately this is only true with some minor „Hardware modifications“ on the Tonido Plug. I had to use a Scissor to adopt the Tonido Plug to the HDD and also the cover does not fit anymore. Anyway, the drive seems to work and I am now in the process to install ArchLinux ARM on this new device and boot permanently from it.
More on this one in a later post.

Tonido Plug 2 – Wlan

I have the problem, that after a certain amount of time, the wlan is not responding anymore on my Tonido Plug 2. I have now updated the Power Management on the device to „off“ using the following commands:


sudo iwconfig mlan0 power off

Hope, that this helps 😉

SparkleShare Dashboard

Today I wanted to install SparkleShare-Dashboard on my Linux Laptop. I was pretty glad, since it is a nodejs application and the target plattform, where I would like to install this application finally, will be a nodejs system (ArchLinux ARM) as well.

To install SparkleShare Dashboard on the latest nodejs-Version (v0.8.4) I had to adopt the Git-Child-Process creation in the backend/git.js-Module. For the full working version, please see .

There is also a little „difficulty“ and probably a miss-understanding in the community of how to create a „SparkleShare-Git-Repository“. I have done it, therefore please find a step-by-step guide:


mkdir -p /home/USERNAME/sparkle/public.git
cd /home/USERNAME/sparkle/public.git
git init --bare
mkdir /home/USERNAME/tmp
cd /tmp
git clone file:///home/USERNAME/sparkle/public.git
cd /tmp/public
touch README.txt
git add README.txt
git commit -m "Initial commit"
git push origin master
cd ..
rm /tmp/public -rf

This should be it, you do have an initial commit in the repository, and therefor SparkleShare can attach the id to the repository (the id is the SHA1-id of the first commit in the repository).

ArchLinux on a TonidoPlug2 with WLAN

Hello,

for my current vacation (my wife is going to look Olympic Games via TV the whole time) I decided to do me a favor and bought a TonidoPlug2. Since I am pretty much into ArchLinux, I decided to put ArchLinux on this device as well (see ArchLinux ARM). I used the Installation description on the above site without any problems, the way I did it, it went quite smooth. The difference was, that I did install the whole distribution on an USB-Stick before the device even arrived using my ArchLinux Laptop. Very nice 😉

Now I am in the process of finish the Installation on the device (following some advice from binarybitme and this went pretty smooth as well. The tipp with the haveged is pretty useful for the current upgrade of pacman, which requires some entropy for the pacman-key --init command.

Furthermore I decided to use WLAN on this device (hey, thats why I decided to buy this one). Therefor I found one interesting forum entry which helped a lot 😉 In the current version of Arch Linux, the firmware is beneath /usr/lib and not under /lib, like described in the post. Then I installed netcfg and configured /etc/rc.conf and /etc/network.d/w-int-static (wireless device) as well as the /etc/conf.d/netcfg (without this one, netcfg can work, as long as rc.conf is configured correctly). For the whole wlan stuff to work (depending on your used security key) I had to install wpa_supplicant.

rc.conf:

MODULES=(mwifiex_sdio)

HOSTNAME="triton"

# Default network config (fallback, just to get access to the device, if
# wlan configs fail)
interface=eth0
address=192.168.1.25
netmask=255.255.255.0
gateway=

DAEMONS=(... network net-profiles ...)

/etc/network.d/w-int-static

CONNECTION='wireless'
DESCRIPTION='A wpa_supplicant configuration based wireless connection'
INTERFACE='mlan0'
SECURITY='wpa-config'
WPA_CONF='/etc/wpa_supplicant/wpa_supplicant.conf'
IP='static'
ADDR='192.168.0.25'
#ROUTES=('default via 192.168.0.1')
GATEWAY='192.168.0.1'
DNS=('192.168.0.1')
# Uncomment this if your ssid is hidden
#HIDDEN=yes

/etc/conf.d/netcfg

NETWORKS=(w-int-static)
# Specify the name of your wired interface for net-auto-wired
WIRED_INTERFACE="eth0"
# Specify the name of your wireless interface for net-auto-wireless
WIRELESS_INTERFACE="mlan0"

I am not going to show my wpa_supplicant-settings, but these were fairly easy and could already be tested on the laptop.

Java 7 – minor classloading difficulties

Since I am using Arch Linux, I am more then accustomed to using the latest and greates versions of all the stuff. Unfortunately this is not always very good. During the last couple of days I experienced a couple of class loading issues with Java 7 (as opposed to Java 6).
I am currently testing Broadleaf Commerce and had to report an issue to theses guys because of some problems I did receive during compilation and running this application. Something similar happened to me on my project at work as well. I call this „class loading issues“, but it is probably slightly more. I do have problems loading configuration data correctly. (see issue 96 on the Broadleaf JIRA)-
To work around this issue, I just installed Java 6 again. Now it is working like a charm.

Domain-Movement

During the last weekend, I moved my domains (javafreedom.org and wifi-frankfurt.de) to the uberspace.de location. Because of this, it can happen, that emails where not delivered or bounced.

The movement was quite fast (something like 24 hours) for all things. The guys at uberspace.de were really really nice and helped a lot. I can only recommend to any geek out there, to move her domains to uberspace.de.

Spring 3 and Hibernate Envers

I wanted to add Audit functionalities to an application I am writing currently. I know that this seems to be possible with Spring Data JPA, but since this project has just reached Version 1.0.0.M1 I wanted to wait to use this one. Furthermore the application I am working on is already based on hibernate and some GenericDAO stuff we did with Hibernate, therefor a move does not seem to be too easy. Therefor I wanted to use Hibernate Envers.

The setup seems to be quite easy, following the steps in the documentation (Envers Documentation). I provided the @Audited Annotation to all Entities to be audited and provided also a new RevEntity and a new RevListener:

import javax.persistence.Entity;

import org.hibernate.envers.DefaultRevisionEntity;
import org.hibernate.envers.RevisionEntity;

@Entity
@RevisionEntity(RevListener.class)
public class RevEntity extends DefaultRevisionEntity {

    private String userName;

    public String getUserName() {
 	return userName;
    }

    public void setUserName(String userName) {
 	this.userName = userName;
    }
}
import org.hibernate.envers.RevisionListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;

@Configurable
public class RevListener implements RevisionListener {

    @Autowired
    private Member member;

    public void newRevision(Object revisionEntity) {
	RevEntity revEntity = (RevEntity)revisionEntity;

	Member member = MemberHolder.getMember();

	String userName = null;
	if (member != null) {
		userName = member.getUsername();
	}

	revEntity.setUserName(userName);
    }
}

The point here is to show, that I am using the Member, to find out what the current user is in our application.

Now, how do I use the newly created listener in Spring? After using Google a little, I found this post, which uses Envers, but unfortunately with the SessionFactory instead of the JPA EntityManager, like we are using. Furthermore I found this, which did not really help me as well, since there was another error message coming up, that my RevListener could not get instantiated. Since the custom EventListener was using Spring Dependency Injections for the Member, I could not use the above mentioned solution. I had to find a way to use the Spring Beans. See this blog post, which describes the problem and a possible solution.

So, basically one step back and the whole stuff again, this time using a Holder for our Members, which provides the current Member (User) of the system. This is done using the current security-context of the application and determine the member therein (see StackOverflow).

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * @link http://stackoverflow.com/questions/360520/unit-testing-with-spring-security
 */
public class MemberHolder {

    private MemberHolder() {
        // hidden default constructor, this is a "normal" utility class
    }

    public static Member getMember() {
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        Object principal = auth.getPrincipal();
        Member member;

        if (principal instanceof Member) {
            member = (Member) principal;
        } else {
            return null;
        }

        if (member.getId() == null) {
            return null;
        }
        return member;
    }
}

This member-holder is then called in the RevisionListener:

import org.hibernate.envers.RevisionListener;

import de.xxx.RevEntity;
import de.xxx.model.MemberHolder;

public class RevListener implements RevisionListener {

    public void newRevision(Object revisionEntity) {
	RevEntity revEntity = (RevEntity)revisionEntity;

	String userName = MemberHolder.getMember().getUsername();

	revEntity.setUserName(userName);
    }
}

Furthermore the application-context.xml was now corrected to look like this:

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
		  depends-on="transactionManager">
	<property name="persistenceUnitName" value="persistenceUnit"/>
	<property name="persistenceUnitManager" ref="persistenceUnitManager"/>
	<property name="jpaVendorAdapter">
		<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
	</property>
	<property name="jpaDialect">
		<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
	</property>
	<property name="jpaProperties">
		<props>
			<prop key="hibernate.dialect">${hibernate.dialect}</prop>
			<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
			<prop key="org.hibernate.envers.auditTablePrefix">AUD_</prop>
			<prop key="org.hibernate.envers.auditTableSuffix"></prop>
			<prop key="org.hibernate.envers.storeDataAtDelete">true</prop>
			<prop key="hibernate.ejb.event.post-insert">
	org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener
			</prop>
			<prop key="hibernate.ejb.event.post-update">
	org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener
			</prop>
			<prop key="hibernate.ejb.event.post-delete">
	org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener
			</prop>
		        <prop key="hibernate.ejb.event.pre-collection-update">
				org.hibernate.envers.event.AuditEventListener
			</prop>
			<prop key="hibernate.ejb.event.pre-collection-remove">
				org.hibernate.envers.event.AuditEventListener
			</prop>
			<prop key="hibernate.ejb.event.post-collection-recreate">
				org.hibernate.envers.event.AuditEventListener
			</prop>
		</props>
	</property>
</bean>

Some pitfalls I stumbled upon. Do not make the property look nice, e.g.:

<prop key="hibernate.ejb.event.post-update">
    org.hibernate.ejb.event.EJB3PostUpdateEventListener,
    org.hibernate.envers.event.AuditEventListener
</prop>

Your application Context will look nice, but you will get a ClassNotFoundException ;-(

Furthermore, your Custom Event Listener should not appear in the Events, e.g. do not do:

<prop key="hibernate.ejb.event.post-update">
    org.hibernate.ejb.event.EJB3PostUpdateEventListener,de.xxx.RevListener
</prop>

This will lead to an exception like

Caused by: org.hibernate.MappingException: Unable to instantiate specified event (post-update) listener class: de.xxx.RevListener
	at org.hibernate.cfg.Configuration.setListeners(Configuration.java:1766)
	at org.hibernate.ejb.Ejb3Configuration.setListeners(Ejb3Configuration.java:1550)
	at org.hibernate.ejb.EventListenerConfigurator.setProperties(EventListenerConfigurator.java:183)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1085)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:685)
	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
	... 53 more
Caused by: java.lang.ArrayStoreException: de.xxx.RevListener
	at org.hibernate.cfg.Configuration.setListeners(Configuration.java:1763)

So, I do hope, that this helps you. It did help me 😉

Connect from Host to VBox guest via serial console

Today I need to connect to the serial console of a VBox instance to test the serial console boot and connection of the guest system (ArchServer that is). There seem to be a lot of ways on how to do this, I am just explaining, what works for me, using Arch Linux as the Host:

  • socat UNIX-CONNECT:/home/triplem/com1 TCP-LISTEN:8040
  • telnet localhost 8040


This was not working, in that I always received strange Characters in my terminal as soon as I used e.g. the cursor keys. This did not work, even after changing the terminal emulation to VT100 and all others.


The same is true for socat unix-client:/home/triplem/com1 stdout

I do not seem to be able to work with this kind of stuff, the following tip was not working as well:
Work with VBox and serial console.

Hudson / Jenkins – Butler wars

Today I found a nice article about the split of Hudson and Jenking. It has a nice title and is really well written. Furthermore it shows some of the possible implications of this „war“.

Butler Wars.

Read on.

For more information about this story please also visit:

Hudson and Jenkins now on GitHub
Hudson vs. Jenkins – more thoughts
Hudson vs. Jenkins

Hudson and Jenkins now on GitHub

I think, the whole fork stuff with Hudson and Jenkins gets even more hilarious. In a vote, the Hudson community decided to move (take your breath) to github.com.

See InfoQ for more details about this movement. Now both Hudson as well as Jenkins are on github.

Jason (van Zyl) seem to have made already quite some changes to Hudson so, I would expect some major changes coming up for the next Hudson release. Of course these changes are related to (guess what?) Maven. These changes are going to diverge Hudson and Jenkins, and I guess that in the long run these two projects are going to diverge so much, that there is no „drop-in“ of Jenkins Plugins into Hudson and Vice-versa. On the other hand, Sonatype is known for their strong commitment to backward compatibility (see Maven 2/3), but is the same true for the Jenkins guys? I do hope so.

Still, new features developed for one of these forks will not directly appear in the other version. Since Sonatype seems to be doing some major restructuring of the hudson core, I doubt, that features on Hudson will easily be transportable to Jenkins, and vice versa.

Lets see whats going to happen 😉

For more information about this story please also visit:

Hudson vs. Jenkins – more thoughts
Hudson vs. Jenkins