Invaders

I made all new graphics for my silly Invaders game using Inkscape and I have to say, its a cool little tool and mighty fine for being free.

I published it to the Windows Phone Store this morning, and Balmer immediately emailed me to tell me he was still mad at me. I don't even remember what we were arguing about anymore.

Nooooooo

http://nooooooooooooooo.com/

Random Link Post

Cocoa is my Girlfriend 

Simple Bank

Google Diff Match Patch 

How to Build a Tardis Replica 

Mr Data Converter 

Project Euler

 

 

 

 

Revisiting Invaders

So a long time ago, I posted code for what basically amounts to a clone of the Atari 2600 version of Space Invaders, rewritten in XNA.

 

I got bored the other day and ported it to Windows Phone. I went with Phone 7 so I could be lazy and continue using XNA, since Microsoft hates us and hasn't/probably isn't porting XNA to Phone 8 ever.

I had to hack around some custom config code I had to dynamically load different 'skins' for the invaders, but for the most part the majority of it went very fast (took about 3 hours).

Screenshot for now, once I clean it up I'll post the code.

I would submit it to the Windows Store, but I can't imagine it going through without someone suing me. There is, however, a version that looks like it is a clone of the arcade version, so who knows, maybe I'll do it and just see what happens. 

Convert NULL to nil

A macro I stole off of the internet, but didn't want to lose.

I found when I was parsing a nullable type from web api -> JSON into my objects in iOS, it really didn't like the NULL values much and this sorted it nicely, converting them to nul inline.

Just wrap whatever you are assigning in NULL_TO_NIL() and you are good to go.

Just add it to the top of the page, or to some common blah blah whatever.

#define NULL_TO_NIL(obj) ({ __typeof__ (obj) __obj = (obj); __obj == [NSNull null] ? nil : obj; })

 

Random Link Post

PNG Gauntlet 
Tekpub 
thisdeveloperslife
Angled Brackets 
DNSimple 
WatchMeCode 

Getting the apps version number in iOS

We deploy a bunch of our iOS apps to our internal enterprise store, and one feature it is missing is the ability to notify users that there is a new version of the application available.

Using the following code (it includes all of the version magic, the one I am actually using just returns minorVersion), we can compare it to the version in the store and notify the user on launch that there is a new version.

- (NSString *)appNameAndVersionNumberDisplayString {

    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString *appDisplayName = [infoDictionary objectForKey:@"CFBundleDisplayName"];
    NSString *majorVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    NSString *minorVersion = [infoDictionary objectForKey:@"CFBundleVersion"];
    return [NSString stringWithFormat:@"%@, Version %@ (%@)", appDisplayName, majorVersion, minorVersion];
}

To add a bit more excitement, the enterprise store maintains its own version numbers, so you have to make sure when you publish that you increment your version number in your project to match what is in the store.

Stop VS 2012 from auto checking out sln files

Basically there is an issue with the way an older Unity edited the solution file.

Open the sln file, get rid of the 'GlobalSection(ExtensibilityGlobals) = postSolution' section and save.

Adding APN to Nokia Lumia 920

Some of the 920s don't have the add APN under the Cellular/Mobile menu. To add the APN, you do it under Settings -> Access Point

 

For AT&T I used the following settings:

Connection Name:I called mine ‘Bob is awesome’

Access point name: wap.cingular

Username:wap@cingulargprs.com

Password:cingular1

 

I left everything else blank and I seem to be working.

Changing Namespace of your EDMX

I have mostly used Linq2Sql in the past, but as I find myself in a position to support both a website and mobile devices through oData, I have switched to using Entity Framework.

I don't really like Entity Framework better, but I did stumble across something cool today. If you decide to say, refactor a project and totally redo the namespaces, there isn't an obvious way to change the namespace of your EDMX through the GUI. The solution ends up being really straightforward though. If you change the default namespace of the project, the next time you build, it fixes the namespace of the EDMX.

Maybe Entity Framework isn't so bad after all...

Dark Souls for the PC

The Pre-Order for Dark Souls on the PC is up on Steam.

Article I followed to set up spam filtering in Exchange 2010

http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/A_9494-Securing-Exchange-2010.html

 

Just so I don't forget later Embarassed

Linq OrderBy with a String Column Name

This is not new by any stretch, it is posted a thousand places on the web, but I cleaned it up a bit and changed the return type to IOrderedQueryable so you can chain ThenBy after it.

using System.Linq;
using System.Linq.Expressions;

namespace System.Linq
{
    public static class LinqExtensions
    {
        public static IOrderedQueryable<TEntity> OrderBy<TEntity>(this IQueryable<TEntity> source, string sortExpression) where TEntity : class
        {
            var entityType = typeof(TEntity);
            var property = entityType.GetProperty(sortExpression.Split(' ').First());
            var parameter = Expression.Parameter(entityType, "p");
            var orderByExp = Expression.Lambda(Expression.MakeMemberAccess(parameter, property), parameter);
            MethodCallExpression resultExp = Expression.Call(typeof(Queryable), "OrderBy", new Type[] { entityType, property.PropertyType }, source.Expression, Expression.Quote(orderByExp));
            return (IOrderedQueryable<TEntity>)source.Provider.CreateQuery<TEntity>(resultExp);
        }

        public static IOrderedQueryable<TEntity> OrderByDescending<TEntity>(this IQueryable<TEntity> source, string sortExpression) where TEntity : class
        {
            var entityType = typeof(TEntity);
            var property = entityType.GetProperty(sortExpression.Split(' ').First());
            var parameter = Expression.Parameter(entityType, "p");
            var orderByExp = Expression.Lambda(Expression.MakeMemberAccess(parameter, property), parameter);
            MethodCallExpression resultExp = Expression.Call(typeof(Queryable), "OrderByDescending", new Type[] { entityType, property.PropertyType }, source.Expression, Expression.Quote(orderByExp));
            return (IOrderedQueryable<TEntity>)source.Provider.CreateQuery<TEntity>(resultExp);
        }
    }
}

Zerg Cake

Found this on the internet, this is definitely what I want for my birthday.

Acer W500

So, I picked up an Acer W500 to have an x86 tablet to play with while waiting for Windows 8 to get all official on us and, within its limitations, it has been great.

I started looking up options to increase the size of the 32 gig mSATA SSD (I already added a 32 gig SD card) and the only real option looks like this one:

http://www.amazon.com/OCZ-Technology-Nocti-Series-NOC-MSATA-120G/dp/B005FYFVRI/ref=sr_1_23?s=electronics&ie=UTF8&qid=1336517202&sr=1-23

$159 for 120 gigs, which isn't really bad though I don’t know if it is worth it since the RAM is soldered on the board, so you are stuck with 2 gigs, with part of that going to the video card.


I think I am just going to wait it out, I am betting on medfield tablets running windows 8 (arm power envelope, full x86 support). I like the idea of ARM, but I don't know if I am ready to give up x86 quite yet.

Here is one running ICS: http://www.engadget.com/2012/01/10/intel-demos-lenovo-made-medfield-tablet-running-ice-cream-sandwi/

Custom 401 in ASP.NET

Because IIS intercepts your request before you can handle it, you can't just set a 401 page in your custom errors block. While you can still change the default 401 page in IIS, the user will typically get challenged first when you set security with location in the web.config.

You wouldn't do this at all anymore, but I ran into it making a change to a legacy webform app and figured I would save what I found in case I see it again (I am moving 50+ apps).

To handle this you would do something hacky like this:

protected void Application_EndRequest(Object sender, EventArgs e)
    {
        HttpContext context = HttpContext.Current;
        if (context.Response.Status.Substring(0, 3).Equals("401"))
        {
            context.Response.ClearContent();
            context.Response.Redirect("~/AccessDenied.aspx");
        }
    }

One point to note, you can't do this in integrated mode, you would have to drop your app pool to classic mode.

Or you could be one of the cool kids and just rewrite the whole thing from scratch without telling anyone.

Random CSS Link Post

http://www.css3maker.com/

http://jquerymobile.com/themeroller/index.php

http://lesscss.org/

Xamarin

http://blog.xamarin.com/2012/05/01/android-in-c-sharp/

We could only be so lucky.

Random Link Post

Some MetroRT questions answered 

Crazy awesome Microsoft site 

Project Management and being more awesome site 

Awesome Microsoft Robot SDK stuff 

Advanced NT Debugging blog 

Microsoft blog on Globalization 

Global Authorization and allowing Anonymous 

DJ Sures and ez-robot

Good News and Bad News

The good - the new version of Chrome Beta for Android finally supports the desktop user agent string.

The bad - Bluestacks still doesn't let me use touch in the Android app when running on my tablet. They hint that it may work if I install Windows 7 on the tablet, but they are too wishy washy about it to get me to actually try it.

401.2 Access Denied from VS 11

Note to self, when you install Visual Studio 11, it disables NT auth for IIS Express by default. To turn it on, go to My Documents, IISExpress, config and modify the applicationhost.config file, changing <windowsAuthentication enabled="false"> to <windowsAuthentication enabled="true">.

JSIL

If you haven't seen it, some awesome guy named Kevin Gadd has made created a compiler to convert XNA to HTML5 named JSIL.

This should really come in handy soon considering Microsoft is saying they are not supporting XNA in Metro.

One thing to note, be careful when you are pulling down all of the magic from github, make sure you get his fork of ILSpy instead of the official one.

 

I originally pulled this down to convert Invaders to HTML5, it isn't compiling yet, but I had a good bit of stuff in there that wasn't XNA specific (using configurationmanager to dynamic load resources), so I most likely just need to slim it down a bit and give it another go.

Bluestacks

If you haven't tried it, it let's you run Android apps on Windows. Really impressed so far, though touch isn't working for me in  Windows 8. When I contacted them, they said touch is working in Windows 7, they just aren't supporting Windows 8 yet.

It is in open beta, so go check it out.

Enterprise Developers Guild

I used to go to the Enterprise Developers Guild here in Charlotte pretty often until they moved it downtown. Just found out they are having them in the Microsoft Campus again and went to the one this Tuesday called 'Build for All Devices with jQuery Mobile & HTML5' by Dan Thyer.

Had a great time and free pizza, will definitely be going to them more often than not now. Great turn out, must have been at least 80 developers there.

IIS 7(.5) and Anonymous Access

An interesting change I found today is when you choose to allow an application to accessed anonymously, it creds to resources as IUSR by default and not the application pool's identity. To fix it you go to where you configured anonymous access and right click on anonymous access and choose edit.

This is more of a reminder to me, I assume most people already know this, I just rarely ever use anonymous access so it caught me a bit by surprise.