Implementing a Java-based AWS Lambda Function triggered by SNS

I had some initial trouble finding documentation on how to consume AWS SNS events from a Lambda function implemented in Java. The signature can’t be your domain POJO it seems, it has to be a SNSEvent. Here’s what worked for me:

Maven dependencies:


The signature in the Java-based Lambda Function need to consume

public String processSnsEvent(SNSEvent event, Context context) {
String input = event.getRecords().get(0).getSNS().getMessage();
return processInputFooBarSomething(input)

Implementing a Java-based AWS Lambda Function triggered by SNS

Appreciate the one who gives you what you need, be mindful of the one who gives you what you want

It’s a common knowledge that one should give a child what it needs, not what it wants. I tossed this around until I saw the flip side…

Corollary: the one who tells you what you want to hear may not be the one you should listen to.

Appreciate the one who gives you what you need, be mindful of the one who gives you what you want

If you’re smart enough to complicate matters – you’re dumb

Some people seem to believe that complicating matters and making it a continuous, repeated challenge to execute certain steps is a strong demonstration of their intelligence. I tend to believe that solving the problem once, writing down the solution in simple monkey steps and not having to use brainpower for this matter ever again is a demonstration of, uhm, meta-intelligence.

If you’re smart enough to complicate matters – you’re dumb

The Five Perspectives of Offshore Outsourcing

Offshore outsourcing is perceived differently by each stakeholder. This is what my experience shows:

  • Offshore: low risk
  • Business: low rate
  • Development: low skills
  • Management: low velocity
  • Customer: low quality


(I may be breaking some kind of a unspoken rule here, as there is a whole industry built on outsourcing and people have risked their career blindly committing to such method of temporary cost cutting. I do not mean to offend anyone and am open for evidence that shows contrary. Evidently I am generalising as much as the advocates of offshore outsourcing claiming fantastic benefits do)

The Five Perspectives of Offshore Outsourcing

ADT Exception: Multiple dex files define …

I’ve spent hours trying to resolve this problem when launching an app. I followed plenty of misleading posts…

In my case it ended up to be a *.apk file hiding in a project.

I deleted the file, then bounced Eclipse. All working again. I hope this saves your day…

ADT Exception: Multiple dex files define …

Factory Reset for LG 3D P920

First of all – DON’T PANIC !

Resetting your LG 3D P920 is a piece of cake and requires no soldering. All you need is a Windows PC and a USB cable.

  1. Switch off the phone, disconnect if from the PC
  2. Take out battery, write down IMEI that can be found on label in the battery bay, put battery back (if you already know your IMEI, then still cycle the battery)
  3. Install the LG USB Driver and LGMobile Support Tool from the LG update site (Aussies on Optus go here)
  4. Reboot PC
  5. Launch the LGMobile Support Tool
  6. Press – and keep pressed – the Volume Up button while connecting phone and PC via USB cable
  7. Desktop should install more drivers
  8. Update Tool should show phone as connected
  9. Select “Customer Support” – “Recovery Phone”
  10. Enter IMEI (no hyphens), “Check”, “OK”
  11. Support Tool closes, updater software launches after a few seconds
  12. Updater starts to download firmware
  13. Updater then connects to phone and uploads / resets phone

If it doesn’t work, then don’t bang your head against a wall. Try the process again. I think I may have had to reboot once or twice until I got past step 7 & 8.

Oh, and I found the latest su updates to break stuff (October ’11), so wait for updates of SuperUser until this is really fixed…don’t update.

P.S.: Yes, rooting definitely works with SuperOneClick 2.1.1. and phone software version V10J for Australian Optus P920. (The software version can be checked via the LG Tool). But if you go too crazy with removing bloat or similar, then you may need above steps…


Update Aug 2012: no more issues with su. And the download will now get you Ginger Bread 2.3.5 which has significant speed improvements. SuperOneClick fails to root as GingerBreak fails. But Dan’s Exploit gets you there..

Factory Reset for LG 3D P920

Growing a Single Giant Fruit is a Dumb Thing for a Tree to Do

If a fruit tree put all its effort into generating a single giant fruit in its entire life time, then I’d consider this a complete failure. Nature has learnt that producing offspring is a numbers game when there is luck and odds involved. So the tree would do a bad job at preserving its legacy. The few pips would likely be ignored, lost, damaged or remain too close to home. The tree itself would have a tough life as well. Putting all effort into a single fruit would mean working against the natural restrictions of its environment. Seasons would have to be worked around, water and other resources would be put into a single vulnerable spot. Carrying a giant fruit would required stronger branches, hence a change to a design that took millions of years. (The tree wouldn’t have fun, either, as the chances of pollination would be minimal. But I think I’m at the point now where I should move on from this metaphor.)

What inspired the metaphor was the dealing with self-imposed pressure to achieve big things. Me personally, I get this pressure as a natural consequence of being a creative mind, combined I guess with the self-assessment that all this creativity doesn’t count until I’ve produced at least one artefact that will count as my legacy. Evidently,this pressure comes with the expectation that the artefact would be of considerable size to be noticed by my environment. There are of course many other motivations to try and grow a giant fruit. Many individuals work hard for some form of fame and fortune and media events such as cooking, dancing, singing, travelling, surviving and inventing competitions spark the run for the long way to the top even more.

I did come to realise that what I occasionally envy great achievers for – the step to lock themselves into a room for an entire career and to focus on their oeuvre only –  is indeed an extremely selfish, unnatural and plain dumb move. What I mean are the artists, scientists, politicians, business men etc. that sacrifice bonding with their children, marriages, fun and adventures in order to put all resources into growing a giant fruit.

If you want to achieve something great, aren’t you doing it for yourself ? Who can judge more than yourself what hard yakka and long journey it will have been ? Do you really need to produce something as giant as whatever you think matches the benchmark of a TV Master Chef jury, Pulitzer award, national elections or fat payout ?

I’m making this up but maybe there’s a guy out there who could write Nobel price material if he spent a life working towards it. Instead, he teaches kids the beauty, fun and usefulness that can be found in science. He is a healthy and very effective fruit tree. He is continuously creating generations of positive outcomes in his environment, a legacy that will spread and trigger even more amazing developments. He is (hopefully) keeping enough spare resources to put effort into other aspects of life, which guarantees an ongoing experience for all involved. Oh – and he is less likely to fail in his mission.

My point is that continuously producing small achievements within the immediate environment, and without creating an imbalance in where resources are being spent, is not only more sustainable, but also promotes evolution and eventually has a longer, broader and more positive impact than a single giant fruit that by this stage of my blog is already starting to smell rotten.

Legacy happens via distribution and long term value to some community. It does not guarantee for names to be mentioned in news flashes or history books. But it does turn individual actions into ongoing motion and is likely to be rewarded with a lot of karma points. Most importantly, the rewards are genuine and guaranteed.

Growing a Single Giant Fruit is a Dumb Thing for a Tree to Do

W.H.Y. exactly are we cutting carbon emissions ??

Carbon emissions are one of the factors that are likely to have triggered climate change. Ok, I get that part. But how did we come to the reverse conclusion that simply by reducing carbon emissions we will be able to tackle the complex challenge of climate change ?

With all the effort and finance put into it, I would assume that there is good scientific reasoning behind such strategy. I just fail to find any concise and convincing documentation for it.

Can you help me finding the chain of deduction that leads from “greenhouse gases are causing climate change” to “carbon reductions will lower the negative impact of climate change to human mankind” ?

Here are the explanations I’ve tried so far:

Hypothesis 1: “Carbon caused the green house effect, so reducing emissions will revert it.” Anyone with minimal understanding of so-called non-linear dynamical systems (‘chaos theory’) will have to ditch that hypothesis into the very-very-very-unlikely-bucket. Earth’s climate with its interactions to the rest of the planet is an extremely complicated system and certainly not ‘reversible’ in this sense. There can’t be scientific evidence for this approach as no model could provide such accurate prediction. (I may have to elaborate on this soon).

Hypothesis 2: “Carbon caused the green house effect, so reducing future emissions will make it less bad.” So we have proof that reducing emissions will slow down climate change ? Again, if not via climate models, how else could such statement be deduced ? (And if this was our rationale – why are we hand-balling the problem to our children instead of preparing them ?)

Hypothesis 3: “Carbon reduction is a new market with huge potential“. This one actually sounds logical. But surely this can’t be what’s happening, as various non-profit movements would not be supporting the carbon cutting for such capitalist motivation. Moreover it would leave the question open if this approach does fight climate change or not. (Nevertheless, it would be a pretty clever master plan, I have to admit: re-directing the environmental movement towards generating a new market – even with own stock exchange – and getting the politicians to promote it for free. Why did no one use this business opportunity when acid rain was still talked about ?)

Hypothesis 4: “To be honest, we know that we can’t tackle the climate challenge this way – but it’s a good pretext for improving air quality  and general environmental awareness“. Sounds logical. It’s a scam – but for the better. I approve and move on.

W.H.Y. exactly are we cutting carbon emissions ??

Remote Java Debugging via SSH Tunnel Only Works if Local and Remote Ports are Identical

Yepp. At least that’s what I found.


Remote debugging a Java application from Eclipse (or other IDE)  is a great tool. Even if the source code is not available and decompilation due to legal restrictions a no-no: IDEs will allow you to step through the code, showing a strack trace and variable values. This is an often underrated tool to figure out what the hack is going on, especially in someone else’s code.

If your Java application is not only running in a different JVM, but on a different host (such as a virtual machine or a cloud instance), then SSH may be the only secure way to connect to the host. The only way I got the combination of SSH and remote debugging working however, is if I create a SSH tunnel where local and remote port are identical. This may be due to exotic network settings or the actual nature of technology – don’t care, don’t care, don’t care.

How To

If you’re not sure how to set it up:

Start your remote Java application with the following extra options:

-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=80

Create the SSH tunnel (Ubuntu example):

sudo ssh username@hostname -L 80:

Then create a remote debug configuration in Eclipse, pointing to localhost and port 80. Evidently, the choice of port 80 is arbitrary, any port that is not taken on both, local and remote host will do. Also note that if the default ssh port 22 is closed on either side, then the SSH server can be configured to listen to e.g. 443 or another open port. In this case, add ‘-p 443’ to the ssh command.

Remote Java Debugging via SSH Tunnel Only Works if Local and Remote Ports are Identical