Dustin Horne

Developing for fun...

Metro Style UI With jQuery

Lately I've been toying around with the idea of incorporating Metro style elements into web designs.  It seems to be a trendy thing to do lately and a lot of sites have been doing it so I started experimenting with using jQuery to achieve some of the effects.  There are already several Metro plugins for jQuery and jQuery UI but I wanted to write my own code and see what kind of effects I could achieve.  I've setup a demo site that I'm using my my Metro UI playground. 

If you want to see what I've setup you can view the source however I'll caution you that I'm just hacking it together for now and it's nowhere near production ready.  The purpose of the site and code for now is to just incorporate the visual and functional elements.  Once I'm happy with the results, I'll be rewriting and refactoring all of the javascript to make it suitable for use and especially easier to theme with CSS (currently alot of the CSS is being implemented stricly with javascript so I can tweak it easily).

I have several demos setup already.  The live tiles use setInterval and run on a constant loop currently but I will be modifying them to use a setTimeout and make them "pausable" and allow the animations to be changed and removed as well, and hopefully a more solid base of animations.  I'll also be working on compatibility with touch screen devices.  Here is a list of the currently available demos:

Live Tiles
List
Scrollbox
Pivot

Identity Crisis - Identity vs SCOPE_IDENTITY In Sql Server

A common need when writing insert queries is to return the last Id that was generated when inserting your record.  There is more than one way to retrieve this value and it can come back to bite you if you're not careful.  In simple applications it's fine and simple to just append Select @@Identity to the end of your query.  If you manage the database and know the structure will never change this isn't a problem.  In larger scale applications, a DBA can make a simple change that can have major implications.  I'm going to demonstrate the problem and show you how to avoid this pitfall. More...

Simple Asset Manager for MVC

Lately I've been using a lot of jQuery and other custom javascript in my projects.  I like to use external CDNs when possible to load my script files.  In particular, I like to use the asp.net CDN for use with jQuery.  For much of this work I can simply put my script references in the layout pages, however there are times when I want specific scripts for specific pages.  There are also times when I want to be able to upgrade a script to a newer version.  This may require modifying multiple views.  Additionally, it would require modifying my HTML/Razor for at least my layout view and re-uploading it to the server. More...

Getting Color Data for a Texture2D in Silverlight 5 XNA

I decided to finish out the year by converting my XNA Terrain series to work with Silverlight 5 and XNA but during the process of converting I ran into an interesting issue.  The Texture2D.GetData() method is oddly missing from the Silverlight 5 XNA implementation.  I came across several posts around the web asking for a workaround but found no solution so I decided to develop my own. More...

AJAX File Uploads with jQuery and MVC 3

Recently I was working on a project that required upload of images.  I wanted to upload the images AJAX style without refreshing the page and thought jQuery would be a good fit.  Using jQuery to post standard forms is extremely simple, but when posting multi-part forms for uploading files it's not so intuitive.  This is due to browser security restrictions and sandboxing.  Today I'm going to show you how to fake an asynchronous upload without reloading the page and get a result back from the server. More...

XNA Terrain with LOD - Part 7: Better Culling With 2D Shapes

Introduction

In previous sections of this series I mentioned better culling techniques.  I wasn't going to touch upon any of these until after the series but it continued to eat away at me until I finally decided to do so.  The result was hours and hours of trial and error and a lot of mistakes along the way.  Thanks to community contribution in the AppHub forums I was able to get many of my questions answered or at least get pointed in the right direction.  I ran into several issues along the way, but eventually came up with a working solution.  More...

XNA Terrain with LOD - Part 6: View Frustrum Culling

So far in the terrain series we've learned how to create a heightmap based terrain, leverage a quadtree to navigate our terrain data, and add progressive level of detail by using our quadtree to step away our active vertices as we move further from the camera.  Today we're going to concentrate on view frustrum culling.  We're going to avoid drawing any geometry that is not in view of the camera.  If you haven't read through the first 5 parts of this tutorial you can find them on the Terrain Table of Contents page. More...

OmahaMTG QuadTree Demo

I've made the files availble from tonight's QuadTree presentation at the OmahaMTG .NET user group meeting.  The zip file contains the powerpoint deck as well as a Visual Studio 2010 solution with Silverlight demo app as well as a generic QuadTree.  This was a quick and dirty solution so many things can be improved.  The TreeObject could be converted to a container that holds the actual object you're storing in the tree.  This would eliminate the need for you to inherit from the TreeObject with your objects.  You would simply store them inside the tree object using a Generic List and a TreeObject.Add<T>(T object) method.

For a demo of the QuadTree in action:  http://www.dustinhorne.com/quadtreedemo.html

Download Here

 

Also, check out Brian Legg's introduction to XNA 4.

 

XNA Terrain with LOD - Part 5: LODing the Terrain

Up to this point in the series we have accomplished a few major milestones.  We've created a set of data objects to hold the information needed by our terrain, we've constructed a quad tree to allow efficient traversal through different portions of our terrain, and we've implemented the logic to draw our terrain at different levels of detail.  In this part of the series we're going to explore adding LOD to our terrain.  The level of detail code we're going to implement will be simple and linear. 

Only the deepest node containing our camera will be drawn at highest detail and it will step away the detail one unit at a time as it gets further from the camera.  As you'll soon see, this leads to some decent but less desirable results.  Terrain drawn in the distance will be subject to some visible "popping" as the LOD transition changes and vertices not visible to the user will still be drawn, however we will address these issues in the next parts of the series.  For now, our goal is to simply implement a system that allows a transition of detail from our target point outward.  More...

HDC (Heartland Developer's Conference) 2011

I just wanted to post a quick update.  I'm on a bit of a hiatus from my XNA Terrain tutorial series for a few days as I'm attending the Heartland Developer's Conference in Omaha, NE.  One more day remains and so far the conference has been outstanding.  I had the pleasure of having lunch with Scott Hanselman today as well as attending his keynote and off-the-cuff presentations.  There are some exciting things coming out of the Microsoft stack soon and I'm sure I'll be blogging about them as I dive into them.

If you've never been to HDC I would highly recommend it.  The atmosphere is fantastic, the networking opportunities are phenomenal and the presentations are both informative and entertaining.  If you've never had a chance to see Hanselman speak I would highly recommend that as well.  He has a real knack for providing great information in a humorous and entertaining manner.  Here's a picture I had taken with Scott outside of the conference center:

 

Scott Hanselman and I at HDC 2011