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.

SQL Saturday 28, Baton Rouge

I’m in the air flying back from SQL Saturday 28 and wanted to capture my thoughts while the event was still fresh. Overall I would have to rate it as a resounding success. Last year the event attracted 200 professionals from Baton Rouge and the surrounding area, this year attendance doubled to 400, with additional interest from about 200 more that weren’t able to make it. Patrick LeBlanc (blog|twitter)

Read More...

NSubstituteAutoMocker for StructureMap

Introduction I use the Automocking feature of StructureMap quite a lot. But they only have support for Rhino Mocks and Moq. Now there is a new mocking framework, NSubstitute, and I would like to use that. But for that I needed an AutoMocker to take some of the work out of my hands. The StructureMap AutoMocker makes it easy for you to extend it. There are 2 ways you can extend the framework.

Read More...

Git, TortoiseGit, Github and the rest

Introduction This weekend I felt the need to make myself an NSubstitute Automocker for StructureMap. The first thing to do was to download the sourcecode for StructureMap and NSubstitute. Both are being hosted on GitHub. because I wanted to fork StructureMap and add the Automocker to it I had to create an account on github, which is free. And then I had to install Git and download the code.

Read More...

Working with 32 bit providers and 64 bit SQL Server

UPDATE Turned out I was wrong and it’s easy enough to create SSIS package to run an import of VFP table into SQL Server 64 bit. The complete solution was provided by Jin Chen in this MSDN thread How to run SSIS package – Import VFP table to SQL Server 64 bit and I was able to easily follow it and the package ran OK. I now quote the solution:

Read More...

Don’t test your mocking framework.

Today I was writing some tests (as I do every day), and I wrote this. [Test] public void IfLanguageChangesToNlWhenbtnDutchIsClicked() { var _mocks = new StructureMap.AutoMocking.RhinoAutoMocker<FrmMenu>(); var _menu = _mocks.ClassUnderTest; var language = _mocks.Get<ILanguageSettings>(); language.Expect(x => x.Language) .Return(Enumerations.Languageoptions.nl); _menu.btnDutch.RaiseClick(); Assert.AreEqual(Enumerations.Languageoptions.nl,language.Language); }``` I used [Rhino mocks][1] for this. FrmMenu has these three buttons. ```vbnet ''' <summary> Private Sub btnDutch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDutch.Click Me.Language.Language = Enumerations.Languageoptions.nl End Sub So the test should check if the language changes to dutch when I clikc that button.

Read More...

Creating a Conceptual Data Model

There are three types of data models: Conceptual, Logical, and Physical. The conceptual model provides a high-level view of the data, defining the general entities and entity relationships using the language of the business or organization. The logical model adds attributes to these entities, providing a technology-agnostic foundation for a database design. The physical model assigns table names, column names, and data types to the entities and attributes defined in the prior models.

Read More...

System.IO.Path.GetFileName does not do what it advertises

Introduction System.IO.Path.GetFileName does not really do what the name says in certain circumstances. But we can use that behavior none the less. Prerequisites I have setup a consoleapplication with 2 folders and a file in each folder. Something like this. I set the file properties of Class1.vb and Class2.vb to Build Action -> None and Copy to Output Directory -> Copy Always. Files This is what you would use GetFileName for in most circumstances because that is the logical thing to do.

Read More...

Creating a baseline for SQL Server

In my last post, “Baseline, Performance Reporting and being a proactive DBA”, I touched on baselines and using them to set thresholds for actively monitoring performance problems on SQL Server. I briefly discussed that every database server is unique when the databases we attach to SQL Server are packaged installations from third party applications (like SAP, Dynamics etc…). I received feedback from my good friend Aaron Lowe (Twitter | Blog) on this topic and had a very good conversation on how we create these baselines.

Read More...

Misconceptions about unicode in SQL Server

I was browsing around last night on the internet and a person wanted to know what data type to use to store a course name. Here is an answer he got: I would recommend nvarchar or varchar for the name. Use nvarchar if you anticipate there ever being a point in the future that you will need to support foreign languages that might contain unicode characters that are not supported by varchar.

Read More...

How to return only weekend data for the last 4 weeks in SQL Server

I answered this question today and thought it was interesting enough for a blog post. The easiest way to return all rows that are not older than 4 weeks and fall on a wekeend would be to use that handy calendar table that you have. Of course not everyone has a calendar table so here is a way to do it without. First create this table CREATE TABLE TestData (id INT NOT NULL PRIMARY KEY, SomeData VARCHAR(36) NOT NULL, SomeDate DATETIME NOT NULL) GO Now we have to insert some data, the query below will insert 2048 rows into the table

Read More...