Why I am right!

January 15, 2009

Google Chrome

Filed under: Browsers, Chrome, Google, Microsoft — Shaun @ 10:29 pm

I have been an IE user forever. I have tried Mozilla quite a few times and I really want to like it but I just never could. I read about Google Chrome and figured I would give it a try. If you haven’t used it stop reading right now and download it.

There are a few features I really like.

  1. It opens VERY fast.
  2. The cursor goes right to the address/search bar when it opens and the default home page is actually useful.
  3. The tabs actually work. You can move them around, drag them in and out of windows and close them in one click
  4. Google regularly  updates the browser and you don’t even know. Now I don’t have to wait years for the next version.

It is one of those things that is hard to explain why it is better.. it just is.

December 30, 2008

iPhone review and AT&T Outage

Filed under: AT&T, Fail, iPhone, Technology, Verizon — Shaun @ 12:32 am

I picked up an iPhone on Saturday and it is probably the most glorious device I have ever used. Everything works how I would expect it to work without reading a manual. As much as I generally hate Mac’s and their users they might have done something right with iPhone. Before deciding on the iPhone I tried out all the competitors Verizon had including the new Blackberry Storm. The storm was just ok and was generally sluggish to perform any task.

Before switching to AT&T I was with Verizon for 14 years. Their customer service and phone selection is near the top of my hate list but their network was really good. If they made a phone that was decent and didn’t have all their propeitary vCast, vzNavigator, vCrap I would have stuck with them.

AT&T on the other hand could be the worst thing ever. I took the phone home Saturday night and everything worked fine. I had service inside my house and at MOST places I drove. There seems to be quite a few dead zones in some fairly heavily populated areas. Then came Sunday morning. Apparently their was an outage for the whole Midwest which meant I was basically dead in the water all day. If that wasn’t bad enough apparently their “customer service” center is closed on Sundays. There is/was no announcement on their website or on their customer service recording saying their network was down. Congratulations AT & FAIL!

Apparently I have 30 days to decide how much I hate AT&T before I am stuck in their 2 year contract. If the phone wasn’t so awesome I would have taken it back already. So I think I am going to stick it out for the next 27 days and see how bad their network really is.

October 1, 2008

Brewers Playoff Game Start Time

Filed under: Brewers, Sports, Stupid — Shaun @ 8:56 pm

So we have waited 26 years for the Brewers to make it to the playoffs. I can’t wait to watch the Brewers game this afternoon. Wait that can’t be right. Apparently the Brewers play at 2:00pm local time…. on TBS. Wow thanks a lot MLB! Now I either get to take vacation time from work to watch the game or listen to it on crummy AM radio.

I’m sure a 2:00 game will be a ratings bonanza for TBS. Would it be too much to ask to play the game at a time when most people would actually be able to watch it?!

Swipe your own credit card

Filed under: Best Buy, Credit Card, Stupid, Technology — Shaun @ 3:01 am

By now I’m sure everyone has seen the do it your self credit card transaction. Pretty much any store you go to now has the little machine where you swipe your own card and then sign in the box. I love those machines because you can usually swipe your card ahead of time and speed up the transaction. I think the more you can get the $8/hour clerk out of the transaction the better.

One place where that kinds of falls down is at Best Buy. Here are the Best Buy steps:

  1. Swipe your own card like normal.
  2. Cashier stands there looking confused.
  3. Cashier asks for the card that YOU just swiped so they can enter the last 4 numbers.
  4. Cashier talks to friends in line next to you
  5. Card is returned along with 8 foot long receipt with 2 surveys on it.

So if they have to actually take the card from you why don’t they just swipe it themselves?! Am I missing something here?

May 22, 2008

Debugging "caught" Exceptions

Filed under: Debugging, Microsoft, Technology, Visual Studio — Shaun @ 10:05 pm

For the past week or so I noticed a few strange entries in the Visual Studio “Output” window when debugging to a certain page of our app.

Overflow

Something on my page is throwing and catching an OverflowException. Now it probably didn’t matter what was causing this exception because the application was working fine but sometimes things like this bother me enough that I have to figure it out. Luckily there is an easy way to debug ANY exception that you see in that window. I found the solution here.

Once I setup Visual Studio to catch all exceptions of type System.OverflowException (by following the steps in the linked article) the debugger popped the following window anytime that exception was thrown.

  Overflow

From here I was able to follow the stack trace to debug the actual problem which was an Integer getting set incorrectly in a grid we use.

May 13, 2008

Toyota Financial Services

Filed under: Green, Stupid, Technology, Toyota — Shaun @ 10:05 pm

Would you be surprised to find out that Toyota Financial services does not have an e-billing option for monthly payments? You would think the company who invented the gas saving Prius would certainly have a billing alternative that would help save trees. I’m surprised all the hippies haven’t complained about the “greenness” of this policy. Here is the reply I recieved:

Thank you for contacting Toyota Financial Services.  Billing statements
are system-generated, and you will continue to receive a paper billing
statement each month for your records.

We are currently not able to email billing statements.   You may view your
last printed billing statement by selecting the Statements tab.  You will
then need to select the most recent Statement Period from the dropdown
menu.  Billing statements are generated approximately 17 days before your
due date.

You may choose to receive Email Notifications by selecting the My Profile
tab.

We value your business and look forward to servicing your needs in the
future.  Thank you for visiting us at www.ToyotaFinancial.com.

Sincerely,
Toyota Financial Services

I signed up for their automatic payment service so my payment is deducted on the due date every month. I am a pretty anal record keeper so I usually like to know how much of a payment was applied to the principal and interest every month. Their statement and website cannot even tell me that information. If you want to know that you have to call and then they mail you a printout from their internal system that lists the amount applied to each.

I also have a loan through Honda Financial services. They have apparently figured out this black art of statement e-mailing. Each month my payment is deducted and they send me an e-mail with the details.

The worst part of all is I don’t even own a Toyota. I got a loan through them when I purchase a new Honda because apparently Toyota’s interest rate was .5% less.

April 25, 2008

SelectionChanged event fires during databinding (Solution)

Filed under: Microsoft, WPF, XAML — Shaun @ 2:54 am

I was having an issue where the SelectionChanged event would fire during WPF DataBinding. While this may be valid, this was not the desired behavior for my application.

Since I could not find anything after a quick Google search I decided to post my workaround. Part of this example was taken from Adam Nathan’s excellent WPF book. Here is some sample code:

Window1.xaml

<Window x:Class="WpfApplication2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="200" Width="300">
    <Window.Resources>
        <XmlDataProvider x:Key="dataProvider" XPath="GameStats">
            <x:XData>
                <GameStats xmlns="">
                    <GameStat Type="Beginner">
                        <HighScore>1203</HighScore>
                    </GameStat>
                    <GameStat Type="Intermediate">
                        <HighScore>1089</HighScore>
                    </GameStat>
                    <GameStat Type="Advanced">
                        <HighScore>541</HighScore>
                    </GameStat>
                </GameStats>
            </x:XData>
        </XmlDataProvider>
    </Window.Resources>
    <Grid>
        <ListBox ItemsSource="{Binding Source={StaticResource dataProvider}, XPath=GameStat/HighScore}"
                SelectedValue="1203" SelectionChanged="ListBox_SelectionChanged" />
    </Grid>
</Window>

Window1.xaml.cs

using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;

namespace WpfApplication2
{
  public partial class Window1 : Window
  {
    public Window1()
    {
      InitializeComponent();
    }

    private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
      ListBox listBox = (ListBox)sender;
      if (listBox.IsLoaded)
      {
        Debug.WriteLine("ListBox Selection REALLY Changed.");
      }
      else
      {
        Debug.WriteLine("ListBox Selection Changed but we don't care!");
      }
    }
  }
}

As you can see I am looking at the IsLoaded property which comes from FrameworkElement. This is not set to true until the data binding is complete. I am not sure if this will work 100% of the time, but it works for my needs.

January 18, 2008

Changing the diff/merge program used by Visual Studio

Filed under: Beyond Compare, Microsoft, Technology, Visual Studio — Shaun @ 9:42 pm

I first want to congratulate Microsoft on releasing a diff tool that is significantly better than any of their previous versions. I would also like to thank the developers for giving us a way to change the default tool to something else.

Personally I prefer using Beyond Compare. There are a number of reasons why I like it better but in the end it just comes down to what you are familiar with and personal preference. If you are still stuck in the stone age using tools like WinDiff, SourceSafe give it a try, it is free for 30 days.

Anyway, here is how you change the default diff/merge tool in Visual Studio. I know this works in 2005 and 2008. From what I recall the menus are pretty similar in each version.

  • Open Visual Studio
  • Click Tools.. Options
  • Select Source Control in the left pane. (If it is not there check the “Show all settings” box at the bottom left.
  • Select Visual Studio Team Foundation Server.
  • Click the “Configure User Tools” button in the right pane.

Options

  • Click Add in the “Configure User Tools” window

Add

Now you are ready to enter the configuration for whichever tool you choose to use. Below is what I entered for Beyond Compare.

Compare Settings:

%1 %2 /title1=%6 /title2=%7

BeyondCompare

Merge Settings:

%1 %2 /savetarget=%4 /title1=%6 /title2=%7

Merge Settings

If you are not using Beyond Compare here is a post by James Manning that lists settings for different compare and merge tools including WinDiff!

 UPDATE (2/20/08): Added Merge settings

January 3, 2008

The Best Rewards Credit Card

Filed under: Cheap, Credit Card, Gas, Rewards — Shaun @ 4:50 pm

For anyone that uses a rewards credit card, check this one out. I found a card from the Pentagon Federal Credit Union. You need to be a member but anyone can qualify. There are a number of ways to join. I was never a member of the military and didn’t want to bother any relatives who were in the military so I decided to join by making a one time $20 tax deductible donation to the National Military Family Association. From what I can tell it seemed to be a decent organization and with the price of gas these days I should get that back in about 8 weeks if I am getting 5% at every gas station.

If you haven’t clicked on the link here are the details at the time of writing:

  1. 5% back on all gas purchases (pay at the pump).
  2. 2% back on all grocery purchases.
  3. 1.25% back on everything else

These are not introductory rates and there are no limits on the rewards as far as I can tell. There is no annual fee and your reward amount is paid monthly and it does not have to be in any special increment. As far as I have seen this is the best rewards card available.

Their site is pretty ugly but seems to work fine. The application process took about 10 minutes and wasn’t too painful. Approval is not instant but only took a couple of hours. When you create an account you are required to open a savings account and put at least $5 in. If you are going to do this make sure you use a debit card to avoid any potential fees from your current bank.

January 2, 2008

Updating XML columns in SQL Server 2005

Filed under: Microsoft, SQL, SQL Server 2005, Technology — Shaun @ 7:33 pm

I had a table with a large XML column containing hundreds of rows. I needed to update the value of a single node in some of those records. Here are the steps I used to do it and the errors I encountered along the way. Hopefully this will save someone else some time. I cannot use my actual code for a number of reasons so I will attempt to simplify it for this example.

Assume you have a XML format like this:

<Sample>
  <NodeOne>Value1</NodeOne>
  <NodeTwo>Value2</NodeTwo>
  <NodeThree>OldValue</NodeThree>
</Sample>

We want to replace ‘OldValue’ in NodeThree with ‘NewValue’.

Attempt 1 (Invalid):

DECLARE @newValue varchar(50)
SELECT @newValue = 'NewValue'
UPDATE [Product]
   SET ProductXml.modify('replace value of (/Sample/NodeThree)[1] with '+ @newValue)

Since this script would be run a number of times with a different parameter I needed a way to change the ‘NewValue’ without rewriting the script. I was hoping to use String concatenation but it does not work.

Msg 8172, Level 16, State 1, Line 5
The argument 1 of the xml data type method “modify” must be a string literal.

Attempt 2 (Invalid):

DECLARE @newValue varchar(50)
SELECT @newValue = 'NewValue'

UPDATE [Product]
   SET ProductXml.modify('replace value of (/Sample/NodeThree)[1] with sql:variable("@newValue")')

To fix the above error I had to use the sql:variable syntax. as you can see this simple replaces the string concatenation with sql:variable(“@newValue”). I thought I was home free but there was one more problem.

Msg 2356, Level 16, State 1, Line 6
XQuery [Product.ProductXml.modify()]: The target of ‘replace value of’ must be a non-metadata attribute or an element with simple typed content, found ‘element(NodeThree,xdt:untyped) ?’

Attempt 3 (Valid):

DECLARE @newValue varchar(50)
SELECT @newValue = 'NewValue'

UPDATE [Product]
SET ProductXml.modify('replace value of (/Sample/NodeThree/text())[1] with sql:variable("@newValue")')

What I really wanted to do was replace the text of the NodeThree element. To do that I had to add /text() to the end of the XPath. This script will replace the text of the specified element with whatever value is in the @newValue parameter. Thanks to this thread for the answer.

Disclaimer:

As far as I know this only works on un-typed XML columns. If you have a typed column I believe you need to add a couple things to this statement but hopefully this will point you in the right direction.

During testing I wrapped my entire script in a BEGIN TRANSACTION/ROLLBACK TRANSACTION so I could see the results of my script without doing any damage. You should do at least that before attempting any updates as the XPath is generally tricky.

Older Posts »

The Silver is the New Black Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.