LessThanDot Site Logo

LessThanDot

A decade of helpful technical content

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.

Resharper File template for Nunit testing with Structuremap support for VB.Net

So I also made the a similar template with structuremap support included. Which looks something like this ``` Imports Nunit.FrameWork Imports StructureMap Namespace $NAMESPACE$ “’ <summary> “’ A TestClass “’ </summary> “’ <remarks></remarks> <TestFixture()> _ Public Class $CLASSNAME$ #Region “ Setup and TearDown “ “’ <summary> “’ Sets up the Tests “’ </summary> “’ <remarks></remarks> <Setup()> _ Public Sub Setup() StructureMapConfiguration.UseDefaultStructureMapConfigFile = False StructureMapConfiguration.ScanAssemblies.IncludeTheCallingAssembly() End Sub ''' &lt;summary&gt; ''' Tears down the test.

Read More...

Find the last Backup taken in SQL Server

SELECT * FROM msdb.dbo.backupmediafamily backupmediafamily JOIN msdb.dbo.backupset backupset ON backupmediafamily.media_set_id = backupset.media_set_id and backupset.backup_start_date = (SELECT max(backup_start_date) FROM msdb.dbo.backupset child WHERE child.database_name = backupset.database_name and child.type = 'D') and database_name = 'ReplaceWithDatabaseNameHere' and backupset.type = 'D' This is based on something I found here. Thank you mrdenny. And this works in SQL Server 2000.

Read More...

Do automated restore tests on your SQL-Backups.

I found out yesterday that my SQL server backups were corrupt and so I couldn’t restore them (happy me). So I went out on Google and combined a few things to make this declare @verifystatement nvarchar(250) declare @backupdevice nvarchar(250) declare @err int set @backupdevice = (SELECT TOP 1 [physical_device_name] FROM msdb.dbo.backupmediafamily backupmediafamily JOIN msdb.dbo.backupset backupset ON backupmediafamily.media_set_id = backupset.media_set_id and backupset.backup_start_date = ( SELECT max(backup_start_date) FROM msdb.dbo.backupset child WHERE child.database_name = backupset.

Read More...

File unlocker for windows

On windows files can be locked by different programs. This little gem unlocks your file so that you can delete it.

Read More...

Simple addition of a range

Adding a range of numbers Adding numbers is easy. Very easy for programs, right? How about adding up a range of numbers? 1 to 5 maybe ? 1+2+3+4+5 = 15 … easy ! What about adding up 1 to 100 ? not so easy in your head, but with a little code this shouldn’t be a problem. In fact a lot of programmers would approach it like the following:

Read More...

Listen to yourself

Well :oops:, I can still hear myself say to everybody who wanted to hear it “Keep the objects that you are returning in your webservices simple”. So this means, don’t return complex objects like a dataset, datatable, arraylist or all other kinds of collections. Make a POCO (Plain old C# object) and pass that to the client. So yesterday I switched to VS 2008 and the first thing I do is compile the thing and get the application out there.

Read More...

VS 2008 ErrorMessage

Yesterday I finally installed VS2008 at work. And it was apart from the time spent pretty painless. Adapting finalbuilder turned out to be a little less painless but that is another story. So I was surprised today that the some of the bugs are still there bu that the errorscreen has gotten an upgrade. So if you can’t make it better then make the errors nicer to look at.

Read More...

Review of Inside Microsoft SQL Server 2005 Query Tuning and Optimization

SQL performance tuning is probably one of those things you can do to really make a HUGE difference in performance. Let’s put this in perspective: take a typical application, if you can improve the performance by 100% then you really made a huge improvement. You can improve a SQL query by 1000% with 2 lines of code (sometimes all you have to do is take away a % sign). If you can make a query sargable so that the optimizer can do an index seek instead of an index scan your query might go from 12 seconds to 200 milliseconds.

Read More...

The concepts of OOP

My explanation Well there seems to be some confusing opinions on the net over what OOP seems to be. I’ve been reading up on the concepts of OOP after a little discussion with our teacher yesterday where he did most of the talking. He followed the APIE principal A = Abstraction P = Polymorphism I = Inheritance E = Encapsulation 1. Abstraction Not many sites talk about this concept as part of OOP but apparantly this means that abstract real world things to your code, for example Car, Vehicule, Sportscar, … become objects.

Read More...