Archive for July, 2008

Gnome-Mud 0.11 Released!

Wednesday, July 23rd, 2008

After a very long hiatus we have just released the brand new 0.11 release of Gnome-Mud!  This represents a great deal of work over the older 0.10.x branches.  It is essentially a complete rewrite of the application from the ground up.  What this release does is change Gnome-Mud into a nice looking, well behaving, and modern Gnome application.

Hello, Beautiful

Not only that but there’s an absolute ton of new features added including support for the Mud Sound Protocol (which allows for sound effects and music to be played on muds that support it), SOCKS proxy support (versions 4 and 5), per connection input history, and a completely rewritten netcode layer that provides RFC compliant Telnet support. For a full feature list check out our wiki page.

Mart Raudsepp also contributed a really nice input widget for Gnome-Mud.  It’s a standard GtkTextView but it appears to be an entrybox until enough text is entered that it needs a new line to display it all.  At that point the input widget will automatically adjust it’s size so it can display all of the input.  Right now the height limit is set to 5 and if there are more lines than that a scroll bar will appear.  Its really neat and intuitive and works even when text is pasted into it or when the user cycles through the input history.

Input Widget

This is an important release. It gives us a great foundation on which to start building even more features into the client as we push for 1.0.  There are sadly a few regressions: Keybindings, Python plugins, and Variables didn’t make it in this rewrite.  However they are all in store for the 0.12 release!


Tuesday, July 22nd, 2008

This just goes to show you how much computing power is readily available around us that we don’t really notice.

The whole demo is highly impressive.  I haven’t yet taken a look at their code but keeping in mind this is coming from a total storage space of 8k in ROM I’m pretty damn sure that it’s fine.  There is several really neat tricks they use in the hardware design.  Not only are they bitbanging the vga signal but they use an internal shift register in the AVR to output 8 bit commands using a single cpu instruction (!!!).

My Top 10 Shell Commands

Sunday, July 20th, 2008

I came across this over on Planet Ubuntu from Ubuntu hacker Edward Robinson.  Entering the following pipeline into your bash terminal will give you the sorted list (by invocation count) of the top ten commands issued in your history:

history|awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head

Here’s my list:

111 ls
109 cd
57 vim
41 make
20 svn
18 sudo
14 patch
12 rm
12 gnome-mud
9 ./configure

I only had by bash history setup for 500 history items but I’ve upped it a bit now. I’m curious to see what my long term usage pattern looks like!

Code Completion with VIM 7

Sunday, July 20th, 2008

Code completion, also called by some ‘intellisense’, is easily setup in VIM for C/C++ files (its setup-able for essentially any language but since I am mostly a C hacker this is what this will cover.)

In Vim 7 the vim team released something called omnicompletion.  What this does is that it allows you to create an omni-function that is called whenever the omni-completion command is executed (C-X C-O by default).  The reasoning behind this is that it provides a mechanism for generic completion support rather than any particular implementation.   Since VIM is used by a great many people there are at least that many use cases for omni-completion this gives the user the power to extend their editor to allow for any sort of completion setup they might desire (albeit with sufficient technical knowledge to preform the setup).

A key tool to VIM’s omnicompletion abilities is the use of Exuberant Ctags.  For those who do not know, this utility scans source and header files and creates an optimized representation of interesting bits that other programs can use to do likewise interesting things.  So to start with the setup lets look at how to create a tags file that usable by VIM.

Lets say you want to have GTK+ intellisense in your editor.  The following incantation will create the tags file for you:

 ctags -R --c++-kinds=+p --fields=+iaS --extra=+q /usr/include/gtk-2.0

This will recursively scan every header file in the gtk-2.0 directory and create tags for every function, definition, and structure contained in there and it will spit out a file called tags in whichever directory you ran this.  I would recommend renaming this file to gtk+.tags or similar.  The parameters we pass to ctags specify which type of information we want to collect.  The reason for those particular parameters is that they provide the data the a VIM plugin called omnicppcomplete needs to functions which we will cover shortly.

Now that you’ve generated the gtk+.tags file place it whereever you would like to keep it.  VIM will always look for a file named tags in the current directory but for these sorts of tag files (whole interface dumps) it’s better to include them in your .vimrc like so:

set tags+=/path/to/gtk+.vim

You can create multiple files for each library you want completion for, or you could simply create a single tag file for the entirety of /usr/include.  Be warned using a huge /usr/include single tags file could slow down things considerably depending on your hardware.

Now that our GTK+ tags are setup we need to install omnicppcomplete.  This is a VIM plugin that provides an omnifunction for C and C++ languages obviating the need for us to create our own.  Once you have installed this (simple extracting it into your .vim folder for the most part), you now have intellisense for GTK+ like so:


VIM GTK+ Completion

Isn’t progress exciting ;)  Remember that VIM also looks for a tags file in the current directory.  So if you wanted to add completion support for your individual projects its as easy as creating a tags from your source tree.  I setup a key command (C-F6 in my case) that will generate this for me while I am in a VIM session so as I update structures and functions I always have current completion:

 map <C-F6> :ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>

Omnicppcomplete is smart enough to start completion when it encounters an -> or . in the code so it really is like intellisense when you’re using it.  To complete a function name you’ll still need to hit the omnicompletion command sequence but otherwise it Just Works:

VIM Project Completion


Finally, and this is a matter of personal preference, but one of the reasons I use VIM over EMACS is that command sequences that involve lots of Control/Meta/Shift/Alt stuff annoy the hell out of me.  So in my case C-X C-O has to go away.  I use a function that maps the tab key  in a SuperClever way that I got from the book Hacking Vim by Kim Shulz which is a great repository of various VIM tips and tricks.  What this function does is that if there is no completion that could happen it will insert a tab.  Otherwise it checks to see if there is an omnifunction available and, if so, uses it. Otherwise it falls back to Dictionary completion if there is a dictionary defined.  Finally it resorts to simple known word completion.  In general, hitting the Tab key will just do the right thing for you in any given situation.

To get this functionality just add the following to your .vimrc:

 function! SuperCleverTab()
    if strpart(getline('.'), 0, col('.') - 1) =~ '^\s*$'
        return "\<Tab>"
        if &omnifunc != ''
            return "\<C-X>\<C-O>"
        elseif &dictionary != ''
            return "\<C-K>"
            return "\<C-N>"

inoremap <Tab> <C-R>=SuperCleverTab()<cr>

And there we have it.  A full, quick, and fast ‘intellisense’ setup in Vim.  I use this in my hacking every day, its really changed the way I work with Vim. If you’re a vim afficiando you really ought to give this a go.



Sunday, July 20th, 2008

Thanks to Jeff Waugh I am all set up again to use this blog.  I have lately been doing an absolutely ton of work on gnome-mudJordim thinks that I should give Foundation membership another go once the .11 release comes out and that I should easily become a member.  I don’t want to get my hopes up too much I suppose but its exciting to hear anyways.

Anyway, the .11 release of gnome-mud is imminent!  It represents a huge amount of work as it is essentially a complete rewrite of gnome-mud from the ground up.  .11 could be considered the ‘KDE 4.0′ release of GnomeMud in as much that we lose a few features (very few luckily) but have a much stronger base to work on for future development.

Some of the big new features in GnomeMud 0.11 are:

  • Full MSP (Mud Sound Protocol Support) – We use GStreamer for this, playbin is absolutely amazing for how simple it is.
  • SOCKS Proxy Support (Finally! Version 4 and 5)
  • Zenith Mud Protocol (ZMP) Support – Just the core package for now but that’s only because noone is making packages for it. This is a real shame. ZMP uses the TELNET protocol 100% correctly by passing all information through Telnet’s subnegotiation mechanism.  This is in stark contrast to more popular MUD protocols like MXP and MSP which send all their information in-band so the client has to strip it out or the user will see the output. They also use a really cumbersome pseudo-html/xml format that is a real mess.  The only benefits I honestly think they have is that they are the most used extension protocols. Sigh.
  • Full Encoding Support – We now support proper encoding for our VTE widget so character sets can be rendered correctly.  We also support the TELNET CHARSET option which allows for character set negotiation (which is pretty cool), but mud server programmers being mud server programmers, noone actually uses this great option.
  • Auto-sizing text entry widget – This works like the entry in Gossip. It automatically changes its height based on the amount of text entered.  We have it set to a 5 line maximum at which point it’ll start to scroll. A minor but neat feature :)
  • Input History – We have bash style input history on a per connection basis now. Woo!
  • Nice new icon – Andreas was nice enough to give us a great looking tango-fied icon for this new release.

For the full list just visit our wiki page.  This gives us a great base to start on.  We’re still a long way from GnomeMud 1.0 but after this release comes out we are much closer because this is officially our Not Dead Yet release that’s going to kickstart the new era of GnomeMud development.