Archive for December, 2006

XPS Lights: Source code in Subversion

I have exported the XPS light control source code into my subversion repository. The software is currently set up to build with Cygwin. As an added bonus, I now have added a target that creates a dll so the code can be reused more easily.

How to use:

xps_lights>make all
rm -f *.o *.dll *.exe
gcc -mno-cygwin -Wall   -c -o xps_led_control_lib.o xps_led_control_lib.c
gcc -shared -o xps_led_control_lib.dll xps_led_control_lib.o
gcc -o testexe xps_led_control.c -L./ -lxps_led_control_lib
testexe -all 4 [all the leds turn turquise]
gcc -mno-cygwin -Wall   -c -o xps_led_control.o xps_led_control.c
gcc -o xps_led_control xps_led_control_lib.o xps_led_control.o
ruby xps_led_control.rb
Cycle array [the side and top leds cycle through a list of colors]
xps_lights>ls
Makefile     xps_led_control.c    xps_led_control.o   xps_led_control_lib.c    xps_led_control_lib.h
testexe.exe  xps_led_control.exe  xps_led_control.rb  xps_led_control_lib.dll  xps_led_control_lib.o

Enjoy.

Comments (1)

In-process Web Integration Tests with Jetty and JWebUnit

Do you speak test? In that case: Hello web application:


public class WebIntegrationTest extends net.sourceforge.jwebunit.WebTestCase {

    public void testIndex() {
        beginAt("/index.html");
        assertTextPresent("Hello world");
    }

    private org.mortbay.jetty.Server server;

    protected void setUp() throws Exception {
        server = new org.mortbay.jetty.Server(0);
        server.addHandler(
                new org.mortbay.jetty.webapp.WebAppContext("src/main/webapp", "/my-context"));
        server.start();

        int actualPort = server.getConnectors()[0].getLocalPort();
        getTestContext().setBaseUrl("http://localhost:" + actualPort + "/my-context");
    }
}

This code runs with no application server, no separate deployment step, just like that.

If this looks interesting, see my full-sized article on java.net

Comments (3)

Transparent encryption with Hibernate

The security people at my were suggesting that we needed to create an encryption service, to securely store passwords so that even rogue DBAs could not get at them. The idea is that no matter how good your access is to the database, you shouldn’t be able to decrypt the passwords unless you have the secret key. In a solution like this, the key is generally stored offline with the application and loaded into memory sometime during startup. The encrypted data never leaves the database.

Read the rest of this entry »

Comments (8)

Creative Commons Attribution 3.0 Unported
Creative Commons Attribution 3.0 Unported