Saturday, September 12, 2009

With a day off and nothing to do, I was excited to migrate my home PC to Windows 7.  I’ve used the beta and RC for a while on my laptop but my home PC is a different story.  This is my “main” computer in the house and I need it for lots of stuff. I wasn’t worried about Windows 7 but I also decided to go 64 bit!  Plus I have a lot of software to install and licenses to find, so that always makes me nervous.  All (hopefully) of my data is on different drives than my OS so that makes life easy.

Anyway, I installed Windows 7 64 bit with no issues, so I thought.  Afterwards I even started installing additional software.  It wasn’t until I rebooted my PC without the Windows 7 install DVD in the drive that I realized I had a problem!  On boot up, I got the following doosy of an error:

Disk Boot Failure, Insert System Disk and Press Enter

That is one of those errors that really makes you pause.  It really makes you feel like you are in big trouble.  Figuring maybe there was some piece of installation that wasn’t yet complete, I put the Windows 7 install DVD back in and it booted just fine!  But of course, I still couldn’t boot without the DVD.  This had me bewildered for a while, I tried various combinations of rebooting, and then searched the internet for answers.  All the while, this seemed strangely familiar – I’ve had this happen to me before, but I can’t remember when and why (don’t you hate that?).  I did a reinstallation of Windows 7 but that didn’t fix anything.  I was reading articles about bootmgr and active drives and all kinds of stuff.  From my research, I started to figure out that (I may explain this wrong) when you install Windows, some information about how to boot up goes on your hard drive but it isn’t necessarily the same hard drive (or partition) that Windows gets installed on.  I mentioned early that I had a separate data drive.  As a matter of fact, I have 4 hard drives in my PC.  So now I had an idea of the problem (just an idea at this point) – my PC was probably reading hard drives in the wrong order and couldn’t figure out how to boot up.  I wasn’t sure how to fix it.  Then the answer came to me, it was really quite simple.  Here is how to solve the problem:

When installing Windows 7 (or any Windows version, I’d guess), disconnect all additional hard drives except for the C drive!  Then you know all of the right information goes on the drive that you want to boot off of.

I did just that.  I left just the one HDD connected in my pc and reinstalled Windows 7.  I’m sure there are exceptions to this and reasons why you shouldn’t do this.  I’m not an IT Pro, just a software developer who’s done installations more than a few times.  But this worked for me!  After installation, I just hooked up my additional drives and everything worked perfectly! 

I hope this helps and good luck.  By the way, if you have additional questions related to installation problems, I am probably NOT the guy to ask.  I just got lucky on this one.

 

Saturday, September 12, 2009 10:08:35 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Saturday, June 13, 2009

It's been a busy few months since my last post.  Ben's building his vocabulary and knows a bunch of words.  He's also working on his "animal sounds".  He knows that a cow says "moo" and a bunch of others.  If you ask him what a pig says, he makes a sort of coughing sound.  I figured out he is saying the end of the word "oinK".  Ben was a little late to the game for walking. But he really got the hang of it and was very proud to be walking around.  But then he had a bit of an accident and broke his leg!  It sounds pretty crazy but the doctor says it is really quite common.  The specific break is actually called a "toddler's fracture"  To be clear, we aren't talking about one of those nasty "dangling limb" breaks.  Just a crack.  It still sucks for a 15 month old kid.  So poor Benny has a cast on his leg and that put an end to walking for a while. 

It's actually quite interesting to see Ben respond to this situation.  When the accident happened he was really unhappy and scared.  I don't think he was in a terrible amount of pain if he kept still.  But he was really scared, he knew something was not right in a serious way.  It took a while in the hospital and he did not like it when they splinted and wrapped his leg (the cast would get put on the next day at the Orthopedist's office).  However, as soon as his leg was immobilized he was out of pain and started turning back to normal, even playing a bit.  I expected him to play with the splint or try and take it off.  But he just ignored it.  I think somehow he actually understood that it was helping him.  Even when the cast got put on, he never pulled at it or anything.  He just accepted the situation - "now I have a cast on my leg, what's next?" He was back to crawling full time but didn't seem to care about the broken leg at all.  He eventually started to stand on it (leaning  on furniture) and now even takes as many as 8-10 steps on it!  He's not really supposed to but it isn't so easy to keep him off it.  The worst part of the whole thing is 6 weeks with no baths (not real ones, anyway), sand, swimming, dirt etc.  Anyway, in 2 weeks the cast is coming off.  My expectation is he'll quickly adjust back, start walking and that will be the end of that story.

We've also joined the Philadelphia Zoo.  This is a great idea for any family and we are really liking it, with 2 trips in so far this summer.  Benny loves it and points and yells at the animals.  We've also seen a lot of family lately including a visit to the park with Grandma and Longstreet Farm with his cousins. 

The last new thing is that we've been taking Ben for bike rides (he hangs out in a trailer), it's fun for the whole family.  Wow, so much to talk about, I really need to post these things more often!  Here's a bunch of photos:

  • Craft Time for Ben, Mommy and cousin Fiona!

DSC04082 DSC04084

  • With Grandma on Passover.  A classic "how big is Benny?" photo!

 DSC04093

 DSC04104 DSC04110 DSC04120 DSC04121 DSC04137

  • Here's a shot of Ben with his cast.

DSC04142

  • Benny's catching a free ride with Uncle Dennis, and posing with cousins Kaycie, Allie, Sami and Jake at Longstreet Farm.  Also Benny is his bike trailer - and looking cool too!

 DSC04146 DSC04154 DSC04167

 | 
Saturday, June 13, 2009 2:01:10 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, May 04, 2009

Lot's of bloggers have written a post just like this.  It's almost a staple for the tech-blogger.  I've avoided it until now because there are lots of posts like it out there already.  Wow, really makes you want to read on, huh?  Well since I am in the process of installing Windows 7 RC on my laptop, I couldn't help but notice my list of favorite utility programs. So here they are in no particular order.  Check em out!

Disclaimer/Note - I am not affiliated with any of these products in any way, I just like them. 

Virtual Clone Drive:  This tool is great because it allows you to take an ISO image and treat it like it is a drive on your computer.  So if you download an install CD/DVD image, you don't need to burn it onto a disk in order to install it.  Just use Virtual Clone Drive and you can click on it like any other drive on your computer and browse or run files.  Very Cool!  Plus, they've got one of the coolest logos around.

Paint.Net:  I'm a developer, not a professional designer.  Paint.Net is similar to programs like PhotoShop but it is free.  It certainly doesn't have as many features as PhotoShop but most of the time, for me, it gets the job done.  I've been using this tool a lot for years!  And it is FREE! If you think you need photoshop, but just for casual use, check out Paint.Net.

Visual Color Picker:  This is a great tool to use if you need to figure out what color something is on your computer.  Just open a web page, application, or whatever you want to investigate and use Visual Color Picker to "pick" the color with it's dropper tool.  Piece of cake.  Then just copy the color name or code into the application you are working on and you are all set.  Off all the tools on my list, this one seems to be the "best kept secret".  You should really try this out, it is awesome.

BurnCDCC:  I just learned about this one from an old post Scott Hanselman's blog.  (If I ever need a cool tool, I search his blog!)  Burn CDCC lets you put an ISO image on DVD as a true image, not just data.  This is important when you download a cd/dvd and need it to actually run off of disk (such as to install some software).

Zoomit:  This is a great little app for when you are doing presentations.  It allows you to easily zoom in on a portion of your screen, and scribble on it too!  This one is written by Mark Russinovich but available for free from Microsoft.

Lastly, an Honorable Mention...

Windows Snipping Tool:  Honorable mention, because it is already included on most computers with Vista or Windows 7.  If you need to highlight and clip just a portion of a screen shot and paste it somewhere (like into a Word doc or a blog post) Snipping Tool makes it easy.  Like some of the other tools listed above, there are some great products available out there for purchase.  In this case, Snipping Tool is similar to SnagIt, which is a cooler, better product.  And actually, SnagIt isn't priced too highly.  But Snipping Tool makes for a decent, free version.  Oddly, up until a few weeks ago, I didn't even know I had it!  And In 1 week, two different people told me about it.  Turns out, in an effort to enhance the performance of my computer while using the processor/memory hog Vista, I shut down a lot of things, including the Tablet PC Features in Vista.  For some reason, Snipping Tool is included in that package.  So for all this time, I didn't have access to a really neat little feature.  Oh well.  Now I've got it, and I use it all the time!

 

While I'm at it, I may as well list the software getting installed on my laptop too.

Things I can't do without:

Firefox (with Firebug, WaveToolbar, and YSlow addons), Live Writer (for composing blog posts like this one!), Digsby (for Instant Messaging), Twirl (twitter client), Live Mesh

And then:

Office 2007 and Outlook, SQL Server, Visual Studio 2008, ReSharper (my favorite VS Add on!), Bit Defender (Anti Virus), Tortoise SVN (source control) and more...

Something tells me that after I publish this, I'll think of a bunch of stuff that I left off the list

 

Technorati Tags: ,
Monday, May 04, 2009 9:35:41 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Thursday, April 23, 2009

jQuery rocks.  It makes it really easy to do cool stuff client side with JavaScript, like these cascading DropDowns (aka Select Lists).  But at the end of the day, jQuery is JavaScript, and it can still be tricky to work with.  One of these days, Visual Studio will treat JavaScript like a first class language and life will be much easier.  You'll see that there isn't much JavaScript here, but it took me several iterations to get this right.

I'll start with the UI code and JavaScript.  If you want, you can read further and see the Controller code and more.

In my View, I have two DropDowns (Select Lists) and some JavaScript:

<p>
    Country:
    <%= Html.DropDownList("Countries", ViewData["Countries"] 
             as List<SelectListItem>) %>
</p>
<p>
    Region:
    <%= Html.DropDownList("Regions", new List<SelectListItem>()) %>
</p>

<script src="../../Scripts/jquery-1.3.2.js"></script>

<script type="text/javascript">
    $(function() {
        var countries = $("#Countries");
        var regions = $("#Regions");
        countries.change(function() {
            regions.find('option').remove();
            $.getJSON('/Home/Regions', { countryId: countries.val() }, function(data) {
                $(data).each(function() {
                    $("<option value=" + this.RegionId + ">" + this.RegionName + "</option>").appendTo(regions);
                });
            });
        });
    });
</script>

The Countries DropDown is pre-populated with data passed in ViewData. 

The second DropDown, Regions gets loaded when Countries changes.

Here's how the JavaScript and jQuery stuff works...

First I get the two Select Lists, using jQuery and the ID as the selector (jQuery makes it easy!):

        var countries = $("#Countries");
        var regions = $("#Regions");

Next I wire up the change event on the Countries list to an anonymous function (jQuery makes it easy!):

        countries.change(function() {
        // ...
            });

Inside that function I do a few things.  First, find all options in the Region Select List and remove them:

            regions.find('option').remove();

Next I need to get the data for the second Select List. Guess what?  jQuery makes this easy too.  Using the getJSON() method, I supply the Controller and Action, as well as the Id of the country so I can get the correct regions.  I also declare a function to call when the JSON result comes back:

        $.getJSON('/Home/Regions', { countryId: countries.val() }, function(data) {
        // ...
        });

The last thing to do is load all of the results into the Select List.  This actually was the hardest thing to do but in the end it is very little code.  I tried using jQuery to create options and adding them to the select list.  I tried creating a list of options and setting the html value of the Select list.  I tried a bunch of stuff.  But this worked great... Iterate over the results with jQuery's .each function and call a function for each iteration.  The function creates some dynamic html and appends it to the Region list.  I must admit, I was surprised this worked.  I'd assume that appending would put it after the select list (<select id="Regions" />) but it actually put it inside it!

        $(data).each(function() {
            $("<option value=" + this.RegionId + ">" + this.RegionName + "</option>").appendTo(regions);
        });

That's it!  It works great.  Of course there are more complex ways to do this, with caching etc.  This is just one way to accomplish the goal.

Here's some code from the Controller that helps make it work.  Just remember, this is demo code.  I'm not too worried about separation of concerns and similar details. In a production app, I'd be calling more services!

In the Index Action (in this sample the Select Lists are in my Index View) I load the countries list into ViewData.  Again, this is a demo and that may not be the best practice.

    public ActionResult Index()
    {
        ViewData["Countries"] = GetCountries();
        return View();
    }
    private List<SelectListItem> GetCountries()
    {
        List<SelectListItem> countries =
            _countryList.Select(c => new SelectListItem {Text = c.CountryName, Value = c.CountryId.ToString()}).ToList();
        countries.Insert(0, new SelectListItem{ Text="", Value = "0"});
        return countries;
    }

Then I have a Regions Action that returns the JSON result with the values to add to my Regions Select List:

    [AcceptVerbs(HttpVerbs.Get)]
    public ActionResult Regions(int countryId)
    {
        return Json(_regionList.Where(r => r.CountryId == countryId).Select(r =>
                                                                            new
                                                                                {
                                                                                    r.RegionName,
                                                                                    r.RegionId
                                                                                }));
    }

 

That covers most of it.  Happy coding.

Technorati Tags: , ,
Thursday, April 23, 2009 7:30:44 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [5]  |  Trackback
 Wednesday, April 22, 2009

When using strongly typed views, don't name the controller action arguments with the same name as another form value!

I've been working with ASP.NET MVC for a couple of months now.  It is really pretty awesome.  It's worked so well, I haven't had much to blog about!  The other day I ran into an issue so I'm sharing the solution.   MVC will "automagically" bind the parameters of a controller action based on the values in the form.  And if your View is strongly typed and your controller action has a parameter of that same type, it will bind it too.  But in my case, the parameter was null.  MVC wasn't loading it. And there was no exception to help me out.

Here's a simple demo, I'm not showing every line of code...

 

Typical for an MVC application, I have a view that is strongly typed:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<OrganizationRole>" %>

 

The View has a simple form which includes two text boxes:

<p>
    <label for="OrganizationName">OrganizationName:</label>
    <%= Html.TextBox("OrganizationName") %>
    <%= Html.ValidationMessage("OrganizationName", "*") %>
</p>
<p>
    <label for="Role">Role:</label>
    <%= Html.TextBox("Role") %>
    <%= Html.ValidationMessage("Role", "*") %>
</p>

 

A button on the form posts back to the controller, calling the Create Action.  Here is Action Code:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(OrganizationRole role)
{
    // Do Something Here...
    return View();
}

In the screenshot below, you can see that when I debug the app, the role parameter has not been loaded.

image

The fix was simple but it took a while to figure it out!  All I had to do was re-name the parameter from "role" to "organizationRole":

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(OrganizationRole organizationRole)
{
    // Do Something Here...
    return View();
}

You see, I was being lazy and abbreviated the argument's name.  That is ok, you can name the parameter almost anything you want.  But I gave the parameter the same name as one of the other form variables!  Notice above that my form has a text box named "Role"!  MVC tried to load the values of my parameters - it takes each of the posted values from the form ("OrganizationName" and "Role") and tries to match them up with arguments with the same names (it is not case sensitive) if they exist.  It also tries to load the entire form value (strongly typed as the class OrganizationRole) to the argument of type OrganizationRole, if one exists.  But an argument of type OrganizationRole with the name "Role" screws the who thing up!  The only problem is that it doesn't throw any exceptions.  Anyway, I changed the name and presto, it works.

Wednesday, April 22, 2009 9:01:18 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Saturday, April 04, 2009

It's hard to keep up with posting these photos of Ben.  Time flies.  Lots more news since my last blog post.  First of all, Ben had his 1st birthday!  His grandma made him an awesome cake (and cupcakes) and they were a big hit. 

Ben is really trying to gain some weight (he's a on the small side).  The Dr. put him on a "butter" diet, telling us to put butter on everything he eats.  Somehow he got the message.  All of a sudden he started eating everything in sight.  He gained 1 lb in 6 weeks.  Then he stopped eating again and got really finicky and cranky.  After a few days Rebecca took him to the Dr. to find out that he had an ear infection!  After a day or 2 of antibiotics, he was back to eating again.  He's a pretty funny eater.  One day he'll be eating Brussels sprout (yes, spelled with an "s" at the end, I looked it up), broccoli, meatloaf, spaghetti and meat sauce, salmon, and more.  It's like he loves all different flavor foods.  And the next day, he's bored of it all and won't eat anything!

Right around the time of the ear infection Benny developed another ailment, much to our dismay.  He's become a bit of a "momma's boy"!  All he wants is for his mommy to hold him.  It's pretty funny too because if it's just me and him hanging out, it's all good. He laughs and plays and is perfectly content.  But when Rebecca comes in the room, he starts to get cranky and he just wants her.  I'm sure this is pretty typical behavior for a kid his age.  For me, it's a little insulting - "what, I'm not good enough for you?".  But for Rebecca it is just plain annoying because she can't get anything done when he is around.  This too shall pass.

We've had a few other big achievements lately.  Ben started taking some steps on his own.  Still just 2 or 3 at a time, but people say once it starts, he'll be walking soon enough.  He also has increased his vast vocabulary to 3 words.  In addition to "momma" and "dadda", he now says "dog".  Well, more like "daw daw" but we are impressed.  It's funny too because we don't have a dog.  But he gets excited when he sees them on TV or out walking around, or at friends' houses.

OK, as usual, here are some recent photos...

No, that first one isn't Ben, but a classic just the same.  Big Steve eating Chicken Holiday!  Below are pictures of ben playing, at the park with Grandma, and showing off his new "Vail" shirt (he wants to go skiing there next year!).  Also, three classic "messy face" pictures.  The first is Ben eating his 1st Birthday Cake (his first sugar fix ever).  I think he liked it because you can see him eating his friend Ricky's cake too (with the red icing).  Think he enjoyed it?  And there's another with him covered in Oreo cookie!  Don't worry, he eats a lot of veggies and fruit too!

 DSC03995 DSC04006 DSC04023 DSC04036 DSC04037 DSC04045 DSC04062 DSC04072

 | 
Saturday, April 04, 2009 9:48:13 AM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Thursday, April 02, 2009

My blog has been pretty quiet lately.  Things got a little hectic in mid February. 

More new technology:

After struggling to get the hang of Silverlight for a while, I was really starting to get comfortable with it.  Development on my project was moving along, the client was liking the results, and I was learning a lot!  Just when things were going well, my client informed me that he'd be dropping the project (hopefully temporarily) due to financial issues.  I was disappointed for many reasons.  I felt bad for the client (this economy is hurting a lot of people) and I felt bad for me, I had to find another client without much notice.

Lucky for me, I was able to get started on a new project pretty quickly.  I was very excited to dive into ASP.Net MVC too!  But from a blogging perspective, it meant another shift in direction.  I had been trying to focus on one thing and blog about it a lot.  I like the fact that my blog isn't tied to a particular technology, but it is fun to get good at something and share information.  Oh well.  The fact is, I have been very lucky lately regarding new technology.  I was fortunate to start using VS2008/.Net 3.5 during the Beta at Orbius (lots of LINQ to SQL), then Silverlight 2 for my next client (and lots more LINQ to SQL) and now I'm doing ASP.Net MVC with jQuery, Dependency Injection, and other related stuff (and still lots more LINQ to SQL!) in my current situation.

What to blog about?

So now, no more Silverlight posts (unless I find some time to play around with Silverlight 3 which I am very excited about).  But I hope to continue blogging about what I am learning now.  There is one problem.  I typically try to blog about something that I struggled with and then resolved, hoping to spare others the frustration.  That was easy with Silverlight 2 which I thought was sort of painful to use (but I enjoyed it and liked the result).  But MVC doesn't seem to be like that.  The switch to ASP.Net MVC was pretty easy for me.  And it seems to work pretty well.  The basics are pretty simple, in many ways less confusing that ASP.Net web forms, and I haven't had too many issues yet.  Could it be that MVC really is the right way to go?  So far, it seems that way.  As I dig in more, I'm sure I'll find plenty of blog worthy material.  As a matter of fact, I already have one, to be posted soon.

Business Update:

I've been pretty busy and haven't been focusing on the "business side" of business.  A lot of independent consultants aren't sure how to set up a business and I promised to write about it.  Here's a quick update... I had debated back and forth about incorporating by forming an LLC or S-Corp.  I spoke with a lot of people including some accountants.  In the end, it seemed that there was no need to rush.  I had a client that didn't care.  So I started to operate as a sole proprietor.  However, as a sole proprietor you can operate in several ways.  You can just mix up all of your personal and business money and confuse everything.  Or you can be a sole proprietor and act like a business.  That is what I am doing.  I have separate bank accounts and check books, I got a business credit card, and I record all of my income and expenses in QuickBooks.  Also, being a sole proprietor, I learned that you can also "do business as" some other name. It's called DBA (not like a database).  This is a good idea for someone like me, since I do already have the my web site, blog and email on the domain IngenuityNow.net.  You don't need to actually be incorporated to use a business name!

I also looked into insurance and learned about liability and E and O (Errors and Omissions) insurance.  You need liability so you can't get sued if you knock over a server rack at a client, or a client falls walking into your house (nope, personal insurance doesn't cover that).  E and O is to cover you if you screw up an application, trash a database, or find some other way to ruin a client's business.  From talking to a lot of people, it seems that E and O isn't so popular and most people only get it if the client insists.  It is also pretty expensive.  Liability insurance is much cheaper and seems like a good idea.

I also set up a web site and got business cards.  A little marketing goes a long way towards professionalism!  The web site is pretty simple so far but it will grow in time.  Please let me know what you think.

So what is next on the business front?  I've got to keep the networking up.  There are lots of clients out there, we just need to find them!  I also plan to get the incorporation thing going.  There are some good benefits to it (for taxes and liability) and I have spoken with a few clients that won't work with you without being incorporated (although I know many consultants who never incorporate).  My only pain point so far on all of this is the accounting stuff.  QuickBooks helps, but it isn't that easy to use if you don't grok all of the accounting concepts, so I have a lot to learn

Thursday, April 02, 2009 8:45:44 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Thursday, February 19, 2009

If you are looking to learn about Silverlight development, here is your chance.  Our local Microsoft Developer Evangelists are running a free full day event this Saturday featuring a good variety of information. 

To learn more or register, click here.

If you are a beginner or haven't gotten started yet, this is a great opportunity.  I'm not a beginner and my weekends are pretty busy these days.  So initially, I was going to skip this event.  But from my conversation with Dani Diaz last night, it sounds like there will be a decent range of information here, so I think I will attend too. 

I don't know the full agenda but some of the speakers include Dani, Lindsay Rutter, Bill Wolff and Pete Brown.  That's a good line up but to be perfectly honest, Pete Brown is the big draw for me.  I've been reading his blog since I started doing Silverlight development, this guy really knows his stuff.  One thing I've learned over time is that if a good speaker if giving a talk, even on a topic that I think I know fairly well, it is worth attending.  You never know what kind of tidbit you may pick up from them!

Hope to see you there.

Thursday, February 19, 2009 9:42:51 AM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [2]  |  Trackback