Thursday, October 06, 2011

Steve Jobs, 1955 - 2011

“Being the richest man in the cemetery doesn’t matter to me … Going to bed at night saying we’ve done something wonderful… that’s what matters to me.”

Monday, May 16, 2011

Visual Studio: ASP.NET MVC, Flip quickly through your controllers and views

This tip is specifically for those writing ASP.NET MVC applications using Visual Studio

As your MVC application grows, the number of views and controllers can grow pretty quickly and ctrl+tabbing through them gets pretty painful, sometimes only to discover that you don't have *that* view open, so you need to go find it. That's where this tip comes in, if you right click on your controller, there's a menu option to go to the view, likewise, if you are in the view and right click there's a menu option to go to the controller, now, if you are a mouse guy, this is enough for you, you can stop reading now, but there's a quicker way, you can assign a shortcut key to those options

Go to Tools, Options, Environment (first option), keyboard, and type "GoToView" (without the quotes) and assign the shortcut you want, chose one that is not being used, or one of a feature you don't use (there are  millions of those), for this type of thing that I do a lot, I like using keys that are easily accessible, put that F1 key to good use!!, do the same thing for the "GoToController"




Click OK and you're ready to roll, go to your controller and press your shortcut, you'll be flipping through your views and controllers like there's no tomorrow!

You're welcome J

Saturday, March 19, 2011

Kindle: We were unable to download the book... please try again later

A few days ago I installed Kindle on my Mac Book Pro, then only after a couple days of using it I suddenly got this error and was not able to open any of the two books I had just bought, I was able to open the books just fine on my iPhone and iPad, but the Kindle for Mac kept giving me this error message no matter how many times I tried clicking; a search on Google gave me 3 results and no solutions, so I uninstalled the App and reinstalled, got nothing. I tried the Tools menu, manage your Kindle from the Kindle app which takes you to the amazon site, noticed the "your orders" at the bottom and the options to download the content, tried that a few times, still nothing, another thing I noticed on the Kindle app was that the title was something like "???????????????? Home", I knew something was messed up bad, but even reinstalling didn't fix it, so in one last desperate attempt I checked out the Kindle preferences [Command]+, or under the Kindle menu, preferences, I clicked the only button there: "Deregister", agreed to the warning and selected "remove all licensed content from this device" and clicked "deregister" again on the warning window; a register button then showed up, I clicked it to register the app again, had to agree to some other warning, and that right there was the solution, I was able to get my books (had to download them again) and start reading, so I'm just leaving this out there in hopes it can help someone else; long story short, deregister the app, make sure to select "remove all licensed content from this device", then register again.

Wednesday, March 02, 2011

FluentNHibernate: "unable to locate persister:"

There's quite a bit of info out there for this error message, but all I could find refers to xml configuration, the recommendation being somewhere along the lines of:


  1. Make sure your mapping file is named *.hbm.xml
  2. Make sure it is set to an embedded resource.
  3. If all else fails, debug.

What most articles fail to mention is the root cause, which is the fact that NHibernate was not able to load the mappings for the class you are trying to use in your query, knowing that you can at least focus in a single area, in the case of fluent nhibernate, the configuration looks something like this:


public static ISessionFactory CreateSessionFactory() {
   return Fluently.Configure()
   .Database(MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("AppDb")))
   .Mappings(m => m.FluentMappings.Add<ProductMap>())
   .Mappings(m => m.FluentMappings.Add<CategoryMap>())
   .ExposeConfiguration(c => c.SetProperty("current_session_context_class", "web"))
   .BuildSessionFactory();
}

The two .Mappings() lines are the bug in this case, any subsequent calls to it override the first one and you won't be able to query Products
There are two ways of fixing this, one you can tell it to load all the mappings found on the same assembly as the first map


   .Mappings(m => m.FluentMappings.AddFromAssemblyOf<ProductMap>())

or if you want to be specific:


   .Mappings(m => { m.FluentMappings.Add<ProductMap>();
                    m.FluentMappings.Add<CategoryMap>(); })


Hope someone else finds this helpful

Monday, February 28, 2011

IE 9 : How to get your old address bar back


IE9 introduced a new address bar that is located on the same row as the tabs that are open, that may be useful for some people, but for everyone else it's just annoying, luckily they added an easy way to change it back to the same way it was before, all you have to do is right click on any tab or the tab area and you'll get a "show tabs on a separate row" option at the bottom


And that's it, you get your old address bar back :)