This week I’m trying to find all the new thing in .Net 4.0 and VS2010. One of the more exiting features in .Net 4.0 is the parallel extension. Or how to make multithreading easy. I guess we all know the Fizzbuzz test by now. Describe by [Imram][1] as the following. Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
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.
One of the great new features of 2010 is the improved extensibility. And hence they added the Extension manager to manage extensions. First thing we see if we click on Tools > Extension manager. Is the Installed extensions. First thing I miss on that list is Resharper. Which is weird since Resharper does show up in the online gallery. As you can also see from the image above is the that it is hard to see which extensions are free and which aren’t.
In .Net 4.0 we now have a BigInteger to play with. This is how I used to do it as can be seen [LTD Puzzle 5: Calculating the Fibonacci Sequence][1]. Module Module1 Sub Main() Dim x As Double Console.WriteLine("Give the number to create") Dim input As String input = Console.ReadLine() If Double.TryParse(input, x) AndAlso x > 2 Then Dim y As Double Dim oldz As Double Dim z As Double = 0 Dim newz As Double = 1 Console.WriteLine(z & ",") Console.WriteLine(newz & ",") For y = 1 To x Try oldz = newz newz += z Console.WriteLine(y & ". " & newz & ",") z = oldz Catch ex As Exception Console.WriteLine("end reached") Exit For End Try Next End If Console.ReadLine() End Sub End Module``` Which runs out of bytes at around 1475 when using the double. There is a way to do this with string if you don’t have .Net 4.0. ```vbnet Imports System.Numerics Module Module1 Sub Main() Dim x As Double Console.WriteLine("Give the number to create") Dim input As String input = Console.ReadLine() If Double.TryParse(input, x) AndAlso x > 2 Then Dim y As BigInteger Dim oldz As BigInteger Dim z As BigInteger = 0 Dim newz As BigInteger = 1 Console.WriteLine(z.ToString & ",") Console.WriteLine(newz.ToString & ",") For y = 1 To CType(x, BigInteger) Try oldz = newz newz += z Console.WriteLine(y.ToString & ". " & newz.ToString & ",") z = oldz Catch ex As Exception Console.WriteLine("end reached") Exit For End Try Next End If Console.ReadLine() End Sub End Module To make the above work I had to reference System.Numerics and do an Imports. And I had to add a few ToStrings to.
If you ever try to debug a script task by setting a breakpoint and the package is on a 64 bit machine it will just ignpore the breakpoint. I ran into this problem myself a while ago and this week a co-worker also ran into it and asked me how to resolve it. It is pretty simple, all you have to do is click on Project, then select Debug Properties. Under Configuration Properties, click on Debugging. Make Run64BitRuntime False. See image below.
Yesterday was the first time I attended a SQL Saturday event. The event kicked off with a keynote about SQL Server 2008 R2 by Roger Doherty showing some of the things that are in this new release. The sessions were held in five difference rooms and sometimes it was a tough decision deciding what to attend because there were five concurrent sessions. I attended five sessions, some sessions were slides only, some were code only but the majority of the sessions were slides and code.
Scott Stauffer (blog | twitter) asked a question on #sqlhelp a few days ago and thought I’d go into actually doing an example on the task he was trying to accomplish. Below is a snapshot of the tweet. My first thought was to throw in a script component to transformation. With each row input into the buffer the row could be parsed to validate the header. If the unique pattern in the string was found, then lock a variable and assign the value to it
Today I was doing some LINQ to nHibernate and I came to this statement. Considering that I used a Person class that looks like this. Public Class Person Private _lastName as String Private _id as Integer ... End Class``` And what I wanted was the lowest Id number for all people that were named like me. Because I am sure I will always have the lowest id. In SQL that would look something like this. ```tsql Select min(id) from person where person.Lastname = 'baes'``` The first linq statement I came up with was this. ```vbnet _session.Linq(of Person).Where(Function(x) x.LastName.Equals("baes")).Min(Function(x) x.Id)``` That gave the right result. But it was loading all of the Person objects and then doing the Min function in memory on those Objects. So I changed it to this. ```vbnet (From e in _Session.Linq(Of Person) where e.LastName = "baes" select e.Id).Min``` Which did result in the above mentioned select statement.
There are certain operations where dropping an index, loading data and then again creating the index can speed up data loading. SQL server 2005 introduced a way to disable an index. Let’s take a look, first create this table Create table TestIndex (id int, somecol varchar(20)) Insert a little bit of data insert into TestIndex select number,CONVERT(varchar(20),getdate(),100) from master..spt_values where type = 'p' Create a nonclustered index create index ix_TestIndex on TestIndex(id,somecol) Now let’s disable this index
Our ticket counts are down, the systems are failing less often, and we’re reporting regular corrective actions to the business instead of just patches. Fixing issues as they occur, even root cause correction, is a process of stabilization. I’m not sure about you, but I don’t like aiming for average. This is the third article in a three part series on major gaps that we never seem to have the time to address as well as ideas on how to overcome and initiate processes for closing or reducing those gaps. Each article is based on one high-level subject and provides ideas on how to gain individual and group level traction.
“If I have been of service, if I have glimpsed more of the nature and essence of ultimate good, if I am inspired to reach wider horizons of thought and action, if I am at peace with myself, it has been a successful day.” –Alex Noble The above quote from Alex Noble could not describe how I perceive the success of SQL Saturday in Chicago enough. The day after the event I sat at my desk looking out of the window recapping the day. I could still see Brent’s (blog | twitter) Mac Book unguarded in front of me with evil thoughts going through my mind. Sadly, the bids on Twitter were pretty low, making the deal not worth it. I can see Wendy (blog | twitter) smiling as we passed in the halls and, even knowing we both wanted to stop to see how things were going, we knew if we did something would be delayed. I can still see the look on Aaron’s (blog | twitter) face when he realized a 30 foot VGA cord was needed to truly get Woodfield A setup as we needed it. Yes, that cord was never found. I recall the panic as I walked passed registration at 8:00 AM and the only thing missing were “people”. That quickly turned to a new type of panic when, 10 minutes later, there were 100 people standing in line. I chuckled then when I realized just how difficult it is to walk in on a speaker that I call a friend and have great respect for to give him the, “You need to stop!” look. Thankfully, I’m still friends with them, even after that. Last I recall walking through the halls from room to room making sure things were moving along while receiving great feedback from the attendees. They were smiling and letting me know things were going really well. Those appearing happy in passing kept me pushing on.