Dynamically Rendering GitHub Files in Web Pages

You know how you can easily embed GitHub Gists into a webpage? I’ve always wanted that for any file on GitHub. I post a lot of code on my blog and it’s always tedious and error-prone having to copy and paste the code. I’d rather be able to dynamically render a specific version of a file hosted on GitHub. So I created a little JavaScript jQuery plugin called github-files that pulls blobs from GitHub. Those blobs can then be rendered client-side and optionally syntax highlighted.

Play 2 Scala Console on Heroku

I’ve been working on a Play 2 application that I’ll be using for the Grails vs Play Smackdown at ÜberConf next week. The app is running in production on Heroku but since I don’t have an admin UI yet, I needed a quick and easy way to create a new entity. I could have gone straight to the database but thought it would be better to run Play 2’s Scala Console on Heroku and then just run some arbitrary Scala code. The Scala Console in Play 2 is really just the Scala REPL in SBT but it allows you to interact with a Play application.

Webinar: Social Enterprise Java Apps on Heroku

Tomorrow, May 30th, I will be co-hosting a webinar about Social Enterprise Java Apps on Heroku. The webinar will be at both 2:00 p.m. GMT and 10:00 a.m. PDT. Register at: http://www.developerforce.com/events/webinars/2012-05-30/registration.php?d=70130000000sW7g

Here is the description:

In this webinar you will learn how to build Social Enterprise applications using Salesforce.com, Heroku, and Java. Through live coding and demonstrations you will learn how to instantly deploy and scale Java apps on the cloud with Heroku. You will also learn how to integrate those applications with Salesforce.com and Force.com through REST.

Graphs in the Cloud: Spring + Neo4j on Heroku

Last week I hosted a webinar about running Java apps on Heroku that use the Spring Framework and the [Neo4j graph database][1]. Here is the recording of that webinar:

In the webinar I began by deploying a copy of the Spring MVC + Hibernate template app from [heroku.com/java][2] on Heroku. Then I made a few modifications to the app to switch the persistence from Hibernate / JPA to Neo4j. You can get the [full source code on GitHub][3].

Play 2 Java Tutorial

Update: This tutorial is a bit old. For more up-to-date tutorials see: https://www.playframework.com/documentation/2.3.x/Tutorials

I’ve created a Play 2 Tutorial and posted it on GitHub! The tutorial covers how to:

Each section has a corresponding branch in git so you can diff against my version to see if you’ve done everything correctly. Right now this is just for Play 2 with Java and Ebean but I’m working on doing this for Play 2 with Scala as well.

Heroku, Java, Play and Neo4j Presos: Denver JUG, Atlanta JUG, London Flash UG & Webinar

Over the next couple weeks I’ll be doing two Java User Group presentations, a Flash Platform User Group presentation and one Webinar. Hope to see you at one of these events:

  • Thursday May 10 - Webinar hosted by Neo4j:
    Graphs in the Cloud: Neo4j and Heroku
  • Tuesday May 15 - Atlanta Java User Group:
    Running Java, Play! and Scala Apps on the Cloud
  • Thursday May 24 - London Flash Platform User Group:
    HTML5 Apps in Java & Scala with the Play Framework
    Deploying Apps on the Cloud with Heroku
  • WebJars in Spring MVC

    Last week I announced the WebJars project that allows you to specify your web libraries (JavaScript, CSS, etc) as dependencies in your Java web applications. With some help from Jeremy Grelle I was able to get a simple WebJars Spring MVC example working.

    First you will need to add the WebJars repository to your build. For Maven, just add the following to your “pom.xml” build file:

    <repositories>
            <repository>
                <id>webjars</id>
                <url>http://webjars.github.com/m2</url>
            </repository>
        </repositories>
    

    Then add a WebJar dependency, like Twitter Bootstrap:

    Introducing WebJars – Web Libraries as Managed Dependencies

    Update: I’ve created a Spring MVC WebJars example.
    Update 2: Ukrainian translation here - http://softdroid.net/vvedennya-webjars by Eclipse Android.
    Update 3: WebJars.org has been officially launched! Learn more.

    Our web apps are using more and more web libraries like jQuery, Backbone.js and Twitter Bootstrap. The traditional way to use those libraries is to locate & download the JavaScript and CSS source then just copy it into a project. To me this resembles how we used to just copy JAR files into a project’s WEB-INF/lib dir. But why not do with web libraries like we now do with Java libraries and specify them as managed dependencies? This allows us to declaratively set the version, use a consistent version across an application, and easily deal with transitive dependencies. Then we just need web frameworks that can serve static assets from JAR files and we are good to go! Luckily Play 2 and Dropwizard both have out-of-the-box support for this. So I decided to give it a try…