Mladen Prajdić has updated his SSMS Tools PACK to work with SQL Server 2008. Here are some of the cool new things – Query Execution History (Soft Source Control) and Current Window History: Save all executed queries to file or database and easily find them. Current window history is a dockable window that show queries executed in a currently active window. There is also a search box at the top that filters results as you type
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.
There is no bug in Rhino mocks if that’s what you’re thinking. Rhino mocks 3.5 just uses things that VB.Net 9.0 can’t use and that can be frustrating. I wonder what possessed them to do it like that? So let me tell the story. I got a service and a repository, the service calls the repo. Repo interface: Namespace Repository Public Interface IRepository(Of T) Function FindAll() As IList(Of T) Sub Update(ByVal ObjectToUpdate As T) End Interface End Namespace``` The repo implementation: ```vbnet Imports System.Data.SqlClient Namespace Repository Public Class ProductRepository Implements IRepository(Of Model.Product) ''' <summary> ''' Here is where you would go to the database ''' </summary> ''' <returns>A list of Products</returns> ''' <remarks></remarks> Public Function FindAll() As System.Collections.Generic.IList(Of Model.Product) Implements IRepository(Of Model.Product).FindAll 'Do something Return Nothing End Function Public Sub Update(ByVal ObjectToUpdate As Model.Product) Implements IRepository(Of Model.Product).Update 'Do something End Sub End Class End Namespace``` The service interface: ```vbnet Namespace Service Public Interface IService Function FindAllProducts() As IList(Of Model.Product) Sub Update(ByVal Product As Model.Product) End Interface End Namespace``` The service implementation: ```vbnet Namespace Service Public Class Service Implements IService Private _Repository As Repository.IRepository(Of Model.Product) Public Sub New(ByVal Repository As Repository.IRepository(Of Model.Product)) _Repository = Repository End Sub Public Function FindAllProducts() As IList(Of Model.Product) Implements IService.FindAllProducts Return _Repository.FindAll End Function Public Sub Update(ByVal Product As Model.Product) Implements IService.Update _Repository.Update(Product) End Sub End Class End Namespace``` And now we want to test it. First, we test the service’s findall method. We mock out the repo and see if the repo was called. ```vbnet <Test()> _ Public Sub Test_If_Service_Returns_A_List_Of_Products() Dim _Repository As Repository.IRepository(Of Model.Product) = MockRepository.GenerateMock(Of Repository.IRepository(Of Model.Product))() Dim _Service As Service.IService = New Service.Service(_Repository) _Repository.Stub(Function(e) e.FindAll).IgnoreArguments.Return(New List(Of Model.Product)) Assert.IsNotNull(_Service.FindAllProducts) _Repository.AssertWasCalled(Function(e) e.FindAll) End Sub``` This works just fine. Now I want to see if the update method is also used as it should be, so I write this: ```vbnet <Test()> _ Public Sub Test_If_Service_Updates_A_Product() Dim _Repository As Repository.IRepository(Of Model.Product) = MockRepository.GenerateMock(Of Repository.IRepository(Of Model.Product))() Dim _Service As Service.IService = New Service.Service(_Repository) _Service.Update(Nothing) _Repository.AssertWasCalled(Function(e) e.Update(Nothing)) End Sub``` But that gives me an error “Expression does not produce a value.”. Mmmm, you can find an explanation for that [here][1]. And the solutions is there as well. The solution is, however, a bit clunky, as he says. So in the end you could do this: ```vbnet <Test()> _ Public Sub Test_If_Service_Updates_A_Product() Dim _Repository As Repository.IRepository(Of Model.Product) = MockRepository.GenerateMock(Of Repository.IRepository(Of Model.Product))() Dim _Service As Service.IService = New Service.Service(_Repository) _Service.Update(Nothing) _Repository.AssertWasCalled(Function(e) wrap(e)) End Sub Function wrap(ByRef repo As Repository.IRepository(Of Model.Product)) As Object repo.Update(Nothing) Return Nothing End Function Which solve the problem, more or less.
Mono 2.0 Has Been Released Mono 2.0 is a portable and open source implementation of the .NET framework for Unix, Windows, MacOS and other operating systems. Some Details: Microsoft Compatible APIs ADO.NET 2.0 API for accessing databases. ASP.NET 2.0 API for developing Web-based applications. Windows.Forms 2.0 API to create desktop applications. System.XML 2.0: An API to manipulate XML documents. System.Core: Provides support for the Language Integrated Query (LINQ). System.Xml.Linq: Provides a LINQ provider for XML.
So after Shiloh, Sphinx, Yukon and Katmai now we have Kilimanjaro. Kilimanjaro is a mountain in Tanzania and the new codename for SQL Server 11 🙂 [Edit]Apparently Kilimanjaro is the code name for the next version of SQL Server but this is not SQL 11 🙁 Here is what it says in the press release Ted Kummert, corporate vice president of Microsoft’s Data and Platform Storage Division, showcased “Kilimanjaro,” which will further enrich SQL Server’s BI capabilities while providing a robust and scalable data platform capable of supporting the largest BI deployments. “Kilimanjaro” will include a set of new, easy-to-use analysis tools for managed self-service, project-code-named “Gemini,” that will enable information workers to slice and dice data and create their own BI applications and assets to share and collaborate on from within the familiar, everyday Microsoft Office productivity tools they already use. Customers and partners will be able to gain early access to “Kilimanjaro” within the next 12 months via a community technology preview (CTP) with full product availability slated for the first half of calendar year 2010. [/Edit]
Well, not in this case anyway. I have this Rhino mocks method that uses a lambda expression. Like this: _MspFactory.Stub(Function(e) e.CrudLocus).Return(_CrudILocus)``` And that happens to work and compile. However, intellisense doesn’t seem to be able to infer the type of e like the compiler seems to be able to do. Just look at picture 1. <div class="image_block"> <img src="https://lessthandot.z19.web.core.windows.net/wp-content/uploads/blogs/DesktopDev/lambdanotinfer1.jpg" alt="" title="" width="434" height="116" /> </div> But when I specify the type, it is happy to add the intellisense. <div class="image_block"> <img src="https://lessthandot.z19.web.core.windows.net/wp-content/uploads/blogs/DesktopDev/lambdanotinfer2.jpg" alt="" title="" width="747" height="152" /> </div> Something to work on for version 2010 boys and girls. Let the inferring begin ;D.
Npgsql2 has been RTM 🙂 Npgsql is a .Net Data Provider for Postgresql. It allows any program developed for .Net framework to access the PostgreSQL database server. It is implemented in 100% C# code. Works with Postgresql 7.x and above. Npgsql2 Supports .Net 2.0 and 3.5 and there is even added support for the EntityFramework You can download all the goodies here: http://pgfoundry.org/frs/?group_id=1000140
So, last week Ayende made a new version of Rhino Mocks available, namely version 3.5. He made a post on what is new and shiny, but I would like to look at what the new AAA syntax has in store for us VB.Net users. And I want to tell you how it used to look and how it looks now. This is the old version, works with Rhino mocks 3.4. Imports NUnit.Framework Imports Rhino.Mocks Namespace AnalysisManagement <TestFixture()> _ <Category("ModelServices")> _ <Category("ModelServices.AnalysisManagement")> _ Public Class TestDAOFill #Region " Private members " Private _Mocker As MockRepository Private _Factory As DataAccessLayer.AnalysisManagement.Crud.Factory.IDAOFactory Private _Fill As ModelServices.AnalysisManagement.Interfaces.IFill #End Region #Region " Setup " <SetUp()> _ Public Sub Setup() _Mocker = New MockRepository() _Factory = _Mocker.DynamicMock(Of DataAccessLayer.AnalysisManagement.Crud.Factory.IDAOFactory)() _MspFactory = _Mocker.DynamicMock(Of DataAccessLayer.MSP.Crud.Factory.IDAOFactory)() _Fill = New ModelServices.AnalysisManagement.DAOFill(_Factory, _MspFactory) End Sub <TearDown()> _ Public Sub TearDown() _Mocker.ReplayAll() <em>_Mocker.VerifyAll()</em> End Sub #End Region #Region " Tests " <Test()> _ Public Sub FindAllFiberFluorescenceColorN21s() Dim _CrudIFiberFluorescenceColorN21 As DataAccessLayer.AnalysisManagement.Crud.Interfaces.IFiberFluorescenceColorN21 = _Mocker.DynamicMock(Of DataAccessLayer.AnalysisManagement.Crud.Interfaces.IFiberFluorescenceColorN21)() <em>Expect.Call</em>(_Factory.CrudFiberFluorescenceColorN21).IgnoreArguments.Return(_CrudIFiberFluorescenceColorN21) <em>Expect.Call</em>(_CrudIFiberFluorescenceColorN21.FindAll).IgnoreArguments.Return(New List(Of Model.AnalysisManagement.Interfaces.IFiberFluorescenceColorN21)) <em>_Mocker.ReplayAll()</em> Dim _templist As IList(Of Model.AnalysisManagement.Interfaces.IFiberFluorescenceColorN21) = _Fill.FindAllFiberFluorescenceColorN21s Assert.IsNotNull(_templist) Assert.IsInstanceOfType(GetType(IList(Of Model.AnalysisManagement.Interfaces.IFiberFluorescenceColorN21)), _templist) End Sub #End Region End Class End Namespace Ok, so we notice the use of _mocker and DynamicMock to create our Mock objects and then we set our expectations, then we do a replayall and execute the methods under test. When the test is done the verifyall is executed which looks if our expectations are met.
Before we start with code let us take a sample IP address, does 127.0.0.1 look familiar? Yes that is your local IP address. Here it is in decimal and binary 127 0 0 1 01111111 00000000 00000000 00000001 Now to convert, you would take the first value, add the second value + 256 add the third value + (256 * 256) = 65536 add the fourth value + (256 * 256 * 256) =16777216
Belle's sql musings blog has a list of 7 free SQL Server books. The books are the following ones SQL Server 2008 MS Press Free Ebook How to Become an Exceptional DBA Best of SQL Server Central Brad’s Sure Guide to SQL Server 2008 Brad’s Sure DBA Checklist RedGate’s SQL Server DBA Best Practices Dissecting SQL Server Execution Plans These books are offered by Microsoft Press, RedGate and SimpleTalk Get the links to all these books here: http://sqlmusings.wordpress.com/2008/10/04/free-sql-server-ebooksresources/
A few tag lines for your motivational posters at work… Rome did not create a great empire by having meetings, they did it by killing all those who opposed them. If you can stay calm, while all around you is chaos… then you probably haven’t completely understood the seriousness of the situation. Doing a job RIGHT the first time gets the job done. Doing the job WRONG fourteen times gives you job security. Eagles may soar, but weasels don’t get sucked into jet engines. Artificial Intelligence is no match for Natural Stupidity A person who smiles in the face of adversity… probably has a scapegoat. Plagiarism saves time. If at first you don’t succeed, try management. Never put off until tomorrow what you can avoid altogether. TEAMWORK… means never having to take all the blame yourself. The beatings will continue until morale improves. Never underestimate the power of very stupid people in large groups. We waste time, so you don’t have to. Hang in there, retirement is only thirty years away! Go the extra mile. It makes your boss look like an incompetent slacker. A snooze button is a poor substitute for no alarm clock at all. When the going gets tough, the tough take a coffee break. INDECISION is the key to FLEXIBILITY. Succeed in spite of management. Aim Low, Reach Your Goals, Avoid Disappointment.