<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace Site Server v5.9.2 (http://www.squarespace.com/) on Wed, 10 Mar 2010 03:38:52 GMT--><feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><title>Home</title><subtitle>Home</subtitle><id>http://www.bitdestroyer.com/journal/</id><link rel="alternate" type="application/xhtml+xml" href="http://www.bitdestroyer.com/journal/"/><link rel="self" type="application/atom+xml" href="http://www.bitdestroyer.com/journal/atom.xml"/><updated>2010-02-19T03:29:31Z</updated><generator uri="http://www.squarespace.com/" version="Squarespace Site Server v5.9.2 (http://www.squarespace.com/)">Squarespace</generator><entry><title>Roomba Drinking Games</title><category term="Drinking Roomba"/><category term="Gaming"/><category term="Technology"/><id>http://www.bitdestroyer.com/journal/2010/2/18/roomba-drinking-games.html</id><link rel="alternate" type="text/html" href="http://www.bitdestroyer.com/journal/2010/2/18/roomba-drinking-games.html"/><author><name>James Miller</name></author><published>2010-02-18T18:57:07Z</published><updated>2010-02-18T18:57:07Z</updated><content type="html" xml:lang="en-US"><![CDATA[<p><strong><span class="full-image-float-right ssNonEditable"><span><img src="http://www.bitdestroyer.com/storage/Roomba-Guinness.png?__SQUARESPACE_CACHEVERSION=1266523064809" alt="" /></span></span></strong>We purchased our first iRobot Roomba the other day. I have to say  it's one of the coolest , and most useful, things I've ever bought.  Watching it pinball around our apartment vacuuming, and doing a damn  good job of it, is extremely entertaining. It makes you realize exactly  how far technology has truly come. All of this begs at one serious  question... <strong>how can we utilize this beautiful piece of  technology to get us inebriated</strong><strong>?</strong></p>
<p><strong><br /></strong></p>
<p>I've come up with a couple to start off, post yours in the comments  and I'll update the list with the good ones. Also, if you have any recommened names for games that are already posted, let me know. All drinking games should have catchy names. I take no responsibility for any damage to your Roomba or yourself, play and drink at your own risk!</p>
<p>&nbsp;</p>
<ol>
<li><strong>Spin the Robot</strong><br /><br /><strong>Basic Premise:</strong> Everyone sits/stands in a circle with the Roomba in the center and enough space between people for the Roomba to escape. Whomever the Roomba bounces off of must drink. If the Roomba escapes the circle, everyone drinks. If the Roomba escapes, he is put back into the center of the circle and the cycle starts again.<br /><br /><strong>Notes:</strong> You will need some way of randomizing what direction the Roomba faces (or where everyone is sitting/standing) since it generally travels in a straight line after being turned on. One way of doing this would be for everyone to stand in a circle and roll a pair of dice. Whatever they roll is the number of people to their left or right that they move. Also note that some Roomba's may begin with a circular pattern, in which case this isn't needed.<br /><br /></li>
<li><strong>Plinko</strong><br /><br /><strong>Basic Premise:</strong> Everyone randomly picks a position in a group with a few feet between them for the Roomba to travel. Once everyone has their places, they can not move. The Roomba is placed at the front of the group by a designated person and turned on. The Roomba will travel towards to group of people bouncing off whatever it hits. Each person it hits must drink. If the Roomba attempts to "wall follow" (or bounce around their feet to find out where the particular obstruction ends), they must finish their drink. The person who lets the Roomba loose should try their best to get the Roomba to hit its first target inside fhe group of people to keep the Roomba from hitting the first person, changing direction and going away from everyone.<br /><br /><strong>Notes:</strong> Once again, you will need a way of deciding who will place the Roomba and let it loose.<br /><br /></li>
<li><strong>Musical Robots</strong><br /><br /><strong>Basic Premise:</strong> This is a variation of Spin the Robot except everyone stands in a tight circle with no room for the Roomba to escape. Whoever the Roomba hits as it makes its way around the circle is removed from the circle. After someone is removed, everyone should move in tighter to prevent the Roomba from escaping the circle. Because it is hard for the last couple people to create a circle that will contain the Roomba (he's crazy, after all), you can either enter some kind of elimination mode or... everyone can drink. Your pick. Either way you get inebriated.<br /><br /><strong>Notes:</strong> As always, you will need to randomize the orientation of the players.<br /><br /></li>
</ol>
<p>Now give me your suggestions. I know these are basic, but I'm sure you imaginative people will come up with some better ones.</p>]]></content></entry><entry><title>The Importance of Rumors</title><category term="Rumors Innovation"/><category term="Technology"/><id>http://www.bitdestroyer.com/journal/2010/1/26/the-importance-of-rumors.html</id><link rel="alternate" type="text/html" href="http://www.bitdestroyer.com/journal/2010/1/26/the-importance-of-rumors.html"/><author><name>James Miller</name></author><published>2010-01-26T14:33:55Z</published><updated>2010-01-26T14:33:55Z</updated><content type="html" xml:lang="en-US"><![CDATA[<p>Over the past few months, as Apple Tablet rumors and speculation have heated to a feverish pitch, I've noticed two trends that really caught my eye, first during the coverage of CES. The first trend is a combination of many factors that have caused an interesting response from people who are excited about the potential for a tablet computer.</p>
<p>I've observed, in listening to interviews and even in my own excitement about the devices potential, that many people have risen the idea of a tablet computer from Apple into an almost god-like symbol that solves all of their computing problems. This is, more or less (probably more), a result of the track record Apple has had in recent history regarding the success of it's products, putting Apple devices on a plateau of excellence that few companies have succeeded in achieving. People expect Apple products to fill a gap in their life in an elegant, efficient, and beautiful way.</p>
<p>I don't claim to be any exception from this rule, I have my visions of gradeur about the device as well. I personally feel that one aspect of the device that some people have not taken into consideration is one of the key demographics that Apple is most popular with: college students. The speculation that Apple's tablet will attack the Ebook market, much as it did the music market, brings up the potential for the Apple tablet to become a successor for college students who purchase Macbooks. Think of having all of your textbooks and notes on an elegant and light device... I'd buy that for a dollar.</p>
<p>And this is exactly what I'm talking about. As I am currently a student (and gadget whore, there, I said it...) with a desire to streamline the process of attending school and managing all of the information contained therein, I've imbued the tablet with all of the traits that I see as being useful to me. I've seen countless people from all interests do the same thing. Obviously we can't expect it to solve everyones problems. Hell, to be completely honest, we <a href="http://www.penny-arcade.com/comic/2010/1/22/">don't even know what <em>it</em> is</a> but I think that this explosion of theoretical thinking regarding what problems this device can solve for people is ultimately a very important thing, which brings me to my second observation.</p>
<p>Anyone who followed the coverage at CES will have certainly noticed that many device makers were preempting Apple's tablet release. Some were even brazen enough to name their devices after a few of its rumored names. While many of the devices will fade into the ether without ever hitting the shelves, I do honestly believe that the interest people have taken in crafting devices in their minds-eye that will solve whatever problems they have will ultimately drive innovation. We've already seen a slew of innovative devices that have tried to solve each of those problems, such as the Lenovo U1 and the plethora of third-party Ebook readers, each with their own unique take on the direction of the device.</p>
<p>All things considered, I find it particularly interesting that when rumors of an anticipated device begin to fly, especially with the fervor that accompanies any Apple announcement, average people begin to dream up devices that solve their problems and ultimately begin to drive the industry in a new direction by thinking differently. Even if Apple doesn't announce a tablet device, a mark has been made that there is an opportunity for someone to produce a device that solves these problems.</p>]]></content></entry><entry><title>Google &lt;3 The Internet</title><id>http://www.bitdestroyer.com/journal/2010/1/12/google-3-the-internet.html</id><link rel="alternate" type="text/html" href="http://www.bitdestroyer.com/journal/2010/1/12/google-3-the-internet.html"/><author><name>James Miller</name></author><published>2010-01-13T03:20:04Z</published><updated>2010-01-13T03:20:04Z</updated><content type="html" xml:lang="en-US"><![CDATA[<p>If you haven't read <a href="http://googleblog.blogspot.com/2010/01/new-approach-to-china.html">this recent post</a> on the Official Google Blog, I recommend you give it a once-over. Wait, no, give it a twice-over. Really let it sink in.</p>
<p>We all have that fear in the back of our mind about trusting Google with so much of our information but so far they've done a great job of sticking to their "do no evil" motto. I must say though, this recent move by Google has made me at least slightly more hopeful that their motto is sincere and that they will stick to it as they continue to change the web and our lives.</p>
<p>I have no statistics about the type of penetration Google has in the Chinese market since it appears that they already censor Google Apps like Gmail and Google Docs but what kind of impact do you think pulling out of China would have? Are we about to see firsthand the power of information used to strong-arm a government into complying with a policy of openness? I seriously doubt the last part, but it will be interesting to see how the Chinese government and it's people react to this momentous change.</p>]]></content></entry><entry><title>Haikus for Our UPS Man</title><category term="Haiku"/><category term="Literature"/><id>http://www.bitdestroyer.com/journal/2009/11/14/haikus-for-our-ups-man.html</id><link rel="alternate" type="text/html" href="http://www.bitdestroyer.com/journal/2009/11/14/haikus-for-our-ups-man.html"/><author><name>James Miller</name></author><published>2009-11-14T07:23:10Z</published><updated>2009-11-14T07:23:10Z</updated><content type="html" xml:lang="en-US"><![CDATA[<p>In order to persuade our UPS man to leave a package I was expecting, Teya wrote him a few haikus. In the end he left the package and took the haikus.</p>
<p><span class="full-image-block ssNonEditable"><span><img src="http://www.bitdestroyer.com/storage/post-images/Haiku.jpg?__SQUARESPACE_CACHEVERSION=1258183596915" alt="" /></span></span></p>]]></content></entry><entry><title>BSOD Karaoke</title><id>http://www.bitdestroyer.com/journal/2009/11/8/bsod-karaoke.html</id><link rel="alternate" type="text/html" href="http://www.bitdestroyer.com/journal/2009/11/8/bsod-karaoke.html"/><author><name>James Miller</name></author><published>2009-11-09T03:37:20Z</published><updated>2009-11-09T03:37:20Z</updated><content type="html" xml:lang="en-US"><![CDATA[<p>Follow the bouncy... erm... memory address?</p>
<p>&nbsp;</p>
<p><span class="full-image-block ssNonEditable"><span><img src="http://www.bitdestroyer.com/storage/post-images/BSOD.jpg?__SQUARESPACE_CACHEVERSION=1257737898023" alt="" /></span></span></p>]]></content></entry><entry><title>Elegantly Handling AJAX Errors in ASP.NET MVC using jQuery</title><category term="ASP.NET MVC"/><category term="Error Handling"/><category term="Programming"/><category term="jQuery"/><id>http://www.bitdestroyer.com/journal/2009/11/5/elegantly-handling-ajax-errors-in-aspnet-mvc-using-jquery.html</id><link rel="alternate" type="text/html" href="http://www.bitdestroyer.com/journal/2009/11/5/elegantly-handling-ajax-errors-in-aspnet-mvc-using-jquery.html"/><author><name>James Miller</name></author><published>2009-11-05T05:53:03Z</published><updated>2009-11-05T05:53:03Z</updated><content type="html" xml:lang="en-US"><![CDATA[<p>One issue I've always struggled with when using AJAX is how to handle server side errors. I would usually wind up writing a bunch of code that would return some type of response code to indicate what happened on the server. As you can imagine this is incredibly tedious, messy, and horrific to maintain. Tonight as I was working on a project I came up with an elegant way of handling such scenarios that I thought I would share.</p>

<p>To begin, I always inherit all of my controllers from a custom base controller class. Within that base controller I added a method and event, shown below:</p>

<pre><code>protected JsonResult AJAXError(string message)
{
    if (String.IsNullOrEmpty(message))
        message = "Oops! Something went wrong while processing your request.";

    Response.StatusCode = 500;

    return Json(new { ErrorMessage = message });
}

protected override void OnException(ExceptionContext filterContext)
{
    if (Request.IsAjaxRequest())
    {
        filterContext.Result            = AJAXError(filterContext.Exception.Message);
        filterContext.ExceptionHandled  = true;
    }

    base.OnException(filterContext);
}
</code></pre>

<p>The OnException event catches any exceptions that are thrown during the execution of controller actions. Within this event, we first check to see if the exception occurred during an AJAX request. If so, we set the result to the return value of our AJAXError method. The AJAXError method only does two things, it sets the StatusCode to 500 (Internal Error) so that the AJAX request shows itself to be an error and returns a JSON object with an ErrorMessage property that contains the current error. </p>

<p>Something else to keep in mind is that often times when a site is public, you won't want all of the details of the error being published to the user. This opens up a potential security risk if critical information is leaked out via errors. In my code (not shown above), I account for checking to see if the site is in production use or in debug and if so change the error message to a default error. This will prevent unwanted information from leaking out.</p>

<p>Onward!</p>

<p>The second part of the solution comes with the help of jQuery's global ajaxError event. Within a client-side javascript include, I have the following code:</p>

<pre><code>$(document).ready(function() {

    $(document).ajaxError(function(event, XMLHttpRequest, ajaxOptions, thrownError) {
        var result = $.secureEvalJSON(XMLHttpRequest.responseText);
        ShowDialog(result.ErrorMessage, "Oops! There was an error.");
    });

});
</code></pre>

<p>jQuery provides the ajaxError event as a means to catch any errors that are fired from all AJAX requests on a page. Remember the JSON object we return from the server-side AJAXError method? It winds up in the XMLHttpRequest.responseText property as a JSON string. To make things easier, we need to convert that JSON string to a JSON object. Some people will suggest using the eval method to do this but I would urge strongly against that. Doing this could potentially allow an attacker to execute client-side code.</p>

<p>After a bit of research, I opted to use the jquery-json plugin (<a href="http://code.google.com/p/jquery-json/" target="_blank">found here</a>) to handle the conversion. The jquery-json library provides us with the $.secureEvalJSON method, allowing us to translate that JSON string into a JSON object. </p>

<p>Calling result.ErrorMessage will now give you the message that was set on the server side, allowing you to alert the user about the issue. The ShowDialog function above is simply a method I put together to display a jQuery Dialog Box rather than a plain alert.</p>

<p>I'm pretty happy with this solution because not only does it catch any unexpected exceptions on the server-side, but you can use the AJAXError method to return an error when doing data validation. For example, here is some code from one of my actions:</p>

<pre><code>    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult UpdateUserDetails(FormCollection collection)
    {
        Contract.Requires(!String.IsNullOrEmpty(collection["username"]));

        var profile                 = this.Users.GetUserProfile(collection["username"]);

        if (profile == null)
            return AJAXError("There was an issue updating user details. The users profile could not be found.");

        /* Do some stuff... */

        profile.Save();

        return new EmptyResult();
    }
</code></pre>

<p>If the users profile can not be found, we just return an AJAXError with the error details and that gets reflected on the client-side automagically.</p>
]]></content></entry></feed>