28 April 2009

Hosted HTTP API for the Apple Push Notification Service

Bigcurl is building a simple web service for the Apple Push Notification service for iPhone and iPod Touch.

Bigcurl HTTPush is a hosted web service that enables developers for the iPhone and iPod Touch to easily and cost-effectively send vast amounts of push notifications to there customers. It stores the information to map a user name to a device, collect all notifications and act as a secure gateway to Apples infrastructure.

To get some ideas what you can do with the Push service, you should watch the preview-presentation for the iPhone OS 3.0.

Bigcurl HTTPush is in private alpha at the moment, but you can request an invite by signing up at http://push.bigcurl.de

10 April 2009

...and since twitter is the...

If you like, follow me on twitter here @bigcurl

A small sinatra app in Google App Engine

As I discussed Google AppEngine with friends, the question of perfomance for a ruby app arrised. I ported our smallest app to sinatra and used the instructions on how to set up a sinatra app. The result is here. It is a free referer removal service and it is not touching the database or does any fancy calculations.

Take a look for yourself http://r.squidshot.com/.

08 April 2009

Running Sinatra apps on Google AppEngine (Java)

Update(14.04.2009): Jruby moved to git today. Please use git instead of svn to checkout the jruby project.

Google today announced Java as a new runtime environment for Google AppEngine. This not only enables developers to use the Java Language to build web applications but also opens the door for a lot of dynamic languages including my current favourite one Ruby. With the help of the Jruby project it is possible to deploy ruby apps in Googles Cloud.

At Bigcurl most applications are written in ruby and a new hosting option which is basicly free is always welcomed. Take a look at some of our internal apps for yourself (www.squidshot.com) and try to spot which ones are hosted in the cloud and which ones are hosted in a traditional data center.

This is a proof of concept which shows that it is possible to run ruby applications and maybe also ruby on rails applications on Google AppEngine. With the help of Ola Bini and the AppEngine Docs for Java , I created a tiny sinatra app (which acts as a placeholder for your much-more-logic-containing-app) and show how to use Google AppEngine as a ruby deployment option.

This was done on Mac OS X 10.5.6.


Jruby

First check out a fresh copy of jruby
git clone git://kenai.com/jruby~main

go into the jruby dir
cd jruby~main

and compile jruby.
ant && ant jar-complete

Lets see if we have the correct version.
bin/jruby -v

The output should be something like:
jruby 1.3.0 (ruby 1.8.6p287) (2009-04-08 r9524) (Java HotSpot(TM) Client VM 1.5.0_16) [i386-java]

Install some gems for our newly created jruby.
PATH-TO-JRUBY/bin/jruby -S gem install rake sinatra warbler


jruby-rack

Get a fresh version from http://github.com/nicksieger/jruby-rack/tree/master

cd jruby-rack
PATH-TO-JRUBY/bin/jruby -S rake SKIP_SPECS=true


We will come back to jruby-rack later.


Create the sinatra app.


Create a new folder "sinatra-app"
cd sinatra-app
touch config.ru app.rb appengine-web.xml
mkdir views public config lib


Fill the files config.ru, config/warble.rb, appengine-web.xml and app.rb with the content from this gist: http://gist.github.com/91801

This is our basic Sinatra app. It will just display a string. But then we know it is working.

For a quick test run:
ruby app.rb

and go to http://localhost:4567/

Now we need to copy some files to the lib dir.
First go to the download section to find the Google App Engine SDK for Java. Version 1.2.0 - 04/07/09 is here.

After the download is finished we need to copy appengine-java-sdk-1.2.0/lib/user/appengine-api-1.0-sdk-1.2.0.jar to the lib dir.

Copy following jar file from jruby-rack to lib folder.
JRUBY-RACK/target/jruby-rack-*.jar.

Next up is jruby itself. Since Ola pointed to the 1000 file limit with AppEngine he wrote a script which splits the jruby-jar into two pieces.

But first copy jruby-complete.jar from PATH-TO-JRUBY/lib/jruby-complete.jar to the lib folder of the sinatra app.

Then run his script in the lib folder and you should have two jar files instead of one. jruby-core.jar and ruby-stdlib.jar. You find the script here.

Now we should be ready to pack our application.
run PATH-TO-JRUBY/bin/jruby -S warble

This should create a tmp folder and a .war file. Since AppEngine needs the exploded war folder and not the .war file, we simply ignore the file

Go to tmp/war/WEB-INF/gems/gems/sinatra-0.9.1.1/lib/sinatra.rb and commend out the last line which is use_in_file_templates!. Somehow this makes problems with the runtime.

Run appengine-java-sdk-1.2.0/bin/dev_appserver.sh tmp/war/ to get a local server up and running for testing stuff.

If you have no error on the console go to http://localhost:8080 and you should see a nice welcome message in form of the string from the app.

Things work fine? Lets deploy.

You need to be signed up as one of the 10.000 developers who have early access to the java runtime. Sign up here if you haven't allready.
If so got to the Google AppEngine, sign in and create a new application.
Copy the application-id you get from there into the appengine-web.xml file and replace YOUR-APPLICATION-ID.

Run this to repopulate with the new id
PATH-TO-JRUBY/bin/jruby -S warble

and then deploy running
appengine-java-sdk-1.2.0/bin/appcfg.sh update tmp/war/

Now got to your-application-id.blogspot.com and it should work. The first request takes quite a while but the following should be fine.

Have fun!

Want to redirect naked domains in App Engine. Take a look here.

02 April 2009

Fresh passwords, every 5 seconds

Passwords should be secure. One way to archive this is by making them very long.

Most web applications I create, have a common workflow of sending a preconfigured password to a newly signed up user . To make it unguessable before the user changes it, this password is normally 40 characters long and contains only numbers and characters and no special characters. Some mail clients tend to do special stuff with the characters, remove some and the copy/pasted password is not working anymore.

Beeing a user myself I like to have these long passwords as login but most apps tend to send out either no password at all or send very short, memorizable passwords.

The short ones are good if you want to access your account from arround the world but most of the time I sit in front of the same computer and Keychain in Mac OS X (or any other app that stores and fills in password for you) does a pretty good job of remembering the long passwords for me.

So you need a password now. Want it long, copy/paste save and secure? Here you go: http://p.squidshot.com.

Passwords are refreshed every 5 seconds. So no excuse of using bad passwords anymore.