Scala syntax highlighting in gedit

Update: A small typo, an unnecessary “<” tag before xmlns in scala-mime.xml has been corrected. Thanks @win for finding the error. See the comments below for additional references.

The default text editor on Ubuntu, or for that matter any Gnome powered desktop, is gedit. If you are a developer like me, who isn’t a huge fan of IDE(s), there is a good chance you use gedit for some of your development. Gedit supports syntax highlighting for a number of languages but if you were hacking some Scala code using the editor, you wouldn’t find any syntax highlighting support out-of-the-box. However, the Scala folks offer gedit syntax highlighting support via the scala-tool-support subproject. To get it working with your gedit installation, do the following:

  1. Download the scala.lang file from You can checkout the source using svn or scrape the screen by simply copying the contents and pasting it into a file named scala.lang. On Ubuntu, using Ctrl-Shift and the mouse, helps accurately select and copy the content from the screen.
  2. Copy or move scala.lang file to ~/.gnome2/gtksourceview-1.0/language-specs/
  3. Create a file named scala-mime.xml at /usr/share/mime/packages/ using
    sudo touch /usr/share/mime/packages/scala-mime.xml
  4. Add the following contents to scala-mime.xml:
    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;mime-type type="text/x-scala"&gt;
    &lt;comment&gt;Scala programming language&lt;/comment&gt;
    &lt;glob pattern="*.scala"/&gt;
  5. Run
    sudo update-mime-database /usr/share/mime
  6. Start (or restart, if its running) gedit and you now have scala syntax highlighting in place.

Next Stop: NFJS Rocky Mountain Software Symposium

I speak on Flex and Java Integration, Flex and Hibernate and Collaborative real-time RIA this Sunday (November 22, 2009) at the No Fluff Just Stuff (NFJS) Rocky Mountain Software Symposium in Denver, CO. If you are in Denver and coming to the show, I hope to see you there.

Featured on DZone “Meet the Author” Video Series

Watch me speak on BlazeDS, Flex and Java integration. (Original Post on DZone: Meet the Author – Shashank Tiwari on BlazeDS, Flex & Java Integration).

Speaking at NFJS Northern Virginia Software Symposium November 6-8, 2009

This weekend, I will be speaking at the No Fluff Just Stuff Northern Virginia Software Symposium in Reston, VA. The symposium, as always, has some truly brilliant speakers from the world of Java, dynamic languages and agile software development. I have 3 sessions; all on Sunday. All my topics relate to Flex and Java integration. On Sunday morning at 9.00am I  start off with a general and broad based topic: “Flex and Java Integration“. Later that afternoon, I explore the world of “Flex and Hibernate” and the promising domain of “Collaborative real-time RIA“. The session on “Collaborative real-time RIA” extends beyond Flex and Java integration and includes the larger context of collaborative applications and real-time systems.

Speaking on the NFJS 2009 Tour

Speaking on the NFJS 2009 Tour

If you are already at the symposium, please stop by at the sessions. If you are interested in these topics and are in the area, consider attending them. If you are nowhere close by and are interested in the topics, then do let me know, and I could perhaps plan a session in that geography, if there are enough interested.

Also, not to forget, a lot of what I speak about in these sessions, is covered in my book Professional BlazeDS (Wiley/Wrox, 2009).

BlazeDS DZone RefCard Available for Free Download

Getting Started with BlazeDS, a DZone RefCard on Adobe BlazeDS that I authored is available online. Go ahead and download it now.

The great thing about the DZone RefCards is that they are terse and useful presentations of technical topics and are available completely free of charge. The RefCard on BlazeDS is a quick 6 page practical introduction to some of the key aspects of using BlazeDS. For more details, consider reading my book on Adobe BlazeDS — Professional BlazeDS (Wiley/Wrox, 2009).

Please let me know if you find the RefCard useful. Also, please point out to me any errors that may have slipped through the cracks.

Speaking at SextaFlex Brazil

Igor Costa has invited me as a guest on the next episode of SextaFlex, the Friday talk show on Flex. I speak about combining Flex and Java using BlazeDS. My talk is around my new book Professional BlazeDS (Wiley/Wrox, 2009).

If you wish to understand how best to combine Flex and Java and extend the power of BlazeDS to support production grade scalable applications then join the SextaFlex session this Friday, October 23, 2009.  The session will be delivered over Adobe Connect, which you can access online at

Professional BlazeDS (Wiley/Wrox 2009) is Available

Creating Rich Internet Applications with Flex and Java

Creating Rich Internet Applications with Flex and Java

My new book on “BlazeDS” was released earlier this week. I got my first set of author copies last night in the mail. It was a great feeling holding a copy in my hand. This book was written over the last many months as I toiled with a number of other things, including working on client projects, at the same time. Most of the writing was done in the nights and weekends.  I must at this point mention that my family (wife and kids) was extremely supportive else this book would have never been possible.

The book covers a lot of ground at the sweet intersection spot where Flex based RIA and Java meet. It covers the fundamentals of the wiring, protocols, formats and the API that relate to the integration of Flex/AIR and Java in the first few chapters and then rapidly graduates to explaining advanced topics. Advanced topics include Spring and Hibernate integration, custom adapters and real-time data push. As the topic clearly suggests all integration discussion is in the context of the open source data services product from Adobe: BlazeDS.

If the subject of integrating Flex/AIR and Java interests you, then go grab a copy of this book from your local technical book retailer or order online at Amazon — As you read the book, please let me know of any errors. If you like the book, please rate it well on Amazon and/or leave a comment behind.

Hope the book helps the folks who are actively combining Flex (or AIR) and Java to create the next set of rich and robust productivity enhancing enterprise grade applications.

Flex and Spring JMS

If you are someone who is interested in coupling Flex and Spring based messaging (especially JMS) systems, you may want to whet your appetite by reading my article on the subject at DZone. Here is the link: Integrating Flex and Spring based JMS applications. Please let me know if the article was helpful or want to learn more about the subject.

Installing and Setting up BlazeDS in JBoss AS 5

In this article I illustrate how you could install and setup BlazeDS in a JBoss AS 5 application server instance. A number of new developers have difficulty installing and setting up BlazeDS in JBoss. I hope this article will provide answers to their questions and also help all those others who are seeking similar help.

First lets download and install JBoss AS 5. If you already have an instance installed then you can skip this step. If you have a prior version of JBoss (a 4.x version) installed then you could possibly avoid upgrading the installation, unless you need one of the newer features in version 5. You can read “What’s new in JBoss AS 5” to understand the new features in JBoss AS 5.

To download JBoss AS 5.1.0.GA (which is the latest stable release at the time of this writing), go to Once you have downloaded the distribution expand the archive file to a folder in your file system. JBoss AS is distributed in .zip and .tar.gz archive formats. If you are on windows, use the .zip distribution. Whereas, if you are on Mac OS X or Linux then get the .tar.gz version.

JBoss AS 5.1.0.GA needs JDK 6. If you don’t have JDK 6 on your machine please download and install it from

Once you expand the JBoss distribution and you have the correct version of Java running on your machine, you are ready to start using JBoss. One of the thoughest things for a JBoss newbie is to understand the following:

  • the JBoss directory structure
  • the deployment model
  • the application server configuration
  • the startup and shutdown process

Therefore, in this write-up I will atttempt to explain the very basics of each of the topics in the list above and see how it applies to BlazeDS.

The JBoss AS 5.x directory structure

First look at the Figure 1 below.

Figure 1: JBoss main directory structure

Figure 1: JBoss main directory structure

The “bin” and “server” folders are what you will need most. The “bin” folder has all the executables, including those to start and stop a server. The “server” is the core of the appplication server. This is where all the application server modules are and this where you deploy your application. The BlazeDS application, that you will download shortly will be deployed in a sub-folder of this folder.

The “lib”, “client” and “common” folders have all the jar files that JBoss server and client applications may need. The “docs” folder has the documentation.

Within the “server” folder you will find the following sub-folders:

  • all
  • default
  • minimal
  • standard
  • web

Each of these are built-in server profiles that you could use to deploy your application to. In most likelihood going with “default” will suffice. If none of these available server profiles are sufficient or suitable, you can also create your own custom server profile. For example I created a custom server profile called “sandbox” and started out by copying over all the contents of the “default” folder into it.

I will stick to the “default” server profile for the rest of this post and will not talk about custom server profiles for now. Within the “default” folder is a folder called “deploy”. The “deploy” folder is where you deploy an application within JBoss AS. This is a good time to download and deploy BlazeDS to show what deployment of a application in JBoss involves.

Downloading and deploying BlazeDS

Go to and download the latest BlazeDS release build (which as of now is a 3.x version). BlazeDS can be downloaded either in source or binary formats. In addition, you have the option to download a BlazeDS turnkey distribution, which includes an Apache Tomcat instance and a set of sample applications that leverage BlazeDS, as a part of the distribution. I would recommend downloading the turnkey distribution to get hold of the sample applications. At the time of this writing the latest BlazeDS tunrkey release is “blazeds-turnkey-”.

Once downloaded, unzip the zipped up distribution. Once you expand the archive you will find the following “war” files in the root of the distribution:

  • blazeds.war
  • ds-console.war
  • samples.war

Next, copy over all the three “war” files to the server/default/deploy folder.  Now, you are ready to start the JBoss application server.

Starting and stopping JBoss AS

The JBoss AS “bin” folder has start and stop scripts. Scripts are available for multiple platforms, sepcially windows and the linux/unix/mac os x platforms. To start and stop a JBoss instance use “run.bat” and “shutdown.bat” on windows and “” and “” on the linux/unix/mac os x platform. When using “run.bat” on Vista you may encouter problems with the script’s ability to locate findstr. Read more about this problem: Findstr Command Not Found.

Once the server starts, open up a browser instance and go to http://localhost:8080/samples to access the sample applications that come with the BlazeDS turnkey distribution. In addition, you could point your browser to http://localhost:8080/ds-console and access the administration console that helps monitor the state of your BlazeDS instance.

At this stage if you peek into your JBoss server logs you are likely to see a trace that says its unable to connect to the sampledb. The error output on the command line is as shown in Figure 2.

Picture 2

Figure 2 : JBoss server log snippet

To correct this problem, go to the place where you unzipped your blazeds turnkey distribution and run the “startdb” script within the “sampledb” folder.

BlazeDS is now installed and ready for use with a JBoss AS instance. More accurately you have taken the first few steps to start with more configuration and serious development. In later posts I will explain numerous configuration options around JMS, clustering, remoting and more. For now, I hope the write-up helps those who have had trouble with getting started with BlazeDS on JBoss.

Speaking on Scala Actors at NY Scala Enthusiasts

Thanks to Dustin Whitney, we have a meetup for Scala enthusiasts in New York City.

New York Scala Enthusiasts

New York Scala Enthusiasts

I speak on the actors library at the meetup this (March 30, 2009) evening. Last year, I spoke on the same topic at SD Best Practices in Boston. This presentation today will be structured on similar lines to the talk at Boston. Its an introductory but fairly thorough walk through the concepts of actors and threadless concurrency in Scala. Scala brings this great Erlang style concurrency to the JVM and it is something every Java (and of course Scala) developer should peek into, if not learn thoroughly.

The Actors Library

Scala's Actors Library for Concurrency

If you are in New York City and care for Scala actors then do drop by.