Showing posts with label play. Show all posts
Showing posts with label play. Show all posts

Saturday, September 7, 2013

Developing Trackpad: An 18 second Vine documentary

My goal was simple. I wanted to be able to control my Mac's mouse from my Nexus 7. These following Vines document an evening's attempt at that.

Phase 1 - Basic Android application. Just getting set up.

Phase 2 - Server setup. My mouse now speaks http.

Phase 3 - Hook server up to application. World's hackiest wireless mouse.

Check out the android app here
Accompanying scala Play service here.

Saturday, July 13, 2013

Scheduling background tasks in Play made easy: A mailer bot example

It took a little while for me to figure this out earlier, so I thought I'd share how to easily schedule background tasks in your Play application. Let me illustrate with an example that will send an email to a user every 5 seconds. If you follow all the steps below, you should have your very own spam bot up in no time.

1- Create a new play application in scala
> play new background-email
2- Let's set the Global object location for our project. In your background-email/conf/application.conf file, make sure you have the following set:
application.global=Global
This will tell Play where to look for the Global object class of our application.

3- Under background-email/app/ create Global.scala. This file is loaded at application start time and the onStart method is where we can add calls to schedule tasks. In the example below, we'll have onStart call startAwesomeBackgroundTask which will schedule periodic email sends. Note: If you want this example to work, create a gmail account and replace "user@gmail.com" with your username and "password" with a the real password.


4- Before we can run our code, we'll need to add the right dependencies to our project. Update background-email/project/Build.scala to include a reference to org.codemonkey.simplejavamail:

5- You should now be able to run the application and see it in action:
> play start


Voila! From the console output you should be seeing an email sent every 5 seconds. The proof is in the pudding:



*The above instructions work as of Play 2.1.2.

Monday, May 27, 2013

Visualizing Twitter geo data using Play 2.1 & heatmap.js

My latest weekend project involves visualizing real time Twitter geo data using heatmap.js:


I'll be hosting the app here for the next couple of days: ignite.phyous.com

Check out the code on github if you'e curious: https://github.com/phyous/ignite