The operating system is not presently configured to run this application

After installing Visual Studio 2010, I started getting an error message every now and then when I would try to view the designer in Visual Studio 2008.

The first popup would say:

The operating system is not presently configured to run this application

Which was followed by the message:

Cannot load MSO.dll

I found that mso.dll was located in “C:Program FilesCommon Filesmicrosoft sharedOFFICE12”, and after adding that path to my PATH environment variable in Windows (I’m running XP Pro) the issue seems to have gone away in VS2008.

Marking things as deprecated in VB.Net

If you have some old classes/methods that you can’t get rid off, but you dont’ want anyone to use them for new development, you should mark them as deprecated, which can be done with the Obsolete tag:

<Obsolete("Don't use this class")> _
Public Class Whatever

End Class

This will cause any reference to Whatever to produce a warning.  You can treat these as errors if you want by using one of the other constructors like this:

<Obsolete("Don't use this class", True) > _
Public Class Whatever

End Class

Embedded Images in HTML Emails with .Net

I had looked for a few examples of how to send embedded images in an html email with the .net api, and the first few I found didn’t work.

This code, found on the blog of one Mike Pope, did work however:

Imports System.Net.Mail
Imports System.Net.Mime
Imports System.IO

Dim fromAddress As String = "mike@elsewhere.com"
Dim toAddress As String = "mike@elsewhere.com"
Dim subject As String = "Test EmbeddedImage"
Dim contentId As String = "image1"
Dim path As String = Server.MapPath("~") & ""
Dim filename As String = path & "MyPicture.jpg"
Dim body As String = "Here is a linked resource: <img src=""cid:image1""/>"

Dim mailMessage As New MailMessage(fromAddress, toAddress)
mailMessage.Subject = "Testing embedded image"
Dim av1 As AlternateView
av1 = AlternateView.CreateAlternateViewFromString(body, Nothing, _
    MediaTypeNames.Text.Html)
Dim linkedResource As LinkedResource = New LinkedResource(filename)
linkedResource.ContentId = contentId
linkedResource.ContentType.Name = filename

av1.LinkedResources.Add(linkedResource)
mailMessage.AlternateViews.Add(av1)
mailMessage.IsBodyHtml = True
Dim mailSender As New SmtpClient("smtpHost")
Try
    mailSender.Send(mailMessage)
    labelStatus.Text = "Message sent!"
Catch ex As Exception
    labelStatus.Text = ex.Message
End Try

 

Car Negotiator

My wifes 12 year old Corolla was still running strong, but it was in need of some work and seeing as how we just had our first kid we decided it was probably time to get a new car.

I absolutely hate car shopping.  I hate the fact that you end up wasting so much time at the dealer, the BS pricing tricks, the high pressure sales tactics, the “treating me like I’m an idiot who doesn’t that monthly price is ues, the “let me go talk to my manager” crap, I hate all of it.

So, I decided to try hiring a car negotiator
http://www.nomorehaggling.com/

I had heard Phil Landers on WGN Radio a few years ago, and thought it sounded like a great idea.  I wasn’t in the market for a car at the time, but a few years later when I googled “car negotiator” he was the first in google.

For a fee of $395, Phil made 2 trips out to the dealer with us (one to negotiate the car, and one to pick it up).  He probably spent about 5 hours in total.

I didn’t find any reviews of him online, so I figured I would write this one so anyone in the future searching can feel better about going this route, as I would recommend him to others.

Most people want to know right off the bat, did he earn the money.  Well from a strictly $$ sense on the price of the car, we probably broke even.  On my first trip to the dealer (w/o Phil, when I was just looking) the salesman started right off talking about dealer invoice.  Normally it has been my experience that dealers will start with the sticker price, and then offer you some small amount below that as the first offer.  You then have a major gap between the dealers first offer, and where you think the final price should end up. 

With, Phil we ended up about 500 lower than the dealer offer, or about 500 bucks worth of dealer profit based on their invoice, but several hundred below invoice when you include a cash back deal that was going on.  So strictly on price, I don’t think it is beyond reason that I would have been able to get them to come down 500 from their offer, even if there wasn’t much room for haggling left.

However, if the dealer hadn’t been forthcoming on the first offer, I’m guessing I’d have probably ended up paying more than that. 

The place where Phil really helped (in our deal) was with the other stuff.  The car we had driven 2 days before was already sold, and there was a similar car on the lot, with a slightly less appealing color, and with an extra “protection package” option installed that would have cost us probably 400 more.  I think my wife and I were ready to conceed and just take this car, as the color wasn’t bad, and the cargo tray aspect of the protection package would be nice, even if we were paying too much for that option.  However, before we made this move Phil got the salesman to search the inventory of other local dealers for the color and options we wanted.  I didn’t realized that dealers will swap cars like that w/ no extra charge to the customer. 

Sure enough, a dealer in Schaumburg had the exact color/trim/options we wanted.  So we got exactly the car we wanted, and didn’t end up paying extra for some stuff we didn’t want just because it was on site at the dealer.

They lowballed us on the trade in: 500 bucks.  Phil went to work arguing for us.  The guy came back after “taking another look” they increased their offer by 200%.  Phil told us he thought 1600 was the lowest we should accept, and so their offer of 1500 was pretty close.  Phil made the guy go back to his manager again and he returned with “Split the difference: 1550 and free car washes for life.”  No deal.  It’s 1600 or we take it to carmax (where we already had an offer).  They relented and accepted 1600 for the trade.

When we went back to pickup the car the next day, there had been a mixup and the wrong car was brought in from the other dealer.  It didn’t mean we were getting the wrong car, just that we wouldn’t be driving it home that night.  My wife half jokingly said that they should throw in the cargo tray for free for the mixup.  Phil thought that was a good idea and argued for them to do just that: and they did.

When they told us we could come back the next day to pickup the right car, Phil convinced them to have someone deliver the car to our house, which was nice.  In addition to all this, he got them to give us any dealer installed options at cost, so we ended up getting all season floor mats at 1/2 the asking price.

As we went over all the paperwork, Phil made sure all the paperwork and numbers were legit and make sure we didn’t sign any of the stuff regarding the appearance of the car (which wasn’t there), which they were still trying to get us to sign (duh!).

During the entire process we never had to do any of the talking.  Phil drove the process with the salesmen and we cut through all the crap that you typically expect when buying a new car.

So if you hate the car buying process, and you want to make sure you leave the dealership without getting ripped off, and would rather not deal with any of the headache and stress involved in the car buying process, I’d highly recommend working with a car negotiator and  I’d highly recommend Phil.

 

Preventing Form Resetting

In an application I am creating, I do validation, filtering and ajax saving of values when the user changes something in a textbox.

A problem arrises if the user makes some changes, and then presses the Esc key 2 times.  This causes the form to reset, but it skips all my validation and auto-saving logic.

To prevent this, you can use this little snippet of jQuery javascript:

$(document).ready(
     function() {
         // prevent the esc key from resetting all the textboxes
          $("form").bind("reset", function(e) {
             e.preventDefault();
         });
     }
 );