chrishowie.com

Comcast modem fun

by Chris on May.15, 2009, under Computer, Linux

Well, the Comcast guy showed up today and dropped off the modem self-installation kit. About two or three hours later and it still wasn’t working quite right.

Here is my setup. The modem is plugged into eth0 on a Linux box, and eth1 runs to a switch. Traffic routed out eth0 is masqueraded (also known as NATed). If the modem and Linux box are turned on then everything works fine. But if I bring eth0 down and back up, then some odd behavior begins. All traffic that originates on the Linux box behaves normally — I can use elinks to browse the web and irssi to chat on IRC without any problems. But any traffic that is masqueraded, meaning that it comes from another computer on my network, does not behave normally. The connection establishes and works for a split second and then is silent.

I’d suspect a routing problem on the Linux box, but tcpdump there confirms everything is working as it should. However, ifconfig reports RX errors on eth0. This makes no sense — traffic originating from the LAN side of the router box triggers receive errors on eth0. Unless I reboot the router and the modem. I have not observed this behavior with any other ISP or uplink switch.

Anyone have any theories?

6 Comments more...

Git and Banshee.OpenVP fun

by Chris on May.07, 2009, under Banshee, C#, Computer, OpenVP, Programming

Well it’s hacking season again. With GNOME’s switch from Subversion to Git complete, which means Banshee now uses Git too, it gave me an excuse to finally learn it. This was not fun. But having toughed it out, I can definitely say that I love it.

Now that Banshee is using Git, Aaron is starting work on a branch off of the 1.4 series to incorporate my visualization patch. Wielding my new Git tool belt, I was off and hacking. Taking Gabriel’s branch allowing replacement of source widgets, I rebased that from master to stable-vis, fixed the merge conflicts, and started hacking away at Banshee.OpenVP. Unfortunately, not all the pieces I needed were there yet. So I added them and pushed them up to Gitorious. Neat.

Now Banshee.OpenVP looks like this:

14 Comments more...

Résumé and availability

by Chris on Apr.27, 2009, under Computer, Personal

I will be graduating in two weeks from Anderson University with a B.A. in Computer Science and Mathematics. I’m actively looking for employment in the Anderson/Muncie/Indianapolis, Indiana area. I’ve had several prospects for some months but nothing has come through yet. If you know of any opportunities, or are looking for a dedicated coder familiar with many languages (C, C#, PHP, just to name a few) and both Linux and Windows environments (Linux preferred), drop me a line. My résumé is available in two formats: PDF and HTML. Feel free to ask any questions about my experience or skills. Looking forward to hearing from you!

Update: I’ve disabled comments since I’d rather people email me about opportunities than leave a comment. My email address is on both versions of my résumé.

Comments Off more...

The new Gazebo: a Gtk# interface to FICS

by Chris on Apr.17, 2009, under C#, Chess, Linux

I’ve abandoned my idea of creating an AJAX interface for the time being. It is a cool idea but I think I can do much better by writing a proper application.

The Linux FICS interface scene is rather weak. eboard is about the best there is in terms of usability, and it has its share of problems. xboard is there for the minimalists who want their interface to provide a chess board only. When compared with the powerful and extensible interfaces available for Windows it’s rather a shame there’s nothing similar for Linux.

So I’ve decided to take the name I was going to use for my web interface and apply it to a new Linux interface. Building on Mono.Addins, I’ve already got an interface that can be extended in several key ways. Addins can, for example, provide new text highlighting classes or classes that can manipulate the console text buffer in interesting ways.

Using a tip from jonp in #mono, I have now come up with an extensible preferences system that does not suck, based on XLinq. Addins can simply subclass PreferenceContainer, slap on a few attributes, and they have an easy-to-use set of strongly typed preferences that get automatically serialized to XML. Right now only the basic primitive types and strings are supported, but this will be extended later to include things like arrays, lists, and XLinq objects. Thanks to Mono.Addins and some more support classes I wrote, addins can also provide Gtk# widgets that get embedded into the application preferences window. By writing very little code, addin authors can persist their settings and provide the user with a convenient way to change them.

I’m still lacking a chess board though. If anyone likes writing custom widgets and feels comfortable working on this project let me know. The sources will be made public in the coming weeks after I’ve had a chance to polish them and set consistent style guidelines.

3 Comments more...

Gazebo: An AJAX interface to FICS

by Chris on Mar.23, 2009, under Chess, JavaScript, Web

I’ve been getting back into chess recently, and my favorite online community is the Free Internet Chess Server (FICS). There are a wealth of free and open interfaces available for download, but they all have one thing in common: you have to download them. At my workplace this is a no-no, but over my lunch break it would be nice to get in a few games. If I forget my laptop then I have no way to play.

Enter Gazebo. I started this project last Friday night, so it’s only been about two days. Still, what I have right now is rather impressive for that amount of time. At face value, the current version is not very representative of the time that’s gone into the project so far, and for a very good reason.

The HTTP protocol used by web servers was not engineered around the idea that you’d establish a long-lasting connection with the server. It’s better suited for quick request-response cycles. Because of this, the PHP web service has no good way to maintain a connection to FICS.

The solution I came up with for this problem is simple, yet very involved. A daemon script (yes, written in PHP…) listens on a UNIX socket for connections from the PHP web service script. If a new FICS session is requested, it creates a new session and returns some authentication parameters to the web service. On every request to the service, another connection to the daemon is made over the UNIX socket, the session attached to with the authentication parameters, and some action taken, like “write this to the network socket” or “tell me when you get new data from the network socket” or even “close the network socket and destroy the session.” The daemon essentially acts as a super-proxy that persists the network sockets and enables access to all of them from one UNIX socket.

Yes, it’s kinda ugly. But it also works incredibly well. There is still some tuning to be done, but behold the awesomeness of what is essentially in-browser, color-coded telnet:

Leave a Comment more...

Issues with Crockford’s JavaScript conventions

by Chris on Mar.10, 2009, under JavaScript

I’ve been reading up on Douglas Crockford’s Code Conventions for the JavaScript Programming Language and I agree with most of them, but I definitely have a bone to pick with one of them: “All variables/functions should be declared before they are used.”

This sounds good in theory, and is probably a good programming practice. However, in JavaScript we frequently use callbacks to implement asynchronous calls, due to the fact that JavaScript is single-threaded. Code like this is common:

function BeginProcess(data) {
    // process data
    DoDataProcess({
        'data': data,
        'onComplete': EndProcess
    });
}

function EndProcess() {
    alert('The process is done');
}

Think AJAX in particular. This kind of thing is commonplace. However, declaring things before we use them means we have two options. We can either swap the functions around, or we can declare var EndProcess; at the top of the script. The latter reminds me too much of C, where you have to declare function prototypes ahead of time if you want to write them in any order you want. The former is just incredibly confusing. Consider how that would look:

function EndProcess() {
    alert('The process is done');
}

function BeginProcess(data) {
    // process data
    DoDataProcess({
        'data': data,
        'onComplete': EndProcess
    });
}

This is horrible. The natural code flow is broken. You now have to start at the last function and read it, then go up to read the next part. This is the same reason that top-posting sucks and bottom-posting makes sense. If those functions were both longer than a screen, you have to scroll to the bottom of the script, then up to the function header. Then read down to find “EndProcess” and say “what’s that?” Then scroll up to find EndHeader, then back down to read it. The human mind has not been conditioned to read this way.

Consider this quote from the linked article on top-posting:

Top-posting makes posts incomprehensible. Firstly: In normal conversations, one does not answer to something that has not yet been said. So it is unclear to reply to the top, whilst the original message is at the bottom. Secondly: In western society a book is normally read from top to bottom. Top-posting forces one to stray from this convention: Reading some at the top, skipping to the bottom to read the question, and going back to the top to continue. This annoyance increases even more than linear with the number of top-posts in the message. If someone replies to a thread and you forgot what the thread was all about, or that thread was incomplete for some reasons, it will be quite tiresome to rapidly understand what the thread was all about, due to bad posting and irrelevant text which has not been removed.

Given a suitably large enough application (like the one I am working on right now) this means that I either need about 200 var statements at the top of my program to indicate every class I am defining, and the same within each class to indicate each private function, or I have to reorder them. Both are unwieldy. One is unnecessarily verbose, while the other is horrible to read and breaks the natural flow of the code. Your initialization function winds up at the very bottom of the script, then you have to work your way up to see what is going on.

Crockford seems like a pretty intelligent guy, but I’ve yet to see any extensive code samples that show how he gets around this problem. Thoughts?

4 Comments more...

JavaScript appreciation and more

by Chris on Mar.06, 2009, under Computer, JavaScript, Personal, Programming

I’ve been up to a lot of little things recently but haven’t undertaken any projects big enough to warrant a whole fancy blog post. I figured I might as well summarize what I’ve been up to.

I’m doing a project at school that improves the experience of on-campus tutors and their clients. They’d been using Moodle workshops to allow clients to submit content to tutors, and recording hours manually on timecards. Moodle will still be involved, but the tutors will now interact primarily with a web application I’ve been coding that will track their hours for them, as well as fulfill some clerical roles, such as preventing two tutors from working on the same paper. (Previously this was done more or less manually by updating the workshop submission title. Not a terribly fun way to track that kind of stuff.)

This project has me up to my neck in JavaScript, a language I’ve long held in contempt. However, after reading up on some patterns and watching a talk or two my mind has been completely changed. In fact, I enjoy coding in JavaScript now. I enjoy it a lot. When you know what you are doing (and what to avoid) all the frustration and general icky feelings associated with working in the language disappear. What’s left is an incredibly pure, lightning-fast web application. A maintainable one too. Who knew JavaScript could do that?

Some other semi-random facts:

  • I’m getting married in 91 days. (See that counter in the right column? Yup, that one. If you’ve been wondering what that’s counting down to, now you know.)
  • I’ve recently revived the RTS gaming genre on my system by reinstalling Age of Empires 3. I don’t recall why I stopped playing, but I shouldn’t have.
  • In case anyone wonders why I haven’t been on WoW for a while, it’s because I let my subscription expire. That was over six months ago, I think. Honestly I have not missed it. There are more fun games out there, and they don’t require a monthly fee. Team Fortress 2 is an especially good option if you like class-based games and first-person shooters.

That’s all for now, I guess. Stay tuned for some more developments on Banshee.OpenVP in the coming weeks.

3 Comments more...

More visualizations

by Chris on Jan.29, 2009, under Banshee, OpenVP

I spent some of Tuesday porting some of my older OpenVP visualizations from XML-serialized scripted effect presets to “real” preset classes, and committed them to Banshee.OpenVP. The results:

10 Comments more...

Finished visualization pipeline

by Chris on Jan.21, 2009, under Banshee, C#, OpenVP

Hopefully, anyway.

I spent some time this last week (probably over 15 hours total) giving the Banshee visualization pipeline another overhaul. In the process of doing this I finally filed a bug I found in the spectrum GStreamer element that I’ve been trying to work around for a long time.

Even though Sebastian was able to fix this specific bug, another crept up, which he did fix, but it became apparent to me that using the spectrum element was the wrong approach. I won’t go into too many details, but it made disabling and re-enabling the pipeline incredibly tricky and required a buffer of spectrum slices that had to be synchronized with a mutex since it was being accessed by three threads.

Sebastian gave me some pointers on using libgstfft directly, and this has reduced the amount of code required to do spectrum analysis while making it less laggy and less of a hack.

I’m told this patch (and possibly Banshee.OpenVP) will be going into Banshee 1.6. Sweet.

Mandatory screen shot of the new code and of the new Voiceprint visualization in Banshee.OpenVP:

Update 2009-01-22: I had to revise the patch to fix a segfault caused by a race and to eliminate some timing issues with thawing synchronization. The link to the patch has been updated.

3 Comments more...

New new display

by Chris on Jan.12, 2009, under Computer, Personal

I got the replacement for my defective laptop display on Saturday and got around to installing it last night. So far everything looks good. There are no defective pixels as far as I can tell and, as a bonus, it’s a matte display instead of the glossy one that came with my laptop. Woot!

2 Comments more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact me so I can take care of it!

Links

Links to friends' blogs, and a few other sites of mine.