Background JavaScript with PhoneGap / Cordova and iOS

I was recently working on a project where I needed the ability to do some background processing for audio on iOS. I started out writing a lot of native Objective-C to accomplish this, but in the process discovered that I could actually do almost all of my processing in JavaScript by simply starting a background task for a period of time. It seems that while a background task is active, all threads are allowed to process with no real restrictions! It’s quite incredible really, as iOS is often loathed for its limitations on multitasking.

Now take note… Apple may feel differently about this than you probably do. They have a typically strict set of guidelines around when you are allowed to background task, and often these states must be declared in your Info.plist. These could be tracking location, or playing background audio. Take them to heart – they are really a good thing designed to prevent abuse of battery life and network usage. Check out the iOS App Programming Guide and the Technology Usage guidelines.

Generally my operations maybe only needed 5 to 30 seconds of background time in case a user was impatient and tabbed out of the application before a buffer was filled or an AJAX request was completed. In any case, having just a few spare seconds of background time can be a real help to your application!

I wrote up a small plugin for PhoneGap to help take care of this. Here is what most of the magic on the plugin side looks like:

- (void)doBackgroundTimeLoop
{
    __block UIBackgroundTaskIdentifier task;
    UIApplication* app = [UIApplication sharedApplication];
    task = [app beginBackgroundTaskWithExpirationHandler:^{
        [app endBackgroundTask:task];
        task = UIBackgroundTaskInvalid;
    }];
 
    while(YES){
        @synchronized(self){
            backgroundSecondsCounter--;
            NSLog(@"Remaining background seconds: %i", backgroundSecondsCounter);
            if (backgroundSecondsCounter <= 0)
                break; // Exit loop
        }
        [NSThread sleepForTimeInterval:1];
    }
 
    // End this background task now
    [app endBackgroundTask:task];
    task = UIBackgroundTaskInvalid;
}

 

This is a very basic use-case for background tasking. There’s only a single task running on a background thread that keeps all of your other threads alive. This may not be ideal for your app, and I also heard rumors that a single background task will expire after 15 minutes, regardless of whether you are finished or not. Keep this in mind while you program, as keeping the background operation alive too long could cause the entire thing to time out. Use it sparingly, only when needed, and free it up when it is complete. Be a good app citizen and treat your user’s phone (read: battery life) with respect!

Clone or download the plugin on GitHub

Posted in Hacks, iOS, Javascript, Mobile, Programming | 5 Comments

Breakups with Breakpoints: Creating configurable debug traces with C# and .NET

Breakpoints: Secretly evil

There. I said it. You can get mad and leave a nasty comment now, or you can hear me out. I’ve been writing .NET for years using breakpoints because that’s just how they train you to do it. It’s how things are done in Visual Studio because… why not? It’s there to use isn’t it? But is it always the best way to solve a problem, especially a very complex one?

A spotlight on the problem

Don’t get me wrong – breakpoints are an invaluable tool and not to be underestimated. For quick and dirty debugs, they’re almost always the way to go. However, for complex problems they can be limiting and cloud your broader vision. Set a breakpoint here, set a breakpoint there, hit F10 twenty times, hit F5 and continue… read a variable here, read a variable there, continue again, read another variable… wait, what happened back there a minute ago? Where am I now? What is going on? Suddenly I am super lost in my own code.

Call me attention deficit but I seriously don’t have the attention span or cognitive capacity to track all of these numbers and values and process flow all at once… and why should I? This is why computers were created in the first place. What we need is a way to trace the process AND the values at the same time, in a readable format that I can comprehend and process in my own way.

A floodlight on the problem

It’s time to say hello to our new best fiends: the Trace class and Visual Studio’s Output window. Using these we can pretty much write out anything we want in string format to the Output window and watch the program go to work.

Trace.WriteLine(string.Format("[{0:HH:mm:ss.fff}] The current value is: {1}", DateTime.Now, myVariable));

This is our basic trace. With these you can go to the moon and back, printing everything you want. The Trace class requires the TRACE compiler constant to be defined in your build settings. You can see if this is set by right clicking on the project (not the solution!) and going to Properties. They will be under the Build tab.

Defining the TRACE constant

You will pretty much always only want this defined in your Debug or other debugging-related build configurations. Leaving tracing enabled on your production builds can seriously hurt performance, so watch out. I’ll mention a bit more about this later on.

Comment in! Comment out! Don’t commit that! Delete those lines!

Possibly the worst part about tracing lines is that most people have to comment them in and out of their code when they want to do debugging. Other times they delete them and then end up needing them later. Sometimes they’ll get committed into source control in the wrong state. Other headaches, problems, etc… What a pain. How about we avoid all of that using a little compiler magic that .NET provides for us?

As we just saw above we can define the TRACE constant to enable the Trace class. If this isn’t defined then our calls into the Trace class are actually compiled all the way out of the build! It’s like those lines don’t even exist in our source. Amazing, right? The problem here is, sometimes I want to trace things in debug mode and sometimes I don’t.

“What’s the harm in tracing if I’m already debugging?” you might be asking – here is why. Tracing is super useful, but it is also super slow. If you have a large loop with some tracing inside you will really feel the difference as the Output window struggles to capture everything you are dumping out into it. Sometimes I want to run debug mode, but I don’t have all day to wait for the Output window to fill with more traces than I can even consume.

What I’d really love is the ability to do tracing on my own terms, in my own consistent format, while being able to completely compile them out of my assembly with the switch of a build configuration.

What do you think? Can we build it?

YES WE CAN! (Please don’t sue me)

Absolutely we can, thanks to the power of the Conditional attribute. Since TRACE is already taken as a compiler constant, I am going to use my own. If that’s not your style, you can just repurpose TRACE to do what you need – I promise it won’t hurt my feelings… much :(

Creating our new build configuration

First things first we’re going to create a new build configuration for our project. Here’s the step by step:

Go to the configuration manager for your solution

Select to create a new configuration for your project

Enter the config’s name and choose to copy from something (I like Debug for this). If this is the first project in your solution you are doing this for then also choose to create a new solution configuration.

If you have more than one project in your solution (like I do here) you will need to do this for each one you would like to trace on. I would recommend using the same name, and after the first time you do this in a solution don’t select to create a new configuration – it will throw an error if you have already use that name.

Now you can select the Trace configuration from your list and debug with it

There’s just one more thing we need to do now to turn it on. We’ll set our own compiler constant so that we can control it outside of the standard TRACE constant. Go ahead and right click on your project (not solution!) again and hit Properties. Go to the Build tab. Here we will add the OUTPUT compiler constant as shown.

Setting the OUTPUT compiler constant for our Trace build configuration

Nice! Now we’re ready to to put it into action.

Writing compiler conditional code

For my project, I’m going to have a static class that I’ll use to write my helper methods for tracing. You can do this however you like, but here’s my example class:

using System.Diagnostics;
 
// You should probably put this in a namespace so it's not dangling
 
public static class CoreHelpers
{
	[Conditional("OUTPUT")]
	public static void WriteOut(string str)
	{
		Trace.WriteLine(string.Format("[{0:HH:mm:ss.fff}] {1}", DateTime.Now, str));
	}
}

 

Great! Now that I have my helper method setup I can start tracing with it. Here’s an example from my project:

//Draw the moisture
// ... code code code code here
CoreHelpers.WriteOut("Moisture Value: " + moisture);
CoreHelpers.WriteOut("Moisture Density: " + moistureDensity);
// ... more code code code code here

 

Putting it to work

Now when I debug my project with Visual Studio and my new Trace build configuration I will see these messages in the Output window:

Visual Studio’s Output window shows our tracing lines

From the Output window you can copy results, hit the clear button, run them again, paste them, save them, look for points where things go wrong in the process, difference them to look for variations (check out my favorite difftool KDiff3), send them to customers/clients for verification, or whatever else you need to do.

Now instead of getting a single look at a variable or two, with no scope on the overall process, and no way to document what in the world just happened you get a nice, neat output complete with timestamps to look for things that take too long.

Cleaning up some trace trash

By default, Visual Studio has a bunch of other things writing into the Output window. You’ll see traces about bypassed code, loaded/unloaded modules and assemblies, etc… This might be useful to you, but it’s not useful to me. It’s annoying and clutters up my output. So I turned them off. Go to Tools, Options, and find Output Window under Debugging. These are the options I have set, but you can adjust them however you like.

Changing your Output window options in Visual Studio

Final thoughts and other ideas

To wrap up, I just wanted to list other thoughts and ideas I had around this. Feel free to leave comments if you have other thoughts!

  • This is how I have done this on one project and it has worked out really well. However, in the future I may use the existing TRACE variable instead of defining my own. I’ll probably disable it in my base Debug build and enable it in my copied Trace build.
  • I think there is a real benefit to creating your own WriteOut method or whatever you want to call it. Doing it this way you could very easily switch to log to another source (such as a text file) or control the Trace output on a more complex level (Normal, Fine, Superfine… like Java does). It’s your call. In fact you could even write the same method twice and have it compile differently using the #if compiler directive. Imagine tracing to a different source with the switch of a build configuration! Amazing.
  • I think that it could be very possible to replace some of your comments with detailed tracing messages. Since they are removed at compile time I don’t see the harm in leaving them there. If you think they are cluttering your code, use them like comments instead of writing more comments.
    They should help explain your code and you can turn them back on (or off) with the flip of a build config. Save yourself the headache of remembering to comment them in or out, remove them, avoid committing them to source control, etc…
  • Know when to call it – writing extensive tracing is not always a good or useful way to spend your time. If you think it’s quicker or easier to use breakpoints then do it! There’s nothing wrong with them. You can even create conditional breakpoints to search for specific conditions without hitting F5 hundreds of time and watching variables like a hawk.
Posted in Hacks, Programming | Leave a comment

Terraria Server with Ubuntu 10.04 LTS (Linux)

Jan 2nd, 2012 Update

TDSM has supposedly decided to shut down. You can still follow the blog post below (mostly) but try using TShock for the server now instead of TDSM. Visit their GitHub downloads page.

First: My two cents on Linux distros…

I’ve recently become somewhat addicted to my new virtual dedicated Linux server. I love Ubuntu because of their outstanding support, vast community, and massive, up-to-date package repo. While we’re talking about distros I have to say that I HATE CENT OS with a deep, burning passion. It’s a horrible, convoluted, out-of-date distro and no one should ever use it. Ever. I’m looking at you, MediaTemple. I really wanted to use your servers, but I refuse to settle for Cent OS.

Headaches, compiling and dependencies (You don’t need them!)

Let’s move on. I did a lot of research into this while trying to get it to run, so here is a little background…

Terraria is written in Microsoft’s .NET framework with XNA. It’s pretty much perfect for Microsoft platforms as .NET and XNA gives a TON of flexibility with Windows, Phones, Xbox, and more. Personally, I love the .NET framework to death. It’s effective, pretty clean, and it gets the job done quickly. There’s tons of other features (anonymous types, LINQ, etc..) that I could gush about, but I’ll skip it for now. Unfortunately, that’s where the fun stops. Once you go .NET you’re effectively vendor locked to Microsoft, or at least you used to be. Enter the Mono project

What is Mono?

Mono is a project lead by Xamarin (formerly by Novell) that is trying to open up the .NET framework so that anyone can use it on any platform.

Cool, so Mono is basically the .NET framework… right?

Well, almost. It’s a constant work in progress playing a massive game of catch-up with the real .NET framework. The real Terraria server doesn’t actually work inside of Mono. My understanding is that the core reason behind this is the XNA framework isn’t readily available inside of Mono. So I went off on a research spree… I tried compiling MonoGame and MonoXNA to work the dependencies into Mono. While we’re talking about them… they should both be horribly, horribly ashamed of the lack of documentation around their build processes. Mostly because there is none. I had to go digging around into the source to figure out that OpenTK is required for MonoGame, and for MonoXNA I stopped caring before I could get very far into the 50+ compile errors it was throwing fresh out of version control.

Well that was a wild goose chase… and lucky for you because compiling all of that junk is confusing, prone to errors and tons of other headaches. After some more research I found that I had missed another solution. Instead of running the stock game files, the wonderful (I haven’t met them, but their software rocks.) person/people over at Terraria Dedicated Server Mod (TDSM) have whipped up a modded server that is actually super powerful in comparison to the stock server. Now you may be thinking, “Hey buddy, don’t mod my server. I like things stock!” But hold on. The mod server seems to run totally stock, but has some extra power and options in the console. It’s even open source on GitHub!

An open, dedicated Terraria server

I finally worked through the whole process and it’s super simple compared to what I thought it was going to be. Here is the culmination of my effort in semi-bash script format, but don’t try to run it, it’s not actually a script. Follow along with my double hash (##) comments to get a firm understanding on what’s going on.

## To start, we'll work inside our home directory.
## You can work elsewhere if you prefer, but this makes permissions easy.
cd ~
 
## First, add BadgerPorts into your sources list
## For more information on BadgerPorts visit http://badgerports.org
sudo nano /etc/apt/sources.list
 
## Add these lines to the end of sources.list (the first line is a comment for your reference!)
# BadgerPorts apt source for Mono
deb http://badgerports.org lucid main
 
## Download and add the GPG key for BadgerPorts
wget http://badgerports.org/directhex.ppa.asc
sudo apt-key add directhex.ppa.asc
 
## Update your apt repo and install the Mono package
## For more information on Mono visit http://mono-project.com
sudo apt-get update
sudo apt-get install mono-devel
 
## Check your Mono version. It needs to be 2.10 or greater.
mono -V
 
## Download the Terraria Dedicated Server Mod (TDSM)
## For more information on TDSM visit http://www.tdsm.org
wget http://update.tdsm.org/Terraria_Server.exe
 
## Move the executable elsewhere if you desire.
## It will generate some files when it is run.
mono Terraria_Server.exe
 
## That's it! Edit the server.properties file to update settings.
## You'll be asked if you want to stop and edit on the first run.

 

Hey, it works! A Terraria server on Ubuntu!


Congratulations! You can keep running unchained from Windows. If you’re looking for an excellent way to manage your servers, I cannot recommend tmux highly enough. It’s excellent for backgrounding tasks that take over the console like Terraria’s server. In addition you can come back later on and run `tmux attach` to get back to your existing sessions. Check it out, and seriously consider reading the manual. It’s a little complicated at first, but it will pay off. Installing tmux in Ubuntu is as easy as `sudo apt-get install tmux` – I seriously love the package manager and repos Ubuntu has.

Posted in Hacks, Linux, PC Games, Programming | Tagged , , , , , , , , | 16 Comments

Test and debug your ASP.NET sites on iPhone / iOS, Android, and other mobile devices locally with SharpProxy

Update for 2014: I wrote this back when Visual Studio 2010 was all the rage. It came bundled with a little built-in web server that I believe is different from what more modern versions of Visual Studio use. I haven’t had a chance to use them yet, but I believe they are based on IIS Express. I’ve heard that this server doesn’t have the localhost restrictions that the original webserver did. With a little reading and some tweaks, you may be able to access it from your device over Wi-Fi. If you already have good information on this, please leave a comment with details! Thanks, and good luck!

Have you ever wanted to test and debug a mobile ASP.NET site on an iPhone, Android phone, Blackberry, or other mobile device? If so, you might have noticed that the development server packaged up by default with Visual Studio is a little bit… limited. It doesn’t allow anyone to access your local development web server, and will actually reject requests from outside your local machine outright.

Maybe this is a good idea for security. Maybe it was a decision made to keep people from using the development servers instead of getting a real IIS server. Maybe it was just easier to program when developing Visual Studio? I am really not sure what the official reason behind it was.

First, let me ask you a few questions about mobile web development issues with ASP.NET that used to be painful for me:

  • Ever had to push a site up to a development server every time you make a change?
  • Tired of waiting FOREVER for sites to publish after changes just so you can test them on your device?
  • Frustrated over not being able to use breakpoints after publishing to a remote server?
  • Sick of resynchronizing data every time you have to push a change to your development server?
  • Ever wished you could share changes from your local machine without overwriting or waiting to republish on development?

I sure hope these are things that make you mad, because they were pissing me off to no end. After doing a few full mobile sites with ASP.NET I could literally take no more. I decided to come up with a solution. Maybe it’s not the best solution, but I needed something that would solve these problems for myself and people on my teams.

I decided to go for a program that would open up the internal local port to another port of my choosing globally. All traffic is passed directly from one port to the other, internally, while being completely loss-less and unchanged. Since it’s written with the .NET framework and I generally call it like it is… I dubbed this project SharpProxy.

SharpProxy does what it can to keep things simple.

Using SharpProxy is easy:

  1. Take a peek at what port your local ASP.NET server has decided to use.
  2. Enter it in as the Internal Port
  3. Change the External Port if desired
  4. Hit Start

Finding your ASP.NET development server’s port

That’s it! Once you have SharpProxy up and running, you can connect your device to your internal Wi-Fi network and access the server via IP and port. In my case, the process looks like this:

  1. Configure and start SharpProxy
  2. Connect my iPhone to Wi-Fi
  3. Point Safari to http://192.168.1.103:5000

If I wanted to, I could setup a port forward from my router on port 5000 and use my public IP address or a dynamic DNS service. Hopefully how this all fits together is making sense – I trust you (the developer) are at least partially familiar with network scopes, firewalls and all of that. ;)

Potential Pitfall: I really don’t think this will be a problem for most people. Still, you should be aware of it. This isn’t a problem with SharpProxy, rather it is a problem with redirections in general.

When using this with our CAS authentication server at work, I noticed that sometimes the redirects from our projects were wrong. I corrected for our case by making sure I redirect back from CAS to whatever the requested host was – NOT localhost.

In code, you can detect what the base host is by doing something like this from an ASP.NET MVC site’s controller. I think it should also work from an older ASP.NET web forms project also.

string baseURL = "http://" + this.Request.Headers["Host"];

To conclude, I hope that SharpProxy can be useful for you. I’ve published the source on GitHub, so feel free to get a copy of it, or just download and use the executable (requires the .NET 2.0 framework or greater). It may work in Mono also, but I haven’t tested it.

It’s free as in beer! (That means it’s really free, no license.) If you like using it feel free to talk about, write about it, link to it, or donate a few dollars into my PayPal. I have no shame about asking for that – everybody’s gotta eat!

Download SharpProxy
(Make sure you have the .NET 2.0 framework or greater)

Get the source code on GitHub

Posted in productivity, Programming, Web Programming | 67 Comments

Kalidity – Stream your music anywhere

This past weekend I officially opened up Kalidity, my answer to the streaming media on the web and mobile. This has been something I’ve been working on for several years, and is the result of much experimenting, tweaking, and perfecting. When I started this project, there was very few alternatives that I was aware of. Simplify Media was one of them, but they have since been purchased by Google and shutdown. I recently tried Orb, but found it to be terribly clunky and prone to crashes. Using it was just short of a nightmare. I’ve gone through countless other alternatives and just didn’t like what they had to offer. So I did what needed to be done and built my own from scratch the way I felt it should be, and more truthfully, the way that it needed to be.

For me, music isn’t just for entertainment or casual enjoyment. It completely drives my day and powers me through almost every effort I make. No matter what I am doing, I almost always have music in the background. I love to listen to music while I work, drive, or even while I do the dishes. Music isn’t just a small aspect of my life, it’s a huge part of everything I do.

Problems

So if there are people out there that love music like me, then why is every media player trying to get in my way? Why don’t they put my newest music at the top of my list if I ask for it? Why do they scramble up my artists when my folders are arranged perfectly? Why is it always such a pain to create ad-hoc playlists based on what I want to listen to at that moment? Why don’t they give me the album art automatically? Why don’t they recommend new music to me? Why is searching my library always a terrible experience?

The problems often extended beyond the media player. No one lives life standing still. We all have mobile devices, laptops, desktops, computers at work, computers at school, and more. Taking music everywhere is a real problem, and you could be stuck copying audio everywhere and syncing up your mobile devices every time you get a new song. Don’t even mention the space limits on mobile devices. Anyone with a serious music library won’t be able to fit much of it on a 8GB or even 16GB iPod. So what happens when you’re out and just want to hear that one song… but you couldn’t fit it on your iPod earlier? What if I don’t want to sync my music to 5 different locations every time I get a new song?

Solutions

Kalidity is a music connection service that keeps your music available wherever you go. Kalidity is powered in part by its own small application that you install on your home computer. If your computer is online, your media available. There are no space limits. I also wanted to avoid the legal mishaps (not to mention days/weeks of upload time) that come along with copying music off of your computer to a remote server. With Kalidity there is no uploading files. Everything you make available remains on your computer.

Kalidity Web Interface

Kalidity's Web Interface

Kalidity’s home application works to optimize your media for the web instantly, while supporting a wide variety of common file types. What this means is that there is no more waiting for things to buffer. Audio is converted and streamed on-the-fly with zero waiting time.

Everything in your library is made available in ways that are easy to use. You can access everything through the web interface, or through the mobile website. There’s no applications to download while you’re on-the-go. Simply access everything through whatever browser you have available.

Kalidity aims to get you what you want faster. Listening to music should always be about the music, not stumbling around with the media player trying to find what you’re looking for. Kalidity makes it easy to put what you want in a playlist, and then forget about it. The only reasons to come back to the player are because you’re hearing a great song, or because you decided to skip one. If a song comes on and you’re in the mood to hear more, just click the artist or album name and the interface will search for them instantly.

Searching with Kalidity is fast and accurate

Searching in Kalidity is fast and accurate

Discovering new music based on what you listen to is something that I felt was especially important. I often get asked how I discover new bands. The answer used to be cruising Amazon’s site and listening to samples based on what other customers had purchased. Now music discovery is a feature that is built into Kalidity. I simply open up the “Discover” tab and get recommendations based on what I’m listening to. Instantly. If I decide to, I can click anything that looks interesting and listen to samples on Amazon.

Kalidity's Discover Tab

Kalidity's Discover Tab

The mobile web application was an especially important feature to me. Since purchasing my iPhone, I’ve realized one big flaw in touch devices: using my iPod while driving is hard. By “hard” I mean both difficult and sometimes dangerous. If I had one goal, it was to do what I could to make music listening easier while performing other tasks. Extensive playlist controls and accurate searching make it much easier to setup what you want to listen to, and then put the device away. You can queue up hours of music at a time, which results in a much more hands-free experience than the original iPod application.

Kalidity on an iPhone

Kalidity on an iPhone

So that concludes my short tour of Kalidity (as it is currently). The site is open and you are more than welcome to integrate it into the way you listen to music. I am currently working on making it cross-platform so it will also be available for Mac and Linux. (UPDATE) Kalidity is now available for both Windows and Mac OS. If you have something to say about Kalidity (positive or negative) write me a message and let me know. You can use the community support forums to reach myself and everyone else quickly. I hope you’ll take the time to try Kalidity for yourself. I love using it, and I hope you do as well.

Click here to check out Kalidity now

Posted in Media, Music, Programming, Web Programming | Tagged , , , , , , , , , , | 4 Comments

ToDo Teams now available for use

Divide, conquer, and get stuff done. ToDo Teams is a little project I whipped up for a few reasons.

  1. I found that while splitting tasks up with student developers at work, that we were often stepping on each others toes. We needed a quick and easy way to indicate what we were working on so no one else would be trying to do the same thing.
  2. We needed a centralized place to manage tasks and track things to work on for specific projects.
  3. I wanted to learn CakePHP.

ToDo teams is essentially a productivity free-for-all. There’s no assigning tasks to people or forcing people to work on certain things. There’s simply a list of things that have to get done, and everyone is given the ability to work towards that goal.

…at least that’s how it is now. In the future it could change.

When something on a project changes, other users viewing that project will quickly receive notifications about projects changes through AJAX alerts. This helps to keep everyone up-to-date on the latest project information, and helps keep stale information or concurrency issues from happening.

ToDo Teams Screenshot

ToDo Teams Screenshot

ToDo Teams uses OpenID (currently through Google or Yahoo) so that there’s no extra usernames or passwords to remember. You can be logged in and working in seconds, and there’s no extra headaches keeping team members from joining your project.

ToDo Teams aims to be as simple as possible with the focus on getting stuff done, not fooling around with complicated project management software. If you think ToDo Teams may be a good fit for you and your team, check it out now.

Go to ToDo Teams

Posted in productivity, project management, Web Programming | Tagged , , , , , , , , | Leave a comment

Free Contact Management / Roledex Software for Windows

A few years ago I wrote some contact management / Rolodex software for a friend. I went back to it today and created an installer for it and wanted to release it to the world. Download it now! Interested in the source code? It’s available on GitHub! http://github.com/jocull/ContactManagement

New Contact

New Contact

Main Interface

Main Interface

Detail Sheet

Detail Sheet

Program Options

Program Options

Birthday and Anniversary Alerts

Birthday and Anniversary Alerts

Posted in Programming | Tagged , , , | Leave a comment

Zen Garden Farmer for Plants vs. Zombies – Get fast money from your Zen Garden!

Plants vs. Zombies is a great game. There’s lots to do, even after you beat the main game. There’s new games and puzzles to play, and things to buy. Money actually becomes a large part of the game later on, so having a good way to get money is important.

In my opinion, the Zen Garden is the easiest and most consistent way to get money if you have a decent sized garden. Purchasing Stinky the Snail makes collecting the coins and diamonds easier, but there is one critical problem: he’s narcoleptic. He’ll often take a snooze after just a couple minutes of collecting coins, meaning that you have to sit there and wake him up.

“Not fair!” I say. What if I wanted to take a nap? Can’t we take shifts? Apparently not, according to PopCap. So, I decided I needed something that would wake Stinky up, and along the way a few other features snuck in. Ladies and gentlemen, I give you… Zen Garden Farmer.

Garden Farmer works for you by taking control of the mouse and doing some of the more tedious tasks of taking care of your Zen Garden. Hopefully this video will help explain things.

So, feel like trying it out for yourself? Go ahead and grab it then! Interested in the source code? It’s shared on GitHub! http://github.com/jocull/ZenGardenFarmer

Download Garden Farmer now

and/or…

Join the discussion on the Steam forums

Update: I got bored and decided to add in a Whack-a-Zombie mode. It works for Beghouled Twist too as long as you have matches available. If you run out of matches you can just take over for a second to hit the “shuffle” button, then put it back on cruise control. Video here:

Posted in PC Games, Programming | Tagged , , , , | 37 Comments

“tv2night” Goes Live

I applied for another Twitter account and created a small CRON job for it on my own server. Now you can follow Television Tonight and get tweets about one hour before your favorite shows come on the air.

Tweets (updates) are limited to 140 characters. In the space we have most of the important information. The format is concise, but useful:

[Show Name] s[Season #]e[Episode #] is starting on [Show's Network] in [minutes 'til air time] min! ([Time show starts] EST) Summary: [TinyURL to Episode Summary]

The tweet is measured before and after adding the summary. If the tweet is too long, the word “Summary: ” will be cut. If the entire link won’t fit it isn’t included at all, because having half of a URL doesn’t make much sense.

Interested in following? Check it out now: http://twitter.com/tv2night

Posted in Programming, Web Programming | Tagged , , | Leave a comment

Dawn of War 2 Multiplayer Beta Thoughts

  1. The Requisition is broken.
  2. The Requisition is really broken.
  3. Seriously, please fix the requisition. The game is great, and deserves it.

This game reflects Company of Heroes pretty closely. Much of the game is based on taking cover, positioning, suppressing, and flanking the enemy. Especially suppression is a huge issue to deal with. Suppressed squads move slowly, take more damage, and are basically just dead. The only way to get out of these suppression effects is to get out of fire, die, or run like hell. The game has a “Flee” ability on most units that make them run away to the nearest reinforcement point. It breaks suppression effects and gives a little defensive bonus, I think. Your units are likely to live while fleeing, but they can get blocked off or pulled back by certain abilities.

Unfortunately, right now a big part of the game is also running the hell away from anything that could possibly kill your units. Because the requisition is so broken, any loss of units means minutes waiting to rebuild. In this game every second counts, and a minute feels like an eternity. I never see my requisition-per-minute counter passing 350, and it usually sits at about 200. One squad of Tactical Space marines costs 500. Are you seeing the issue here? If your marines die, you’re probably going to have to wait two and a half minutes for the requisition to accumulate. It’s rare that you’ll have any left over or stockpiled, because really you should be spending it all on more units, upgrades, an enhancements.

That little math problem aside, all of the Space Marines units are just plain too expensive. I often find myself stuck with two scout marine squads wondering how on earth I’m going to afford any other units, let alone upgrade my base or buy higher tier units. All of the other races have much cheaper base units. Granted, they are weaker, but at least you can afford them. Basic infantry (ranged and melee) squads in the other races run at about 270 requisition

The Eldar even get a 4-man suppression turret for 270 requisition. Based on this, I hereby declare the Eldar over-powered. No infantry squad can afford to be suppressed, and if you can cover lots of angles with the suppression effects, the other team is pretty much screwed. Punching through a line of fire is nearly impossible. You’ll either have to jump over the suppressing squad, tunnel under them, flank them, or somehow just avoid the fire. It almost never works, and you’re pretty much dead.

Similar suppression effects for the space marines cost 340 requisition for a devestator squad that, in my opinion, isn’t even as good as the Eldar’s. Tyranids must pay 400 requisition for a warrior squad, and then upgrade them for another 50 or so to get suppression. Orcs can’t even buy a suppression squad until they hit the 2nd Tech Tier. The best they can do is buy a shoota-boyz squad, and upgrade them with bigga-gunz. In my opinion, this doesn’t count. It’s an ability with a cooldown, and often the suppression doesn’t work or wears off too quickly. The cost to get that would be about 270 requisition plus another 50 or so for bigga-gunz.

The game seems to have a few parallels to Blizzard’s Warcraft III, though they play them down so it doesn’t seem that way. First off, you select a “Commander” to lead your army. Each Commander sort of plays a different role. Offense, Defense, Support, Tunneler, Assassin, etc. The Commander (and all other squads) level up, and get stronger (yes, stronger) as they kill units. To me, this almost doesn’t make sense. If you are on the wrong end of the stick getting your ass handed to you, do you really want the other guy just gaining an even bigger upper hand? While he’s stockpiling requisition and you are getting little to none?

Also, a large part of Warcraft III was the “Upkeep”. What happened with upkeep was that when your army got large, you only got a portion of any resources you harvested. It isn’t ever mentioned in this game, but if you pay attention you will notice that you get a lot less requisition-per-minute when you have a standing army than when you have next to nothing. Compare the screenshot below with the screenshot above:

As a final thought, it also doesn’t seem to matter how hard you work to take requisition points. In the end it hardly even matters. I laid the smack down on the highest level computer player and took every point possible as quickly as I could. This actually HURT me, and I acquired less requisition than he did in the course of the game. Now how the hell did that happen?

This is warfare, not welfare!

It seems like the only strategy that matters is stealing people’s power. This keeps them from upgrading their headquarters, getting higher tier units, and getting upgrades.

Posted in PC Games | Tagged , , , , , , , , | 1 Comment