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.

Occupy VB

Yes, it is time to stop the madness called VB. In all shapes and sizes. In all versions and subversions. VB 1.0 VB 2.0 VB 3.0 VB 4.0 VB 5.0 VB 6.0 VB.Net 1.0 or VB7 VB.Net 2.0 or VB8 VB.Net 3.0 or VB9 VB.Net 4.0 or VB10 Lets also get rid of all other forms of Basic that annoy any serious developer out there. They ruin our nights, they ruin our day.

Read More...

Vb.Net: Addhandler and lambdas, watch out.

The problem Just look at this code. And try to figure out what’s wrong with it. Without watching the solution. You can even compile and run it without a problem. ```vbnet Module Module1 Sub Main() Dim testClass = New Class1 Dim returnString = "" AddHandler testClass.OnSomething, Function(result) returnString = result testClass.Dosomething() Console.WriteLine(returnString) Console.ReadLine() End Sub Public Class Class1 Public Event OnSomething(result As String) Public Sub Dosomething() RaiseEvent OnSomething("test") End Sub End Class End Module``` The problem is that Console.

Read More...

Showing sysjobhistory run_duration in HHMMSS format

Someone asked the following question on our forum: HHMMSS format in sysjobhistory. The sysjobhistory table in MSDB stores the run time of jobs in the format HHMMSS as an integer. Thus, a job that finishes in 18 minutes and 9 seconds is stored as 1809. If a job finishes in 4 seconds it’s stored as 4, and another that finishes in 7 hours, 21 minutes, 33 seconds as 72133. I’m trying to get to this data and need it formated in the time data type.

Read More...

Location of files for new database in SQL Server

The following question was asked I’ve got a sql server that’s set up to have database files to default to e drive, but the model’s files are on c. will new database pick up the setting from the server and put them on e, or will they pick it up from the model and put them on c? What SQL Server does is that it will pick up the settings from the server settings.

Read More...

SQL Server 2012 RC0 is here!

The SQL Server 2012 RC0 is finally here! The news of this today is bringing many hopes that SQL Server 2012 release in RTM form will be on time so we as SQL Server Professionals can take ahold of this major new version in the life of SQL Server. Key parts of this impressive version of SQL Server include Deliver required uptime and data protection with AlwaysOn Gain breakthrough & predictable performance with ColumnStore Index Help enable security and compliance with new User-defined Roles and Default Schema for Groups Enable rapid data discovery for deeper insights across the organization with ColumnStore Index Ensure more credible, consistent data with SSIS improvements, a Master Data Services add-in for Excel, and new Data Quality Services Optimize IT and developer productivity across server and cloud with Data-tier Application Component (DAC) parity with SQL Azure and SQL Server Data Tools for a unified dev experience across database, BI, and cloud functions

Read More...

SQL Server 2012 RC0 available for download

![][1] SQL Server 2012 RC0 is available for download, you can download the bits here: http://www.microsoft.com/download/en/details.aspx?id=28145 To read all my SQL Server 2012/Denali posts go here: /index.php/All/denali: [1]: /wp-content/uploads/blogs/DataMgmt/Denis/.evocache/sql2012.PNG/fit-400x320.PNG?mtime=1318434386 “”

Read More...

SQLCop is now available via chocolatey

Here is the definition of chocolatey as stated on the chocolatey.org website. Chocolatey NuGet is a Machine Package Manager, somewhat like apt-get, but built with windows in mind. Chocolatey can be easily installed. To install chocolatey now, open a powershell prompt (execution policy needs to be unrestricted – Set-ExecutionPolicy Unrestricted), paste the following and type Enter: PS:> iex ((new-object net.webclient).DownloadString(“http://bit.ly/psChocInstall”)) And Chocolatey also has a GUI if you like those kinds of things.

Read More...

List all stored procedures that run at startup in SQL Server

You know that you can mark a proc to run at startup in SQL Server. What you have to do is create the stored procedure in the master database and after that you have to set the startup flag to true. If your stored procedure name is spMyProc, the code would look like this. exec sp_procoption N'spMyProc', 'startup', 'on' What if you want to list all the stored procedures on your server which are set to run on startup?

Read More...

No need for a "for loop" when you have linq

Introduction Like I said in a previous post of mine. From time to time I answer a few questions on Stackoverflow, mostly because you can learn a lot from someone else’s problems and it makes you think. [ ]2 Thinking is something you need to practice every day. This time the problem was simple and it seems like most people revert to a for loop loop to solve it. While using linq is so much shorter easier to read.

Read More...

use pdfviewernet in a project for .net framework 4.0

So I downloaded the source for pdfviewernet and just ran it out of the box. And it worked. If you go look in the properties of the Samplepdfviewer you will notice that it is set to run for a .net 2.0 framework. You might want to change that to .net 4. If you try to run this now you will get this error. An error occurred creating the form.

Read More...