Monday, March 17, 2008

Examining MSIL output for string operations on null object references

http://forums.asp.net/t/1234799.aspx

This was an interesting question to me as I had always known to test an object reference to be (Is Nothing) or != null before performing string operations or instance methods upon it... but I didn't know why. I also wanted to investigate exactly what the CLR does when the + operator is used on strings.

As an addendum to the above post, I discovered that using the & and + operators in VB is inherently sinful..

Console.WriteLine(obj1 + "asdf")

Console.WriteLine(" ")

Console.WriteLine(obj1 & "asdf")


produces the following IL:


IL_0002: ldloc.0
IL_0003: ldstr "asdf"
IL_0008: call object [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.Operators::AddObject(object,
object)
IL_000d: call void [mscorlib]System.Console::WriteLine(object)
IL_0012: ldstr " "
IL_0017: call void [mscorlib]System.Console::WriteLine(string)
IL_001c: ldloc.0
IL_001d: ldstr "asdf"
IL_0022: call object [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.Operators::ConcatenateObject(object,
object)
IL_0027: call void [mscorlib]System.Console::WriteLine(object)


I thought it was at least slightly interesting that VB.Net does not use the String.Concat function internally when the + operator is used. I expected & to be a VB CompilerServices method though.

Wednesday, December 12, 2007

Has it really been 9 months?

Wow, I can't believe it's been this long since I've posted....

Anyways, for a few comments on LSU.... My Tigers are heading to the Superdome for the BCS Championship game against the Ohio State Buckeyes. My prediction??? 27-14 LSU. I don't think anyone in the country can run with this LSU team when everyone's healthy. We have been suffering on defense with Dorsey and Beckwith injured, Alexander out for the whole season, and Jean-Francois suspended. We should be at 100% for the bowl game.

With that out of the way, I've just completed 1/3 of the new Microsoft Certified Professional Developer: Web Developer certification: the 70-536 exam. I highly recommend Microsoft's excellent Self-Paced Training Kit. It's currently offered at a great price by Amazon with free shipping. You'll also get a 15% discount on each test from purchasing these books.

Monday, March 26, 2007

Finding the English alphabetic order of a character

http://forums.asp.net/thread/1637908.aspx

This was an interesting post to me, as I haven't peeked around .Net's simple data types much. I came up with the following:

C#:

int GetOrdinal(char c)
{
return ((c.CompareTo('a') < 0) ? c.CompareTo('a') + 33 :
c.CompareTo('a') + 1);

}



VB.Net


Function GetOrdinal(ByVal c As Char) As Integer
Return IIf((c.CompareTo("a"c) < 0), c.CompareTo("a"c) + 33, c.CompareTo("a"c) + 1)

End Function

Wednesday, March 07, 2007

Baby, he's Back!!!

Alley Broussard seems to think he's back. Well, his new rap song seems to indicate that, anyway.

Why doesn't Les Miles feel the same way?


"At running back, we expect that Keiland Williams, Charles Scott and Richard Murphy will pursue those spots," Miles said to a group of reporters in his office. "Don't know exactly after that. It might be (Jacob) Hester. At fullback, Hester will the be lead dog. Thereafter, we'll have (Shawn) Jordan and Quinn Johnson.

"Trindon Holliday - we're going to find key spots for him. As the spring goes on, we're going to look to and talk about how to get those guys the ball."

Only then did Miles bring up Broussard, whose work habits and inability to come back strong from knee surgery and get in shape last season put him out of favor with Miles.

"Alley Broussard is a guy that right now I don't know exactly where he's at or how he fits," Miles said. "I'm not really ... let's just say comfortable. We will look at opportunities to use Alley when he's most prepared to compete. But he's not that right now."

Miles did confirm that Broussard is enrolled at LSU and still on the team.

"Alley is in school and doing well, I'm told," Miles said.

Broussard did not return calls on Friday. Asked if Broussard's problems with Miles stemmed from his work habits and attitude, Miles said, "All of the above," but declined to go into more detail. He did say he was pulling for Broussard to return to form.


Thursday, February 22, 2007

#3 is here, John Brady needs to go, and other thoughts

Well, my third child was born 8 days ago at a healthy 7 pounds, 3 oz. Her name is Abigail!

All will be well in the household eventually.... after she sleeps for longer than an hour at a time during the night. Where's my *tired* smiley?

I don't know if there's ever been as disappointing of a basketball season - immediately after a Final Four - than LSU is having this year. We weren't able to turn the gaudy success into recruiting (LSU whiffed on Arthur, Augustin, and Reynolds) or fan support (LSU had under 5000 in the stands for an early season top-25 game against Wichita St., a Sweet-16 team from last year). Is there a "Worst SEC Coach Of The Year" Award?

To top it all off, he was quoted in the Advocate as saying "One criticism of me that I'll accept is that I haven't really had a prototypical point guard during my tenure". Who is he out recruiting? Three different shooting guards. Who has signed their LOI's? 3 SF's and a PF.

It's time for a change, $kip.

And it needs to happen sooner rather than later. His financial mind ought to be able to put two and two together; JB gone == butts in seats and recruits on campus.

It's looking like I'll start my new gig on Monday, March 5th. Wish me luck!!!

Labels:

Tuesday, October 10, 2006

Torvalds on VB

http://sztywny.titaniumhosting.com/2006/07/23/stiff-asks-great-programmers-answers/

" - What do you think will be the next big thing in computer programming? X-oriented programming, y language, quantum computers, what?"

Linus Torvalds:

I don’t think we’ll see a „big jump”. We’ve seen a lot of tools to help make all the everyday drudgery easier - with high-level languages and perhaps the integration of simple databases into the language being the main ones. But most of the buzz-words have been of pretty limited use.

For example, I personally believe that „Visual Basic” did more for programming than „Object-Oriented Languages” did. Yet people laugh at VB and say it’s a bad language, and they’ve been talking about OO languages for decades.

And no, Visual Basic wasn’t a great language, but I think the easy DB interfaces in VB were fundmantally more important than object orientation is, for example.

So I think there will be a lot of incremental improvements, and the hardware improvements will make programming easier, but I don’t expect any _huge_ productivity help or revolutions in how people do things.

At least not until you start approaching real AI, and I don’t think real AI is going to be anything you will ever „program”.

I'm floored. Really. I don't know what to say.

Thursday, October 05, 2006

IsDate() silliness

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=219046

For the life of me, I cannot understand why Microsoft would change the behavior of a function that has been in place for X years.

Does allowing date values with a decimal separator make any sense to anyone out there?

I only stumbled on this because a corporate expeditor was searching for a voucher whose value was $819.03. If the value had been, let's say, $1600.46, it wouldn't have been an issue.