Friday, January 28, 2011

Corona SDK Goes Windows

Corona SDK, the multi-platform development kit for iOS and Android had a major update this week. There is now a Windows SDK allowing the same lua language apps which can be compiled into iOS and Android Java apps on the Mac to be developed for Android on Windows.

To accompany this Ansca have included a slew of new features, all announced on their blog:
This is a really big step and one I believe will lead to some very interesting developments. Personally, I'm hoping for a lot of developer interest, to help bolster the Corona community and Ansca Mobile themselves, as well as WP7 builds.

I Hate Windows Server 2008

I really do.

But besides that, here's an article written to do justice (if not, comedy) to the annoying 'features' of the server OS. His other articles are about the useful, productive and more positive aspects, so please feel free to find out lots about the system.

Consider this article, however, the warning/watch out/snafu guide:

Slightly More Invasive

Tuesday, January 11, 2011

Wednesday, January 05, 2011

Corona Collision Filters

Ansca Mobile (www.anscamobile.com) have created a truly brilliant multi-mobile-platform SDK (iOS, Android) called Corona, which includes a Box2D (www.box2d.org) physics engine. There are many implementations in many languages for Box2D and one of the things which Ansca have got right is collision filters, one of the trickier things to implement in an physics API.

Brent Sorrentino of IgnisDesign has produced and posted a helper chart for working out which collision filters various objects should be assigned when building physics-based games using Corona:

Friday, November 19, 2010

Finally Developing For iOS

Here's a little post I made a while ago (which languished in draft for some time):
And here's some links I've found recently, now that I've chosen a development platform for iOS - having decided that, essentially, re-learning ANSI C++ with a new IDE (that I can't find any straightforward videos for [the latest version of XCode works slightly - but importantly - differently to that demonstrated in all the online tutorials]) is not my cup of tea...
I've found that for ease of learning the new language and a solid output, Ansca Mobile's Corona platform is performing well, has plenty of good tutorials and material and after the Apple iPhone Developer 1 year license ($99 in the USA, £59 in the UK), the Corona or Corona game license isn't too pricey. Though that might change soon...

Friday, October 22, 2010

Javascript Everyone Should Know - Iterating URL Args

Here's some javascript I'm often looking for, because I can't remember it off the cuff after 3 months of LINQ coding and I've started writing something where JQuery isn't available...

It iterates through all the parameters and their arguments passed in the URL...

var url = window.location.toString();
var query_string = url.split('?')[1];
var params = query_string.split("&");
for (var i = 0; i < params.length; i++)
{
var name = params[i].split("=")[0];
var arg = params[i].split("=")[1];
alert(i+': '+name+' = '+unescape(arg));
}

Thursday, October 21, 2010

Simple Category Tree Walking In T-SQL

I needed, as many have done before me, to create a snippet of SQL which was short and fast and returned a flattened table of tree nodes. In short, if you have a tree of nodes, get all the nodes below a specified node. The result is surprisingly simple and straightforward. Here it is, both as a snippet and a stored procedure. Assume the tree is stored in a table called Category, with CategoryID being the primary key and ParentCategoryID being the foreign key, to the same table, but nullable...

--------------------
declare @collect table ( catid int, tlevel int )
insert into @collect values (3,1)

declare @count int
set @count = 2

declare @maxlevel int
set @maxlevel = 2

while ((select count(1) from @collect where tlevel = @count-1) > 0 and @count <= @maxlevel)
begin

insert into @collect
select c.categoryid, @count
from category c inner join @collect b on c.parentcategoryid = b.catid and b.tlevel = @count-1

set @count = @count + 1

end

select * from @collect order by tlevel
--------------------
--------------------
CREATE PROCEDURE [dbo].[GetCategoryTree]
-- Add the parameters for the stored procedure here
@ParentCategoryID int
AS
BEGIN

-- the category id's to be output
declare @collect table ( catid int, tlevel int )
insert into @collect values (3,1)

-- a loop counter used to limit the depth we go to
declare @count int
set @count = 2

-- the deepest level to go to
declare @maxlevel int
set @maxlevel = 2

-- the loop to collect category id's
while
(
(select count(1) from @collect where tlevel = @count-1) > 0 -- keep going while we have categories
and @count <= @maxlevel -- keep going until the max level depth is reached
)
begin

-- insert the categories where the previous level contains the parent ids of the current level
insert into @collect
select c.categoryid, @count
from category c inner join @collect b on c.parentcategoryid = b.catid and b.tlevel = @count-1

-- increment the level being collected
set @count = @count + 1

end

-- return the found category id's
select * from @collect order by tlevel

END
--------------------

Tuesday, October 12, 2010

Writing Windows Services

Just found a really neat (as in compact) post on writing Windows Services in C#:
And here's some Windows Services resources for doing different things in a service:

Friday, October 01, 2010

Monday, September 27, 2010

Monday, September 20, 2010

Wednesday, September 15, 2010

DateDiff

Recently, I had to work out the number of months between two arbitrary dates. In C# this is a bit of a challenge, simply because DateTime.Subtract(DateTime) returns a TimeSpan, which does not have a Months property.

This is because TimeSpan doesn't know which months it would be referring to. Specifically, to know how many months there are in a date range you need to count each month index from date A to date B. Problem being, if you don't know those arbitrary dates - you only have a count of days - how many months does that range cover?

Example: How many months does 30 days represent? Answer: 1.

Wrong.

Why?... Because if we are talking about February, it's two months. If we're talking about August it's not a whole month.

The solution is to take into account the specific dates being used in the subtraction and count their months, unfortunately. Yeah, I don't want to write that code either.

However, for the C#'ers among us, there is a solution. VB has a DateDiff class which can do this for you. Just use the Microsoft.VisualBasic namespace and the static DateDiff method, as I found out here:
Here's a post about writing your own:

Friday, September 10, 2010

Wednesday, September 08, 2010

Tuesday, September 07, 2010

The Register: iPad Apps Galore

The Register has pulled together a collection of iPad apps for geeks, techies and web pros...

Monday, September 06, 2010

LINQ2SQL Transaction

A good thread to read on LINQ to SQL transactions, centred on commits and rollbacks: