LinuxSoftware

Coding and tramping in Aotearoa / New Zealand

Car insurance

Apr 4

Updated my Vim plugins

, , david, Sunday, 2:52 pm


Vim is a powerful text editor, based on the standard Unix vi command, but much improved. The different modes are confusing to new users, but when you’ve been using them as long as I have they just seem natural. My fingers have learned vi and don’t like having to use anything else. I end up with strings like jjjbcw in other documents.

I’ve built up a bundle of plugins and configurations which I use with Vim. Recently I’ve gone through, cleaned out the ones I never use, updated others and added new ones. If you’re interested you can download the bundle or check out my Vim wiki page for more details.

To install the bundle: untar it, then rename dot.vim to .vim, dot.vimrc to .vimrc, and dot.gvimrc to .gvimrc, being careful to first rename your existing vim files if you have anything you want to keep. There’s not much in my .vimrc and .gvimrc, so you don’t even really need to bother with them. Most of my configuration settings are in my vls-config.vim and vls-keys.vim plugins.

Cool new plugins included are: PyFlakes for on-the-fly Python syntax checking; TagList, a function/source code browser, most recently used (MRU) files, Case-persistant substitutions, and the NERDTree file explorer. I’ve also created myself acustom toolbar which reminds me to use some of the new features of Vim 7.0 such as folding, tabs, and the undo tree. Happy Viming!


Apr 14

linuxsoftware.co.nz or software.net.nz

, , , david, Monday, 9:27 pm

I am greedy, I have two domain names. The question is which one is better? I got linuxsoftware.co.nz first. It narrowly won over professional-bum.co.nz. I’ve been using it for a long time, but another friend Tracy said it was too long and I needed something shorter. About then software.net.nz came free so I nabbed that.

Now I have these two domains I’m not sure which is better?

  • software.net.nz is quicker to type
  • people tend to forget the .net.nz part and type software.co.nz (not mine)
  • linuxsoftware says a bit more than just software (they’re both too generic)
  • I have been using linuxsoftware longer

Perhaps I should get a whole new domain name? Suggestions?


Jan 12

Reviving old code

, , , david, Saturday, 11:52 pm

Persona was my first X11 app. It’s not much, just a basic address book, but it has been interesting to get it up and running again. I’m creating new project pages for all my various little projects and it seemed appropriate to start with the oldest.

Persona uses the XForms library written by Mark Overmars and T.C. Zhao. (Not to be confused with the XML format). Back around 95 I discovered this library and found it so much easier than trying to write raw Xlib apps. With oval buttons! I wrote a C++ wrapper around it which I thought was pretty nice. And so when I wrote Persona in 99 I used it, even though QT and GTK+ must have been around by then.  XForms is pretty obsolete now, but fortunately it can still be downloaded from its Savannah project page. And it still builds and links against X11 without any problems.

Getting Persona working with modern standardised C++ was the main bit of work. Back when I wrote Persona the C++ standard was still being discussed, things weren’t stable, so there are some work arounds. For example I wanted to use auto_ptr, but I found GCC had removed it as “because the details of the interface are still being discussed by the C++ standardization committee”. I copied in my own copy as djm_memory, but that clashes with the now standardised memory header, so djm_memory had to go.

Some other antiquitisms:

  • I had using std; instead of using namespace std;
  • I was using strstream instead of stringstream – Quietened that down with-Wno-deprecated.

I switched off the GCC warning which drives Nigel nuts, “has virtual functions but non-virtual destructor”, with -Wno-non-virtual-dtor. For me this may really point to a memory leak, but I’m going to ignore that for now.

My XForms wrapper code uses member functions and templates a lot. So I got a lot of error messages like: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&MainForm::prev’ It’s nice when the compiler tells you how to fix your bug. I wonder why they tightened the member function rules up though?

Finally, it lives!

I also rediscovered Persona has a text command mode implemented with Lex and Yacc. I’d forgotten that. Persona will run in text mode if there is no X11 display, or if “-text” is passed on the command line. It’s not very good though, because I never implemented the search command for this mode.

Fonts aren’t the same so I tweaked some of the placements, not much though. This makes me realize XForms didn’t have very good font handling.

Next task: to rewrite Persona with a GTK or wxWidgets interface. Hmmm, maybe not. I’ll just leave Persona as it is, as a piece of LinuxSoftware history.

persona09