Licode Architecture

May 27, 2013 at 05:10 PM | categories: programming, webrtc | View Comments

I've been playing with Lynckia, now known as Licode, as a WebRTC media server. It's a pretty easy way to go from zero to a video conference, but there are a lot of moving parts. There's an overview of the components here: Licode Architecture. It's a good start, but it leaves out how all the components communicate. Hopefully this diagram of the components in the basic example makes this a little more clear:

Scala as a Java REPL

November 08, 2011 at 09:10 PM | categories: programming, scala | View Comments

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)

That's all there is to it. Scala, with the help of sbt, makes a great REPL for testing out Java libraries.

Python TUI Programming

February 14, 2007 at 10:16 PM | categories: programming | View Comments

I've heard rumblings about Urwid occasionally; today I actually had a chance to use it. For those who haven't seen it before, Urwid is a pure Python library for console user interfaces. It can uses curses as the backend or speak directly to the terminal emulator. The library isn't too complex and as long as you can pick colors better than I can the TUIs look pretty nice. Check it out the next time you don't want to write a GUI.