The Dread Pirate Matt

In Touch With The Obvious. Mostly.

by Matt Redmond

Initial Thoughts on PRISM

13 Jun 2013

So somehow I managed to actually miss the entire scandal as it broke. I only found out anything about it when I got into work on Tuesday (Monday was a public holiday here), and I’m still catching up on it.

To be honest, is anyone actually that surprised?

There’s all sorts of things about minimising your online presence, etc. as a counter-measure.

Personally, I’m going to propose an alternative – what is essentially security through obesity.

Basically, the idea is to generate a low signal-to-noise ratio; i.e. flood the system with useless and meaningless information so that any real data which may exist becomes unusable. Just like most people’s Facebook and Twitter. Or this blog.

Comments

Mass Effect - The Movie

27 May 2013

There’s been speculation since the first game came out that Mass Effect would get the big screen treatment.

I actually am not really a fan of the idea. Movies, by their very nature, need to strip out any non-essential elements; even if you were planning a multi-movice franchise, à la Marvel’s Avengers, you still have to create a complete arc for each of the entries.

Given the fragmented nature of RPG stories, and the fact that much of it is ultimately self-contained side stories, I don’t think the movie treatment would necessarily be the best option for game franchises.

A TV series, on the other hand, would be perfectly suited to Mass Effect’s story-telling style.

Yeah, that could work…

Comments

jQuery ".on"

27 May 2013

When using on (which replaces, amongst other things live), the initial selector needs to be declared at load time. For example,

$('.js-dynamic-selector').on('click', 'a', function(event) {
  // ...
  event.preventDefault();
});

will only work if .js-dynamic-selector is already defined (i.e. this can’t be an element that you’ve added).

You can, however, use the dynamic selector as a filter (or part thereof):

$('.js-wrapper').on('click', '.js-dynamic-selector', function(event) {
  // ...
  event.preventDefault();
});

In this case, .js-wrapper has to be defined at load time, but .js-dynamic-selector can be initialized whenever.

Comments

Band or Business?

27 May 2013

A while back, Jens F. Ryland of Borknagar posted an interesting article at Artisan Norway about running a band as a business enterprise, including a summary of a paper he wrote on the subject.

Business management is definitely something that most bands lack. It is possibly the single best reason to have a good manager separate from the band members.

Like most musicians, I’m more interested in making music than focusing on the business side of things, so it’s good when you can hand that aspect over to someone else. Someone who cares…

Comments

Mass Effect

24 Apr 2013

I’m a big fan of Mass Effect, although requiring Origin to play ME3 on PC is a whole world of suck, so I recently got the PS3 box set.

The decryption mini game is nigh impossible in this version. (I was used to the PC ‘frogger’ style game, so was unaware of this version on XBox 360 and PS3 until now.)

There seems to be some timing glitch with the game (several people have reported the problem, though there seems to be an equal number who do not) which means that the first button in the quick time event is not even appearing until the timer has almost completely run out. I’ve only ever even seen the third button appear once (through sheer chance I managed to get the first two buttons on a particular run).

Now, I’m not as sprightly as a thirteen-year-old kid, but my reaction time is still pretty good, and it’s not like I’m a ME n00b.

It is frustrating beyond belief and turning an otherwise potentially pleasant gaming experience into an endless loading screen.

I wonder if it is in fact a clock issue, since there seemed to be a similar glitch in the HD re-issue of God Of War where you have to push the crate down to the cliff face before the spikes shoot up. There seemed to be just that fraction of a second less available to complete the task than in the original version, which meant that even if you did manage to time everything else perfectly, there was still a chance that you wouldn’t make it.

Update 27/05/2013: I’m beginning to think it is a sync issue, since during conversation the animation begins before the audio. Likewise, I think the timer is starting before the inputs are initialized for certain classes of QTE. (It only seems to apply to decryption QTEs on containers and terminals, too. Story-related QTEs function as expected.)

Comments

Resurrection

18 Apr 2013

I have been extremely lax with writing lately. Partly due to overwhelming business. Mostly due to laziness.

Resurrecting my writing is definitely in order.

Comments

Queensryche

27 Mar 2013

I must say, this is the most excited I’ve been about Queensrÿche in a long time. La Torre sounds just like early-90s Tate.

Still missing Chris DeGarmo though.

Comments

Git Tip

27 Mar 2013

I’ve recently come across a situation where I needed to delete a whole bunch of files from git (i.e. they no longer existed on the system, but removing them individually would have taken waaaay too long).

git add -u

will add all untracked changes – including removed files. Handy if you need to perform lots at once.

Comments

XSLTransformation in MSBuild

22 Mar 2013

I’ve started using MSBuild for a project at work. One thing I needed to do was inject a bunch of values into configuration files based on the environment. My batch file accepts two command line parameters, the project to build – there’s three options in the case of this project – and the server to which it is being deployed: development (dev), user-acceptance testing (uat) or production (prd).

I needed to pass different values for configuration files based on which environment was being built, since it has hard-coded URLs in certain configuration files.

XSLT to the rescue, right?

Unfortunately, the method for passing parameters to the XSLT files is rather cumbersome. The XSLTransformation task has a Parameters attribute, which accepts the parameters for the transformation.

Let’s say you have an XSL transformation which copies the configuration file and injects the values into the content of the nodes matched by the XPath query.

<!-- ignoring the header part... -->

<xsl:param name="param1" />
<xsl:param name="param2" />

<!-- Match and copy everything -->
<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates match="@*|node()"/>
  </xsl:copy>
</xsl:template>

<!--
  matches 
  <xpath>
    <to>
      <match1>text here is replaced with value of param1</match1>
    </to>
  </xpath>
-->

<xsl:template match="xpath/to/match1/text()">
  <xsl:value-of select="$param1"/>
</xsl:template>

<!--
  matches 
  <xpath>
    <to>
      <match2>text here is replaced with value of param2</match2>
    </to>
  </xpath>
-->
<xsl:template match="xpath/to/match2/text()">
  <xsl:value-of select="$param2"/>
</xsl:template>

So to pass the two parameters to the XSLT, we have the following in our project build file.

<XSLTransformation XslInputPath="template.xslt"
                   XmlInputPaths="@(InputFiles)"
                   OutputPaths="$(OutputFolder)%(RecursiveDir)%(Filename)%(Extension)"
                   Parameters="&lt;Parameter Name='param1' Value='some value'/&gt;
                               &lt;Parameter Name='param2' Value='another value'/&gt;"/>

This will take all the input files specified by the InputFiles item group, and output them to the folder specified by the OutputFolder property, recursively with the directories, filenames and extensions of the original files.

Now, the problem here is with the Parameters attribute. We have to pass in the escaped XML, using &lt; and &gt;, which is cumbersome and makes the build script much less readable. While this might be OK for one or two parameters, things get messy when you’re dealing with 15-20 (which I am).

CData to the rescue!

Simply define a PropertyGroup for the parameters.

<PropertyGroup>
  <XslParameters>
    <![CDATA[
      <Parameter Name='param1' Value='some value'/>
      <Parameter Name='param2' Value='another value'/>
    ]]>
  </XslParameters>
</PropertyGroup>

Then just pass through your parameters as Parameters="$(XslParameters)" when calling XSLTransformation. You can even reference other PropertyGroup elements in these, for example:

<PropertyGroup>
  <XslParameters>
    <![CDATA[
      <Parameter Name='param1' Value='$(MyParam1Value)'/>
      <Parameter Name='param2' Value='$(MyParam2Value)'/>
    ]]>
  </XslParameters>
</PropertyGroup>

Comments

Older posts