Creating Algorithmic Art Using Processing

by Robert Greiner on March 7, 2010

Algorithmic Art – also known as Computational Art – is a form of expression that uses various algorithms and processing techniques to create visually aesthetic digital artwork in the form of still images, animations, and music.

Processing is an open source programming language and environment invented by Ben Fry and Casey Reyes from the MIT Media Lab that provides a way for anyone to create algorithmic art. Even you! Simply download Processing and follow one of the introductory tutorials to get started.
Here is a piece of algorithmic art I created by extending one of the Read the rest

Now that the hard parts are finished, all that’s left is to run our bundle in the Knopflerfish Desktop.

Click File -> Open Bundle File (Ctrl+O) and select the bundle we created in Part 2 (the default is:
/out). Note, the bundle .jar file gets built automatically through Eclipse.

Once the bundle has been loaded into the Knopflerfish OSGi Desktop simply hit the Start Bundle button and watch it go!

And that’s it! You have just created your very first OSGi bundle using Eclipse and Knopflerfish. The RandomRoll application is probably one of the lamest apps around,… Read the rest

OSGi Development with Knopflerfish – Part 2: The Code

by Robert Greiner on February 28, 2010

Now that we have Eclipse and Knopflerfish installed let’s get into some code. This OSGi bundle will roll a random six-sided die every second and print the result to the Knopflerfish Desktop console.

Creating the RandomRoll Project

Click File -> New Project and select OSGi Bundle

Fill in the project information, I am going to call this project RandomRoll.

This is the OSGi specific information, make sure you check the “Create Activator” class box (More on this later.)

bundle.manifest

The manifest file contains all of the OSGi required information for your bundle. The Eclipse OSGi plugin… Read the rest

OSGi Development with Knopflerfish – Part 1: The Setup

by Robert Greiner on February 23, 2010

The OSGi framework allows Java developers to create a dynamic component model for their applications. Developers create “bundles” that can be deployed and executed remotely and provide distributed services. The OSGi Framework can act as a Install New Software
Next, click the “Add” button and add the Knopflerfish update site: http://www.knopflerfish.org/eclipse-update/

Once the update site has been added, you should automatically see an option for the Knopflerfish plugin. Check the box and hit “Next” to install. Read the license terms and complete the installation.

Now, we can create OSGi Projects (More on that later)

Installing Knopflerfish

Download… Read the rest

The #if directive provides a perfect way to ensure your released executable doesn’t execute any code that was only intended for debug mode.

#if (<symbol>) will return true whenever the symbol being checked has been defined by default, or manually using #define.

#if DEBUG
	//Perform debug only code
#else
	//Release-level code
#endif

Remember, this is only one application of #if, you can use it any time you need to check to see if a symbol has been defined.

You can also use the [Conditional("<symbol>")] attribute on any method that has a return type of void. This will… Read the rest

Sending Email in ASP .NET

by Robert Greiner on February 17, 2010

I can’t think of too many websites that don’t send automated email. Unfortunately, for ASP .NET programmers, there are several incorrect and out-of-date code snippets online which try to explain how to send email.

Here’s the code I use on the contact form for my personal website which does the trick quite nicely.

/* using System.Net.Mail; */
MailMessage newMail = new MailMessage();
newMail.To.Add(toAddress);
newMail.Subject = subject;
newMail.Body = body;
newMail.From = new MailAddress(fromAddress, name);
newMail.IsBodyHtml = true;

SmtpClient SmtpSender = new SmtpClient();
SmtpSender.Port = 25; //or, whatever port your SMTP server operates on
SmtpSender.Host

Read the rest

Getting Started With Git and TortoiseGit on Windows

by Robert Greiner on February 12, 2010

Version control is essential to the success of any software project. It provides the ability for multiple developers to work on the same codebase simultaneously and allows projects to be versioned for release. However, a great deal of programmers fail to leverage the great benefits of version control for their personal projects, typically due to laziness or complacency (myself included).

Luckily, for us lazy programmers, Git and TortoiseGit are extremely easy to install and configure on Windows. Now, there’s no excuse not to version control your code!

Here are the topics we will cover today:

  • Install Git
  • Install

Read the rest

Working With Custom Time Strings in C#

by Robert Greiner on February 12, 2010

Let’s say we need to process some external data where the format and contents of the files are out of our control. To make matters worse, what if those same external files store tiemstamps in a foreign format that DateTime.Parse() does not understand?

It would be ill-advised to keep the dates in string format due to the level of robust date processing capabilities present in .NET.

Luckily, .NET provides a nice way to create custom date formats so any date string can be easily converted into a DateTime object.

//locale information
CultureInfo provider = CultureInfo.InvariantCulture;

//The timestamp from

Read the rest

Using .NET to Monitor a Directory for Changes

by Robert Greiner on February 8, 2010

.NET’s FileSystemWatcher class can soothe the paranoid control freak in all of us by monitoring a specified folder for different types of file system changes.

The Code

using System;
using System.Text;
using System.IO;

namespace FolderWatcher {
  class Watcher {
    static void Main(string[] args) {
      FileSystemWatcher watcher = new FileSystemWatcher(@"D:\test");
      watcher.IncludeSubdirectories = true;
      watcher.Filter = "";
      watcher.Renamed += new RenamedEventHandler(renamed);
      watcher.Deleted += new FileSystemEventHandler(changed);
      watcher.Changed += new FileSystemEventHandler(changed);
      watcher.Created += new FileSystemEventHandler(changed);
      watcher.EnableRaisingEvents = true;

      Console.ReadKey();
   }

    private static void renamed(object sender, RenamedEventArgs e) {
      Console.WriteLine(DateTime.Now + ": " +
          e.ChangeType + " " + e.FullPath);
    }

    private

Read the rest

myBlog.createNew();

by Robert Greiner on February 8, 2010

There comes a time in every young developer’s life where he realizes that the knowledge he gains from work alone will not be enough to carry his career for the next few decades.  For me, this time is now.  I need to find a way to take my skill-set as a software engineer, corporate employee, and member of the development community to the next level and I think journaling my growth as a developer through this techblog is a great place to start.

With this blog, I will attempt to accomplish the following:

  1. Keep track of my growth as

Read the rest