ECT

Etoile Cercle Triangle - Star Circle Triangle

Un blog, un arbre

| Comments

J’ai décidé de soutenir l’action “Blog zéro Carbone” de Petits gestes écolos qui vise à planter un arbre pour chaque blog déclaré auprès d’eux.

Le principe est simple :

  • Je publie un petit article sur la démarche et j’appose un badge sur mon blog (ci-contre)
  • Je les préviens via blog-zerocarbone@bonial.fr
  • Ils se chargent de tout pour la plantation de mon arbre en Bretagne

Reste plus qu’à trouver, par la suite, un moyen d’identifier mon arbre dans la plantation et lui rendre visite régulièrement :-)

Partage de connexion Internet avec Android par câble USB

| Comments

Depuis Free Mobile, il est possible de partager la connexion Internet de son mobile avec son ordinateur, sa tablette, … sans coût supplémentaire. Si vous devez payer, changez d’opérateur.

Encore faut-il savoir comment faire (câble USB, Wifi, Bluetooth), que ce soit sur le smartphone ou l’ordinateur.

On trouve moultes applications de partage de connexion (tether/tethering) plus ou moins bridées et payantes alors que Google fournit désormais tout cela gratuitement, même les pilotes pour Windows XP (nécessaires pour partager la connexion au travers d’un câble USB).

Simple et gratuit.

Play2War 0.7 is out!

| Comments

A major release

Despite of his version number, Play2War, the famous productive web framework:

Servlet 2.5 containers can now be used to deploy your Play applications!

Servlet 2.5 containers means Tomcat 6, Jetty 7, …

But this compatibility as a price: performances. They are worth than with Servlet 3.0, themselves worth than with native Play 2.

Two threads are indeed necessary to compute each request:

  • one for handling HTTP request
  • one for Akka asynchronous computing

Standard Java synchronization mecanisms (wait/notify) are then used to make theses threads work together. Of course, they are managed by threads pools, but synchronization has a cost. So if you need high performances and have to deploy WAR packages, please upgrade to a modern servlet 3.0 container, such as Tomcat 7, Jetty 8, JBoss 7.x, Glassfish 3.x (not tested yet), …

Don’t forget to look at full Changelog.

Upgrade your project’s configuration

Switching between Servlet 2.5 and 3.0 requires configuration, so you will need to upgrade to Play project to be compatible with Play2War 0.7.

Here is a typical Play2 project project/Build.scala using Play2war v0.6:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sbt._
import Keys._
import PlayProject._

object ApplicationBuild extends Build {

    val appName         = "myproject"
    val appVersion      = "1.0-SNAPSHOT"

    val appDependencies = Seq(
      "com.github.play2war" %% "play2-war-core" % "0.6"
    )

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
      resolvers += "Play2war plugins release" at "http://repository-play-war.forge.cloudbees.com/release/"
    )

}

Follow the next steps to upgrade it to play2War v0.7.

Remove Play2War core dependency

Dependency to Plat2War core is not necessary anymore. It will be automatically setup by the plugin.

Before
1
2
3
4
5
6
7
8
9
val appDependencies = Seq(
  "com.github.play2war" %% "play2-war-core" % "0.6"
)

...

val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
  resolvers += "Play2war plugins release" at "http://repository-play-war.forge.cloudbees.com/release/"
)

So, remove it.

After
1
2
3
4
5
6
7
8
9
val appDependencies = Seq(
  // Nothing or your other dependencies
)

...

val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
  // Nothing or your other settings
)

Update Play2War plugin version

As usual, update project/plugin.sbt:

1
addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "0.7")

Import Play2War SBT settings

1
2
3
...
import PlayProject._
import com.github.play2war.plugin._

Move all settings in a variable and add Play2War SBT settings to your project’s settings

1
2
3
4
5
6
7
8
9
10
11
val appVersion      = "1.0-SNAPSHOT"

val projectSettings = Play2WarPlugin.play2WarSettings ++ Seq(
  // Your settings
)

...

val main = PlayProject(
   appName, appVersion, appDependencies, mainLang = JAVA
).settings(projectSettings: _*)

Configure servlet container version

1
2
3
4
val projectSettings = Play2WarPlugin.play2WarSettings ++ Seq(
  Play2WarKeys.servletVersion := "3.0"
  // Or Play2WarKeys.servletVersion := "2.5"
)

Final project file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sbt._
import Keys._
import PlayProject._
import com.github.play2war.plugin._

object ApplicationBuild extends Build {

    val appName         = "myproject"
    val appVersion      = "1.0-SNAPSHOT"

    val projectSettings = Play2WarPlugin.play2WarSettings ++ Seq(
       Play2WarKeys.servletVersion := "3.0"
    )

    val appDependencies = Seq(
      // Nothing
    )

    val main = PlayProject(
      appName, appVersion, appDependencies, mainLang = JAVA
    ).settings(projectSettings: _*)

}

Package your application

Then, package your application as usual: sbt package (or play package).