The Return of the iTunes to Zune Playlist Converter

Posted: September 24th, 2009 | Author: | Filed under: Software | Tags: , , , , , , | 2 Comments »

Hey all,

After a couple of irate posts regarding the failure of my old iTunes to Zune playlist converter tool to work with newer versions of the iTunes and Zune playlist formats, I’ve rebuilt the project from the ground up and re-branded it as yourTunes. You can find the support page here, where downloads and tutorials can be found, and you are welcomed to leave some feedback.

This first version is a rebuild and incremental improvement on the old project, but plenty of cool features are planned for future releases, so keep on top of it!

Cheers, Jon

Automating Command Line Applications VisualBasic.Net

Posted: April 29th, 2009 | Author: | Filed under: Software | Tags: , , , , , , , , , , , , , , , , , , | 2 Comments »

A lot of the programming that I do for myself involves the creation of little tools that patch two existing parts of my workspace together so that they work better. For example, I recently had need of an SFTP client that links into a database front end to retrieve a list of files to download. Since the SFTP specification is ridiculously long and convoluted, I decided to try and use WinSCP to take care of the FTP portion of the program instead of re-inventing the wheel. Because I was trying to patch the database layer and FTP client together into a single application, I decided to take a shot at controlling WinSCP directly from the command line so that the two portions of the project were contained in a single application.

Readers who have spent time fooling around in Visual Basic 6 might remember the Shell function that allows a program to launch another process. Generally speaking, if we don’t care about the output of the program, or are just launching something like a browser window, this command is more than sufficient. However in this case, I wanted to capture the output of WinSCP and its exit code so that I could tell if errors had occurred and take appropriate action on them, so I needed something with a little bit more kick.

Since I wrote my code with WinSCP in mind, the rest of the article is going to focus on creating an application that will serve as an FTP front-end that allows the user to upload or download a file to or from a remote SFTP server. That said, the ideas are general and easy to adapt to any other application that supports command-line arguments.

You’ll want to begin by dragging and dropping the executable that you wish to automate directly into your project, and setting its “Copy to Output” property to “Copy to Newer” to ensure that your application can always find it. For WinSCP, that included both the and winscp.exe files from the install directory. That done, let’s jump in.

Using System.Diagnostics.Process:

This handy System class provides a beefier version of the Shell functionality, and is really very easy to use, once you get the hang of it. At the top of your class, add the line imports System.Diagnostics so that we can find the pieces that we’ll need with ease.

When automating a command-line application, we first create a ProcessStartInfo object that contains all of the information about the process that we would like to create. Start by declaring one of these:

Dim startInfo As New ProcessStartInfo("")

This line creates a ProcessStartInfo object with the path to the application that we’d like to automate as it’s only argument. Next, we set a few properties of the object:

startInfo.Arguments = commandLineArguments
startInfo.UseShellExecute = False
startInfo.RedirectStandardOutput = True
startInfo.CreateNoWindow = True

The first line passes the string commandLineArguments to startInfo, telling it to give them to as command line arguments. Command line argument options for most programs can be found on their websites. If you’re interested in WinSCP in particular, it has some great online documentation that you can take a look at. The next three lines tell the startInfo object that it should direct the standard output from the process to a System.IO.StreamReader object where we can intercept it, and that it should run that process in the background, without showing the window to the user.

Next, we create a new Process object, and pass it the information that we just stored in startInfo:

Dim p as New Process
p = Process.Start(startInfo)

This creates a new process for, and passes it the command line arguments that we stored earlier in startInfo. Now, we need to catch the standard output from our newly created process and store it somewhere so that our users can see what the application did.

Dim s as IO.StreamReader = p.StandardOutput
While p.Responding
Exit While
End Try
End While

On the first line, we create a new IO.StreamReader object that will catch the standard output from our hosted process. The while loop tries repeatedly to read a line of output from the application and dump it into a list box while the process is still responding to the operating system. When the application finishes its work, s.ReadLine will return null, killing the loop and allowing the program to continue.

Finally, when a program exits, it returns an exit code that lets the operating system know whether or not it completed its work successfully. We can access this code with the line


In most programs, if this returns zero, the program finished successfully. If an error was encountered, this function should return something other than zero, and depending on the program, the other value may have some meaning that you can use as a status check.

Next Steps:

Because this code is purposely general, it should be easy to adapt it to control most any application that provides some kind of command line interface. This method can make for a nice alternative to batch scripts if you need to write batch scripts with some kind of logic in them and don’t feel like installing a python interpreter to get the job done. At the cost of making the code application-specific, you could easily change it to analyze the output from the program and take some action based on those return values.


As always, the source is available for download. Check out Tyler Burton’s Hash Verifier application if you want to ensure that you’re getting the same copy of the code that I claim you are.
Source Code: Click Here
MD5 Hash: 4B5D543E193CAC2B4B9477727E17EFB2
SHA1 Hash: ABD8692CBB20D316DBF35FE650399D034DA57697

Areca: The Open Sourced Backup Solution

Posted: January 19th, 2009 | Author: | Filed under: Software | Tags: , , , , , , , , , , , , , | 1 Comment »

Readers will recall the issues that I’d had some time ago in trying to force Windows Backup to play ball with an external hard drive encrypted by TrueCrypt. For some reason or another, Windows Backup refused to recognize the mounted drive as a valid backup location. One reader recommended that I try Acronis True Image out. Seeing as I like free stuff, I’ve found a free solution that solves the problem entirely.

Now it should be said from the outset that this process is a little bit ugly and a tad long winded, but that it does a really swell job and is full of opportunities to improve upon and to customize it for your particular situation.

Read on for the full tutorial – now with pretty pictures!
Read the rest of this entry »

MAX: A Half-Baked 3D Engine

Posted: January 5th, 2009 | Author: | Filed under: Education, Software | Tags: , , , , , , , , , , , , | No Comments »

Last term, I took the CP411 Computer Graphics course at Wilfrid Laurier from Professor Hongbing Fan. It was an introductory course to creating computer graphics systems using standard C++ and OpenGL technologies. All in all, it was probably the best course I’ve taken yet at WLU, and I learned an awful lot. As a final project, we were asked to create some 3D application, and I chose (without really considering the ramifications of such a commitment) to attempt a 3D graphics engine.

The result was MAX; a highly extensible, working 3D graphics engine that I would say is about par with an N64 in terms of graphics capabilities, and leaves enough room for improvement that I could probably spend another full year working solely on it. However, for 2 weeks development time, I think that what I came up with represents an excellent baseline for what is necessary of a 3D engine, and that it was a worthwhile project and a great learning experience.

Following are a number of screen shots from the project:

The engine itself, while simplistic, is robust. It relies on OpenGL for its lighting and backface removal functions, supports mouse and keyboard input, texturing, models (although I haven’t written any adapters for importing complex model formats yet – all of the models are hard-coded for now), collision detection, and basic physics such as gravity.

By and large, I had problems with the amount of work. When I decided to create a 3D engine, I made the mistake of not setting out some boundaries for what I wanted to get out of it. I had 2 weeks to work on the project, and just started throwing whatever I had at the project. This of course led to feature creep, poor organization, and a continuous reduction in expectations for the final product. That said, I really am proud of the result of the experiment, although I would definetly change my work habits next time around.

Finally, here is a quick list of improvements that I feel need to be made to the engine before it is ready to host any kind of game:

  • Improved Collision Detection: Current algorithms utilize a simplified object-aligned bounding box algorithm that simply checks whether any two bounding boxes intersect with each other. Pros of the method are that multiple bounding boxes are supported for any model, and that moving model collisions (colliders) are abstracted from non-moving model collisions (colidees), meaning that no two inanimate objects will ever be checked for a collision with each other. A better method is to project the model onto each of the axes, and check for collisions between the resulting 2D shapes. If the 2D shapes collide on every axis, then the two objects are colliding. For an awesome tutorial (albeit in flash script and for a 2D engine, but easily extensible, check out N Tutorials)
  • Object Collision Events: Currently, when any two objects in the game collide, they both stop in their tracks. This works, but it would be better to assign some scriptable action to this event, and to implement semi-complex interactions like friction and force and the ability for one object to push another. The engine already supports gravity on all moveable objects, as well as collision detection with the outer walls of the world area, so a little bit more physics would be nice.
  • Complex Model Support: This is a seriously trying thing to do. Models of more than about 50 polygons quickly become unwieldy to handle quickly in memory and require some fast code to display at a decent frame rate. At least that’s what I’ve read. Since I needed an engine fast, and didn’t want to waste my time modeling (heck, I can’t draw anyway), I created my models as hard-coded in-engine entities comprised of simplistic geometry and this did not become a concern. However, I would like to improve my model class to support a greater number of polygons and textures, and enable reading in from common model formats.
  • Texture and Lighting Class Wrappers: Currently these items are exposed right in the main class of the application. It would be nice to have some sort of abstraction around them that allows for simple palette and lighting switches, as well as for improved resource management. Also, dynamic shadows are cool, and require only one additional rendering pass that should be easy enough to implement.
  • Particle Engine and Visual Effects: An easy way to do really cool visual effects is with a simple, sturdy particle engine that supports textures, anti-aliasing, and swarm-like movement of the particles. This can be used for bugs, birds, magic spells, weather effects, leaves in the wind, tornadoes, or really most any other simple effect you can think of. NeHe has an interesting tutorial on the matter here.

Overall, I’m proud of what I accomplished in such a short period of time. As always, the code is available for download for those who wish to play with it or just check it out.



Edit: Resized the images so that they aren’t all gross and stretched out. Also, my apologies to any non-programmers attempting to download the engine – all you’ll get is Dev C++ source code. I’ll compile it and up an *.exe file tonight for those who aren’t interested in the pain and anguish involved in attempting to use Dev.

Troubles with XNA

Posted: August 26th, 2008 | Author: | Filed under: Software | Tags: , , , , , , , , | 2 Comments »

I’ve always had an interest in making video games. I remember making a puzzle-based game with Microsoft Power Point way back in the day that occupied a full box of floppy discs. While the current state of the video game industry seems contrived to prevent new players from entering the scene, I’ve often toyed with the idea of trying to get involved by way of participation in a smaller project.

I’ve worked on numerous ‘bastard’ games over the years, so called because they’ve often been written in VB or Java, and usually had horrible physics or jerk rules that made them impossible to play. These have always been fun, but I recently decided that I’d like to do something a little more serious, and started looking into the MS XNA framework for Windows and XBOX 360.

I grabbed a text book on the subject, and started at it, intending to create an old-school top-down RPG similar to early Zelda titles or Pokemon a la GameBoy. So there I was trying to write a game in an unfamiliar language (having never used C# before), and with a new mindset on how games should be created. The majority of basic classes were ported over from an old VB project that I had lying around, allowing me to get a sprite and tiling system up in short order.

In order to properly test the tiling system, I decided to leave the engine for a short period and build a map editor app back in trusty old VB. I set it up so that the editor saves two files – a PNG pallete of all tiles used in the map, and an XML file that describes which image from the pallete to put on each square of the map grid. For those interested, the source code can be had here.

So now that basic maps can be created and saved, the task of loading maps into the engine is at hand. And this is where I got seriously mucked up. XNA introduced me to the idea of a Content Pipeline – essentially, my engine cannot load files from arbitrary directories on the system drive at run time. All necessary files must be dropped into the project at design time, to be compiled into a binary file that the engine will read from at run time.

Ok so not a big deal for image files – just drop them into the content folder, load them into a Texture2D object, and draw them to the screen. But how on earth do you do likewise for an XML file? In order for my engine to use the fancy map editor that I spent hours working on (and am pretty proud of), it has to process an XML file for the level, load the necessary pallete of tiles, and construct the background grid based on that information.

Sure, hardcoding the levels -would- work, but that’s ugly and stupid and horrible. I like my XML levels, and want to process them (with the content pipeline if I must) with ease. The missing link is figuring out how to open an XML file for reading that is hanging out in the content pipeline.

Anyway, that’s about as far as I’ve gotten, but I’ll keep updates coming as I get farther into my adventures with writing an RPG.



iTunes to Zune Playlist Converter

Posted: August 20th, 2008 | Author: | Filed under: Music, Software | Tags: , , , , , , , , | 16 Comments »

This handy application converts iTunes playlists to Zune jukebox playlists. I wrote it out of frustration with the Zune jukebox auto-playlist feature, and it has served me well so far. The project is still in development, so if you have any suggestions on how to improve it, please leave a comment.

Download the Program

The program is pretty simple to use. Just follow these handy steps:

  1. Download the zip file and unzip it to a directory of your choice
  2. Open iTunes and close the Zune jukebox software
  3. Right click on the playlist that you wish to export and select ‘Export Song List…’ from the context menu
  4. Choose where you’d like to save the playlist, and ensure that ‘Save as Type’ is set to *.xml
  5. Launch the ‘iTunes to Zune Playlist Converter.exe’ application from the unzip directory
  6. Use the browse button to load the saved *.xml file into the ‘iTunes Playlist File (XML)’ field
  7. Use the browse button to choose where you’d like to save the converted Zune Playlist file. Note that for the Zune player to recognize the new playlist, it must be saved to C:\Documents and Settings\User\My Documents\My Music\Zune\Playlists\ on Windows XP, or C:\Users\UserName\Music\Zune\Playlists on Windows Vista.
  8. Click the ‘Convert’ button, and wait for the success message box to pop up.
  9. Launch the Zune jukebox software and go into the ‘Playlists’ view. You should see your newly created playlist in the pane to the left. Note that it might take a second to recognize the playlist, and another minute or two after that until the list is playable, depending on the size of the list. This is because the Zune software has to sift through the playlist and link each referenced file to one in its current library before the list can be used.

It is important to remember that this only works if the iTunes library and the Zune library in question are drawing from the same media files. This means that you should have the Zune jukebox software set to monitor the iTunes music folder that you are drawing from, so that the same files are referenced in both programs’ libraries.



Originally posted at