Wednesday, April 29

Game: No More Heroes (Wii) Click for more info

Hilarious third person slash-em-up where you play a wannabe assassin trying to climb the ladder in his chosen field. I'd call it GTA for dummies, except it pushes the boundaries quite a bit (albeit in a variety of amusing ways) so isn't really for kids. In fact I'd say its style and humour are pretty sophisticated (although perhaps not as much when you're recharging your blade), and the reason this game is worth a play in the first place.

Gameplay is simple and straightforward although a bit unresponsive at times. This isn't a problem in the main, but can make things a bit frustrating when you're up against a boss. Sound and graphics are passable but nothing amazing (even for the Wii).

Another bonus for me is the brevity of the game; I don't see the game lasting more than 10 hours which is the perfect length for someone who just doesn't get the time to play any more. That and the episodic flavour of the game make it great for picking up and playing.

Monday, April 27

Snippet

xxxx says (22:48):
my mom just showed me this new rishta's picture
Shak says (22:48):
hot?
xxxx says (22:48):
he's holding a really cute baby in the picture
way to manipulate girls eh
Shak says (22:48):
yeh
i did that with my nephews
didnt work
xxxx says (22:49):
and the second guy...got himself photographed infront of a mercedes
which looks rental
Shak says (22:49):
yeh
i did that
didnt work
xxxx says (22:49):
because he is wearing the same shirt in all three pictures
really
you rented a mercedes
Shak says (22:49):
no
xxxx says (22:49):
with leather red interior
Shak says (22:49):
it was a vauxhall zafira iirc
...
didnt work

[...]

Shak says (22:51):
http://www.radioshak.co.uk/2009/04/snippet.html

[...]

xxxx says (22:52):
lol..you responded the same way
as you did here...
OH
nevermind
i feel stupid

[...]

Shak says (22:54):
lol
that's funny
i gotta add that
xxxx says (22:54):
no don't....let's not publicize my blondness

Sunday, April 26

Film: Observe and Report Click for more info

Oh Seth. Why couldn't you have stuck to the plan? Yes, you play the loser brilliantly... But in this film you kinda fall short. It could have been because of the attempt at depth, perhaps it was just the setting of a mall that did it. But really I think it was just the dire and joke-thin script that failed you on this occasion.

There were some funny bits, like the classic exchange between Seth Rogen's and Aziz Ansari's respective characters. It soon becomes clear that the funniest parts of this film were the bits that had nothing to do with securing a shopping mall, and as such there weren't really that many of them.

Quite disappointing really.

Saturday, April 25

Spittin' Light, Healing the Hood Click for more info

To save me time I'm just going to link to this. There wasn't much difference in the line up in this year's Radical Middle Way tour, and unfortunately even some of the material was reheard. Still, the crowd was different enough (in both size and stature) to make the event as a whole different and since you can't get too much of a good thing overall I'm glad I went.

Thursday, April 16

Film: Let the Right One In Click for more info

It's official: Buffy has spoiled all vampire movies for me. Whatever twist or "fresh" approach a film of this genre takes will have already been seen in that seminal show, and alas that fact remains true with this one.

Okay, not quite. But this story of young love between people from vastly different worlds has been done before (and I'm guessing hordes of teenage girls will swear by Twilight) and what makes it worse in this case is that LTROI only has this particular gimmick to rely on. Take that away and there's not much left.

Still as a film it's well put together. The story is subtle yet deliberate, with a lot of things implied instead of being spelled out. This gives it a kind of engaging quality; multiple dimensions and questions for you to explore and debate. In that sense it's quite clever, but unfortunately cleverness alone doesn't make a film enjoyable.

A curiosity at best, I guess I was just expecting a bit more straightforward meat to relate to here. You should definitely check this out - just perhaps not in the cinema.

Wednesday, April 15

England People Very Nice Click for more info

Immigration is always a tough topic to tackle in a play. EPVN approaches it using humour, quite the risk considering how easily it could have been misunderstood by the audience. However since it actually tells the story of four different waves of immigration into London (French Protestants, The Irish, Russian Jews and Sylheti Lascars) it manages to get away with it.

The downside of all this action is that it took way too long to cover it all. The play weighed in at a massive three hours with a 15 minute interval (quite possibly the longest play I've ever seen). The final group got most of the face time, their story spanning almost a century (from the World Wars to the London bombings); I reckon the Bangladeshis alone could have had their own play.

As well as being funny EPVN was pretty relevant too. It took the same "play within a play" route that others seem to be taking; this was a production put on by modern immigrants, each waiting for the decision on whether they get their leave to stay or not. Mentions of things like Facebook and sufism vs wahabism give the play a thoughtful and contemporary feel and so it feels well placed to make the comment that it does.

The Olivier Theatre is really impressive, if not in the legroom area - a much bigger concern than usual because of the sheer length of the play. On stage we were treated to various costumes rather than complicated sets, although the generous use of projected animation was well-done and added some charm to the production.

Overall though the play was way too long. It managed to stuff a lot in there, but this was at the cost of my attention span; as mentioned above EPVN could easily have been split into two. But not really, since the first three stories of immigration provide some kind legitimacy for the final one and they wouldn't have really worked otherwise. The length is enough for EPVN to just miss out on a recommendation, but if you do go to watch just make sure you can bear the three hours.

Film: Fast and Furious Click for more info

Girls! Cars! Muscle! Except not quite enough. It was definitely better than the embarrassing second and third parts to the franchise, if only 'cos it had Vin in it, but even he didn't distract from the shallow plot, two-bit script and weak characterisation.

I must admit that I was expecting a great deal more, something along the lines of The Fast and The Furious (yes, the titles had me baffed too), and so it's really disappointment that you're reading here. As a sequel it probably does enough, it's just a shame that the people who made this didn't learn anything from the middle two; even more so when we were led to believe it the return of the original cast would fix everything.

Worth a watch since it is fun enough. Just about.

Video of the Day Click for more info

Oh snap, epic Pwnage!



Nicked from Mash, here.

Monday, April 13

Hever Castle Click for more info

Day trips are fun. There's just something about loading up cars with people and food and heading off after breakfast that sets up the day to provide a magical time. Even the little things like parking together and buying group tickets adds to an occasion where even the threat of bad weather doesn't spoil things. In my earliest memories these group trips were largely made up of family - cousins and aunts and uncles. Now it seems that it's all friends. Not bad, but different.

Today we checked out Haver Castle in Kent. If you haven't heard of it, don't worry; most of us hadn't either. It just happened to be close and cheap enough to draw a large enough crowd (thirteen of us) to make it work. We were there in 45 minutes and it cost us 7 quid to get in.

The day was spent dossing, boating, eating, dossing and dossing. The boating was a massive laugh actually with none of us having anything even resembling sea legs. After a while things fell into place and we ended up playing a game of tag with the two boats we had under our command. I may be biased but I reckon our larger boat (of 8 people) totally out-rowed the other for most of the hour.

We also checked out the gardens and maze; a typically boys vs girls affair with a dare for the losing team. As the majority of the group went off to play rounders (or some other activity requiring an excess of energy) the remainder of us just sat and chilled, imagining that the sun was shining behind the overcast clouds. Still, at least it didn't rain for the whole day.

We got chucked out at 6, us being the only ones still bringing in food from the cars towards closing time. We had already made the most of the day, but we unwinded at the home of one of the group; the perfect end to such a chilled out, fun and easy day.

Saturday, April 11

Film: 17 Again Click for more info

I like to think of myself as a secure enough chap. Still having said that it does take quite a bit to admit that I went to see this film - don't get me wrong, I have nothing against Zac Efron per se; I thought HSM was great (a fact those of you who've listened to my in-car music will attest to) despite our young hero and this even had Matthew Perry (swoon) to balance out any lingering prepubescent hormones. But still, this was one for the (teenage) ladies and that was probably enough to take it out of any running of what to watch on a Saturday afternoon. But the trailer looked fun so I thought I'd give it a try anyway.

It wasn't that bad. In fact there were plenty of laughs to be found amongst the skinny plot and hammy acting; I was slightly disappointed by the lack of any real feel good factor although I did care a bit about what was going to happen toward the end so there was definitely some kind of characterisation there.

Otherwise there's nothing particularly special about 17 Again: definitely watch it if you're a die hard Efron fan I guess, although even if you're not it won't be that painful by the end.

Thursday, April 9

Joke of the Day

What did one tampon say to the other tampon?
Nothing, they were both stuck up bitches.

Tuesday, April 7

Using Perl-like Regular Expressions in MySQL

Regular expressions are amazing. They allow you to parse bits of, search for patterns in and validate strings, all with a simple, uh, regular expression. For example the following represents any possible email address:

/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i

It's not my expression - Google has expressions for almost anything you want to find, and you can easily figure out your own quite easily for the rest.

There is one pretty fatal flaw with regular expressions though: they're not necessarily universal or platform independent. The above pattern would be used by Perl, whereas the following represents email addresses in a POSIX regex environment, like MySQL:

^[[:alnum:][.period.][.hyphen.][.underscore.]]+@([[:alnum:][.hyphen.][.underscore.]]+[.period.])+[[:alnum:][.hyphen.]]{2,6}$

The things is, how much use are regular expressions if they can't be used across platforms? Sure, they're inherently faster (in development and execution) than hardcoding some pattern matching logic, but for me the real gain is being able to define immutable "facts" using them, and then referring to these facts from anywhere you need to. This requires a universal syntax.

Perl and POSIX are the most popular syntaxes, but there are others. Of the two, the Perl syntax seems to be regarded as the most powerful, and looking above the more concise. It's also more wildly used - many platforms (like .NET and Java) have a compatible syntax, but thanks to an excellent library called PCRE (Perl Compatible Regular Expressions), the Perl syntax has been made available to a wide variety of situations and platforms, including Ruby.

Since it made sense to store regex in the native format of MySQL, my first approach was to look for some kind of conversion library to convert from POSIX to Perl syntax. I found nothing. Nada. Zip. Zilch. Personally I found that pretty strange.

Going the other way was better - almost accidentally I discovered that some bright spark had created lib_mysqludf_preg, a bunch of User Defined Functions which accept Perl regex (once again using the PCRE library). Once installed, these would work in exactly the same way MySQL functions work on POSIX regex - I would then store all regex in the Perl syntax and use them in MySQL (via the new UDFs), Java, Ruby and wherever else I needed to (provided they accepted Perl regex, of course). Hooray!

Of course installing the library wasn't that simple. I was now in Linux world, and was required to, gasp, build my own copy of the library. This wasn't as difficult as I thought it would be - the hardest part was using Synaptic to get the MySQL development libraries. Compared to the rest of the installation, building was a breeze.

Each UDF is created using the following command:

CREATE FUNCTION lib_mysqludf_preg_info RETURNS STRING SONAME 'lib_mysqludf_preg.so';

where lib_mysqludf_preg.so is the name of the newly built library.

In my case, however, this returned the following error:

ERROR 1126 (HY000) at line 3: Can't open shared library 'lib_mysqludf_preg.so' (errno: 22 lib_mysqludf_preg.so: cannot open shared object file: No such file or directory)

The lib_mysqludf_preg readme warned me that I needed to place lib_mysqludf_preg.so in a location covered by LD_LIBRARY_PATH (whatever that was), and I had done this by adding the default build location of /usr/local/lib to ld.so.conf and running ldconfig to refresh the file cache for the linker. Checking the output of that last command confirmed that ld, the system linker, could indeed see the file.

pretending to be some kind of expert with these things, I used strace to figure out where MySQL was looking for lib_mysqludf_preg.so. This totally sent me down the wrong path as it complained about a permission error - as far as I could tell with my not-so-l33t Linux skills the file was readable by anyone.

After half a day of faffing around I finally found a lead on the MySQL forums: it turns out that the file had actually been built into the wrong location. I was running a 64bit MySQL on a 64bit Linux, and for that reason lib_mysqludf_preg.so had to be placed in lib64. After doing this, the CREATE FUNCTION command worked as advertised. I removed the path I added to ld.so.conf.

Any misgivings I had toward anything Linux (this wouldn't have taken a day to figure out on a certain other platform, I reckon) quickly dissipated after I adapted my database to use Perl regex instead of POSIX. I could finally use single regex "facts" across my application - something that was definitely worth the hassle getting it all to finally work.

Monday, April 6

Using The Rails MemoryStore Cache to Store ActiveRecord Objects in Development Mode

Despite the length of the title up there, wanting to use the Rails cache to store an ActiveRecord object isn't something that's too advanced or unreasonable. It makes sense to store relatively static objects in some kind of cache to save a round trip to whatever is actually storing them proper; since that store is usually a database of some kind it's likely that these static objects will be based on AR seeing as that's the default ORM doohickey in Rails.

That said, I'm not actually using proper AR models. The data for my models is coming over the wire from a magical place that has no databases, so in theory I shouldn't be using AR anyway. However a lot of non-ORM good stuff comes with AR (like validations and other convention-based magic), and seeing how some clever chap went to the trouble of writing a plugin to allow us to use "tableless" AR models I couldn't help but oblige and use it.

But I digress. This post is about what happens when we try to cache said AR object using Rails' built in cache functionality (when the cache is based on the hash-like MemoryStore). In short, the answer is a terrible disaster of immense (and typically agile-like if I'm allowed to make such a dig) proportions. Here's the technical bit: any instance methods you define on your AR models get lost when you retrieve them from the cache.

What the heck? Well, let's create a simple example. We'll start with a model representing a person - one who has a first name and a surname as fields/columns in the database. AR is magical in that it will look at the DB and create accessors for first name and surname for us. However we want something slightly more than that and so we define a method that will return a concatenation of the two. We'll call this method name, but I'll spare you the code.

Now we only have ten people in the system, and since these are guaranteed not to change in the lifetime of the application it makes sense to cache them after retrieving them from the DB. Let's ignore the fact that we could define them in the application itself (in my opinion, data belongs in the DB no matter how static it is). So let's store it in the cache:


all_persons = Person.get_all_persons
all_persons[0].name #returns a concatenated name
Rails.cache.write("all_persons", all_persons)


where get_all_persons returns a simple array of persons after getting them from the DB.

A Rails request later, and instead of calling get_all_persons we use the following:


all_persons = Rails.cache.read("all_persons")


Et voila, we once again have an array of all persons.

Except when we try the following something goes wrong and:


all_persons[0].name


results in:


NoMethodError: undefined method `name' for #Person


But... but my source code says the method is still there. What's gone wrong?

The trouble stems from how Rails loads classes. There is another (magical, naturally) option which tells Rails to watch source files and reload classes if any of them change. This is handy for development, since it means you can make a change and see it without restarting the Rails server. The way in which Rails does this magic is even cleverer - it literally reaches into the code of the class and modifies the methods which it has on offer. Amazing, no?

Well maybe. See, it's this exact mechanism which first strips an AR class of all its instance methods (something put in to deal with a memory leak) and then reload them later with the same magic used to create accessor methods. Except, for some reason, it misses out the ones defined explicitly like name, above. Yes, I was just as bemused.

But let's get our story straight; there are a few red herrings and caveats here. Firstly, this has nothing to do with Rails.cache - that just acts as a mechanism to keep objects around long enough to have their classes redefined. New objects created in the lifetime of a request use the original, and so correct, class definitions - which is why name gets called correctly the first time. No, it's Rails' class reloading (or rather, redefining) mechanism which is at fault here, or rather the way it deals with reloading AR classes.

Knowing this much presents us with a few options. The first and most obvious is to disable class reloading - indeed non of these problems occur in the predefined test and production environments where class reloading is disabled (or rather class caching is enabled). This would make development a pain though and take away one of Rails' biggest pros: it's facilitating of rapid development.

The second solution is a bit more sneaky. As we've discussed, freshly created objects in a request are loaded fine, and so if we somehow recreated the objects in the cache (perhaps via a copy) and use those, everything would be hunky dory. There is actually a more straightforward way to do this, and that's to use Marshal to serialise objects coming in and out of the cache; unmarshalling creates new objects to load up the data into. In fact since other cache stores (memcached and filestore) already do this marshalling by default (since they have to, whereas MemoryStore can just hold objects, well, natively), we don't see this issue (albeit by accident).

There are drawbacks here. Marshalling brings with it an unnecessary overhead - the marshalling isn't actually required, we just want to use its implicit "newing" behaviour. This means that when you push the code to test and productions, we're not doing things as efficiently as we could be (remember, we don't reload classes in those environments).

For now, I'll be marshalling explicitly when using a MemoryStore cache. Perhaps if I move to another cache I'll remove this redundancy, but for now I'll leave it in if it means I get to keep Rails' reloading of classes. Oh and for more info on this behaviour, see here.

Oh and before I forget, yes, I am now using Ruby on Rails to further my project. This flies in the face of a previous post but I don't mind contradicting that. I've not looked back since moving to Rails, but more on that in a later post.

Sunday, April 5

Film: Monsters vs Aliens Click for more info

You can hardly call Monsters vs Aliens run of the mill. It has everything that a classic CGI animation needs: it has monsters for one thing, and aliens for another. In that sense it's pretty much what you would expect from a film with such a title - this, however, ends up being the biggest thing wrong with MvA.

But let's start with the good stuff. The film is technically brilliant, with some good visuals, wonderful voice acting and laughs aplenty, something which we guessed must have come down to the presence of Seth Rogen (I laughed out loud at General Monger's description of Ginormica, for instance). As is fashionable with CGI nowadays we watched this in Not-Really-3D, except it wasn't actually that bad and I found myself even reflexively reacting to some bits. On paper there wasn't much wrong with this film.

But that's not enough in a genre where we expect nothing but excellence. In this case it was the story and plot which let the rest of the film down, with not enough time being spent on character or plot development. Things were happening way too fast, love for all the zany figures in the film was missing and as a result you find yourself not actually caring much about what happens. That's pretty much a failure for any animated flick.

So a bit of a let down, despite being really good otherwise? Pretty much. I'll still say that MvA is worth a watch though since even an average animation is better than most stuff out there.

Friday, April 3

The End Of An ERa

And that's it. After a whopping fifteen years on air, ER has finally finished.

Fifteen years. Let's put that into perspective: that's spanning a period of half my entire life - or over that for the most of the show's target demographic. Most successful shows don't get past their fifth or sixth year, but ER managed three times that. I would call that institutional.

Still, I must admit that I called for ER to end, although that was during a spat of boring seasons. Still, a part of me felt obligated to see through seasons ten and eleven, and by twelve I was glad my previous request was ignored. ER managed to get back to the awesomeness it had for most of its first decade, a time when it consistently made number one in the US ratings.

Quite laughably, if there was one thing which constantly reminds me of how I could have been a doctor, it was ER. Yes, all my doctor friends constantly tell me how it's not reality, but I'm sure that there's some truth in the excitement, friendship and, well, eliteness demonstrated by those in the show. It makes medicine look fun, intense and rewarding; way more than visiting Whipps Cross ever did.

As a show it was pretty special. ER wasn't about story arcs spanning multiple episodes or people having affairs or clever comedy or wordplay. There were no gimmicks, and no determinable hook other than making you want to follow the lives of some relatively real people in relatively real situations. In that sense you can see why it lasted much longer than other shows which possibly relied on a more short term attraction; it was very much about Barnett, Benton, Carter, Chen, Corday, Gallant, Gates, Greene, Hathaway, Knight, Lewis, Lockhart, Morris, Pratt, Rasgotra, Romano, Ross, Taggart, Weaver and many many others than what they did for a living.

There was the usual fan service seen during series finales in last night's episode - full opening credits (a rare treat nowadays), a return of old faces and even na bhgfvqr fubg bs Pbhagl Trareny, something we've never actually been shown before. It all made the occasion way more poignant than it should have been - the episode itself didn't offer anything more than a nod to what made the show so great. Understated yet still good, there was never going to be an easy way to end ER.

And so it's done. There is no more ER, and the show I've seen for the longest and most of is finally over. I'm actually going to miss it, I think.

Wednesday, April 1

All Good Things

There comes a point in time where you have to accept the facts of the matter - in this case the way in which I no longer have time to write anything of any interest any more. Yes, there's still the regular movie, games and restaurant reviews but judging by my inbox these are much less appreciated than the articles on Islam or relationships.

But why has Radio Shak been so lacking? I've managed to pin point a few reasons - the rise in my use of Twitter for inane comments, the fact that my work is now interesting and distracting (as opposed to virtually being paid to write as I was in my previous job) and plainly having better things to do are all causes for my writer's block. It's also possible that, finally, I've run out of things to say.

There is an argument that one should end these things on a high. This may not be relevant in my case since my hit counter has long been dwindling, but seeing how I doubt I'll again reach the heights I once was at, quitting would be better late than never. And so that's what I've decided to do. From this post onwards there will be no updates made to Radio Shak.

Of course this doesn't mean anything on a personal level; virtually I'll still be on email and IM, and I'll certainly have an opinion to air in person (if you're willing to hear any of it).

I sincerely hope you had as much fun as I did. Radio Shak is now officially off the air.

Shak

EDIT: As the comments indicate, yes this is all balls. Ironically the point still stands that this blog has been lacking recently. I'd like to promise that this will change, except I've done that already...