An explanation of Play Future results

I don’t remember where I took this picture from, I assume it is the Play Framework docs, but it offers a nice explanation of how a Future works in the Play Framework, especially in regards to blocking the client and server.

A Sencha Touch mobile client and Play Framework server app

I’ve started to write a mobile app using Sencha Touch for the client, and the Play Framework and Scala on the server side (to create a RESTful API). At some point I may make all of this code open source, but for today I’m just going to share some pictures of the Sencha Touch client.

Notes list

First, here’s the Notes screen. A note can be anything with a title, and optional body:

An Nginx proxy pass example

As a quick note to self, as I configure my “Mini-Me” application, which has a client written with Sencha Touch 2, and a Play Framework server, I used this Nginx proxy pass configuration:

Get a web client's IP address with PHP

I just ran into a situation for a Drupal/PHP client where I wanted to log some access information. There was some unusual access activity on the website, and I want to log IP addresses and URLs for a few days.

As part of that, I wanted to get the web client's IP address, and in PHP you get the client IP address like this:


That returns something like this:

If you just need to get a web client's IP address from a PHP script, that's all you need.

A Scala JSON (Gson) HTTP POST RESTful client example

While working on a Scala project recently I created the following example Scala code to test a variety of things, including:

  • Scala case classes
  • The Apache HttpClient classes, including HttpPost
  • Creating JSON with Gson
  • Sending the JSON object/string to my POST RESTful server

Given that brief introduction, here's the source code for my Scala HTTP client, which uses POST (Apache HttpPost) to send data to a RESTful web service:

A Scala REST 'get content' client function using Apache HttpClient

As quick post here today, if you need a Scala REST client function, the following source code should be able to work for you, or at least be a good starting point. I'm using it in several applications today, and the only thing I think it needs is the ability to set a connection timeout and socket timeout, and I share the code for that down below.

Here's my Scala REST 'get content' client function, using the Apache HttpClient library:

A Scala IMAP email client (using SSL, IMAPS, JavaMail)

If you ever need to write an IMAP client in Scala, I hope the following example can be helpful. For my project named SARAH (a Mac OS X Siri-like project), I wanted an IMAP client to periodically check my mail and then say something a little better than, "You've got mail", and the first part of that was getting a Scala IMAP client going.

Syndicate content