A New Venture: Wedu Games

My new venture, Wedu Games, is up and running. Or at least the site is as there are no games finished yet. There are a few things in development, though, including an interactive storytelling table app (that isn’t a game at all) and a stud/hold-em poker hybrid to launch on mobile and Facebook together. Everything’s being built in HTML and JavaScript with possibly a bit of Node.js for simple back-end.

In the meantime there are a few blog posts to read. Now, back to making the games again…

Indie Game Developers and the Facebook of Doom

Slides from my presentation at the London Facebook Developer Garage last night:

Indie Game Developers and the Facebook of Doomhttp://static.slidesharecdn.com/swf/ssplayer2.swf?doc=futureindiegamedevelopers-100225032338-phpapp01&stripped_title=indie-game-developers-and-the-facebook-of-doom

View more presentations from Karl Bunyan.

fbExchange.Net – a new site for Facebook development answers

With Daniel Schaffer (author of the .Net Facebook API Client) I’ve put together a Stack Overflow-type website for Facebook developer help called fbExchange.Net. It’s intended to build as a knowledge base and to be focussed more on tech than the official Facebook developer forum’s discussion format. (So hopefully the forum will be the place for “Is the Platform down?” or “What do you think of the new design?” type questions, and fbExchange.Net can be the site for “How do I…?” questions.)

For anyone who’s not familiar with the Stack Exchange model, you gain reputation by asking (good) questions, and answering them such that other people vote for your answers. For freelance developers and consultants having a high reputation can even help to bring work in. While the site’s in an early stage (“bootstrap mode”) it’s easier to gain points too, so there’s some benefit in getting in there now (hint, hint).

It’s intended to be dev-centred, but there’s no reason why it can’t cover most of the practicalities of “how do I set up a Facebook Page” etc, so feel free to create questions you know the answer to and even answer them yourself. The great thing about the system is that since it’s community moderated, and questions are tagged rather than put into categories, then the definition of “what can I ask?” is fairly broad.

Microsoft SQL Server text data column and PHP length problems

I’ve had this problem before: PHP truncates results from a SQL Server text field to 4096 characters. (This is running PHP under Apache on Windows.) To save myself having to work out the right Google terms again, this is the solution: change the following in php.ini (note that ini_set doesn’t appear to work:

; Valid range 0 - 2147483647.  Default = 4096.
mssql.textlimit = 2147483647

; Valid range 0 - 2147483647.  Default = 4096.
mssql.textsize = 2147483647

Repeatable random numbers in JavaScript

Ever since programming BASIC on the Spectrum I’d wondered why it was possible to seed a “random” number generator. But then I found I wanted to do something that would produce repeatable results, but look like a random sequence. Strangely, although JavaScript alongs you to specify a seed for Math.random() the numbers that follow aren’t a repeated sequence. I’m guessing the system clock comes into it.

So after some Googling for an equation to generate numbers I put together the following function. It works on a sequence of 2^32 numbers, in “random” order. (I believed the equation I found – I didn’t test the completeness of it, but it looks pretty random to me.) So, just call Random.next() to get a decimal between 0 and 1, or pass in a range (lower,upper) and you get a random number between the two.

var Random =
{
 seed : 12345,
 //Returns a random number between 0 and 1
 next : function(lower,upper)
 {
  var maxi = Math.pow(2,32);
  this.seed = (134775813 * (this.seed + 1))
     % maxi;
  var num = (this.seed) / maxi;
  if(typeof lower!='undefined')
  {
   var range = upper - lower;
   num *= range;
   num += lower;
  }
  return num;
 }
}

Set “Random.seed” to taste.

Firing JavaScript functions after a .Net AJAX request

I wanted to have a function called after data was returned to the page from a .Net AJAX call. (The idea was to fade out when you pressed “submit” and then redraw when data came back.) It turns out there are handy handlers already there to, erm, handle this:

Sys.WebForms.PageRequestManager.getInstance()
.add_beginRequest(StartRequestHandler);
Sys.WebForms.PageRequestManager.getInstance()
.add_endRequest(EndRequestHandler);

Those little nuggets add calls to your functions, and the functions themselves are:

function StartRequestHandler(sender,args)
{
}
function EndRequestHandler(sender, args)
{
}

Nice.

Moritz Stefaner is a genius

The Six Degrees of Separation Facebook application

I was thinking about how to best represent connections between people in my Six Degrees of Separation Facebook application and Paul Crabtree recommend I get in touch with Moritz Stefaner as he had something that would fit very nicely indeed.

And he most certainly did; the relation browser was exactly what I wanted to do, but better. If you have a Facebook account, install the application, and go to the Show Network tab you’ll see what I mean.

Identifying slow blocking queries on SQL Server

This piece of SQL is perfect for finding which query is running at any particular time, especially if you want to find what it is that’s running very slowly.

sp_who2

This should return a list of what’s running, including process ids (in the first column). Find out what’s causing all the trouble and enter it’s id after spid = below:

DECLARE @Handle binary(20)
SELECT @Handle = sql_handle FROM
  master.dbo.sysprocesses WHERE spid = 55
SELECT * FROM ::fn_get_sql(@Handle)

Facebook’s new ‘Invite friends’ tag

Everyone’s been either copying and pasting or writing from scratch some code to add “Invite friends” to their Facebook apps, but now there’s a simple tag that they’ve provided. It’s currently in beta and, knowing Facebook, is bound to change and break everything a few times, but it’s very easy to use:

"
image="http://apps.exponetic.com/itrust/
_img/iTrust-logo-magenta-small.gif">
  

(Note the slightly dodgy tag inside the content attribute.)

We’re now using it at Exponetic on our second Facebook application, called iTrust.

Exponetic, Facebook developers in London

iTrust

Six degrees of separation