Archive for February, 2010

Git Remotes

I’ve been trying out GitHub for my XNA work (http://github.com/SteveJohnstone/BurntFramework) and part of that is learning about how Git works. Thankfully I found quite a nice article by Rafael Garcia-Suarez about how Git remotes work.

ConstType: Git: how remotes work.

Tags: , ,

No Comments


RPG Duration and Content

The Rampant Coyote mentions on his blog that RPGs are difficult to construct because of the amount of unique content that the genre seems to require. I’ve always wondered why there are such high expectations of content from RPGs as opposed to other genres such as FPSs. A shooter can take around eight hours to complete the single player storyline, whereas if an RPG ends in under twenty hours the internet seems to explode in nerd rage.

From Destructoid’s review of Mass Effect:

“Mass Effect is hilariously short, for an RPG.” “I still finished the main storyline in less than 16 hours.”

No Comments


jQuery Checkbox Replacement

Ordinary checkboxes on the web are a bit boring. I’ve seen a few replacement scripts, but I thought that it would be pretty easy to write my own.

function replaceCheckbox(name, on, off)
{
  $(name+':not(.checkbox-replaced)').each(function (){
    var image = ($(this).is(':checked') ? on : off);
    var imageElement = $('<img style="cursor:pointer;" src="'+image
      +'" onclick="$(this).next().click();"/>');
    $(this).before(imageElement).hide()
      .addClass('checkbox-replaced');
    imageElement.click(function (){
      $(this).attr('src',(this.src.indexOf(off) > 0 ? on : off));	
    });
  });
}

It seems to do the job fairly nicely, so I’m quite happy.  It does require the use of jQuery. To use it simply go:

replaceCheckbox('input[type=checkbox]:visible','check_on.png','check_off.png');

Tags: , ,

No Comments


De-serializing RSS XML

In our project at work we had a need for an RSS reader in c# and, through the power of Google, I managed to find quite a neat way of deserializing the RSS XML.

Basically all I needed to do, was save an example feed to a file on my hard disk. Then, using the Visual Studio Command Prompt and then run the command:

>xsd rss.xml

which generated several xsd files. Then I ran:

>xsd /c rss.xsd rss_app1.xsd rss_app2.xsd rss_app3.xsd

which generated the required c# class file (If you don’t add the other files, you may get the message “Error: Error generating classes for schema ‘rss’”). After copying the class file into my project, I was able to de-serialize the stream by writing:

           Â
using (Stream stream = WebRequest.Create(url).GetResponse().GetResponseStream())
{
    StreamReader reader = new StreamReader(stream);
    //string response = reader.ReadToEnd();
    XmlSerializer serializer = new XmlSerializer(typeof(RDF));
    feed = (RDF) serializer.Deserialize(stream);
}

As a certain meerkat would say, simples!

Tags:

No Comments



SetPageWidth