Implementing a Java-based AWS Lambda Function triggered bySNS aws, javaLeave a comment

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

Maven dependencies:

dependency
groupIdcom.amazonaws/groupId
artifactIdaws-lambda-java-core/artifactId
/dependency
dependency
groupIdcom.amazonaws/groupId
artifactIdaws-lambda-java-events/artifactId
/dependency

The signature in the Java-based Lambda Function need to consume com.amazonaws.services.lambda.runtime.events.SNSEvent:

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 bySNS
Appreciate the one who gives you what you need, be mindful of the one who gives you what youwant linkedin, thoughtsLeave a comment

Its 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 youwant
If youre smart enough to complicate matters youredumb linkedin, thoughtsLeave a comment

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 youre smart enough to complicate matters youredumb
How to avoid Kurzweils Singularity fun, linkedin, thoughtsLeave a comment

Ray Kurzweils singularity is made possible by human knowledge digitised and accessible to computers. (Same applies to Skynet becoming self-aware and eradicating humans). But wait we can beat it: stop writing down anything, revert to oral tradition.

How to avoid Kurzweils Singularity
The Five Perspectives of OffshoreOutsourcing linkedinLeave a comment

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

Offshore: low riskBusiness: low rateDevelopment: low skillsManagement: low velocityCustomer: 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 OffshoreOutsourcing
ADT Exception: com.android.dx.util.DexException: Multiple dex files define android, linkedin3 Comments

Ive 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: com.android.dx.util.DexException: Multiple dex files define
Factory Reset for LG 3DP920 android, linkedin6 Comments

First of all DONT 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.

Switch off the phone, disconnect if from the PCTake 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)Install the LG USB Driver and LGMobile Support Tool from the LG update site (Aussies on Optus go here)Reboot PCLaunch the LGMobile Support ToolPress and keep pressed the Volume Up button while connecting phone and PC via USB cableDesktop should install more driversUpdate Tool should show phone as connectedSelect Customer Support Recovery PhoneEnter IMEI (no hyphens), Check, OKSupport Tool closes, updater software launches after a few secondsUpdater starts to download firmwareUpdater then connects to phone and uploads / resets phone

If it doesnt work, then dont 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 fixeddont 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 Dans Exploit gets you there..

Factory Reset for LG 3DP920
Growing a Single Giant Fruit is a Dumb Thing for a Tree toDo linkedin3 Comments

If a fruit tree put all its effort into generating a single giant fruit in its entire life time, then Id 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 wouldnt have fun, either, as the chances of pollination would be minimal. But I think Im 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 doesnt count until Ive 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, arent 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 ?

Im making this up but maybe theres 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 toDo
W.H.Y. exactly are we cutting carbon emissions?? linkedin8 Comments

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 Ive 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. Earths climate with its interactions to the rest of the planet is an extremely complicated system and certainly not reversible in this sense. There cant 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 cant be whats 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 cant tackle the climate challenge this way but its a good pretext for improving air quality  and general environmental awareness. Sounds logical. Its 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 areIdentical java, linkedin2 Comments

Yepp. At least thats what I found.

Summary

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 elses 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 dont care, dont care, dont care.

How To

If youre 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:127.0.0.1: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 areIdentical