I needed a way to expire passwords in MVC 5. Unfortunately, most of the ways that I found were no longer relevant, so I cobbled together this [PasswordAuthorize] attribute to use instead of [Authorize].

using Microsoft.AspNet.Identity.Owin;
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Microsoft.AspNet.Identity;

When displaying bitmap images in WPF, the system wants to display all images in 96 dpi. WPF is one of the few environments where the file’s DPI is used in calculating the display DPI. The images that I was working with had 500 dpi and the images were displaying blurry since they were being downsized to 72.

I haven’t found a way to override the output resolution of an image, so instead, I hack the resolution of the image when it is being read. Bytes 38/39 is the Horizontal DPI and 42/43 is the Vertical DPI.

To set it to 72 DPI, we must first realize that the resolution is in meters. Google’s online conversion app says that 3780 inches = 96 meters. So we set our resolution to 0x0EC4!

This takes the XML file and imports it into SQL as a XML database table. Doing this step separately from the rest of the steps will allow you to rerun the rest of the code without the time overhead. Also, doing this step here reduces the import time considerably.

The following code takes the XML database able and imports it into your Demographics table. The script only imports First, Last, and Photo. Adding the additional fields should be easy enough.

After I discovered that the only device that uses the 1x Universal image asset was the iPad 2, I went back and did a little bit more experimentation. If the 1x image is missing, then the iPad 2 will use the 2x image, scaled down properly for the device. Since it is a easy 50% reduction in the image size, there should be no degradation of the image quality.

The iPhone 6 also adjusted correctly. If the 3x image was missing, it upscaled the 2x image to fit in our screen size properly. Although functional, upsizing the image will cause a bit of blur to occur, so I’ll continue to support adding the 3x images.

So the only assets that need to be used in a Swift SpriteKit application are Universal images 2x & 3x. This let me reduce the overall file size significantly and made my job a whole lot easier.

I have gotten a chance to look at the new SpriteBuilder alpha version and I must say, I am quite impressed. I can’t tell you how long I have been waiting for a tool like this.

One of the latest features that they have added is the ability to include sound to the timeline. Included with this is a audio display of the waveform along the timeline. This has proven extremely valuable in timing the animations with the audio.

I’m anxiously awaiting the final release, and I’m certain to become a huge fan of the product. You can check it out at www.SpriteBuilder.com