Maven advanced: defining profiles (with module order) to make the build faster

Submitted by Jochus on Tue, 09/02/2010 - 18:10 | Posted in: Java
Posted in



Consider following setup:

Maven root POM

A simple project has 5 modules

<?xml version="1.0" encoding="UTF-8"?>
 
<project>
	<modelVersion>4.0.0</modelVersion>
	<groupId>be.jochusonline</groupId>
	<artifactId>pom-profiles-example</artifactId>
	<packaging>pom</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>PARENT</name>
 
	<modules>
		<module>module1</module>
		<module>module2</module>
		<module>module3</module>
		<module>module4</module>
		<module>module5</module>
	</modules>
</project>

Maven module POM

The maven modules are looking like this (just by example). The other modules have a similar POM structure

<?xml version="1.0" encoding="UTF-8"?>
 
<project>
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>be.jochusonline</groupId>
		<artifactId>pom-profiles-example</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</parent>
	<artifactId>pom-profiles-example-module1</artifactId>
	<packaging>jar</packaging>
	<name>MODULE1</name>
</project>

Building

Building this project costs:

<a href="mailto:jochen@baileys">jochen@baileys</a> ~/Desktop/modules $ mvn clean install
[INFO] Scanning for projects...
[INFO] Reactor build order: 
[INFO]   PARENT
[INFO]   MODULE1
[INFO]   MODULE2
[INFO]   MODULE3
[INFO]   MODULE4
[INFO]   MODULE5
[INFO] ------------------------------------------------------------------------
8< ... >8
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] PARENT ................................................ SUCCESS [3.388s]
[INFO] MODULE1 ............................................... SUCCESS [1.129s]
[INFO] MODULE2 ............................................... SUCCESS [1.073s]
[INFO] MODULE3 ............................................... SUCCESS [0.033s]
[INFO] MODULE4 ............................................... SUCCESS [0.040s]
[INFO] MODULE5 ............................................... SUCCESS [0.042s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Tue Feb 09 18:01:54 CET 2010
[INFO] Final Memory: 16M/79M
[INFO] ------------------------------------------------------------------------

... 6 seconds

Change Maven root POM to build only single module

Sometimes, in real software development processing, it's not really needed to build the whole project. Imagine the project exists of a "processing", a "web" and a "backoffice" part. You are working on the backoffice part, so why would you rebuild the web and processing part as you didn't change them?!?!
So, the improve the build process, I'm introducing profiles:

<?xml version="1.0" encoding="UTF-8"?>
 
<project>
	<modelVersion>4.0.0</modelVersion>
	<groupId>be.jochusonline</groupId>
	<artifactId>pom-profiles-example</artifactId>
	<packaging>pom</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>PARENT</name>
 
	<profiles>
		<profile>
			<id>all</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<modules>
				<module>module1</module>
				<module>module2</module>
				<module>module3</module>
				<module>module4</module>
				<module>module5</module>
			</modules>
		</profile>
		<profile>
			<id>module1</id>
			<modules>
				<module>module1</module>
			</modules>
		</profile>
	</profiles>
</project>

I'm not changing anything to the modules. And I'm still able to build the project:

<a href="mailto:jochen@baileys">jochen@baileys</a> ~/Desktop/modules $ mvn clean install
[INFO] Scanning for projects...
[INFO] Reactor build order: 
[INFO]   PARENT
[INFO]   MODULE1
[INFO]   MODULE2
[INFO]   MODULE3
[INFO]   MODULE4
[INFO]   MODULE5
[INFO] ------------------------------------------------------------------------
8< ... >8
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] PARENT ................................................ SUCCESS [3.387s]
[INFO] MODULE1 ............................................... SUCCESS [1.129s]
[INFO] MODULE2 ............................................... SUCCESS [1.071s]
[INFO] MODULE3 ............................................... SUCCESS [1.035s]
[INFO] MODULE4 ............................................... SUCCESS [0.043s]
[INFO] MODULE5 ............................................... SUCCESS [0.039s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Tue Feb 09 18:06:37 CET 2010
[INFO] Final Memory: 16M/79M
[INFO] ------------------------------------------------------------------------

Now, imagine you only want to rebuild module1. You can say to Maven: "hey, just build module 1 again" by adding: -P module1 at the commandline.

<a href="mailto:jochen@baileys">jochen@baileys</a> ~/Desktop/modules $ mvn clean install -P module1
[INFO] Scanning for projects...
[INFO] Reactor build order: 
[INFO]   PARENT
[INFO]   MODULE1
[INFO] ------------------------------------------------------------------------
8< ... >8
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] PARENT ................................................ SUCCESS [3.104s]
[INFO] MODULE1 ............................................... SUCCESS [1.241s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Tue Feb 09 18:08:46 CET 2010
[INFO] Final Memory: 15M/79M
[INFO] ------------------------------------------------------------------------

So, you just won 2 seconds. Seems stupid! Yes, of course, it's just an example project with nothing in it. But in a real life situation, you can save up to 2 minutes in a build process. If you build 30 times a day, you just saved yourself ... one hour waiting for builds! ;-)

JPR clubkampioenschap (manche 3)

Submitted by Jochus on Sun, 07/02/2010 - 20:54 | Posted in: Lifetime
Posted in

Vorige woensdag de 3e manche van het JPR clubkampioenschap gereden. Voor mij toch wel een redelijke belangrijke race. Ik hoopte vooral op een goed "karretje", want anders had ik 3 slechte wedstrijden op rij en dat zou ik niet zo tof gevonden hebben.

De manche ...

Vorig week was het een speciale race. Normaal gezien rijden we 5 min chrono, gevolgd door 30 min race. Ditmaal was het 15 min chrono, met 60 minuten race. In principe zou dit in mijn voordeel moeten zijn. Ik kan een veel betere chrono zetten op 15 min tijd (ik heb meer "wenningstijd" nodig). En bovendien kan ik met gemak 60 min vol karten.

We moesten een half uur vroeger op post zijn omdat we na de race nog getrakteerd werden op een lekkere spaghetti van het JPR management ^^. Alle karters waren perfect op tijd, jammer genoeg waren de 2 organisatoren te laat en vertrokken we dus al met vertraging :-D.

De chrono...

Toen ik naar de kart ging die ik geloot had, zag ik het nummer "1" staan. Ik riep naar Kristof: "Ale man 'T IS NIET WAAR EH! Ik heb weer kart 1 :p" (lees: 't was dezelfde kart als 2 weken geleden - als de nummers niet veranderd waren tenminste). Kristof riep terug: "Ey man, kijkt es goed, 't is wel "7" eh? :-D". Ik had idd niet goed gekeken en lootte dus kartje 7. Toch even testen: ik drukte met mijn hand zachtjes de gas in ... en ojaaaaaaaa ... die motor maakte een lekker geluid :-D. Stefan vertrok als eerste in de chrono, gevolgd door Kristof, ikke en Roel erna. Ik was al vrij snel voorbij Kristof en had een goed gevoel bij de kart. Ik wou hard rijden om zo bij Stefan te geraken. Maar Stefan was gaan vliegen. Ik kon die langs geen kanten bijhouden. Ook Roel kwam opzetten en ik liet hem door. Ik wou proberen hem te volgen om zo strakkere tijden te rijden. En jawel, met succes. Ik focuste me op Roel en kon zo een lekkere 8e tijd (van de 18 piloten) neerzetten! Stefan startte sterk van op de pole. Sander 3e. Voor mij zat er niet beter in. Ik had de perfecte kart, maar als ik keek naar de mensen die voor mij op de grid stonden, dan was mijn 8e plaats verdiend. Mijn 7 voorgangers zijn nu eenmaal beter dan mij ;-) ...

De race...

De race ging ooooooo zooooooo leuk van start. Bij de vorige 2 manches kon ik nooit mijn voorganger bijhouden omdat de motor niet genoeg vermogen gaf. Maar dit was nu anders! Roel stond op P7 en ik kon hem perfect volgen. Ik kon niet zijn achterbumper raken, dus 't was niet dat ik sneller was. Maar ik was ook niet trager. Knabbel, Shauni, Roel en ik vormden een "accordeon" treintje. P9 (Dimitri) kon ik gelukkig van me loskrijgen waardoor ik mij volledig kon concentreren op aanvallen!
Na 3 min rijden gingen de helft van de lichten uit op het circuit: 1e specialleke: half-dark race :-D
Roel pitte vroeg en ik kon daardoor van P8 naar P7 springen. Tussen Shauni en Roel was toen al een gat van 5meter en ik kon het heeeeeeeel traagjes dichtrijden. Mijn kart was SUPER.
Na ongeveer 30 min wedstrijden denk'k, zag ik dat ze de safety kart aan het klaarmaken waren (2e specialleke!). Ik MOEST EN ZOU in de volgende ronde pitten. Als ik pitte voor de safety kart, was ik mijn verplichte pitstop kwijt. Al degene die nog niet gepit hadden, gingen sowieso NA mij eindigen ;-). Het lukte mij nog nét om te pitten voor de safety kart en sloot vrij op het einde van de lange kart trein aan.
We reden 1 ronde achter de safety kart ... maar umh ... wat gebeurde er. De safety kart reed de pits omgekeerd in !!! Het 3e specialleke kwam naar boven. We reden nu andersom!!! Ik kan u zeggen: 't was ff wennen. Ik was gewoon van tegenwijzerszin te rijden, en nu opeens moest ik wijzerszin rijden. Roel had blijkbaar een iets snellere pitstop gemaakt en stond vlak voor mij. Toen de race van start ging, merkte ik dat reverse sterker was en ik hing écht aan zijn achterbumper. Aan de bocht aan pits wou ik een andere racelijn pakken om bij het uitkomen van de bocht aan de binnenkant van de volgende bocht te geraken. Maar aan de pits stonden de garagepoorten open en was het beginnen binnen regenen (4e, niet gepland :p, specialleke). Roel sloor uit, ik zat links van Roel en moest dus ook uitwijken en kwam op een NAT stuk terug. Ik was de controle volledig kwijt en kon met veel moeite de flexi track nét ontwijken. Ondertussen konden 2 piloten na mij Roel en ik pakken. Jammer ... :-(...
Maar goed, Roel en ik waren weer sterk weg! Ik was reverse écht sneller dan Roel en op een bepaald moment maakte Roel een klein foutje. Ik dacht : "Nu is't mijn kans!" en kon met een halve kart naast hem komen. Ik zat op weg om de binnenkant van de volgende bocht te nemen. Ik was er van overtuigd dat Roel mij gezien had, en hij ging dus plaats moeten maken. Maar Roel had me niet gezien ... :-( ... Roel deed de deur toe en ik knalde Roel (onbewust!) de bocht uit. Roel verschoot, en ik ook ! ... Ik had gelukkig geen last van de crash en was dus voorbij Roel. De ganse ronde was ik aan het nadenken of mijn inhaalbeweging correct was. Toen ik voorbij de marshall van JPR passeerde kreeg ik een zwart/witte vlag. Dit wil zeggen dat ik een waarschuwing kreeg omdat mijn beweging niet proper was. Ik zag dat Roel enkele meter na mij reed en besloot sportief te blijven. Ik stelde mijn kart langs de kant van de baan en deed teken naar Roel dat hij mij terug mocht inhalen. Roel is op het circuit wel een concurrent, maar naast het circuit is het een goeie vriend. Ik had geen zin om hierover achteraf ruzie te maken. Roel bedankte me en samen waren we weer op weg.
Ik slaagde er niet om Roel in te halen (toch niet op de propere manier :-D) en finishte als 9e :-( ...
Na de race wat staan babbelen met Roel en hij had mij écht niet gezien :-( ... hij zei dat hij anders nooit de deur had toegedaan. Hij vond het gelukkig wel leuk dat ik hem dan erna terug voorbij gelaten heb. Sportiviteit for the win!

Conclusie...

Leuke race gereden. Goed kunnen battelen. 'k Had een super kart en heb niet moeten onderdoen! Stefan reed als 1e over de finish streep. Sander eindigde 5e en verloor 2 plaatsen. Onverdiend, want hij had te kampen met onsportief gedragen van andere piloten. Ja Sander, 'k weet dat ik misschien zoiets niet mag typen, maar het was niet sportief! :p.
Zelf ben ik echt tevreden over mijn resultaat. Ik reed éééééérg consistent (gemiddeld 40.3 - 40.4) en verbeterde mijn toptijd => 40.15 ! Sander reed een toptijd van 40.11. Terwijl ik vroeger 3 tienden trager was dan Sander, reed ik nu slechts 4 hondersten trager. Stefan reed woensdag in een klasse apart en perste een 39.5 uit zijn kart. Proficiat aan mijn team mate fjo! ;-)

Spaghetti!

Na de leuke race werden we getrakteerd op spaghetti. 't Was toen al 22u45 dacht'k. Mijn eerste bord was vrij snel op. Man, ik had honger gekregen van de race :-D. Veerle kwam dan nog eens aandringen of ik geen 2e portie wou en mijn buik zei dat er gerust nog bij kon :-D. Toen ik 's avonds in mijn bed kroop, had ik precies wel wat spijt van die beslissing :-D. Toooooo much spaghetti for me! :-D. Maar 't was lekker! Dat mag gezegd worden en 't was de ideale afsluiter van een leuke race!

24u van FKI Machelen

We waren er al een tijdje over bezig, maar nu is het officieel. Op 24 en 25 april verdedigt een (uitgebreid) team van Traxxis "JPR indoorkarting" op de 24u van FKI. We rijden met 8 piloten een wedstrijd die ... logischerwijze ... 24u duurt. Nu woensdag start onze 1e training en we hebben nog heel wat werk voor de boeg. Maar ik kijk er gigantisch naar uit!

Flitslocaties en -palen in het buitenland

Submitted by Jochus on Thu, 04/02/2010 - 22:00 | Posted in: Lifetime
Posted in

'k Ben al verscheidene keren met de wagen naar het buitenland gemoeten, en ik vind het altijd handig om te weten waar de flitspalen staan, en waar ze staan te flitsen. En neen, niet dat ik zo een hardrijder ben :p, maar 't is altijd handig om te weten hoe snel je waar mag :p ...

De POI's die je kan vinden op http://flits.bnet.be, zijn enkel geldig voor België. Op http://www.alertegps.com/ kon je vroeger recente flitslocaties downloaden voor je TomTom. Maar helaas hebben ze die vorige week betalend gemaakt (de ganse site is trouwens herwerkt).

Iemand die nog toevallig een goeie site weet voor flitspaal/locatie POI's in het buitenland?

Top Gear Live! (RAI, Amsterdam)

Submitted by Jochus on Tue, 02/02/2010 - 22:54 | Posted in: Lifetime
Posted in

Het weekend van 22-23-24 januari ben ik samen met Sander, Nicolas, Ben, Laurent en Stijn afgezakt naar Amsterdam, meer bepaald naar de RAI.

TOP GEAR LIVE RAAST NEDERLAND BINNEN

Voor het eerst zullen Jeremy Clarkson, Richard Hammond en “The Stig” hun aanstekelijke enthousiasme ook op het Nederlandse publiek overbrengen. Van 21 tot 24 januari 2010 doet de Top Gear Live World Tour namelijk de RAI in Amsterdam aan. De World Tour van vorig jaar zette meer dan 310.000 autofans op vier continenten in vuur en vlam en nu kunnen eindelijk ook Nederlandse auto-enthousiastelingen getuige zijn van het Top Gear Live spektakel.

De 2010 World Tour biedt een spectaculaire stuntshow waarin Clarkson en Hammond met een parade aan auto’s de hoofdrol spelen. Daarbij worden ze vergezeld door The infamous Stig, die via een geluids- en kliksysteem het Top Gear-team van internationale stuntrijders aanvoert en zo het ultieme precisierijden demonstreert.

Jeremy Clarkson: “Ik vond de vorige World Tour fantastisch om mee te maken en ik kijk er naar uit om voor het eerst met deze spectaculaire show naar Amsterdam te komen. We hebben de beste onderdelen van Top Gear samengebracht en gaan deze live vertonen in een ware Auto-Arena in de RAI. Ambitieus? Zeker, maar ik ben ervan overtuigd dat het waanzinnig uitpakt.”

De live stuntshow zit boordevol special effects, het handelsmerk van de show; “smashes en crashes”; aangepaste auto’s en natuurlijk adembenemende stunts die er zeker voor zorgen dat de toeschouwers op het puntje van hun stoel zullen zitten.


Ik moet zeggen, de show was ECHT geslaagd. We hebben de goedkoopste tickets gekocht (ja, was toch alweer 40 50 EUR :-/ ...) en vreesden dat we misschien niet goed gingen zitten, maar 't viel echt super goed mee. We zaten wat aan de zijkant, maar we konden alles perfect zien. Veel zotte auto's gezien, maar toch 1 iets wat ik wel straf vond.

Bekijk het volgende YouTube filmpje (vooral het stuk op 00:18 - waar ge 1ne ziet parkeren lijk nen zot - in't echt zag het er wel zotter uit, op't filmpke is 't precies simpel gedaan )

Filmpje dat de show een beetje samenvat:

Na de show zijn we eens goed gaan uitzakken in Amsterdam ... (halloooooooowwww :p). De zondag zijn we op café nog naar Ajax-AZ gaan kijken. 1 ding was duidelijk: als ge geen slagen wou krijgen, was je best geen supporter van AZ! :-D

EJB3unit testing: example

Submitted by Jochus on Tue, 02/02/2010 - 18:07 | Posted in: Java
Posted in



Last week, we tested a framework that could help us testing our service layer (which is created in EJB 3.0). On a previous project, Kim and I tried setting up a JBoss embedded container to perform some unit testing. But it took too much time to set everything up. It also took a while to run the tests with Maven.
So finally, as EJB's 3.0 are just POJO's, we've created them in our TestNG tests with MyEJB myEJB = new MyEJBImpl();. In order to test them correctly, we had to mock some other services/DAO's. Therefore, we used EasyMock. Now, the problem is you need getters/setters to set these mocks on your EJB (which I think is a very bad practice). You could write a "reflection-util-class" which sets the mock in the EJB using reflection, but then again, you're wasting too much time to test something nice.

EJB3unit

The Ejb3Unit project automates Entity and Session bean testing outside the container for the EJB 3.0 specification.

What are the features of EJB3unit?

  • Ejb3Unit is a JUnit extention and can execute automated standalone junit tests for all EJB 3.0 conform JEE projects.
  • The out of container test approach leads to short build-test-cycles, because no container deployment is necessary anymore.
  • EJb3Unit uses an internal in memory database by default. Alternatively a user defined database can be specified. An example configuration can be found here.
  • Ejb3unit is released under the LGPL License.

Personal advantages of EJB3unit

  • Very fast and lightweight
  • Easy to integrate with M2
  • Easy mocking (no need for getters/setters)

Personal disadvantages of EJB3unit

  • The last release dates from: 2008-05-17 (and the package is a RC!)
  • We had to upgrade to the 2.0.0-SNAPSHOT version as we were having some issues with the 2.0.0-RC-1 version
  • The project seems to be dead ... there's not much activity by the developers
  • <a href="mailto:jochen@baileys">jochen@baileys</a> /tmp/ejb3unit $ svn info
    Path: .
    URL: <a href="https://ejb3unit.svn.sourceforge.net/svnroot/ejb3unit
    Repository">https://ejb3unit.svn.sourceforge.net/svnroot/ejb3unit
    Repository</a> Root: <a href="https://ejb3unit.svn.sourceforge.net/svnroot/ejb3unit
    Repository">https://ejb3unit.svn.sourceforge.net/svnroot/ejb3unit
    Repository</a> UUID: 240b23ad-3c12-0410-ab44-d75537e93366
    Revision: 308
    Node Kind: directory
    Schedule: normal
    Last Changed Author: bendt
    Last Changed Rev: 308
    Last Changed Date: 2010-01-10 15:03:25 +0100 (Sun, 10 Jan 2010)

Example

I want to show an example of how it works. The example is a simple service which reverse the name of a user and add his date of birth (I know it's silly, it's just to show how it works).

So my interfaces:

package be.jochusonline.ejb3unitexample;
 
import javax.ejb.Local;
 
@Local
public interface StringManipulator {
	String reverseNameAndAddDob(String s);
}

package be.jochusonline.ejb3unitexample;
 
import java.util.Date;
import javax.ejb.Local;
 
@Local
public interface DateManipulator {
	Date getDateOfBirth(String name);
}

My implementation classes:

package be.jochusonline.ejb3unitexample.impl;
 
import java.text.SimpleDateFormat;
import java.util.Date;
 
import javax.ejb.EJB;
import javax.ejb.Stateless;
 
import be.jochusonline.ejb3unitexample.DateManipulator;
import be.jochusonline.ejb3unitexample.StringManipulator;
 
@Stateless
public class StringManipulatorBean implements StringManipulator {
	@EJB
	private DateManipulator dateManipulator;
 
	private static final SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
 
	public String reverseNameAndAddDob(String s) {
		/* reverse String */
		Integer len = s.length();
		StringBuffer target = new StringBuffer(len);
		for (Integer i = (len - 1); i >= 0; i--) {
		    target.append(s.charAt(i));
		}
 
		/* get DBO */
		Date dob = dateManipulator.getDateOfBirth(s);
 
		return target.toString() + " " + formatter.format(dob) ;
	}
 
}

package be.jochusonline.ejb3unitexample.impl;
 
import java.util.Date;
 
import javax.ejb.Stateless;
 
import be.jochusonline.ejb3unitexample.DateManipulator;
 
@Stateless
public class DateManipulatorBean implements DateManipulator {
 
	public Date getDateOfBirth(String name) {
		// TODO: add implementation ... not needed for example as we are gonna mock this class
		return null;
	}
}

My test class is looking like this:

package be.jochusonline.ejb3unitexample;
 
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
 
import java.util.Calendar;
 
import org.jmock.Expectations;
 
import be.jochusonline.ejb3unitexample.impl.StringManipulatorBean;
 
import com.bm.testsuite.mocked.MockedSessionBeanFixture;
 
public class StringManipulatorTest extends
		MockedSessionBeanFixture<StringManipulatorBean> {
 
	public StringManipulatorTest() {
		super(StringManipulatorBean.class);
	}
 
	public void testReverseStringAndAddDob() {
		/* init mock data */
		final String name = "JOCHEN";
		final Calendar cal = Calendar.getInstance();
		cal.set(1985, 02, 18); // Calendar starts counting months from "0" => 0 = January, 1 = February, ...
 
		/* define mocks/expectations */
		final DateManipulator dateManipulatorMock = this.getMock(DateManipulator.class);
                context.checking(new Expectations() {{
                    one(dateManipulatorMock).getDateOfBirth(name);
                    will(returnValue(cal.getTime()));
                }});
 
                /* run tests */
                StringManipulator stringManipulator = this.getBeanToTest();
                String result = stringManipulator.reverseNameAndAddDob(name);
 
                /* check result */
                final String expectedResult = "NEHCOJ 1985-03-18";
                assertThat(result, equalTo(expectedResult));
 
	}
}

Things to remember:

  • Extend your class from MockedSessionBeanFixture to be able to run the EJB3unit tests (in the background a JUnit process will start). I've used the MockedSessionBean as I want mocking
  • Mock the DateManipulator and create expectations so you're test will return easily

The result in Eclipse:

Google Chrome OS (Chromium)

Submitted by Jochus on Mon, 01/02/2010 - 22:58 | Posted in: RealDolmen
Posted in

Last week, I went to a presentation at my company to see the new Google Chrome OS in action.

Google Chrome OS is an open source operating system designed by Google to work exclusively with web applications. Announced on July 7, 2009, Chrome OS is set to have a publicly available stable release during the second half of 2010. The operating system is based on Linux and will run only on specifically designed hardware. The user interface takes a minimalist approach, resembling that of the Chrome web browser. Because the browser will be the only application residing on the device, Google Chrome OS is aimed at users who spend most of their computer time on the Internet

Advantages

  1. It is an operating system. And the vendor that controls the operating system controls the application stack and can win the hearts and minds of developers by giving them a way to make money for their code pounding.
  2. The Chrome operating system provides a critical bridge between Web 2.0 applications sitting in the cloud and a beefed-up browser. The entrance of Google into the operating system business closes the loop between online, offline, cloud-based applications and mobile applications.
  3. Google's Chrome browser is a really good browser!
  4. The Chrome operating system doesn't have to be a success. As long as it can play nicely with other open-source operating systems such as Ubuntu and Intel's Mobilin, then the Chrome operating system can be a nice little thorn in Microsoft's side.
  5. The Chrome operating system is only part of the Google game. The Google Wave shared-resource system still in development will be a bigger deal than the Chrome operating system, but just like the Microsoft competition, the more you can make all the parts work flawlessly together the stronger you are.

Disadvantages

  1. Google makes its money sticking ads next to search results and has yet to show it can reach beyond that model.
  2. Operating systems from Ubuntu and Red Hat are way ahead of anything Google can do. Those companies (yes, along with Microsoft and Apple) have shown they can court developers and provide solid operating systems. You really don't need another one in the game.
  3. Hardware suppliers control the operating system business. They cut deals with the software suppliers for co-op advertising dollars and push products based on those deals
  4. The mobile, netbook and desktop operating system business is not going to roll over for Google. The big Asian vendors are going to end up in control of the netbook and mobile operating system business.
  5. The entire operating system business is getting virtualised. No one is going to really know or care what system is running on their hardware.

RealDolmen provided us a virtuale image of the application. I've tested it and it is running great on my Ubuntu installation


(click to enlarge)

I also received a virtual (beta) image of Windows 7. I'm still running the XP version as my portable is soooooo old, but it seems a great OS!


(click to enlarge)

Installing bEID middleware 3.5.3 on Ubuntu Karmic Koala 9.10

Submitted by Jochus on Mon, 01/02/2010 - 22:33 | Posted in: Linux
Posted in


I'm currently working on a project where you need to login with your eID. So, to be able to login, you need software to connect to the eID reader.

The version that is available in Ubuntu is:

<a href="mailto:jochen@baileys">jochen@baileys</a> ~ $ sudo aptitude show beidgui
Package: beidgui
State: not installed
Version: 2.6.0-7ubuntu1
Priority: extra

This version was too old to perform some tests, so I had to look for a way to install the newest version.

Download middleware

Unpack file

<a href="mailto:jochen@baileys">jochen@baileys</a> ~ $ tar -xvzf beid-middleware-3.5.3-#48-ubuntu-squeeze_sid-i686-6107.tgz

Install software

<a href="mailto:jochen@baileys">jochen@baileys</a> ~ $ cd install
<a href="mailto:jochen@baileys">jochen@baileys</a> ~ $ sudo ./install.sh

Set up Firefox

  • In FF, go to: Edit > Preferences > Advanced
  • Tab: Encryption
  • Press: Security devices
  • Load the following device:
    • Modulename: Belgium Identity Card PKCS #11-module
    • Module filelocation: /usr/local/lib/libbeidpkcs11.so

Finish tasks

  • Execute the following steps:
  • <a href="mailto:jochen@baileys">jochen@baileys</a> ~ $ cd /usr/local/lib/
    <a href="mailto:jochen@baileys">jochen@baileys</a> ~ $ sudo ldconfig

  • I don't know why I had to do this, but I had to reboot my system to let everything work

Geluidsinstallaties in de wagen

Submitted by Jochus on Mon, 01/02/2010 - 22:17 | Posted in: RealDolmen
Posted in

Vandaag deze mail ontvangen in mijn mailbox van 't werk (mail werd naar alle personeelsleden gestuurd)

Geluidsinstallaties in de wagen

Blootstelling aan te veel lawaai kan zowel tijdelijke als blijvende gehoorstoornissen veroorzaken. Blijvende gehoorschade kan onmiddellijk ontstaan als gevolg van plotseling optredend extreem hard en explosief geluid. Doorgaans echter ontstaat gehoorverlies geleidelijk als gevolg van langdurige blootstelling aan geluid op een regelmatige basis.
Gehoorverlies is niet het enige probleem dat zich kan voordoen; bij aan veel geluid blootgestelde personen kan zich tinnitus (oorsuizingen) ontwikkelen (al dan niet tijdelijk). Dit is een benauwende conditie die aanleiding kan geven tot slaapstoornissen.
Preventie en veiligheid eindigt echter niet buiten de werkomgeving en -uren. Daarom willen we even de aandacht vestigen op een factor waar we bijna dagelijks buiten de werkomgeving aan blootgesteld worden, namelijk de geluidsinstallatie in de wagen.
In deze kleine omgeving kunnen we inderdaad extreem hard en explosief geluid creëren welke tijdelijke en blijvende schade kan veroorzaken. Ook kan dit met zich meebrengen dat we hierdoor waarschuwingsgeluiden van o.a. politie en ziekenwagens niet waarnemen of concentratieverlies hebben.
Besluit: alles waar een “te” voor staat (TE veel, TE weinig) wordt afgeraden. MET MATE duurt het langst. Zorg dat je na het instellen van het geluidsniveau nog een gesprek in de wagen kan voeren en dat je het omgevingsgeluid nog kunt waarnemen. Of denk eens aan je favoriete deuntjes tijdens het autorijden. Je wilt deze toch blijven horen?

Stof om tot na te denken. Zelf weet (en besef) ik dat mijn radio altijd veel te luid staat. Waarom? Omdat het nu net eenmaal zo lekker klinkt. Het is leuk als je de hoge en lage tonen zo scherp kan horen.
Thuis staat de muziek nooit luid op. Ik woon in een appartement en zou zelf niet graag hebben dat er daar ene naast mijn deur heavy metal zit af te spelen :-).
Ik ben naar bepaalde evenementen geweest waar de muziek zodanig luid stond dat mijn oren echt pijn deden op bepaalde beats. Sindsdien heb ik altijd oordopjes bij. Als het echt té hard wordt, haal'k ze boven.

Een tijdje geleden was er reclame op VT4 over een ringtoon die enkel jonge mensen konden horen. Je kon gewoon in de klas bv opgebeld worden met je geluid aan; een oudere docent/leerkracht ging die ringtone nooit horen. Nu betrapte ik mezelf er op dat ik mij ook al tot die oudere categorie mag rekenen, want ik hoorde helemaal ... niets :-). Misschien toch wat beter die radio stiller zetten?

Introduced the CAPTCHA module

Submitted by Jochus on Sun, 31/01/2010 - 23:34 | Posted in: Website
Posted in

Hmm, while Google is crawling more of my pages, a lot more bots are contacting my site too :p. There are putting SPAM comments and sending me SPAM mail. At a certain point, I received 1000 mails in 1 hour, so I changed permissions that a guest user is not able to post anything.

But, in my opinion, it's really stupid to ask a visitor to register on my site for just putting a comment, or just contacting me using the "Contact form".

So I've installed the Captcha module. I configured the module that it will ask the user a small MATH calculation:

I don't like the "Image" calculation (the user has to type a word that is displayed in an image). As the image is most of the times unclear, the user will get tired of trying to fill up the captcha field.

Anywayz, all visitors are welcome again to comment and mail me ;-) !

Redirecting old Joomla! pages to new Drupal pages

Submitted by Jochus on Sun, 31/01/2010 - 23:25 | Posted in: Website
Posted in

Google has some old URL references to my Joomla! site. I haven't deleted it yet, as people are still contacting those pages. I tried removing the links using "Webtools for Google", but it seems that Google is still picking them up :-( ...

So what I did:

  • when an old page is contacted, the user will be redirected to the new one
  • I'm sending HTTP_STATUS 301 with the redirect, so Google will know NOT to add this page in his content database






So, what you need to do:

  • move the index.php file from Joomla! to index_orig.php
  • create a new file index.php on exactly the same location

To understand the script, check this diagram:

When I imported the old content into Drupal, Drupal created a table which links the id of the Joomla! content to the id of Drupal (see: joomla_content).
The link with "url_alias" (which holds the new URL) is tricky. The "src" attribute holds the id as "node/$ID_OF_DRUPAL". So if you want to obtain the correct URL, you need to do a SELECT

SELECT u.dst FROM url_alias u, joomla_content j WHERE u.src = concat('node/', j.nid) AND j.jcontentid = $jcontentid

To redirect the user, I used the header() function of PHP

header('HTTP/1.1 301 Moved Permanently');
header("Refresh: 0; URL=<a href="http://www.jochus.be/site/&quot">http://www.jochus.be/site/&quot</a>; . $data['dst']);

I'm not a PHP developer, so I'm suuuuure it can be written better. Feel free to improve te script:

<?php		
	// connect to the Drupal DB to retrieve Drupal information
	connectToDatabase();
 
	// check which Joomla component gets activated, if 'com_content', it means the user is trying to access an article
	$content = $HTTP_GET_VARS['option']; 
	if ($content == 'com_content') {
		$jcontentid = $HTTP_GET_VARS['id'];
 
		if (is_numeric($jcontentid)) {
			// foresee SQL injection with 'mysql_real_escape_string'
			$SQL_statement = "SELECT u.dst from url_alias u, joomla_content j WHERE u.src = concat('node/', j.nid) AND j.jcontentid = " . mysql_real_escape_string("$jcontentid");
			$resultset=mysql_query($SQL_statement);
 
			if ( $data = mysql_fetch_array($resultset)) {
				header('HTTP/1.1 301 Moved Permanently');
				header("Refresh: 0; URL=<a href="http://www.jochus.be/site/&quot">http://www.jochus.be/site/&quot</a>; . $data['dst']);
			} else {
				goToOrigUrl();
			}
		} else {
			goToOrigUrl();
		}
	} else {
		goToOrigUrl();
	}
 
	/******************************************************************************
	 * FUNCTIONS
	 ******************************************************************************/
 
	function connectToDatabase() {
		$db = mysql_connect("localhost","YOUR_DATABASE_USER","YOUR_DATABASE_PASSWORD") or die("Connection failed");
		mysql_select_db("YOUR_DATABASE",$db);
	}
 
	function goToOrigUrl() {
		$newUrl = str_replace('index.php', 'index_orig.php', $_SERVER["REQUEST_URI"]);
		header("Refresh: 0; URL= " . $newUrl);
	}
?>