Thursday, July 23, 2009

Mysterious Icewind Port

This doesn't really have anything to do with Linux, but I needed to put this down somewhere so maybe it would help someone else. My friend and I like to play "hardcore" computer RPG games, cooperative style, across the Internet. We have a weekly session, playing for a couple of hours. It's the only way, really, that I would ever complete a game, as I just don't have the persistence to do it myself. I play a bit, and pretty much irregardless of how good or bad the game is, I'm always flying off, checking the next game.



Anyway, we finished Neverwinter Nights (we don't mind playing lagging edge games) and went on to play Sacred, which we picked up for cheap at the wonderful GoG (Grand Old Games) site. It was fun for the first few weeks, but then there started to be problems with the lobby server, as it isn't a direct connect game. It had become a bit of a grind, anyway, so we started looking about for a new game to play.



Unfortunately, classic, hard-core, cooperative RPG games are few and far between these days. The definitive site for all thing co-op, Co-optimus has almost no entries at all for even an action RPG to play co-op. Not sure why the well has dried up. So we decided to go really olde school and try the classic Baldur's Gate. Many years ago, in a galaxy far far away, I actually played this a bit across the 'net, but I've never really played it all that much. As I had two copies of it, I gave one to my buddy and we sat down to play it.



But we played the "Figure Out The Router/Firewall" game instead. For the next 2 hours, we tried to figure out why I couldn't connect to his server. This worked fine for both NWN and Sacred, but whenever I would type in his IP address, BG would just pause for a long time, and the come back with "Cannot Connect To Game Session". As my router is a virtually impossible to configure Juniper Netscreen router, he was hosting the games on his side. He made sure all the ports mentioned were opened, all to no avail. As well as the "official" ports (2300-2400 & 6073), someone also mentioned ports 1470, 15000, and, most importantly, ports 47624-49672. Not sure about those, but port 47624 is the DirectPlay port, so I'm not sure why this doesn't show up in the official docs.



But despite all these efforts, we just couldn't get our Baldur's Gate games to connect. So last night, we tried Icewind Dale. Still a wonderful RPG (in fact, I like it more than Baldur's Gate, despite, or perhaps because of, its more linear and hack-n-slash nature), but a slightly newer engine, esp. when updated with the Heart of Winter expansion and its Trials of Luremaster patch/expansion. So we were hoping the updated engine would be more cooperative.



But, alas, we were wrong. I still got the dreaded "Cannot Connect" error. So we then tried Hamachi, a free VPN software. Still no go. As he's a network wonk, I was sure the firewall and router was correct on his end. And I don't run a firewall at all (don't really need one if you are behind a NAT router), so it had to be my "user unfriendly pain in the butt to configure" Juniper Netgear NS5GT router. I fired up Wireshark (nee Ethereal) and began sniffing packets.



I hosted the game on another internal computer and sniffed the traffic, comparing it to the packets I was sending and receiving to my friend's machine. It was then I noticed something odd - my machine would send out a DirectPlay packet on port 47624, but it would get back the response on port 2300 on my internal connection but, of course, it wouldn't get it back from my friend's computer, because routers will allow a response on the same port but not a different one.



So I rolled up my sleeves, used some Black Belt Google Fu and found this page that describes the dozen or so steps(!) you need to go through to get it to work. I added 2300 & 47624 to my "Infinity Engine" Custom Service Object, and set the policy to forward it to my game playing machine. This got me connected but not for long. Turns out, I needed to add 2350 as well. I tried to add 2300-2400, as recommended somewhere, but the Juniper Netgear complained about not enough ports in the pool, whatever the hell that means.



And now it works. So, the basic fix is to make sure that both players port forward UDP and TCP traffic for the ports mentioned here (2300-2400, 6073) and 47624 (the DirectPlay port). I'm not sure what 6073 is for, as I don't think either of us have it set up - maybe that's an old DirectPlay service port? Yup, it is according to this (DirectPlay 8), while it say 47624 is "directplaysrvr". Not sure what the difference is, unless one is a fallback for the other. At the very least, forward ports 2300 & 2350 - I think it uses the second one by default and will only use a different one if it finds that port is busy.



Thursday, July 2, 2009

Creator and emacsclient

Some notes on using emacsclient on KDE, as I'm trying to integrate it with Qt Creator, because Qt Creator doesn't have Emacs key bindings (so far, my biggest gripe). There's an albeit painful keystroke to pass the current file off to an external editor, so I'm trying to get it to work with emacsclient. So far, here's my external editor command:



emacsclient -n +%l:%c %f



The -n tells it to not wait for the server to relinquish control of the file - I just want to edit it. +%l:%c says set the cursor at the line,column specified. The Info and Man pages for emacsclient don't specify this correctly, as they are both missing the colon.



Now I'm trying to figure out how to bring it to the front. Burying Emacs behind a bunch of windows isn't much help. I did come across a pretty cool KDE keyboard shortcut - Ctrl-Alt-A - which brings to the front the window "demanding attention", but that's not all that much help. Unfortunately, it doesn't look like a problem that has been solved for these window managers that don't allow "focus stealing".





Tuesday, June 23, 2009

Information Please

An article on Lifehacker featured an interesting utility called iotop, which gives a birds eye view of what your hard drive is up to. The commentors mentioned a couple of other interesting tools, although many seemed to be confused as to what iotop is measuring as opposed to some of the other utilities. I thought I'd do a quick write up about a few of these command line machine status reporters.



The most basic status tool is, of course, ps. In number of options, it competes with ls for most in the Linux manual! This is because it has 3 different command "modes" - UNIX, BSD and GNU versions, and all are usually mutually incompatible. ps gives you a basic snapshot of what programs are being run.



While ps is always around, the rest of these usually need special installation, although the next one, top, is almost always around. top adds more information but, most importantly, runs in a curses display, so it stays around and updates itself, giving you a constant view of what your CPU is up to. You can see it change dynamically as programs work your CPU harder. Use the 'h' key to display a help screen, giving you more sorting and display options.



View top in action


The most flexible version of ps is htop. This gives you even more information, more sorting options and an even better curses display. Again, use the 'h' command to get a full help display. I especially like htop for how it displays the complete command line.



View htop in action


iftop uses a top-like display to show you what is going on in your network (your interface). It displays the various network requests, who is making them and how much is coming and going on each. This is an especially useful command on a server, as you can see what your web server is working on, and keep useful totals.


View iftop in action



iotop again uses a top-like display to give you a real time, in-depth view of disk I/O. This is an especially useful diagnostic tool if you notice your hard disk is "thrashing" - ie, the red access light is doing a disco-like strobe effect and you're wondering who is doing all that hard drive dancing.



View iotop in action


saidar is another monitoring tool that shows a nice overview of everything going on in your computer. Useful information like CPU load, swap usage, disk space, and network traffic. Good quick clean overview.


View saidar in action


Next time, perhaps I'll take a look at some of the graphical system monitoring tools available for KDE and GNOME. If you have any other favorite terminal-based monitors, please mention them in the comments.




Wednesday, June 10, 2009

Screencasting the Creator

I'm trying out Nokia's fancy new Qt Creator IDE for developing Qt 4.5 applications. Looks pretty nice, even if Qt itself is a little fugly, given all the weird macros it uses to get its work done. Maybe this IDE will shield me from the worst of it?



Anyway, I'm going through the recommended book (C++ GUI Programming with Qt 4, Second Edition) on Safari and am finding it a bit of a chore. It is working with the older GUI design tool, Qt Designer, and not Qt Creator. As far as I can tell, there isn't much introduction material for Qt Creator. So I'll try and puzzle out the answer to some of the oddities and document them here.


So what I've done is create my very first screencast! I am using recordMyDesktop via its GUI interface qt-recordmydesktop, which works pretty well. I had the usual audio hassles, trying to figure out how to set up the mic for recording. I could never get it to use my USB headset, but luckily this lovely Plantronics USB headset comes with regular 3.5mm jacks that plug into a USB adapter, so by plugging the jacks into the back of the audio board, I could get it to record after trying various options in KMixer.


Coincidentally enough, the most recent issue of Linux Format magazine has a Roundup of screencasting tools. Their pick is the closed source DemoRecorder but it doesn't seem to offer anything that the free recordMyDesktop offers besides the ablity to save in multiple formats. recordMyDesktop only does Ogg Vorbis video, but all the upload sites convert it to Flash video anyway, so I don't really care.



I had a few problems getting the screencast to work. First off is a bug in Qt Creator, where if you rename the main widget, the compiler gets all weirded out. Took me a while to figure that one out. The workaround is to rename it from the Project creation dialog.



Then I was having problems getting the post-recording conversion to work. It would only do some of it, or not a complete audio track. Not sure what the work around was for that. I either got lucky finally or, by just leaving the computer alone until the process was done made it work. Finally, I got the 6 minute screencast to work.



I am using blip.tv to host the video. I've heard it does the best job at conversion and has the fewest restrictions on formats, as well as giving the most options for display. So, without further ado, is my very first screencast:







Wednesday, April 29, 2009

Pick The Best

The latest issue of Linux Format magazine has a very nice article on how to pick the best distro. This is a subject rife with controversy, but they do a very nice job of remaining bias free and objective. By listing a wide variety of user types, you can pick your area and see what they recommend.


I do have a couple of nits to pick with it though:



  • While Ubuntu has its strengths (the biggest of which is the vast and active user community), I think its choice of GNOME as its default desktop is a mistake. GNOME is quirky and quite different from Windows and offers up too many gratuitous changes from the "norm" for it to be a newbie friend face. KDE is much more "normal" in that respect.

  • I also disagree with the admittedly tepid recommendation to use the 64bit version of a distro. Again, just enough annoyances with not enough payback to discourage a newbie.



That being said, I enjoyed reading it and am itching to try a new distro. Still perfectly happy with my openSUSE, but I have a free 40gb partition just begging for some play time:) I did use their recommendation for Qimo as a "family friendly" distro and installed it on my daughters' computers, as WinXP was behaving very badly. They have really enjoyed the pre-installed games and creativity software. I just wish there was better support for it besides comments on a blog post. And I think it should pre-install Flash support, as that is the other big destination for the girls, Flash web games.



Now maybe try Fedora 10, which was included on a recent Linux Format DVD? Or Mandriva? or....



How to choose the best Linux distro for you | TuxRadar



Wednesday, March 11, 2009

import this


$ python
Python 2.5.2 (r252:60911, Dec 1 2008, 17:47:46)
[GCC 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
>>>



Tuesday, March 10, 2009

Magazine Heaven

My favorite Linux magazine, Linux Format (out of the UK) has some interesting news:




  • A very nice podcast, which can be found at Tux Radar. Three editors talk about a wide range of Linux subjects. I have been finding it very entertaining, even if they don't have their RSS feed tags quite set up correctly.

  • They offered up a free download of their issue 116, the KDE issue. The zip file with the 3 torrents (hires, lowres, and ISO) for it is here. Very nice job!

  • And most excitingly, as they announced at the end of their latest podcast, a deal on the subscription! It's hard to justify the US$130 in these tough economic times, even if it is the best Linux magazine going. But if you follow this link, you can subscribe for "only" US$95, which is a pretty good deal for 13 issues. Linux Format sub deal



Every issue is just jammed packed with great info, from news to in depth technical tutorials. I love the mix of articles, and I love the layout. Very clean look, well edited and good stories. I highly recommend it!



Linux Journal also recently had a special ($12 for 12 issues) but I'm pretty sure that was just a day long one. However, they do have a contest to give out some free subscriptions to the digital version. You can get more details here.