Friday, March 27, 2009

Boise Code Camp 2009

Boise Code Camp starts on Saturday (March 28th) and ends on Sunday (march 29th). Should be very interesting and with great presentations. For more details you can go to http://boisecodecamp.org/ .

Wednesday, March 18, 2009

CultureInfo Class

This is just a heads up of a new article that I am about to post here about The CultureInfo class. Just need a couple more days to verify a few things and then I should be ready.

Tuesday, March 17, 2009

decimal ToString

A few things that I have noticed when trying to convert decimal into string value:
1. If the decimal value is a nullable property and you want to format the string (.ToString("C"))=> you cannot do the following:

   SomeTextBox.Text = SubTotal.ToString("C");

   Where SubTotal is a nullable decimal property.

Instead you will have to do:

   //This will assign subTotal a value and therefore it is not nullable.
   var subTotal = SubTotal ?? 0.0m;
   SomeTextBox.Text = subTotal.ToString("C");

2. As far as string formating for a decimal value:
//This will display two decimal places
   subTotal.ToString("F");
//This will separate thousands
   subTotal.ToString("N");
//This will separate thousands and will precede with currency sign based on local environment.
   subTotal.ToString("C");

Thursday, March 12, 2009

Paste Operation Detected!




I got this one from a co-worker (Jarod) and loved it so much that I decided to share it with the www. The funny thing was that last night I learned that I can cycle through the clipboard ring to past different things (last 20 items I believe) in VS by pressing Ctrl +Shift + V.

Tuesday, March 3, 2009

My Day with Telerik Controls

This is just a quick example of what my day looks like => fighting with telerik's tools and their support team.
This time I was dealing with the RadEditor:
http://www.telerik.com/community/forums/aspnet/editor/max-length.aspx#757876

Friday, February 27, 2009

KIS(S) - Keep It Simple (Stupid)


If there's one thing that I always keep in my mind when I program is KISS. No, I am not talking about kissing my beautiful wife. I am talking about

Keep It Simple Stupid.

If you find yourself writing code that looks really cool and sounds awesome when you tell your friends about it... and then, when you try to debug it a couple of weeks later, it takes you ~ an hour to figure out what the hack you were doing there.... Well, that means that you were doing something wrong. To my opinion, one of the important things that a good programmer must have is the ability to write simple code. It may not look very cool, or it might be 1-2 lines longer. But when a co-programmer will have to debug your code, they will not have a puzzled and confused look on their face :)

Sunday, February 22, 2009

RegExp on ASP.NET vs. The World

I was working on a Create New User page and had to add some Regular expressions to some of the fileds on the page. Everything gone well, everything but the regex for the password field.
My regex looked like that:
    (?=^\S[^<>])(?=\S*[0-9])(?=\S*[A-Z])\S{6,20}$

Which translates into: Accept every string of characters that doesn't have white space or '<' '>' and must have at least 1 numeric character and at least 1 upper-case letter and has to be between six to twenty characters long.
I usually test my regex with a nice free tool called: Regex-Coach.

However, when wiring it up on my aspx page, it translated into: Accept every string of characters that doesn't have white space or '<' '>' and must have at least 6 numeric characters and at least 6 upper-case letters.

After hitting my head on my desk for a while I decided to modify my regex to the following:
    (?=^\S[^<>]{5,19}$)(?=\S*[0-9])(?=\S*[A-Z])\S*$

Which translates into the same thing, however this time I moved the "at least 6-20 characters" restriction to the beginning of the expression. This regex worked on both the regex coach and on my aspx page. It seems a little odd to me that the same regex is being translated somehow differently after all regex is regex?!
 
Watch the latest videos on YouTube.com