Posts Tagged ‘programming’

Bulding bridges in the metaverse

Friday, January 8th, 2010

If/once you “get it”, Second Life is pretty cool. It can be a lot of different things, and its potential has barely even been scratched. Sure, the tools are cumbersome, but they are getting better. And some of Linden Lab’s policies suck, but that will just drive people to OSGrid, eventually.

Anyway, there are people in Second Life that I like being able to communicate with. However, when I’m at work, it’s a lot of trouble to create an SSH tunnel home, then forward a text-only client like ommviewer-light just so I can log in and see who is online.

So, as I always do, I went way overboard and created a system that can relay chat between an IRC channel (or channels) and any location (or locations) inside Second Life (or any other grid that supports LSL). It can also check the online status of users and send them one-way IMs. I call the entire system slrelay, and you can get it here.

It requires a few things to work: a running webserver is absolutely necessary. If you want the IRC features, then you also need an IRC network of your choice and a machine that can execute perl scripts. I have my IRC bot connected to irc.slashnet.org.

slrelay has a number of possible uses. You could use it to relay chat between key locations on a large landmass (say, an area that spans 3 or 4 sims). It could relay chat between Second Life and another metaverse grid like OSGrid. It can be used as a simple IRC tool to check who is online very quickly. Or it can do all of these things at once.

emacs 23, dbus, and libnotify

Monday, August 31st, 2009

A new major version of emacs is out, and it includes dbus support. This is great, because it means we can do things like this:

(require 'dbus)
(defun send-desktop-notification (summary body timeout)
  "call notification-daemon method METHOD with ARGS over dbus"
  (dbus-call-method
    :session                        ; use the session (not system) bus
    "org.freedesktop.Notifications" ; service name
    "/org/freedesktop/Notifications"   ; path name
    "org.freedesktop.Notifications" "Notify" ; Method
    "emacs"
    0
    ""
    summary
    body
    '(:array)
    '(:array :signature "{sv}")
    ':int32 timeout))

(defun pw/compile-notify (buffer message)
  (send-desktop-notification "emacs compile" message 0))

(setq compilation-finish-function 'pw/compile-notify)

Add this to your .emacs file and you will receive a libnotify popup when M-x compile completes. It will even give you the exit message, so you know whether the compile was successful.

So now you can let that long compile run, and work on something else. emacs will let you know when the compile finishes.

As written above, the notifications will stay on your screen until you dismiss them (by clicking on them). If you would like them to vanish after a preset time limit, change the 0 in the call to send-desktop-notification. Set it to the number of milliseconds the popup should remain on the screen.

Screenshot of libnotify popup showing a compiler error

Screenshot of libnotify popup showing a compiler error

This is just the tip of the iceberg, of course. Any application that presents a dbus interface can be interacted with from emacs, which means that emacs can also integrate itself with the Linux desktop in other interesting ways.

d20tools 0.3 is here

Saturday, August 22nd, 2009

I’ve released a new version of d20tools. In addition to using a new, simpler file saving/loading scheme and better keyboard handling, the new feature is also a lot more stable. Other highlights include a more sensible entity/group management system, and the ability for any creature to be a henchman.

Get it here.

I’m lifting my moratorium on D&D 4e, as well. This means that d20tools will eventually support 4e creatures. However, this is a huge undertaking, and I have to decide how best to handle it. I’m leaning towards a system that will allow anyone to write system templates; then, any gaming system could be plugged in, theoretically. In practice, this is a lot of work for a single developer, so I wouldn’t anticipate this happening any time soon.

Twitter from the command line

Thursday, July 2nd, 2009

I’ve recently started playing with twitter. A nice way to use it via the command-line (using curl) was suggested here. I have taken that and improved slightly on it.

(more…)

My new project – netjatafl

Thursday, June 25th, 2009

I’ve been pretty busy the last month working on netjatafl. Netjatafl will eventually be a networked client for playing various board and/or card games. It was originally created for hnefatafl and other tafl games. However, I have designed it to be extensible; I’m working on adding mancala games, and it looks like my design makes it pretty easy to add a new game. (I’ve added most of the logic for mancala to the client and server in just a couple hours of work). I intend to add shogi, xiangqi, chess, and possibly even go at some point in the future.

The netjatafl server (taflserv) operates on a simple, completely open protocol; it will eventually support authenticated logins and statistics tracking. Anyone could write a netjatafl client for any platform, if they wished. My clients will all be in C++, because this let’s me reuse the ‘libboardgame’ library, which contains the game logic used by the server. I will also build in a “capabilities” system at some point, so the client and server can both advertise which games they support.

The whole thing is theoretically usable in its current state; the client is an ncurses-based text UI that is pretty cumbersome, but can be used. As far as I know, it only works in Linux. Anyone who wants to cross-compile it for Windows and send me a patch with everything you had to add, feel free! I will eventually add a proper GUI, probably gtk+-based.

Like the sound of this project? Feel free to check out the code, compile it, and let me know what you think!

Etymology notes: netjatafl is Old Norse for “net-table”; i.e. a networked table you can gather around to play games. ‘taflbordh’ is ON for ‘tafl board’ (tafl can also refer to tafl games in general), which sounds a little redundant, but it made a nice name for a client. And ‘taflserv’ is just ‘tafl server’… ’serv’ was meant to be short for ’server’, but I later noticed that it’s also a French word meaning ‘it serves”. I find this somewhat appropriate.

Programming: The theory

Tuesday, August 22nd, 2006

One of my biggest problems with the IT community, both in amateur programmers and prospective employers, is the following question: “So, what programming languages do you know?” This implies that learning a language is an extremely difficult task, and collecting languages like trophies is somehow a worthy pursuit.

A programming language is a tool. A skilled craftsman isn’t good at her trade because she knows how to use a given set of tools; anyone can learn that. Rather, true skill comes from knowing how to *apply* the tools. The fundamental concepts behind programming are the skills on which we should be focusing.

This applies to academia as well. The language you use to teach students, especially the first language they encounter, *is* important. I’m not about to advocate “teaching languages” like Pascal, though. I think it’s important to choose a real-world language, with all the pitfalls and caveats of a real-world language, as a student’s first language. At the same time, it should be a language with the features available to demonstrate all the fundamental concepts in programming. A language that doesn’t support recursion would be a Bad Choice, for example.

So, when someone (a peer or a hopeful programmer-to-be) asks me “what languages do you know?”, I won’t respond “Well, I know C, C++, Java, perl, php, xhtml/xml/css (if you count those), lisp, prolog, LotusScript, Javascript, LSL…” etc. Instead, I’ll say “I’ve used a number of languages, but the key thing is that I know how to learn any language.” When an employer asks, I suppose I’ll have to say “Well, I know @languages…”. Then, though, I might add “…but I consider the fundamental concepts behind programming languages to be more important, because mastering those means I can learn to get around in any language given a week or two of study.”

In summary: Learning a programming language is trivial, once you know the fundamental concepts of programming.