New look.
Posted on February 18, 2008
Filed Under Uncategorized | Leave a Comment
I haven’t been posting much, mainly due to a busy schedule, but also because I really didn’t like the look of the site… I have changed to a new theme. Hopefully, this will motivate me to post more.
One thing I was looking for in a new template, was a fluid layout. It seems the wordpress themes for fluid layouts are pretty scarce. Especially ones that look good. I will stick with this one for the time being and see how it works. I think my code highlighter will fix the reason I wanted a fluid layout anyway.
Disposing of memory leaks.
Posted on January 3, 2008
Filed Under .Net Code, VB.Net | Leave a Comment
One of the biggest causes of memory leaks that I find from time to time is from forgetting to dispose of some SQLConnection object. Even if the connection is closed, the SQLConnection object seems to stay alive forever, which keeps any form objects alive as well.
This happens in VB a lot if you forget to call the Dispose method of the SQLConnection object or if you don’t use the Using keyword. While cleaning up code, the best way to get in the habit of doing it, seems to be changing everything into a Using statement so I get in the habit of using it…
Instead of:
Dim myCommand As New SqlClient.SqlCommand("Select Count(*) from MyTable")
Dim myConnection As New SqlClient.SqlConnection(ConnectionString)
myCommand.Connection = myConnection
myConnection.Open()
Dim iCount As Integer = CInt(myCommand.ExecuteScalar())
myConnection.Close()
myConnection.Dispose()
myCommand.Dispose()
Do this:
Using myCommand As New SqlClient.SqlCommand("Select Count(*) from MyTable")
Using myConnection As New SqlClient.SqlConnection(ConnectionString)
myCommand.Connection = myConnection
myConnection.Open()
Dim iCount As Integer = CInt(myCommand.ExecuteScalar())
End Using
End Using
Since the IDisposable interface on the SQLConnection object will automatically close open connections, there is no need to close it… However, if you decide to do this:
Using myCommand As New SqlClient.SqlCommand("Select Count(*) from MyTable" _
, New SqlClient.SqlConnection(ConnectionString))
myCommand.Connection.Open()
Dim iCount As Integer = CInt(myCommand.ExecuteScalar())
myCommand.Connection.Close()
End Using
Make sure you close the connection first… Although, I don’t recommend doing it that way, because the IDisposable interface of the SQLCommand object does not call the IDisposable interface of the SqlConnection object that it holds. I’ve read that all the SqlConnection object’s IDisposable interface does is close an open connection, I wouldn’t trust that completely and dispose of it properly.
WPF - More *Cooler* Information
Posted on December 2, 2007
Filed Under WPF, Windows Development, XAML | Leave a Comment
I’m reading a pretty well written book by Adam Nathan called Windows Presentation Foundation Unleashed. I am on the hunt for more in depth knowledge of WPF and how it is going to affect me, if at all.
In my search of an answer of the question ‘Why?’ I already found 2 answers.
1. WPF uses DirectX to render the controls on screen. This pushes most of the UI processing onto the GPU (Video Card) instead of the CPU. This should speed up Windows applications a bit and also allow UI elements to be processing while business logic elements are running (think progress bars).
2. Using a WPF application in Remote Desktop will allow all visual elements to be processed using DirectX on the CLIENT PC. This means that if I connect to my machine at work from home, all WPF applications will be rendered using my video card instead of my work PC’s video card. How cool is that?! That will make using remote desktop faster as well. I have already experienced the Remote Desktop application slowdown because of screen redraws and control hang ups because of nasty UI elements. This would fix those problems.
I will continue to post new things as I find them. Little things like being able to write an XAML document and open it in IE without having to compile is a cool feature, but one I’m not interested in. So plan on only seeing REALLY cool features here.
WPF - First Thought
Posted on November 29, 2007
Filed Under WPF, Windows Development | 1 Comment
Pretty cool… Although my REAL first thought after using it was, “Why?”
The reason I ask why is because as I am looking at the available controls and what it looks like on screen once I run the test application, I am really presented with the same looking form as if I just used a regular Windows Forms control. This doesn’t mean that I think it’s useless already. Heck, I only spent about 20 minutes with it. I haven’t even read up on it as much as I should have before even posting this.
So, let it be known that my research into WPF has started with a resounding, “What is this supposed to accomplish?”