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.

Using Byref

Still working on the legacy application and seeing this ```vbnet Module Module1 Public x as long Sub mymethod1(Byref x as long) x = x + 1 End Sub Sub mymethod2() mymethod1(x) end sub End Module``` Way cool.

Read More...

A great use of Goto

I’m in the process of upgrading a legacy VB program and I found this vbnet 10: For x as integer = 1 to whatever if x = 1 then goto 20 dosomethingelse 20: Next I’m gonna use this more often, it’s cool.

Read More...

Some VMware weirdness

Today I had a major computer crash, or something that looked like it. The computer had a bad spell and I was the victim. Don’t ask what went wrong because I have no idea. After rebooting a couple of times it came back as if nothing ever happened. But something did happen. I have VMware workstation 6.5.1 on my machine with 4 open VM’s on it, 3 of them XP and one server 2003.

Read More...

Adding time offsets passed in to a datetime to generate localized datetime

I answered this question today and thought it would be useful to create a little post If you have a varchar value like this ‘2009-06-26 14:30:00.000Z+4:30’ you want to take 4 hours and 30 minutes and then subtract that from the date itself so in this case you will get 2009-06-26 11:00:00.000. The reason you subtract is because the +4:30 means that this was generated in a zone that is 4:30 ahead of utc

Read More...

Can't depend on sp_depends? Try using sp_refreshsqlmodule

This will not work on SQL Server 2000 since the sp_refreshsqlmodule does not exists on that version! A while back in the What is deferred name resolution and why do you need to care? blogpost I showed you that sp_depens is not reliable because you can create procedures that reference objects that have not been created yet. You can use sp_refreshsqlmodule to help ‘fix’ that let’s take a look at how that works

Read More...

DBA SQLCLR Procedures

SQLCLR adds a great deal to the SQL Developer list of methods to get the job done. That is pretty much a given. Hardware, resource usage and all that endless discussion aside, SQLCLR given handled correctly and given the hardware to utilize its abilities without putting memory and other pressure on your instances can be truly a beneficial aspect to your bag of tricks. As a DBA I have dozens of SQLCLR procedures that make my life unbelievably easier than in prior years.

Read More...

Export HTML table to Excel with grid lines

For a long time I have had to make web reports for our company that could be exported to excel. This is a fairly easy process. All you have to do is put your report in an HTML table and add the following 2 lines of code: Response.ContentType = "application/ms-excel"; Response.AddHeader("content-disposition", "attachment; filename=test.xls"); However, when the excel file is generated it has a nasty side effect of having all the gridlines hidden.

Read More...

Not a fan of the Report Manager in SSRS? Using SSRS procedures to get the job done

I took some time off so apologize to readers for my lack of writing lately. Today I thought I’d talk about the report manager and SSRS. Personally I’m not a big fan of it. It lands in there with SSMS and tasks like creating or modifying indexes. I use it when I need it really quick and it’s the only thing I need to touch. If you have to modify or create a bunch of things it becomes very cumbersome and pretty much an annoyance.

Read More...

Installing windows 7 on an Acer aspire One 751h

This week I bought a new netbook. The Acer Aspire One 751h (what’s in a name). It’s an amazing little machine, but I guess everything is amazing at my age I can still remember things like the Commodore 64 and the first x86. Standard, it only comes with 1Gb of RAM but it supports a maximum of 2GB so I ordered that with it and installed it myself which is pretty simple no need to spend 20€ on a tech to do it for you.

Read More...

Using PostSharp and log4net to Set Up Controller Logging in ASP.net MVC

A friend of mine pointed me in the direction of a cool library for Aspect Oriented Programming called PostSharp the other day. I’d read about AOP in the past, but always had so much going on that it slipped my mind to look further into it. But, his excitement rubbed off on me and it wasn’t long before I thought of a way I could use it. I’d been wanting to set up logging on a site I’ve been working on so that I could collect data for a while and report on it to see which controller methods are running the slowest.

Read More...