After years of Python programming, I've been spoiled by always having a REPL available when I want to test something out. As I spend more and more time in Java, I find myself missing a REPL. Well, no more. I'm happy to report that I've finally found a REPL I like using to test out libraries when I'm working in Java: the Scala REPL.
Today I needed to send some JMS messages to ActiveMQ. Instead of firing up eclipse, creating a maven project to get the dependencies, and then writing some Java code, I used sbt and Scala to create a REPL where I could easily send JMS messages.
Create an sbt project
The first step is to create an sbt project. This is as simple as creating a directory with a
build.sbt file in it. My example
build.sbt file pulls in two library dependencies that I want to have available in the REPL.
name := "jmstest" scalaVersion := "2.9.1" libraryDependencies ++= Seq( "org.apache.activemq" % "activemq-core" % "5.5.1", "org.slf4j" % "slf4j-simple" % "1.6.4" )
Run the REPL
Running the REPL is as simple as running
sbt console from the newly created sbt project. From there, it's off to the races:
import javax.jms._ import org.apache.activemq.ActiveMQConnectionFactory val factory = new ActiveMQConnectionFactory("tcp://localhost:61616") val connection = factory.createConnection val session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE) val destination = session.createTopic("jms.test") val producer = session.createProducer(destination) val message = session.createMapMessage message.setString("command", "basic_setup") message.setBoolean("do_stuff", false) producer.send(message)
That's all there is to it. Scala, with the help of sbt, makes a great REPL for testing out Java libraries.
I attended Astricon for the first time this year. Getting some facetime with the Asterisk developers was great and I'm a lot more comfortable with what I'll need to do to get some of my changes upstream. Now for some highlights.
- Asterisk Architecture (part of the Introduction to Asterisk Development block) by David Vossel. While the presentation rehashed a lot of the information in the Asterisk chapter of The Architecture of Open Source Applications, the presentation made Asterisk development feel much more approachable.
- Asterisk Webphone by Chris Mattheiu. Very impressive minimal softphone in a browser. Fun to watch someone daring enough to write code live during a presentation. The only downside was that the web phone requires a proprietary Jingle to SIP gateway.
- IPv6 -- the (Only) Way Forward by Owen DeLong. No nonsense presentation about what it takes to start using IPv6. I appreciated the candor about what works and what doesn't. Especially enjoyable was the VOIP vendor wall of shame.
- Clustering and Scaling Asterisk with Kamailio by Klaus Darilion. Using a proxy in front of Asterisk is a complex subject and Klaus did a great job distilling the details into a great look at what's possible. I use OpenSIPS for a similar purpose and picked up a few config items I can simplify.
- Cooking with Asterisk by Leif Madsen. Solid examples of neat things you can do in the dialplan. The example using Originate and chan_spy to playback a recorded message to one side of the call was impressive.
Stuff I Want to Try Now
- Adhearsion - Advanced Asterisk call control in Ruby
- StarPy - AGI and AMI interface for Twisted
- CMU Sphinx and PocketSphinx - Voice recognition
- Tropo - Voice, SMS, and XMPP API
The Fun Stuff
- Overheard some "creative" methods to deal with users that want to fax during a discussion about fax support on Asterisk SCF.
- Watching Clod Patry win all the tickets in one of the arcade games at the party.
- Best Business Card: TechPro used cleaning cloths for glasses as business cards. Especially useful with all the snow and water I got on my classes on the way to the conference.
With the deprecation
HAL proceeding at full speed it's time to
find a new solution for automounting disks on my Linux box. I've been happily
using halevt, which does a lot more than disk
mounting, but won't be of much use once HAL really goes away.
udisks is the replacement
that the major desktops are moving to, so I decided to write a simple
automounting daemon for those of us not using a major desktop:
udiskie. It's a simple udisks
client that just takes care of mounting removable media right now. I run it by
udiskie & to
~/.xinitrc. When I'm done using a removable disk,
udiskie-umount will take care of the unmount. I probably can't stress enough
how simplistic and undocumented this approach is, but it works for me.
And, of course, for the Archlinux users, it's already packaged in the AUR: udiskie
pm-utils seems to be the clear winner
to userspace suspend and hibernate setup. It's a great back, but, for those of
us who don't run a desktop environment with a power manager, there's one thing
missing: screen locking. I'd like the screen to be locked when my computer
resumes from either suspend or hibernate, and I don't want to run
gnome-power-manager to get that functionality. So,
00lock-screen to the rescue. Just drop that file in
/etc/pm/sleep.d and, as long as you have
xlock setup, the screen will lock as your computer suspends or
For the Archlinux users, it's already packaged in the AUR: pm-utils-screen-lock
« Previous Page -- Next Page »