About andy

in west midlothian, born and raised... on the playground was where i spent most of my days... but yea, i'm a freak.

The debacle that is SimCity 2013

First off, let me say it’s been a while since I’ve last blogged. Since November in fact. And the reason I’m writing here now is, yup you guessed it, I need to rant yet again. So here’s me getting my rant on…

SimCity 2k was the source of countless hours of fun for me back when I first started getting into PC gaming. I remember numerous nights of playing till 4 in the morning, trying to build the “perfect” city. Since then, I’ve played SimCity 3k and SimCity 4 and loved them all. There are plenty of facets to the SimCity games for there to be an appeal to most gamers who play sim or micro-management type games. Network management (traffic), city layout, finance management, and market manipulation are just a few I can think of off the top of my head. What I really loved about this game though, was that the sky was the limit. You were the mayor/God. You could transform the earth. You could rain down destruction/disaster if one of your sims even looked at you funny. You could demolish an entire row of high-rise condominiums without even evicting the tenants first, just to build a new shopping area with a nice medium-sized park so your sims could have their own Tysons Corner Galleria area. If you could imagine it, you could at least *try* to build it.

Fast forward to today. SimCity 2013 has been out for a bit now and the reviews that were originally positive have since turned negative. Maxis did some initial damage control going so far as to have a Q&A on Twitter with the head of the company, Lucy Bradshaw, back when the focus of the problems seemed to be on server issues and players couldn’t get online. Now that the initial launch week stress has cleared, players have come back with new grievances which the company might not be able to just throw more servers at, including pathfinding issues as well as an overly simplistic agent model which might end up causing more problems than it solved. Couple these problems with the anonymous simcity dev who earlier this week said in an interview that the company’s claims of the game depending on online connectivity are exaggerated (take with grain of salt), and you have a recipe for hell week in the PR department at EA/Maxis.

As for me, I’ve returned the game for a refund because it was just unplayable and I wanted to send a message with my wallet. Do I think they’ll listen? Probably not. Do I think the game was worth $60? Nope. I’ll most likely pick it up when it goes on sale for like $10 (which is probably going to be sooner rather than later I’m guessing given the current bad press around the game).

An observation on politics

I haven’t talked about politics much on this blog, but I think the 2012 presidential election that just wrapped up deserves a bit of comment. Let’s talk about the Mittster. What happened? A deluge of blog posts and articles have gone up this past week attempting to answer this question. The answers vary wildly depending on the source. Let’s start at the beginning to try to piece together the flow of fail.

First, you could argue that Romney’s downward spiral began at the 2012 Republican primaries. This year’s special guests included Herman Cain, Jon Huntsman, Rick Santorum, Newt Gingrich, and many others. Much of the Obama campaign’s ammo came almost directly from the mouths of Romney’s competition. Don’t forget that running a campaign for primaries takes precious money and resources away from the presidential campaign. Granted, securing the primary does get the candidate financial/political support from the RNC and PACs, but Romney’s image had already been tarnished.

Once it became clear that Romney was going to get the nomination, the Obama team wasted no time in beginning a negative campaign against the governor to paint him as “an out-of-touch rich guy.” Team Romney spent the beginning of their ad campaign basically defining him as the “not Obama” choice. Seeing how this didn’t work out so well for John Kerry in 2004, I was surprised they didn’t put out more substance, especially when they were being blasted in the media for giving vague answers to everything. It seems like I wasn’t the only one who was critical of this approach because Team Romney slowly started to shift to a 5-point plan which defined a specific plan to deal with the economy. While all this was happening, the Republicans were dealing with internal strife because many in the party still felt Mitt was the wrong choice and wasn’t conservative enough (or oddly, not moderate enough).

This is pretty much how it went all summer. Obama’s campaign was relentless in their attacks on Mitt involving Bain Capital and his tax returns. The “swiftboating” tactics used so successfully against John Kerry in 2004 were devastating against Mitt. What was supposed to be Romney’s strongest point, being a successful CEO, was flipped upside down by Team Obama’s attacks and the message turned into one of Romney shipping jobs overseas and not caring about the average working American. Romney’s team focused on one solid message: JOBS, JOBS, JOBS. Some amazing flubs came out including Romney’s campaign strategist saying that Mitt’s policy stances would undergo some adjustment similar to an “etch-a-sketch”, a secretly taped video of one of Mitt’s closed-door fundraising events where he says that 47% of the American population feel they are entitled to handouts, and some horrible foreign policy incidents including a row in the UK over criticizing their handling of the Olympics and his ill-informed criticism of US actions during the Benghazi attack. Mitt seemed to be digging himself a deeper hole as the summer dragged on, but that all changed during the first presidential debate.

Romney scored a homerun on the first presidential debates. His answers were vague and at some points, just flat out lies, but he won overall based on style and his display of leadership. This brought some much-needed enthusiasm to the right and seemed to re-energize Team Romney. His performance on the subsequent debates never quite matched his first performance, but it had already done its job. Romney was rising in the polls and was soon at a dead heat with the president as election day came closer.

Then came election day. Team Obama had the Narwhal system to try and get more voters out there at the last minute while Team Romney had the newly-created Orca system. Unfortunately for Romney, Orca just couldn’t deliver on what it was supposed to do. These systems were designed to unify the large datasets used in national campaigns and, using statistical modeling, give the campaign an accurate image of the voter base and how the election will turn out. Narwhal was an epic success. Orca suffered from not enough testing, being overly complicated and difficult to use, and many user mishaps which in the end would stifle the Romney team’s election day efforts. Obama won the popular vote by around 2 million votes and scored around 300 electoral votes, crushing Mitt Romney.

There’s so much more to talk about on this issue such as the declining importance of the white male demographic in relation to those of growing minorities, the right’s failure to convince women voters to vote for them, tropical superstorm Sandy, Chris Christie, Mayor Bloomberg, etc. Unfortunately I’m rather tired and will have to do it some other time. In the end, I supported Obama this election cycle and am glad he was re-elected, but hope he changes his tune on civil liberties and intellectual property law.

Taking the plunge: Windows 8

win8

I managed to get a copy of Windows 8 the other day for $15 so I decided to give it a shot even though I’d probably not have upgraded for a while (if at all) because of all the negative press. Well, it wasn’t solely the negative press. I’d read up a bit on the metro UI changes being introduced and was a bit hesitant on having to learn a new UI paradigm, but I’m glad to report my fears were overblown. After a few hours of casual usage, I’ve slowly come around to the new OS and have even come to appreciate some of the design decisions (while lamenting others).

I didn’t have too much on my laptop that I couldn’t get back with a cloud sync. I used the Windows 8 upgrade assistant program off the Microsoft website. It downloaded the Windows 8 image and then let me decide if I wanted to put it onto USB, or optical media, or just run right there. I put it onto USB in case I wanted to use it for the future and proceeded with the install. It went rather quickly on my Thinkpad T520 and was probably up and running in about 15-20 minutes. Then it finally booted up to the actual “Start” screen with the tiles.

desktop

I WER CONFUSED. Not gonna lie. This was a bit intimidating at first. I clicked on the IE tile and got a not found page because I hadn’t connected it to the wireless network yet. Around this time, I figured out that the windows key on the keyboard brought up the start screen. So I tried out the desktop tile and it brought me to something that resembled the Windows 7 desktop minus the start menu. I started getting to work doing all the post-installation work like setting up the wireless, installing Chrome (although IE 10 wasn’t bad from what I saw, but… IE… lulz), checking out the new changes to Windows Explorer, etc.

 

I’m still messing around with it and getting acclimated to the different application modes (metro vs desktop). Some of it feels awkward on the desktop and you can see where it wouldn’t be so bad on mobile (eg. the Games app tile). One quick observation is that file utilities such as copy/delete seem to work insanely faster. I’ll report back on what I find later.

Using javascript’s RegExp exec method

The exec method off the RegExp object in javascript can cause some confusion if you’re not used to it. Let’s say we had the following simple regex:

var regex = /the/i;

So we’re looking for the word “the” with the case-insensitive flag enabled so it will match “the”, “THE”, “The”, etc. Here’s some sample subject text:

var subject = 'The quick brown fox jumps over the lazy dog';

If we go with this “as is”, we’ll get something like the following:

var match = regex.exec(subject);
if (match) {
    alert(match[0]);
}

This will alert “The”, but what about the other instance of “the” in the sentence? How come that wasn’t matched? Oh! We forgot to set the global flag on the regex object. Now it should look like this:

var regex = /the/ig;

And the matching code now looks like:

var match = null;
while ( (match = regex.exec(subject)) ) {
    alert(match[0]);
}

Now we get both instances of “the” in the sentence. So what exactly is going on here? Let’s slightly change that last block of code to this:

var match = null;
while ( (match = regex.exec(subject)) ) {
    alert(match[0] + ' ' + regex.lastIndex);
}

So here, we see the regex object has a property called lastIndex that is set after every iteration of “exec()”. If you run the code, you’ll get something like “The 3″ and “the 34″. Once “exec()” finds a match, it sets the lastIndex property of the regex to the character right after the matched text. The next time it runs through the loop, it checks this lastIndex position and starts from there.

I’ll end this with a couple of cautionary warnings:

  • Don’t set the regex inside the loop. This would cause the lastIndex property to always be initialized to zero, hence, infinite loop if it was run against text with a match.
  • Modifying the subject string during the exec loop is dangerous and can also lead to an infinite loop.

Hope this helps some people!

jQuery Expected

Long time no write. Work has been crazy busy and life is pretty good. Here’s a quick plugin I wrote to help defensive programming when using jquery selectors.

jQuery Expected is inspired by .NET’s Enumerable.Single. It takes in an expected value and returns the collection if the number of items in the selector array matches the expected value. When the expected value doesn’t match, an Error of type ExpectedValueError is thrown. ExpectedValueError is included in the global namespace.

example:

try {
    $('selector').expected(1).html('hello world');
} catch (ex) {
    if (ex instanceof ExpectedValueError) {
        alert('Selector did not have expected length of 1');
    } else {
        console.log(ex);
    }
}

check it out here at github.

jQuery Listerine Plugin

I’ve been helping a friend with his site, www.thehardwareproject.org, for the past couple of months. It was a good chance to rework a lot of my php CMS and one thing I noticed was that there were a lot of pages where all I was doing was displaying information via a list of divs. Different pages might have the lists formatted differently, but rather than write page-specific backend code to format the lists, why not output all lists uniformly to the page and then have client-side code manage the display?

Listerine has 2 modes. One is “columns” which basically creates a user-set number of columns on the page and then evenly distributes the list items between columns. The other mode is “grid” which is more of a tile-like display.

simple columns example:

$('.manufacturer_list_container').listerine({
    cols: 3,
    transform: 'columns'
});

Download the code here.

making bossam (bo ssam)

This weekend, I finally got around to making bossam (bo ssam), the Korean version of boiled pork and cabbage, at home. Using the instructions I found on this great korean food blog, it didn’t come out half bad. Some adjustments I made to the recipe are not using an onion, using a Korean red pepper instead of a Serrano pepper, not using a vegetable boil bag, and using 2.5 lbs of skin-on pork belly (which caused me to have way too many leftovers). Here are some pics of the process.

cleaning the pork

cleaning the pork

giving the lettuce a salt bath

giving the lettuce a salt bath

dwenjang paste and coffee grounds in a pot.

dwenjang paste and coffee grounds in a pot.

boiling pork with coffee grounds.

boiling pork with coffee grounds.

everything in pot with new water.

everything in pot with new water.

boiling napa cabbage

boiling napa cabbage

time to enjoy the fruits of our labor!

time to enjoy the fruits of our labor!

 

Disable Script Debugging in Visual Web Developer 2010 Express

This little registry hack will disable javascript debugging in Visual Web Developer 2010 Express. You should really be using something like Chrome Dev Tools or Firebug when debugging javascript anyways.

reg add HKLM\SOFTWARE\Microsoft\VWDExpress\10.0\AD7Metrics\Engine\{F200A7E7-DEA5-11D0-B854-00A0244A1DE2} /v ProgramProvider /d {4FF9DEF4-8922-4D02-9379-3FFA64D1D639} /f

happy new years 2012

Happy new years! For this first post of the new year, I thought I’d take a look at last year’s resolutions and see how I fared.

  • Play MORE video games.  Try and beat them too since I have a nasty habit of just dropping them midway through.
  • Learn Python and Java.
  • Try and complete more of my programming side projects instead of leaving them half-done (this seems to be a recurring theme in my life).
  • Learn to drive stick.
  • Try and do some more grad school classes.  I had put them off to pay off some debt first, but I should really try and get this done.
  • Pay off debt.
  • Read more books.
  • Be less political.

I have managed to actually beat more of the video games I started playing this year rather than leaving them unfinished. Some exceptions include Castlevania and Oblivion. Now that SWTOR has come out, I’ll probably leave those unfinished for a while though. I’ve managed to learn a bit of python, as well as learned to use git to publish some of the stuff I’ve learned to the web. I didn’t get around to learning stick or take more grad school classes. Due to unforeseen circumstances, I wasn’t able to save up as much money as I would have liked this past year to pay off debt. I did manage to read a lot more books though and I think I’ve become a bit less political. All in all, not a bad run of resolutions.

For this next year, I’ll keep the resolutions simple.

  • Start working out more and possibly start a martial arts class.
  • Pay off debt.
  • Start working on a video game project.
  • Learn, learn, learn. Always try to continue the learning process.