varia

Pecha Kucha – Gamification

2

Vrijdag 16 december was het laatste Java Café van 2011. Ondanks het gure weer en de (aangekondigde) BOB-campagne hebben een 30-tal collega’s de avond gezellig en droog doorgebracht in Introvert, Gent. Naast een lekkere maaltijd stonden een technology speed dating en een Pecha Kucha,gepresenteerd door ondergetekende, op het menu.

Ik schrijf deze blog niet enkel om de Powerpoint te delen, maar ook om eens te vertellen over hoe ik begonnen ben aan deze nieuwe frisse aanpak van presentaties.

Voor de ongeduldigen, hier is de presentiatie:

Wat is een pecha kucha

Om geen open deur in te trappen zijn hier enkele URL’s waar je je kunt inlezen: Wikipedia, pecha-kucha.org, Vacature.com.

Pecha Kucha is een originele manier om ideeën over te brengen aan een publiek. Het volgt de 20×20 regel: 20 slides, 20 seconden elk, wat een totaal van 6 minuten 40 seconden geeft aan de spreker. Dit kader dwingt de spreker om geen overbodige informatie op slides te zetten en enkel de kern van zijn boodschap over te brengen op een visuele manier. Wanneer je zoekt op youtube kun je enkele goede voorbeelden vinden van Pecha Kucha presentaties.

Waarover kun je het hebben

Maakt echt niet uit. Alles is mogelijk, zolang je het zelf maar interessant kunt overbrengen op je publiek. Er is helemaal geen verplichting om het over werk te hebben.

Hoe ben ik er aan begonnen

Alles begint met een idee. Ik lees in mijn vrije tijd blogs en artikels op het internet en vond gamification wel de moeite waard om eens 6 minuten over te vertellen.

Ik ben beginnen zoeken op Slideshare naar presentaties over dit onderwerp door andere sprekers. Ik heb mij gebaseerd op twee presentaties, van samen +300 slides. Dit werd ingekort naar een verhaal met volgende voorbereiding:

  • Welk gedrag of welke toepassingen kan ik aanspreken in het publiek zodat ze onmiddelijk weten waarover het gaat (hoe impacteert mijn idee hen)
  • Welke voorbeelden uit dagelijkse activiteiten kan ik toelichten
  • Wat is gamification
  • Waar gebruikt men gamification (met bekende voorbeelden)
  • Waar moet je op letten bij gamification, wat zijn de pitfalls

Dit verhaal goot ik dan samen met behulp van afbeeldingen en visuele elementen die ik op internet vond.

Presentatie zelf

Over inhoud kon ik nog enkele minuten blijven voorpraten :)

Toch enkele pointers:

  • Beperk je pecha kucha tot 1 enkel idee, en wijk hier niet van af. Beter 1 consistent verhaal dan onsamenhangende oneliners
  • Aan oneliners en krachtige zinnen heb je voldoende. Een voorbereiding met volzinnen is helemaat niet nodig.
  • Oefen thuis het 20×20 kader, 20 seconden is helemaal niet veel.

Conclusie

De ervaring van zelf een Pecha Kucha te geven is zeker aan aanrader. Het maakt je veel bewuster van wat een presentatie goed maakt. De focus die je als spreker moet leggen op je verhaal, rekening houdend met het kader ( 20×20 ), doen je stil staan bij de kern van een presentatie: een boodschap overbrengen op je doelpubliek.

Unix Background Jobs 101

0

On my current project I’m working with a virtual Ubuntu machine on which Weblogic and DB2 are installed. Weblogic starts with the ./startWeblogic.sh command, and log files are written to a logfile ‘weblogic.xml’ :

./startWebLogic.sh > weblogic.log

You may go wild with opening multiple terminals and switching between them, but I hate the fact that the weblogic process is just taking up an entire window, even though it’s essentially meant to be a background process! This is where some basic unix commands kick in: run a long-lasting command or script as a background job, execute it in the background, bring it back to the foreground, see all running background jobs and (possibly) kill them. Let’s go.

Spawning a background job

This code fragment simulates a 10second command. Notice that the cursor isn’t available until the 10seconds are over.

sleep 10

Append your command with an ampersand ( & ), to run it in the background. The cursor is immediately available.

sleep 10 &

You may wonder already, ‘but how do I know the command is finished?’. See the chapter about ‘showing all background jobs’ for that.

Send the current executing command to the background and back

Suppose you forgot the & , or a command is taking longer than expected. You don’t need to quit (CTRL-C) the command, and re-execute it with the &. You can send the current executing command to the background by pressing CTRL-Z.

sander@sander-ThinkPad-T510:~$ sleep 20
^Z
[1]+  Stopped                 sleep 20

Notice the fact that the job was stopped (paused should be a better name). Execute the bg command to make the job continue.

sander@sander-ThinkPad-T510:~$ bg
[1]+ sleep 20 &
sander@sander-ThinkPad-T510:~$ fg
sleep 20

To demonstrate this, you can execute thefg command to make it come back to the foreground again. You can bring back any background job to the foreground using this command. No parameters will show the most recent background job, passing %1 will show process with id 1, %2 with id 2, etc.

You can bring a background job to the foreground using fg command. When executed without arguments, it will take the most recent background job to the foreground.

Showing all background jobs

When using this technique a lot, you might send multiple commands to the background. To show all current background process, execute the jobs command.

sander@sander-ThinkPad-T510:~$ jobs
[1]   Running                 sleep 30 &
[2]-  Running                 sleep 25 &
[3]+  Running                 sleep 20 &

Killing background jobs (OPTIONAL)

Suppose you sent a command to the background you want to kill immediatly. The kill commando can’t only kill processes, but also background jobs.

sander@sander-ThinkPad-T510:~$ sleep 25 &
[1] 21153
sander@sander-ThinkPad-T510:~$ sleep 25 &
[2] 21156
sander@sander-ThinkPad-T510:~$ sleep 25 &
[3] 21157
sander@sander-ThinkPad-T510:~$ kill %2
sander@sander-ThinkPad-T510:~$ jobs
[1]   Running                 sleep 25 &
[2]-  Terminated              sleep 25
[3]+  Running                 sleep 25 &

Opportuniteiten bij onderhoudsprojecten

0

Mijn vorige projecten waren allemaal Greenfield projecten, projecten die van scratch begonnen en waar ik een grote vrijheid kreeg om te ontwikkelen. Die vrijheid kon ik als ontwikkelaar benutten om nieuwe technologieën te introduceren, het component design zo ‘mooi’ mogelijk te maken, laatste versies van libraries gebruiken, en zo meer. Je gebruikt ook je ervaring om alles zo perfect mogelijk te maken en je te houden aan coding conventions, best practices, guidelines op te stellen. Dit zijn de soort projecten waar iedereen zich wel kan in vinden, niet?

Het klantenverhaal…


In September vorig jaar kreeg ik het nieuws dat ik kon beginnen bij een grote klant. Het is een mastodont van een overheidsinstelling: veel postjes in te vullen, veel projecten, veel bedrijven die ‘binnen proberen geraken’. Kortom, er zijn veel consultants die lange tijd op verschillende projecten meedraaien.

De applicatie draait op Struts 1.3.9, EJB3′s, een zelfgebouwd persistency-framework, een ononderhouden codebase met duplicatie van code, hacks, ‘everything-on-the-session’, String concatenation van soms +40 lijnen(dat is een widescreen laptopscherm vol met lijnen!), 614 VO’s BO’s BC’s Actions Forms zonder hergebruik, constants her en der, geen documentatie, you name it. De schok was groot.

Challenge Accepted!

Ik geef toe, ik had m’n twijfels toen ik dit project aanvaardde. Mijn grootste twijfel was of ik hier wel iets uit ging leren? Struts1, onderhoud, jsp’s, *geeuw*. Achteraf bekeken heb ik andere dingen bijgeleerd op dit project. Ik besefte dit pas toen ik het artikel ‘The Joys of Maintenance Programming‘ las enkele weken terug.

Je leert debuggen

Iedereen weet ondertussen wel hoe hij debugged. Breakpoints zetten, je kent je component diagram, soms weet je gewoon al waar je moet kijken zonder te debuggen! Ik heb ondervonden dat het veel meer inspanning en doorzettingsvermogen vraagt om andermans code te begrijpen en te lezen. Stap voor stap moet je de oorzaak van het probleem proberen achterhalen. Misschien gebeurt er op andere plaatsen nóg meer? Of wordt het misschien herbruikt? Je kunt dus niet zomaar veronderstellingen maken, maar je moet je volledig ‘inleven’ in de code.

Het lezen en debuggen van vreemde code doet je nadenken over hoe de code (niet) werkt, in plaats van wat je denkt dat het zou moeten doen.

Je leert beter programmeren

Het is duidelijk uit voorgaand punt dat het gemakkelijker is om goede code te debuggen dan slechte code. Goede code kan (hopelijk ;) ) iedereen hier schrijven. Maar wat is slechte code? Wel, dit onderscheid zal je zeker en vast ondervinden op een onderhoudsproject. Je zult de ‘waarom’ achter code moeten achterhalen, wat de bedoeling was van de programmeur. Ervaren programmeurs herkennen onmiddelijk het verschil tussen goede en slechte code, en omgaan met ‘meer code’ (niet enkel die van jou of andere ervaren mensen) zal dit gevoel enkel versterken.

Je ontwikkelt manieren om je weg te vinden in een onbekende codebase, en je zult een neus ontwikkelen voor code waar een reukje aan zit.

Je leert optimaliseren

De originele programmeurs hebben hun premature optimizations al kunnen doen (niet door laten verleiden! Premature optimization is the root of all evil). Jij kunt nu de échte efficiëntieproblemen en bottlenecks vaststellen. De originele programmeurs staken veel tijd en energie in wat zij als mogelijk performantieprobleem zagen. Problemen die misschien nooit zouden voorgevallen zijn, of die geen grote impact zouden gehad hebben.

Werkende systemen hebben reële performantieproblemen. Het is een heel nobele vaardigheid die de gebruikers zeker positief zullen onthalen om deze problemen te identificeren en er oplossingen voor te formuleren. Het zoeken en oplossen van deze problemen kan zelf leuk worden!

Klanten merken altijd wanneer je hun applicatie sneller maakt, en appreciëren het enorm wanneer je er aan denkt om ze efficiënter te maken.

Je leert met gebruikers omgaan

Bij greenfield projecten werk je vooral binnen het team. De analye is klaar, de business is gecontacteerd, de requirements liggen vast (althans, dat hoop je altijd). Nieuwe applicaties hebben geen echte gebruikers, je krijgt use cases en stakeholders. Bij onderhoudsopdrachten werk je met de eindgebruikers, vooral diegene die de applicatie dagelijks gebruiken en die zich ergeren aan de bugs of aan functionaliteit die niet of slecht werkt.

Communiceren met eindgebruikers die uit een niet-IT-achtergrond komen doet je uit je IT-schelp kruipen. Hierdoor voel je je meer betrokken tot je werk.

This post was mentioned on RealDolmen NoNonsense Blog, and DZone

Happy newyear

0

Best of wishes for 2011!

To celebrate this new year, take a look at some real nerdish history:
geek life history

SFTP Server communication in Java using Jsch

6

Last week I had to write a Java software component that could connect to a SFTP server, read in flat files, process them through a business component, and then place a generated file back on the same server.

The technical details about the SFTP protocol were unclear to me, so I started reading about it on wikipedia. Basically SFTP is the same as SCP, a secure copy over SSH.

Setup of a development environment

Before anything else, I needed a SFTP server installed for development. I choose the trial version of the complete FTP suite-trial version. This isn’t the only, nor the best SFTP server-suite out there. I can imagine using proftpd, ssh, core ftp, or other ftp software.

The only next big thing I had to do was generate a public/private keypair to authenticate myself, PuTTy gen came to the rescue. In my Server admin screen I linked the key to the user account and I was ready to start developing.

JSch

The search for existing Java libraries that helped me working with this SFTP server, didn’t yield the results I was hoping for. There wasn’t a ‘best’ or ‘winning’ API or framework that emerged from the search results.

I found that Jsch was not only used by some big reference applications ( Ant(1.6 or later), Eclipse(3.0), NetBeans 5.0(and later), Maven Wagon, JIRA, and more), but it was also available in the Maven2 repository as a standalone library. I checked out the examples on their website, and found them to be very clear to me. These are also available on my Maven2 demo-project which you can find below.

All in all, I developed a small ‘push’ and ‘get’ component in my project in notime. You can find the relevant code attached to this post. You might think that this API is very lowlevel: commands as “ls”, “mkdir”, “get”, “cd”, … are all avaible in simple method calls. In my opinion, this is a good thing, because in these matters you want to have full control over your communication with the server.

Demo

This Demo will try connect to a given sftp server, list all directories and files in the home directory and exit. For getPrivateKeyAsByteStream(); implementations, take a look at FileUtils in apache-commons or look for code online.
To run this demo, you should either include Jsch on your classpath, or download my Maven2 project here.

public class SftpDemo {

	private static final String HOST = "127.0.0.1";
	private static final int PORT = 22;
	private static final String USER = "test";
	private static final String PRIVATE_KEY_LOCATION = "C:\\sftpkeys\\private_openssh";

	public static void main(String[] args) throws Exception {
		JSch.setLogger(new MyJschLogger());
		JSch jSch = new JSch();
		final byte[] privateKey = getPrivateKeyAsByteStream();
		final byte[] password = "certPass".getBytes();
		jSch.addIdentity(USER,
				privateKey,
				null,
				password
		);

                // TODO: remove this line in real life. Work with known_hosts!
		Session session = jSch.getSession(USER, HOST, PORT);
		Properties config = new Properties();
		config.put("StrictHostKeyChecking", "no");
		session.setConfig(config);

		session.connect();
		Channel channel = session.openChannel("sftp");
		ChannelSftp sftp = (ChannelSftp) channel;
		sftp.connect();

		final Vector files = sftp.ls(".");
		Iterator itFiles = files.iterator();
		while (itFiles.hasNext()) {
			System.out.println("Index: " + itFiles.next());
		}

		final ByteArrayInputStream in = new ByteArrayInputStream(
				"This is a sample text".getBytes());

		sftp.put(in, "test.txt", ChannelSftp.OVERWRITE);

		sftp.disconnect();
		session.disconnect();

	}

This logger is a standard implementation, taken from the JSch-examples. It’s nice to see what’s happening behind the scenes. You should opt for logging frameworks when using Jsch in your project (and in all other cases too of course).

	static class MyJschLogger implements Logger {
		static java.util.Hashtable name = new java.util.Hashtable();
		static {
			name.put(new Integer(DEBUG), "DEBUG: ");
			name.put(new Integer(INFO), "INFO: ");
			name.put(new Integer(WARN), "WARN: ");
			name.put(new Integer(ERROR), "ERROR: ");
			name.put(new Integer(FATAL), "FATAL: ");
		}

		public boolean isEnabled(int level) {
			return true;
		}

		public void log(int level, String message) {
			System.err.print(name.get(new Integer(level)));
			System.err.println(message);
		}

	}

}

RichFaces 4 Alpha Released

2

Today, the RichFaces 4 Alpha 2 was released. For an overview of what’s new in JSF2 and the possibilities, check out this blog by Andy Schwartz for a complete review with lots of links and documentation.

Quote from the Richfaces Project Page
RichFaces is a component library for JSF and an advanced framework for easily integrating AJAX capabilities into business applications.

  • 100+ AJAX enabled components in two libraries
    • a4j: page centric AJAX controls
    • rich: self contained, ready to use components
  • Whole set of JSF benefits while working with AJAX
  • Skinnability mechanism
  • Component Development Kit (CDK)
  • Dynamic resources handling
  • Testing facilities for components, actions, listeners, and pages
  • Broad cross-browser support
  • Large and active community
JSF 2 and RichFaces 4

We are working hard on RichFaces 4.0 which will have full JSF 2 integration. That is not all though, here is a summary of updates and features:

  • Redesigned modular repository and build system.
  • Simplified Component Development Kit with annotations, faces-config extensions, advanced templates support and more..
  • Ajax framework improvements extending the JSF 2 specification.
  • Component review for consistency, usability, and redesign following semantic HTML principles where possible.
  • Both server-side and client-side performance optimization.
  • Strict code clean-up and review.

I followed the tutorial on how to get a project up and running from this JBoss Community article and started work on a clean skeleton. On this blank project I will be experimenting with JSF2 and richfaces components in the near future.

With this blank project in mind, I created following architecture:

  • Maven2 Project
  • Reference JSF2 API and IMPL
  • RichFaces 4.0.0.Alpha2 component library

You can immediatly start experimenting by importing this Maven2 project in your favourite IDE (mvn eclipse:eclipse goal is configured). Have fun!

Download Maven2 Skeleton

Download WAR

GoF Java Design Patterns in the Java SE and Java EE API

0

Today I had the opportunity to write a reusable component for the project I am currently working on. Because I had the freedom to write it from scratch, I looked into some of the design patterns that are commonly used in the process of Software Engineering.

While I refreshed some of the common design patterns, I found this nice thread on Stack Overflow – Examples of gof design patterns. It offers an overview of design patterns that are being used in the Sun Java SE and JavaEE API. Since the sun JDK is open-source and thus free for all, it’s easy for you to take a look into its source code and learn from the better implementations of these patterns.

Some of the patterns that are linked into the JDK:

Just take a look for yourself! Keep your favourite IDE open with sources attached!

Go to Top