I decided to self-host my blog over on my own domain, blog.enginefour.com. I figured I've been paying for it I may as well put it to good use :) I decided to go with BlogEngine.NET, mostly because it was super simple to get setup and seemed to have pretty active development. I think I've ported most of the articles and comments over though a few stragglers may be around. I'll be posting all my pearls and nuggets over there so update to the new RSS address.
I know some of the layout may seem funky, I'm currently porting a free CSS template from a fixed-width layout to a fluid one instead and I haven't pushed everything yet. For the record I used Yahoo's grid builder to come up with the CSS layout and it's damn snazzy. Usually I build up my divs by hand or crib one of my prior fluid layouts but this time I tried something different and I'm impressed. Clean CSS/HTML, though I could use a little more verbose id and class selectors.
Thursday, March 20, 2008
New Blog Address
Wednesday, February 27, 2008
Cheat Sheet Needed for ASP.NET MVC
The cool kids over on the other side of the fence always make these really cool "cheat sheets" for whatever bit of tech kit they're using and I fully expect someone with some good design skills to produce one for ASP.NET MVC.
You hear that Rob Conery? Scott Hanselman? How about you Phil Haack? I fully expect Scott Guthrie, who is a Word among Bytes, to consign some stylish hipster graphic designer to produce a masterful, stylish and yes, useful cheat sheet for the MVC masses at Mix '08, an event I sadly won't be attending because my company considers computers and those that make them work to be second class citizens. I'm lucky if I get to upgrade my IDE before the next one comes out much less attend an actual conference. I've heard of conference swag but I've never actually received any of this mythical bounty.
Still, I desire, want and dare I say expect said cool cheat sheet.
Here are some examples for those that need some prompting and design ideas and to figure out just what in the hell I'm talking about:
What Goes Where (Ruby on Rails cheat sheet by Amy Hoy)
Form Helpers (Ruby on Rails cheat sheet by Amy Hoy)
Monday, February 25, 2008
CopySourceAsHtml for Visual Studio 2008
I ported the CopySourceAsHtml to work with Visual Studio 2008. There are some workarounds to get the existing addin to work with Visual Studio 2008 but they all assume you have 2005 installed, which I don't. I recompiled from source, built against .NET 3.0, removed some crufty code thanks to FxCop and removed a call into olepro32.dll that wasn't needed. I'll provide the updated source if anyone cares, this is just a quick posting as I'm flying out the door :)
To Install
- Download the CopySourceAsHtml AddIn zip.
- Unzip to \My Documents\Visual Studio 2008\Addins, if the Addins folder doesn't exist just create it.
- Restart Visual Studio (you did close it first right?)
- Right-click some selected code and you'll have a new Copy As HTML... menu item, that's the gold, click it.
- Check the boxes in the dialog that comes up to your delight and then paste into your blog software or forum post.
- IMPORTANT: This Addin generates HTML code, so remember to switch into the HTML view in your blog software or forum edit box.
- Bob's yer uncle
Sample
This is how a chuck of code looks when pasted (you'll notice it uses your exact color and font settings):
[Test]public void Select_ColumnList_Specified()
{SqlQuery qry = new Select("productid", "productname").From(Northwind.Product.Schema);
ANSISqlGenerator gen = new ANSISqlGenerator(qry);
string selectList = gen.GenerateCommandLine();Assert.IsTrue(selectList == "SELECT [dbo].[Products].[ProductID], [dbo].[Products].[ProductName]\r\n");
}
Mp3tag 2.40 Released
Anyone that's using my Zune Marketplace Mp3tag source will probably want to upgrade to the latest version of Mp3tag, which as of today is 2.40! I've been using the beta version for awhile and the tagging dialog is much better than in the original 2.39 release, easier to tag those albums where you only have a few of the tracks.
Get it from the official download site.
In a related note I've been using Mp3tag for about 2 years and I finally pulled the trigger and donated some dosh to this excellent free program. Thanks to Florian Heidenreich for continuing to create such a great product!
Tuesday, February 19, 2008
What ASP.NET MVC Can Learn About REST from Rails
I'm starting to see more ASP.NET MVC samples and questions come out and I'm realizing that a large portion of the ASP.NET crowd doesn't even realize that a huge reason for the MVC movement is because of the Ruby on Rails framework. A lot of new .NET MVC developers are struggling with architectural questions that have already been debated and answered in the Rails community, which makes Rails a great resource for when you're first starting out or you're curious how to handle certain situations, like nested resources or how to structure your controllers.
Speaking of controllers one great thing from Rails that I hope more MVC developers embrace is REST. Instead of repeating everything just watch David Heinemeier Hansson's keynote speech from RailsConf back in 2006. Sure, it's almost two years but for ASP.NET developers it may as well be yesterday. I'd suggest starting from the second part since the first segment is just normal conference ra-ra-ra.
Check it out here (don't forget to download the slides that he refers to here).
Note
He talks about using a semi-colon in the URL to denote an aspect/action of a controller, like this:
/people/1;edit
Well, you can ignore that and just assume he *really* meant to say:
/people/1/edit
They dropped that semi-colon silliness in Rails 2.0 and it feels much cleaner.
Friday, February 08, 2008
Nested Resources In ASP.NET MVC
Often you'll need to represent some hierarchical or parent-child relationship in your application and one thing you'll struggle with is how to cleanly mesh both the parent and child controllers yet keep them nice and RESTful. The secret is in good routing.
The problem
A popular example is tickets belonging to events (event as in Burning Man, not OnClick) and you want to get all the tickets for a certain event, as well as be able to work with just tickets or events. You want nice and pretty urls as well, so you're hoping for something like this:
| /events/1/tickets | all tickets for event 1 |
| /events/1/tickets/new | add a new ticket for event 1 |
| /tickets/list | all tickets for all events |
The Messy Way
My first idea was to add a Tickets action to my Events controller so I could call EventsController.Tickets(int eventId) but that didn't really help when I wanted to view all the tickets for all the events. Plus it broke the whole REST idea and that's bad for maintainability.
My second idea was a butt-ugly url along the lines of /tickets/list?event_id=1 but that just kicks the whole MVC, SEO-friendly url philosophy in the nuts. Repeatedly.
The Routes Way
A Big Thanks goes to Adam Wiggins whose post about nested resources finally set off the lightbulb in my brain. Instead of trying to make my controllers do all the work why not take advantage of the actual mechanism that's there to handle these sorts of things and put it to use. That would be the routing mechanism that makes all your urls pretty and dictates which controller does what. Here is the way to keep your urls pretty and to have both a separate Events and Tickets controller yet still maintain the cool parent/child relationship:
RouteTable.Routes.Add(new Route
{
Url = "events/[eventId]/tickets/[action]/[id]",
Defaults = new { controller = "Tickets", action = "List", id = (string)null },
RouteHandler = typeof(MvcRouteHandler)
});
(yes, I know, my code formatting sucks, I'll update it this weekend)
Once I discovered this I smacked myself on the forehead for not realizing just how simple this whole thing was.
Tuesday, February 05, 2008
Microsoft Shareholder Value
I just saw a quote from Joe Rosenberg via the MSFTextrememakeover that included one of the most asinine and scary things I've ever heard about Microsoft:
Rosenberg said. "The company has lost sight of its principal focus, which is to produce value for shareholders."
What's scary is that this is from a "Chief Equity Strategist" yet after this quote I wouldn't trust anything this guy has to say about money or investing because if there is one common theme among the most successful companies and individuals it's that their primary focus is to do what they love and to be the best at doing it. Once you start chasing money for moneys sake the game is over and you're done ever making any type of substantial financial gains. Rosenberg should know this and if he doesn't perhaps he needs to pick up a BusinessWeek and read this article, "The Secret Behind Trump's Success".
So if you ever find yourself starting a venture simply because you think it'll net you millions or because you're secretly hoping you'll be bought out then stop, take a breath and get a grip on reality. If you really want to make money find your passion and be the best at it, do everything you can with it, surround yourself with others who share the passion and push that passion, be uncompromising with it and don't change your vision to fit into a committee or shareholder view.
Tags
- Zune (23)
- Development (21)
- Visual Studio (11)
- Music (10)
- .NET (9)
- Delphi (7)
- Microsoft (7)
- DRM (6)
- iTunes (5)
- Apple (4)
- Marketplace (4)
- MVC (3)
- XBox 360 (3)
- iPod (3)
- SubSonic (2)
- Vista (2)
- AppleTV (1)
- Doctor Who (1)
- Firefly (1)
- Google Docs (1)
- Heroes (1)
- Mac (1)
- Money (1)
- PC (1)
- Personal Finance (1)
- Quicken (1)
- SVN (1)
- Subversion (1)
- TV (1)
- design (1)
- laptop (1)
