Migration in progress
Currently migrating content from Blogger, please excuse the chaos. Excerpts and pagination should now be (mostly) correct, a few other useability improvements are still in progress.
-
Python gotcha: bound method
A quick Python observation that will hopefully save somebody some time. Given the following Python code:
class Example:
X = 5
def __init__(self, value):
self.some_value = value
def method(self, value):
if value > Example.X:
return 'Yup'
return 'Nope'
def another_method(self):
return self.method(self.some_value)
e = Example(2)
print e.some_value
This code defines a class named Example, instantiates it and prints out one of the class member variables. In this case the code will print out the value "2" which is logical as it was used to instantiate the object. -
The MWEB uncapped ADSL myth
I was the unlucky recipient of an acceptable usage notification email from MWEB last night. It turns out that their 10Mbs uncapped account is actually a 125GB capped account and that R749 (my last MWEB bill) every month only actually buys a 1.5Mbps line. I can't say that I am terribly surprised, there is a trend with South African ADSL providers to start clamping down on "high usage" users, MWEB is merely notifying users via email when they have reached this lofty state.
-
Java WAR deployment options on AWS Elastic Beanstalk
Elastic Beanstalk deployment is pretty cool for interpreted languages like Python, Ruby, or PHP where all you need to do is a "git aws.push" to deploy the latest version of your application. The AWS Toolkit for Eclipse is also great for Java deployments but what if you want to deploy a manually built WAR? This post lists a few of the options available. It assumes that you have already created an Elastic Beanstalk application using these instructions. The example uses an application name of war-test and a WAR file named sample.war (kindly provided by Apache Tomcat here).
-
Self-contained JAR file creation using Maven Shade Plugin
Trick for the day. Adding the Maven Shade Plugin (as described here) to your pom.xml allows you to generate a self-contained executable JAR file including all libraries and dependencies.
-
Python cx_Oracle on Ubuntu 12.04
There are some older articles on getting cx_Oracle working using RPMs and alien but it seems Oracle are now providing non-RPM downloads. Below are the (quick and dirty) steps I followed to get it installed on Ubuntu 12.04 x64.
-
Fixing compile error for AWS Java sample
If you are getting an error like:
~/aws-java-sample/src/main/java/com/amazonaws/samples/S3Sample.java:[94,31] error: for-each loops are not supported in -source 1.3
When trying to build the aws-java-sample from GitHub you can fix it by adding the maven compile source and target (see link). -
Ruby DevKit compilation errors on Windows
Lesson for the day, when installing Ruby DevKit on Windows ensure that the Ruby installation architecture matches the DevKit architecture.
-
Yesterday Perl script
A quick script to display yesterday's date in a specified date format