I have the FS T1010 for 3 weeks now so this is just a first impression. First a little about the configuration, which I think is quite impressive considering its size. It has an Intel P8400 processor on board with 3 GB of Ram and a 300GB HD It gets a pretty good score from the windows experience index, namely 3.8. And this is due to the gaming graphics score. Since this is not a machine you will buy for gaming, it is a non-issue.
This is an archive of the posts published to LessThanDot from 2008 to 2018, over a decade of useful content. While we're no longer adding new content, we still receive a lot of visitors and wanted to make sure the content didn't disappear forever.
I got a new tablet PC and I like it, a lot. It takes a little time to get used to. But now I’m so used to it I can’t live without it any more. Of course it is also very cool. I got the Fujitsu Siemens T1010 with Windows Vista Ultimate on it. I will write about it later. But first I had to solve a little annoyance. Vista likes to add an extra mouse pointer when using the pen/touch screen.
I was thinking about writing a post about how C# is morphing into SQL because I noticed that C# has added named and optional arguments. Remember the Compound Operators Or How T-SQL Is Morphing Into VB Or C#? This is basically the same kind of thing only it goes into the other direction. For some bizarre reason Chrissie had the same idea yesterday and posted the following post: What so special about Optional/named parameters. From that article you will learn that VB already had this back in the vb4 days.
We VB.netters have been having them for years, kinda boring actualy. But I guess you C# guys find them all new and exiting. Here a small number of the blogs in the blogsphere about them. [C# 4.0 Optional Parameters and C# 4.0 Named Parameters][1] [Named and optional parameters in C# 4.0][2] [C# 4.0 Optional Parameters][3] This works in VB.Net 2008 (VB9) and VB.Net 2010 (VB10). Optional parameters have been in VB for a long time not sure when named parameters came in.
Yesterday in the Changing exec to sp_executesql doesn’t provide any benefit if you are not using parameters correctly post I showed you that sp_executesql is better than exec because you get plan reuse and the procedure cache doesn’t get bloated. Today I will show you that sp_executesql is better than exec or ad hoc queries when you deal with conversions in execution plans First create this table and populate it with some data
Today I needed to create a sequential GUid in .Net to test if my Compareto function worked as expected. The problem is that Guid.NewGuid produces a random Guid duh. which isn’t sequential. Of course in my unittests I want to know what value I’m giving to the guid. .Net doesn’t have a SequentialGuid function as far as I know So went for a little Google. And I found this site. [Generate Sequential GUIDs for SQL Server 2005 in C#][1]
This is an anti-pattern. Public Overrides Function Equals(ByVal obj As Object) As Boolean If obj IsNot Nothing Then If obj.GetType Is Me.GetType Then Return Me._description.Equals(CType(obj, EventItem)._description) Else Return False End If Else Return False End If End Function``` this is better and gives the same result same ```vbnet Public Overrides Function Equals(ByVal obj As Object) As Boolean Dim ReturnValue As Boolean = False If obj IsNot Nothing AndAlso obj.GetType Is Me.GetType Then Return Me._description.Equals(CType(obj, EventItem)._description) End If Return returnValue End Function``` The anti-pattern is called the arrow anti-pattern and you can find plenty of things about it on the net and how to avoid it. Here are some good ones. [ Flattening Arrow Code][1] by Jeff Atwood [Anti-Patterns and Worst Practices – The Arrowhead Anti-Pattern][2] by Chris Missal Of course the design anti-pattern in the above code doesn’t only have that as a disadvantage. The biggest disadvantage is that ncover will never give you 100% code coverage 😉 because the end-ifs will never be reached. <div class="image_block"> <img src="https://lessthandot.z19.web.core.windows.net/wp-content/uploads/blogs/DesktopDev/ncover/ncover3.png" alt="" title="" width="479" height="156" /> </div> That in itself is a good reason not to write it. Because you are writting code that will never be used 😉 Disclaimer: Of course it will never compile if you leave out the end if. [1]: http://www.codinghorror.com/blog/archives/000486.html [2]: http://www.lostechies.com/blogs/chrismissal/archive/2009/05/27/anti-patterns-and-worst-practices-the-arrowhead-anti-pattern.aspx#
Changing exec to sp_executesql doesn't provide any benefit if you are not using parameters correctly
Changing exec to sp_executesql doesn’t provide any benefit if you are not using parameters correctly I was looking through some code recently and noticed all these sp_executesql calls which did not use parameters correctly. A typical SQL statement would look like this declare @Col2 smallint declare @Col1 int select @Col2 = 4,@Col1 = 5 declare @SQL nvarchar(1000) select @SQL = 'select * from test where Col2 = ' + convert(varchar(10),@Col2)+ ' and Col1 = ' + convert(varchar(10),@Col1) exec sp_executesql @SQL What that code does is it builds a SQL statement and executes it. The problem is that when you do something like that the query plan will not be reused when you change the values of @Col2 and @Col1. When a new plan is generated everytime your values change you will bloat SQL Server’s procedure cache and less memory will be available for data.
Today is going to be a hard day as far as motivation goes. I won’t go into details of why that is but I want to write about nonetheless. I’m going to turn the issues around and say how I find motivation in the daily stress of being in a DBA position with great pressure from all around you. First, no matter what you have to feel good about your accomplishments in life. That includes day by day activities. If you don’t then I wouldn’t bother reading on. You’re already lost and should change careers.
So Close… And yet so far. I’ll guess I’ll just have to implement it so that I can get to the End sub ;-). And yes even with VB.Net you can get close to 100% coverage.