developer

Developer Blog

[I'm a little late posting about this one, but it is still a cool feature]

AWS just keeps pumping out features. One of the latest was multi object delete in s3.

Previously, if you wanted to delete multiple objects within an s3 bucket, each delete operation had to be contained in a single API requests... which quite honestly is slow and clunky. If you wanted to delete 5,000 objects you are going to have to make 5,000 API calls.

I use Amazon's EC2 for a multitude of things - including personal use as an IRC bouncer, a website host, and a SOCKS 5 proxy. Sure, there are more cost effective VPS providers out there for the types of things I'm using EC2 for when it comes to my personal usage pattern. However, I pay the extra money because I love the API and I totally grok Infrastructure as a Service.

Case in point, I open only ports 22 and my port for IRC bouncing to whatever my public IP address is at the time. I don't switch public IP addresses that often, so it was never onerous to do this through the AWS console.

But this morning I decided to sharpen my boto and python knife and script up this process too. What I have now is a script I can evoke on the command line that accepts two options, --port and --group. For whatever --group I specify, rules will be created to allow inbound traffic from my current public IP address on those ports to any instances that belong to the group I specify. Additionally, if any rules previously existed on that security group that have a port range that is upper and lower bounded by a port specified (meaning, a rule listing a single port instead of a true port range), then those rules are moved. This allows me to make sure access to the instance(s) in my security group is limited to only the public IP address that I'm coming in from.

Here's an example usage:

Here, 99.98.113.100 is the public IP I'm coming in from.

What this doesn't do (yet) is detect when my public IP address has changed and automatically change the security group rules to take my new public IP address in to account. There might be fun ways to do this - possibly by listening to OS events for changes to network interfaces. More crudely, the script could just run in the background and hit http://whatismyip.org periodically to check if the response body has changed since the last time it was run.

Anyway, here is the code on Github. Enjoy!

Roughly a year ago I started taking a look at Scala and decided to whip up a quick TicTacToe example just to see what coding in the Scala language was like. I was very fascinated by the pattern matching available in Scala since it works like a switch statement on crack (putting it simply, though it is a bit more). The results of that are found in a previous post here.

Recently I've been reading through Programming in Scala 2nd Edition which does a great job of introducing Scala in steps while also lightly nudging you to write code in a more functional manner. I like reading a book while also coding on the side to put in to practice what I'm reading, so I found my old TicTacToe code, put it on Github to share and started hacking at it to try and do some things in that code base that are more functional. This post describes my basic thought process through those changes.

From this ReadWriteWeb post:

Build a service-oriented architecture: Jeff Bezos once said that when you load a product page on Amazon, you are calling 200 different services. This type of architecture, with a clear, externalized, and easy to use API, allows you to quickly build native client apps that serve as thin interfaces to your application.

Here is a really fun blog post about how one developer swapped out his Macbook Pro for an iPad and Linode.

My first reaction upon reading this is "oh that's cool.. but that won't apply to me". This is mostly because I work in the Java enterprise/SOA space - this means working with lots of fat tools and IDEs. I don't quite have the luxury, nor the kung-foo yet in vi to even begin to pursue a work setup like this.

But do I need to?

I'm at the airport for a little while today, so I tried to do something mickey mouse in scala, just to sharpen the (very dull) steel. The result? A greatest common denominator function implemented in a purely functional style using some Scala idioms.

In short, I just want to get in to the habit of not having internal state anywhere in my code, including with the functions. I also wanted to avoid doing any kind of imperative looping construct in my code, and instead solve this with a recursive method. As a result, I have an inner function defined that handles the euclidian algorithm. That function uses pattern matching, as opposed to conditional statements, to determine if it needs to keep calling itself recursively or if it can return one of the two values it received.

Goofy yes, but it demonstrates some basic features of scala.

I love Python. I love Boto. I love EC2.

I often hate having to drill down deep in some loops to get at some attributes of an instance.

To solve this, I used the itertools library in the Python distribution and some list comprehension to do something, like retrieving all instance Ids for a given EC2 account in a given region. Here's how:

Message groups in JMS provide a way to identify a set of related messages. The messages could be related by anything - a customer order number, for example. Basically a JMS broker provides a guarantee that any messages that belong to a specific group will always be consumed by a common consumer. For instance, imagine that we've used the splitter pattern to split out line items from an order but want to aggregate those line items together later in a route. In order to perform that aggregation you need to guarantee that all of the messages being aggregated together are consumed by the same consumer.

Below is an example of using message groups with ActiveMQ within Apache Camel.

I am a recent convert to Intellij Idea. It is just a superb IDE for development of all kinds. However, I find the initial default color scheme that it comes with to just be entirely too bland and hard to look at and read.

My solution to this problem with Terminal.app and Vim is to use the ir_black theme. However, there was no pre-existing Intellij ir_black them that was hacked up by anyone.

Well, here is my initial crack at it...

A quote from Nolan Bushnell; you know, the guy who gave us Atari:

The critical ingredient is getting off your butt and doing something. It’s as simple as that. A lot of people have ideas, but there are few who decide to do something about them now. Not tomorrow. Not next week. But today.

This made me think back to previous post regarding the Social Network and Mark Zuckerberg. It's all about getting off your arse and executing. Thinking and talking about ideas is necessary to a degree, but unless you are in your editor writing code or in your terminal working on a system, you are not progressing your skills or your projects whatsoever. Talk is cheap. Action is priceless.