Running SQL on Heroku

If you need to run some SQL manually on Heroku, the Heroku SQL Console is exactly what you’re searching for.

It’s installed in 5 seconds:

heroku plugins:install git://github.com/ddollar/heroku-sql-console.git

DeliciousTwitterFacebookLinkedInRedditSlashdotTechnorati FavoritesDiggShare
Posted in Heroku, RubyOnRails | Leave a comment

Where Good Ideas Come From – Steven Johnson

If you ever were curious about how innovation actually works this video is probably what you should start with:

If you found this video interesting, you definitely want to get a copy of Johnson’s awesome book “Where Good Ideas Come From”.

Johnson found, that there are re-occuring patterns which support innovation. He describes these patterns in seven chapters which there are

  1. The Adjacent Possible – New innovations more often than not take existing pieces and put them together in a new way. Each new innovation increases the space of the adjacent possible.
  2. Liquid Networks – History of innovation shows that networks support good ideas and innovation. People connecting to other people and multiple disciplines are more likely to have an innovative thought.
  3. The Slow Hunch – Great new ideas often don’t break through in an Eureka moment. Much more often they linger in the back of someone’s head and need months, sometimes years or decades to develop into something real. Liquid networks at this point can help to bring slow hunches together and then these combined slow hunches lead to a new idea.
  4. Serendipity – Sometimes great ideas come to you in unexpected moments. Johnson talks about a whole bunch of good examples in his book. Sometimes it’s just necessary to free your mind, go for a walk, watch a soccer game, go on vacation and eventually a brilliant connection will occur to you which didn’t come to your mind before.
  5. Error – Innovation is also a history of error. If you don’t want to make any error you likely will never invent anything. By making errors you learn from every single one and if you’re lucky and interpret the errors correctly you might come up with something wonderful new.
  6. Exaptation – Exaptation is a term coming from biology. The feathers of birds for instance were at frist developed by mother nature for means of isolation. Later on however they turned out to be essential for flying. So feathers were exapted for flying. Looking at innovations of the recent centuries from the view point of exaptation, you’ll find that many innovations were possible by using an existing thing in a different way.
  7. Platforms – Platforms support innovation. Platforms allow you to _not_ think about certain things and instead concentrate on the solution of the actual problem you’re trying to solve.

This is a very short summary of a great book, so I hope you got appetite and are going to read it. You can get a copy for example at Amazon.de

DeliciousTwitterFacebookLinkedInRedditSlashdotTechnorati FavoritesDiggShare
Posted in Books | 1 Comment

Getting Started With Spring MVC and Google App Engine

It is amazingly easy to get Spring running on Google App Engine. Here is how you do it.

Install the development environment

I’m assuming you installed a recent version of the JDK. Once Java is installed on your system download either Eclipse or the Spring Tool Suite (STS), which is build on top of Eclipse.

I personally decided for the Spring Tool Suite because it makes it ridiculously simple to install additional plug-ins like for example the Google Plugin and comes with support for Groovy and Grails which I both want to try out at some point. After starting up STS, you’re presented with the STS Dashboard.

Click on the “Extensions”-link and search for the “Google Plugin”. I already installed it, that’s why it’s displayed as installed on below screenshot, but when you get to that page the first time, you can click the check-box on the left and then hit the “Install” button in the lower right corner. It will take a little to install the plugin, but once that’s done you’re ready to go.

Create an App Engine Project

For the sake of simplicity I will create an App Engine project only without Google Web Toolkit. Click on the Google Plugin icon () and specify a project name, a package and disable the GWT check-box.

The plug-in will auto-generate some example code for you which you can deploy straight away to App Engine.

Deploying the App to App Engine

If you haven’t signed up for Google App Engine yet, now is the right time to do so: code.google.com/intl/de/appengine.
Next navigate to appengine.google.com. All you will see is a rather empty screen (at least if you just signed up for App Engine). Click on the “Create Application”-button and fill in the form.

Typically it requires some creativity to select an app ID. I usually use the name I want to use and add some random numbers. That works out well most of the time. If you plan to develop and production application, the app ID doesn’t really matter anyway because you can use a custom domain later on. Once things are set up on Google’s side, hit the “Deploy”-button in STS:

On the upcoming screen, click “App Engine Project Settings …” and specify the app ID you chose in the last step.

Type in the app ID and confirm with OK. Now type in your Gmail address and the password and hit deploy. After a couple of seconds your app will be available at “your app id”.appspot.com.

Adding Spring

Now you will add Spring to the application. Instead of using a simple servlet to return the “Hello World” string you will use a Spring MVC controller.

Adding the right JARs

  1. Download the latest version of Spring 3. I used Spring 3.0.4.
  2. Extract the zip file a copy following JARs to the /war/WEB-INF/lib directory:
    • org.springframework.asm-3.0.4.RELEASE.jar
    • org.springframework.beans-3.0.4.RELEASE.jar
    • org.springframework.context-3.0.4.RELEASE.jar
    • org.springframework.core-3.0.4.RELEASE.jar
    • org.springframework.expression-3.0.4.RELEASE.jar
    • org.springframework.web-3.0.4.RELEASE.jar
    • org.springframework.web.servlet-3.0.4.RELEASE.jar
  3. Additionally you’ll have to add these JARs to your lib directory:
  4. Rename commons-logging-1.1.1.jar to something else, e.g. commons-logging-1.1.1-personal.jar
  5. Add the JARs to your Build Path.

Configuring the App

First, you tell the application to use the Spring Dispatcher Servlet and map it to the root URL. This is the web.xml after the changes:

< ?xml version="1.0" encoding="utf-8"?>
<web -app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
	<servlet>
        </servlet><servlet -name>SpringAppEngine</servlet>
        <servlet -class>org.springframework.web.servlet.DispatcherServlet</servlet>
        <load -on-startup>1</load>
 
	<servlet -mapping>
        </servlet><servlet -name>SpringAppEngine</servlet>
        <url -pattern>/</url>
 
	<welcome -file-list>
		</welcome><welcome -file>index.html</welcome>
 
</web>

Now create a file named “SpringAppEngine-servlet.xml” and paste below XML:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
< ?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
        xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd  
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
 
        <context:component -scan base-package="com.projectsierra.springappengine" />
 
        <bean id="viewResolver"
                class="org.springframework.web.servlet.view.InternalResourceViewResolver"
                p:prefix="/WEB-INF/views/" p:suffix=".jsp" />
 
</beans>

Line 8 tells Spring where to look for your controllers. Line 10 specifies that you will use JSPs as View technology.

Now, the last two things you need to do, is to create an actual controller and a JSP view. First, delete the auto-generated SpringAppEngineServlet class and instead create a HelloWorldController:

package com.projectsierra.springappengine;
 
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
 
@Controller
public final class HelloWorldController {
 
	@RequestMapping(value = "/springappengine",  method = RequestMethod.GET)
	public String HelloWorld() {
		return "MyView";
	}
}

Next create a folder “views” within the WEB-INF folder. Add a file named MyView.jsp. The sole content of MyView.jsp is the string “Hello World”.

That’s it. Start up the development server and hit http://localhost:8888/springappengine:

By clicking the deployment button a second time you can deploy this version of the application to App Engine. If you want to preserve the first version, change the version number in the App Engine Project Settings before you deploy. A live version of above code runs at http://2.springapptest987654321.appspot.com/springappengine.

Resources

DeliciousTwitterFacebookLinkedInRedditSlashdotTechnorati FavoritesDiggShare
Posted in AppEngine | 1 Comment

Software Toolbox for Digital Image Processing

Since I started working in a full time job in 2008 I didn’t really spend much time taking pictures. Last June I decided that I should change that again. I had mainly two reasons. First, I really like taking pictures, second it’s healthy to have some sort of creative hobby other than programming.

After not following the market for digital image processing software for two years I first went through some research regarding which software suites my needs best. After much testing and playing around with trial versions I’m now pretty happy with the ones I list below.

The Basics

RAW developement: I first tried Bibble 5 for developing my RAWs because a colleague recommended it but I didn’t really like the work-flow. After throwing Bibble away, I quickly fell in love with Adobe Lightroom 3. It’s quick, has amazingly useful editing features, efficient noise reduction and supports lens corrections for many models. Lightroom is available for Windows and Mac OS X. Linux users come away empty-handed.

Manipulation: Gimp is the often mentioned free Adobe Photoshop alternative. It requires a bit of effort to get started but it’s well invested time. There are plenty of plug-ins for Gimp out of which I find the following most useful:

  • G’Mic: An excellent collection of filters which I highly recommend to install.
  • UFRaw: Raw Converter for Gimp. By far not as powerful as Lightroom, but it does its job. Useful for Linux users who can’t benefit from Lightroom.
  • Exposure Blend: Exposure Blend supports you in creating HDR / DRI images out of a series of photos with different exposures. I’m not using it much but during testing it did what it promised.

Check out the Gimp Registry for more plug-ins.

HDR Photography

HDR is short for High Dynamic Range and is essentially a method to increase a photo’s contrast range. Thus dark and light areas of an image will be equally well exposed. Use Google’s image search and search for “HDR” or search for the same on flickr, in order to get an impression.
The right software support to create such images you’ll find in Photomatix. Photomatix is totally foolproof while offering a wide range of options. You’ll have your first tone mapped photo within minutes!

Panoramas

I think I haven’t tried to create a panorama for at least 5 years and I remember back then the stitching process was a real pain. Nowadays, software like PTgui let’s you create awesome panoramas in very short time; at least if the source images are usable. PTgui pro even combines panorama with HDR awesomeness. Quite an impressive combination. Check out Christian Maier’s photos on fotocommunity.de for some examples which take it to the maximum.

Macro Photography

I never used any special software for macros, but I recently found Helicon Focus which takes several photos with different depth of field and combines them into one photo. They have a video on their page demonstrating the process. It’s like HDR, but instead of increasing the contrast range, it’s merging depth of fields.

DeliciousTwitterFacebookLinkedInRedditSlashdotTechnorati FavoritesDiggShare
Posted in Gimp, Photography, Tools | Leave a comment

Turn off startup sound in Mac OSX

If you find the Mac OSX startup sound as annoying as I do you will love this tool: StartupSound.prefPane

A detailed description about how to use it you’ll find here.

I do wonder why Apple does not include this option in the system preferences.

DeliciousTwitterFacebookLinkedInRedditSlashdotTechnorati FavoritesDiggShare
Posted in OSX | 1 Comment