Time management and the call of procrastination

By Kenneth 'RabidDog' Clark at December 29, 2011 13:23
Filed Under: Work, Personal

Today I was feeling all flustered and had no idea why. It felt like I had stacks of work to do and didn’t know where to begin. Then half way trying to do something I felt like I had been working for hours on the same thing.

 

I took a step back and remembered a technique our scrum master has taught us called the Pomodoro technique. Yes I know it is old but I thought I would try it again. Now like any true geek I had to find an application that could do the timing (I know you can use any clock but I wanted a history of tasks done).

 

So I found a really cool Adobe Air application which has been developed free. http://code.google.com/p/pomodairo/. If you are one of the unfortunate Apple Mac users Winking smile a friend of mine uses http://pomodoro.ugolandini.com/

 

 

If you interested in reading more about the technic have a glance at http://www.pomodorotechnique.com/

 

Happy days!

Windows 7 Desktop helpers

By Kenneth 'RabidDog' Clark at December 15, 2011 11:48
Filed Under: Open Source, Personal

This morning I went on a mission to organise my desktop icons. I usually try and sort them logically but it appears that in my old age and perhaps an element of laziness is causing my desktop to become, shall we say, uncontrollable?

 

Fiddling with Ubuntu last night I noticed how the unity interface groups icons for you. So I wondered if anything like that existed for windows and guess what, something very similar does indeed exist. Check out http://www.stardock.com/products/fences/ and smile. My desktop went from a cluttered in cohesive, speed valuable time isolating shortcuts and links to this:

 

mydesktop

 

 

Nice and neat, structured, just the way I like it. This is a custom layout and you too can now have this power!

 

Then comes the inevitable question of multiple desktops. Well again, the only decent on I have found is a product called Dexpot which can be found here http://dexpot.de/index.php?lang=en. Still absurd how Microsoft hasn’t built this into their OS.

Airsoft AK 47 MS

By Kenneth 'RabidDog' Clark at September 25, 2011 18:55
Filed Under: Personal, Airsoft, Tactical

YAY! I finally got myself an airsoft rifle care of the folks at http://www.kreature.co.za. Full metal so it weights roughly 3kgs which is really neat (don’t really enjoy the plastic ones that feel like I am carrying a water pistol). My initial impression is that it is pretty neat. It doesn’t quiet have the resonance our presence as the real one (but you can’t go around discharging AK 47s randomly unless you are in some North-African countries) but it seems to work cool.

 

Lets have a look at a couple pictures shall we?

 

First up the rifle with the two point sling mounted and the stock extended

IMG00081-20110925-1556

 

Pretty neat huh? Next we take a look at it with the stock folded (still with the two point sling)

IMG00083-20110925-1558

 

Right my next challenge was charging the battery. I found a really cool site that describes the formula for charging the battery. The formula goes like this:

 

(battery capacity (battery's mAh rating)/charger output (mA - usually written on the charger)) x 1.4(for NiCad batteries, 1.5 for NiMh batteries) = time (in hours).

You can view the rest of the discussion here : http://answers.yahoo.com/question/index?qid=20091013093650AAcTEBp

 

So I worked mine out and it needed 4 hours according to the formula. So I charged it for four hours and went outside to have some fun. The battery died in 5 minutes Sad smile

 

So I remembered that some batteries require a longer initial charge. So I gave the guys at Kreature a call and asked what the story was. Seems the Ni-MH type batteries require and initial charge of 8-12 hours! Ok well at least there is nothing wrong with my battery. So now it is plugged in again and this time I will leave it for 10 hours.

 

Anyways, still very excited to finally have it (been trying to get one for over a year now!) so waiting a few more hours ain’t going to kill me. Now it is time to start finding some games!

Facebook vs Google+

By Kenneth 'RabidDog' Clark at September 19, 2011 20:13
Filed Under: Personal, Web

I logged on to www.facebook.com today and noticed something called “smart lists”. Upon closer inspection this feature is a mechanism to group friends and view only their feeds. Nice, so now you can isolate the feeds you want to see as opposed to having to sift through endless notifications from apps your friends are using that they need “an axe to chop down trees” or a neighbour “has found your long lost gold fish” or any other arbitrary rubbish that gets pushed to your news feed trying to get you to consume the application. So, yeah neat and original idea. Oh wait, it is not original! Doesn’t Google+ circles offer the same functionality? Well I suppose it does, I mean after all if it looks like a circle and acts like a circle it must be a circle “symbol crash”.

 

Upon seeing this I remembered that www.facebook.com was suing someone over a very similar infringement of their beloved news feed.

 

So after reading an interesting article about who is suing who in the mobile space I thought I would see who www.facebook.com is suing (Google Search Results) I almost wet myself laughing when I viewed the results. So I thought, why not see who else is suing who. My next stop was who is Google suing (Results). The more I went on the more I started realising that software not only makes business supposedly run better but it is currently, single handed, funding law firms. With so much effort being pushed into suing people to get money that they feel is theirs no wonder there has been no significant break through since world war 2.

 

Let me validate that statement. World war 2 saw the discovery and implementation of:

Jet aircraft

Fuel injected engines

Ballistic missiles

Nuclear Fission 

Assault Rifles

Radar

Sonar

Precursors to the computer

Devices used in household appliances

Multi track recording

Synthetic rubber

 

and the list goes on and on. So tell me, what have we discovered since world war 2? Asides from making computers small and more powerful? Asides from increasing the capacity of previous discoveries? What have we done in the 66 years after world war 2? Well in my estimation, squat.  Argue all you want but provide me with proof. All we have done is create a society based on rampant consumerism, technological devices get upgraded and upgraded and upgraded, even though we are using less than 50% of the actual capacity of the machines.

 

Anyways this isn’t supposed to be a rant about society, it is just a pointer to how incredibly backwards we have everything. Perhaps I should do an article about creating opportunities for innovation in this space. Maybe I will if I get time. In the mean time, let carry on suing everyone because at the end of the day surely no one in the worlds population of ~6,775,235,700 people  could possibly have the same idea as me. I mean, I am just that special!

Java Hibernate Setup

By Kenneth 'RabidDog' Clark at September 15, 2011 01:02
Filed Under: Code, Java, Personal, Hibernate

Ok here we go again. Now I am struggling get Hibernate working with the persistence unit declaration.

 

The reason I am writing this is more a pointer to myself should I ever have to do this again. Oh, check out my project on github. It is an implementation of a repository pattern using hibernate. It is extendable if you download the source and implement other providers. It is defined for standalone instances, not the full Java 5 EE stack although I am pretty sure with a bit of tweeking it can be used in that instance. Available here https://github.com/RabidDog/Java-Repository-Definition

 

First I was getting the dreaded "javax.persistence.PersistenceException: No Persistence provider for EntityManager named”. After a little testing I figured out that the properties file contained an inverted commas wrapped persistence unit name where it should not have been wrapped

 

datastore.database.persistanceunit = "PU1" -> wrong!
datastore.database.persistanceunit = PU1 -> resolved correctly.

 

Ok so yeah I am rusty but bare with me. After getting that right I started running into Unable to build EntityManagerFactory. Drilling down a bit further it came down to not having an initial context. So I went and manipulated the persistence.xml file to no avail. Then I started digging deeper and found a ClassNotDefined exception (doh!). Seems I had forgotten to include the Postgres driver jar file (this is one feature I really like in C#, if you reference an assembly that references another assembly you get a warning if you haven’t referenced the dependency. Although I can see how this falls through using an XML configuration when there is no type checking happening. So the driver is obviously being created using some sort of reflection. Note to the Hibernate and JPA developers – please provide more verbose or smarter messages. Perhaps I just need to wake up!

 

Ok well, now the persistence.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="CommunityPlatformPU" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
            <property name="hibernate.connection.username" value="xxx"/>
            <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
            <property name="hibernate.connection.password" value="xxx"/>
            <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/database"/>
            <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
        </properties>
    </persistence-unit>
</persistence>

Right, new exception to deal with. For primary keys I prefer using UUIDs or GUIDs as they are always unique. Yes I know indexing issues blah blah blah speed related issues blah blah blah. I use it for a reason. When I transform the data into XML I want globally unique Ids so I can link via Ids. Now I usually got round this with the @PrePersist annotation (because the implementations only supported the integer values) but wanted to see if there had been any improvements since my last run in with JPA. Turns out there has been.

 

This is the way you use UUIDs as PrimaryKeys

@Id
    @GeneratedValue(generator="system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid2")
    @Type(type = "pg-uuid")
    private UUID id;

    public UUID getId() {
        return id;
    }

    public void setId(UUID id) {
        this.id = id;
    }

 

Cool!  Next …

 

This little rig didn’t seem to like the jdbc3 drivers so switching to the jdbc4 drivers seemed to resolve that.

 

So that is that! Finally my test is passing and I am able to go to bed Smile  Well almost. Next it is time to configure the caching for the database and the connection pooling. Seems most of the libraries are included in the hibernate distribution. So the final persistence.xml file looks like this:

 

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="CommunityPlatformPU" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
            <property name="hibernate.connection.username" value="dev"/>
            <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
            <property name="hibernate.connection.password" value="dev"/>
            <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/communityplatform"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            
            <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" />
            <property name="hibernate.cache.use_second_level_cache" value="true" />
            
            <property name="c3p0.min_size" value="5" />
            <property name="c3p0.max_size" value="20" />
            <property name="c3p0.timeout" value="300" />
            <property name="c3p0.max_statements" value="50" />
            <property name="c3p0.idle_test_period" value="3000" />
            
            <property name="current_session_context_class" value="thread" />
        </properties>
    </persistence-unit>
</persistence>

Green light on the tests, creating the database structure and persisting the information. Cool, now it is definitely time for bed, big day tomorrow, Skye turns 6 Smile

 

References:

http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/mapping.html#d0e5294

http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-hibernatejdbc

http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performance.html#performance-cache

Java resources (.properties)

By Kenneth 'RabidDog' Clark at September 14, 2011 21:41
Filed Under: Java, Code, Personal

Ok so I am making progress on a fiddle project that I am working on. I decided I was going to store the the persistence unit name in a properties file to prevent embedding strings in the instantiation methods.

 

I sat and fought for sometime trying to get the resources as a stream and came across some interesting links that explain how to do this. Namely:

http://www.bartbusschots.ie/blog/?p=360

http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html

http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getSystemClassLoader%28%29

http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResourceAsStream%28java.lang.String%29

 

After fiddling and fiddling and getting very frustrated with the NullPointerException that kept on happening I was just about to give up.

 

Then I realised something. Looking at all the examples there is something I had added that I shouldn’t have

//Spot the ERROR!
Properties configFile = new Properties();
configFile.load(ClassLoader.getSystemResourceAsStream("/za/co/codeshark/application.properties"));

 

Don’t feel bad if you don’t see the problem. Laugh at me if you do Winking smile So here is the problem. If you have a look at the string pointing to the resource it has a leading “/”. Yes, this makes the path unresolvable. So it should have look like:

Properties configFile = new Properties();
configFile.load(ClassLoader.getSystemResourceAsStream("za/co/codeshark/application.properties"));

 

Notice that there is no leading “/”. Once I made this change everything started grooving and I was able to access my resource file. Once again kicking myself for not keeping these skills fresh. I find it weird though, that with all the examples of how to do this, none point out anything about how to resolve the path. Perhaps I am just over tired but I figured it might be good to make a note of this for 50 years from now!

SABC TV Licenses

By Kenneth 'RabidDog' Clark at August 31, 2011 10:07
Filed Under: Personal

So I get this nasty letter the other day, demanding I pay my TV license. I then proceed to tell them I have. I am then requested to provide proof of payment. So I attach it to an email and distribute it to the SABC and their debt collection agency. This was three weeks ago. Today I get this:

 

Your message
   To: Justin Dorkin
   Subject: Outstanding TV license account - TV License No: *******
   Sent: Thursday, August 11, 2011 9:24:23 PM (UTC+02:00) Harare, Pretoria
was deleted without being read on Wednesday, August 31, 2011 9:50:29 AM (UTC+02:00) Harare, Pretoria.


 

Though it was funny how it was “demanded” of me to pay and prove it yet when I do comply it is not even considered.

 

Another update to the unread email saga:

 

Your message
   To: Gina Grond
   Subject: Outstanding TV license account - TV License No: ******

   Sent: Thursday, August 11, 2011 9:24:23 PM (UTC+02:00) Harare, Pretoria
was deleted without being read on Friday, September 02, 2011 8:30:51 AM (UTC+02:00) Harare, Pretoria.

 

Seems no one wants to read my emails Sad smile

mDesktop–Multiple desktops on Windows 7

By Kenneth 'RabidDog' Clark at August 29, 2011 15:53
Filed Under: Personal, Work

I have been quite annoyed for some time now because I cannot have multiple desktops on windows (by this I mean it is not native to the OS install). I was using a product called Dexpot but it for some reason stopped working so I went fishing to see what I could find. Every desktop manager I came across was bloated, didn’t work properly and just didn’t fit the bill. I wanted a light weight desktop switching application for Windows 7.

 

I was just about to give up and start writing my own when I came across mDesktop. Brilliant! Light weight, small foot print. Very cool.

 

You can find it here http://code.google.com/p/mdesktop/

 

Cheat sheet:

Alt+Desktop Index (e.g. Alt+1, Alt+2...) switches between desktops

Alt+Ctrl+Desktop Index sends the active window to the Desktop Index

 

Happy days! Perhaps Microsoft will catch a wake up one day regarding multiple desktops. The API is there, can’t for the life of me figure out why they haven’t done this.

In Flames “Sounds of a playground fading”

By Kenneth 'RabidDog' Clark at August 25, 2011 18:56
Filed Under: Music, Personal

In Flames has without doubt, in my opinion produced a master piece with this new album. The sound is raw, something I noticed in the Iron Maiden album “Final Frontier”. It is not over produced, it is just right. I really hope this becomes a trend with current bands, letting the musicians abilities speak as opposed to post production covering everything up leaving you with a thick soup lacking any texture, very quickly becoming unpalatable.

 

The new album sees In Flames go back to the roots of their art as first displayed in “Whoracle” (which is still one of my favourites). The guitar harmonies are back, holes of silence appear filled with nuances that add flavour back to their music.

 

The great metal bands of old can be heard as their influences again which I truly enjoy. Yet even though the influences can be heard the overall sound is still undoubtedly their own. The best part out about the album is the price. I cringed as I asked what the price of the disk was and was pleasantly surprised to hear “R139.00” as opposed to the “R270.00” I had become accustomed to. Basically half price! Could this drop in price be due to the fact that people can now buy single tracks online and the demand for hard media is dropping? I certainly hope the downward trend in pricing continues because it became seriously out of hand at a stage in South Africa.

 

Well that is that, fantastic job to In Flames and all involved in the new album. I am thoroughly enjoying it and cannot wait to get it onto my portable player and give it a listen while taking a long ride. I love the strong anthem flavour prevalent in most of the tracks and take my hat off to the craftsmanship. Perhaps a change in line up is what the band needed to stabilise itself again? Though it is sad to see a member leave sometimes change allows retrospect and a realigning back to the original vision that got them to where they are.

The internet has it’s moments.

By Kenneth 'RabidDog' Clark at March 29, 2010 18:23
Filed Under: Personal

Well I remember a little application called blender when it was but an infant. Pre version 1 release and was a great deal of fun to mess around with. 3D render was cool when you have always dreamed of doing things like that. I am talking round about 10 years ago. Incredible how tie flies.

Anyways back to the post. In my travels across the internet I came across little blender again. Although now it is not so little! With the little bit of browsing and playing I have done with it, it is becoming a fully fledge 3D animation studio and the best part? It is free. No really it is. They happily accept donations but you don’t have to pay a cent to get the software. I have no idea how the project is funded but what I did really like is the community around the project.

I have never heard of the concept of “open movie” and initially thought it to be a piece of software but it is something very different. I am no expert in it but what it seems to be is a community of artists (3D, video and audio) who get together and create a movie using open source technologies. (I personally would like to know what video editing software they use because I haven’t found any open source ones.) This sounds really cool but what I think is the ultimate is that they distribute certain assets of the movie. The one asset I saw them sharing was the 3D models from the movie. I personally recon this is brilliant. Characters now have the ability to live outside the context of the creating studio, there by giving them a life of there own. So often guys have had to take screen shots of videos and then edit them specifically to give the illusion that they might be in a different scene. Now you can do that yourself. Take the character and recast them in a different movie. So now the 3D characters are just like real life actors without out the attitude and enormous pay cheques.

Well don’t take my word for it but rather check it out at http://www.blender.org . It really is a worth while way to spend 15 minutes and perhaps far more time if it is your thing. I personally have an idea for the software already. Big thanks to the guys developing this software. Your time is appreciated more than you can imagine.



I am South African. Always have been always will be. I love my country. I love my wife and two children.


I also really enjoy solving problems. I currently work as a Software Architect exploring new solutions for business problems. Having been round the block a few times I enjoy showing new developers how best to solve problems, how to find answers and how to approach solution development.


In my spare time I enjoy riding my super bike, training in Systema and horsing around with my family.


Month List

Visitors

Twitter Feed

6. February 18:01
Unit tests don't check if code works. They PROVE the code works!

12. January 23:34
@Annaling horrific. People like that should face sever punishment. Unless of course they tried to find the cat :(

12. January 08:28
@Annaling to fix cat problems u need a dog :)

9. January 15:34
@UnexpectedPippa my boy is 2. They rock! My daughter, son and myself have endless fun with them!