Archive for the ‘Programming’ Category.

Removing Non-ASCII Characters

A couple of years ago, I was processing some IRC log files created by an Eggdrop I had running. However, I ran into some problems related to these log files having non-ASCII characters used. I need a quick way of stripping these characters out. The following is a VB6 program (source and binary available) that can process single text files and remove all non-ASCII characters from them. (Appending “.clean.txt” to the filename.)

This was only written for one-time use, so excuse the lack of comments, and the lack of general error checking etc. Someone even slightly skilled at Visual Basic 6 will be able to change the code to batch process files and embed some basic error handling. As with all programs, use this at your own risk.

Download

Simple Facebook Connect Integration

I found an interesting plugin for this wordpress blog when I was going through my RSS feeds a couple of weeks ago. Simple Facebook Connect allows blog commenters to post using their Facebook accounts for authentication. Not only that, it leaves a link back to their profile as well as showing their avatar (depending on privacy settings). I’ve installed the plugin on this blog, which you can try out by going to a post, and selecting “Connect with Facebook” on the sidebar.

I did note, however, that the FB avatar wasn’t being displayed correctly (alignment was broken) with the current theme, Fluid Blue. Needed to edit “simple-facebook-connect/sfc-comments.php” and replace the two relevant blocks that generates the picture displaying HTML with:

$avatar = "";

Clipboard Monitor

When I’m ingame with games such as Left 4 Dead 2, I often want to save chat from game lobbies, or during the game itself. However, it’s often incredibly difficult, requiring alt-tabbing out of the game, and this isn’t really feasible when in the middle of a round.

I’ve written this program, which monitors the contents of the Windows Clipboard, and saves any new content automatically. The idea being, you start the application before you launch a game, and let it run in the background. When ingame, you simply copy chat into your clipboard. The program will then automatically log it, and every minute, write to a log file on the hard drive. That way, there is no need to alt-tab or otherwise leave the game.

When finished, simply close the program, and access/read the log file. I’ve been testing this for the last day or so, and it seems to work fine without any crashes. I should note that it uses an MD5 implementation available here. I’m keeping the program closed-source for now, but if people want the code to verify there isn’t anything malicious going on, I may release it later.

Download:

Binary
Source