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.

Another thing you should never do in VB.Net

There is plenty of things you should never do but can. Lot’s of people would say to never use VB.Net in the first place, but they are wrong. Declare an event and make all the parameters have the same name for instance. ```vbnet Public Class Class1 Public Event NewEvent(ByVal param1 As String, ByVal param1 As String, ByVal param1 As String) Public Sub Doevent() RaiseEvent NewEvent(“1”, “2”, “3”) End Sub End Class``` The above is completely legal and it makes complete sense in that context too.

Read More...

Converting a .Net Console Project to an Azure Worker Role Project

So lets say you’re building a worker role for Azure, but started it out as a Console app for faster local debugging. It comes time to deploy it to Azure for the first time, but there’s no option to convert a Console application to a Worker Role project. We could copy all the code into a new project, but then we not only lose our faster debugging but also the history of commits we have made against the project.

Read More...

The conditional attribute

The conditional attribute is described as follows by MSDN. The attribute Conditional enables the definition of conditional methods. The Conditional attribute indicates a condition by testing a conditional compilation symbol. Calls to a conditional method are either included or omitted depending on whether this symbol is defined at the point of the call. If the symbol is defined, the call is included; otherwise, the call (including evaluation of the parameters of the call) is omitted.

Read More...

Does Async-Await make the simple things easier?

So yesterday we came to the conclusion that even simple things can be more difficult than we think when threads are involved. In our case we had a class that incremented a value and one instance of that class was being invoked by multiple threads. And we found out that even i+= 1 is not an atomic operation. But what happens when you swap the threads for an Async-Await syntax, Does it become more easy.

Read More...

Threads are always tricky, even for simple things, or you might think they are simple anyway.

I know you all read 8 things you probably didn’t know about C#. But there’s a million things about threads you didn’t know and then some would be a nice title for a blogpost too. It’s this little line that should draw your attention. i = 1 is atomic (thread-safe) for an int but not long And that is good to know (for 32-bit systems anyway). But don’t mistake the above with this line.

Read More...

Learning how to program also means you have to try what you learned.

It is very easy o learn and soak up information iwhen learning how to program. The most important thig however is that you are capable of putting theory in practice and the only way to do that is to try things. I think it was Scott Hanselman who once said that he would look at a candidates computer and see how many ConsoleApplication he had in his Projects folder. Because ConsoleApplications typically mean that you tried something, they have little use other wise ;-).

Read More...

VB.Net default properties or indexers in C#

Introduction This post was inspired by this post by Damian Guard “8 things you probably didn’t know about C#” The first point is that indexers can take params as a parameter so you can then give a list of items to get another list of items using the indexer. Default properties and indexers Lets take this collection as an example of how an indexer works. Dim _list = New List(of String) From {"test1", "test2"}``` An indexer let’s you do this.

Read More...

A Few Notes About Creating Custom SSMS Reports

If you don’t know already, I’m a big fan of SQL Server Reporting Services. It’s an easy-to-use, customizable, scalable, understandable solution for reporting needs in companies of all sizes. I’ve created reports in every version from 2005 to 2012. Recently, I was asked to do something new: create a custom SQL Server Management Studio report. I jumped at the chance. Along the way, I learned a few tips and tricks that I hope will help you!

Read More...

Hex Editoring

It’s time to try something new! I was recently challenged to show something in database page with a hex editor for another blog post. I thought, “Hex what? Are we casting spells?” Let’s start with, “What is a hex editor?” It’s a program that lets you view the binary of a computer file – the 0’s and 1’s that it’s made of. There are many available. I started with my coworker Kendra Little’s (blog | twitter) blog, Corrupting Databases for Dummies- Hex Editor Edition.

Read More...

SELECT 1 – Column Level Security

A few weeks ago I wrote about the comparison of SELECT 1 and SELECT * with use in EXISTS T-SQL statements. The subject has been discussed plenty of times but with any subject, revisiting the topic and reasons we write things the way we do, is still valuable. Something did come up offline regarding the concept of how SELECT * will expand the complete column list metadata and security as it pertains to column level grants.

Read More...