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.

How to flash your bios with an Asus P5E MB and NO floppy disk

Today I bought a brand new Intel Q9550 processor. My P5E Motherboard had a Bios version of 0203, and it told me ever so kindly that it didn’t recognize the new proc and the Bios needed a little flash. So I ignored that 😉 and continued on my way and booted in to Vista. And to be honest, it did boot into Vista, it even let me do some work for a while.

Read More...

VB.Net: Some fun with enums

Enums can be used in some very interesting ways. Just look at the anchor property on your windowsform that uses enums and you can combine them. But can you also combine different enums? Yes, you can, as long as you set the value to an integer. Look at this example: Module Module1 Sub Main() CheckColor(Redcolors.Pink) CheckColor(Redcolors.Red) CheckColor(Bluecolors.Blue) CheckColor(Bluecolors.DarkBlue) CheckColor(Bluecolors.Blue Or Redcolors.Red) CheckColor(Purplecolors.Purple) Console.ReadLine() End Sub Private Sub CheckColor(ByVal color As Integer) If Not color = Purplecolors.

Read More...

Nunit: StatThread and WindowsForms Controls

When you try to instantiate a windowsforms control in your NUnit test, you could get the following error: System.Threading.ThreadStateException: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This has something to do with the fact that windows forms controls like to run in STA (Single threaded apartment) and the latests version of Nunit run as MTA (Multi Threaded apartment).

Read More...

VB.Net: Adding ContainsAny and ContainsAll to ICollection(of T) part 2

Since writing the last post on this, I refined these methods a bit. ```vbnet Imports System.Runtime.CompilerServices Namespace Extensions “’ <summary> “’ “’ </summary> “’ <remarks></remarks> Public Module IEnumerableExtensions ''' &lt;summary&gt; ''' Sees if the collection contains any of the parameters. If it finds one then it will return true else it will return false. ''' &lt;/summary&gt; ''' &lt;typeparam name="T"&gt;any object&lt;/typeparam&gt; ''' &lt;param name="Collection"&gt;an IEnumerable of T&lt;/param&gt; ''' &lt;param name="Parameters"&gt;an IEnumerable of T&lt;/param&gt; ''' &lt;returns&gt;True if at least one found, false if not found&lt;/returns&gt; ''' &lt;remarks&gt;This method equals the OR operator for all elements in Parameter collection.

Read More...

VB.Net: Adding ContainsAny and ContainsAll to ICollection(of T)

In an ICollection(of T) you have a contains method to see if your collection has the requested element in it. But if you want to look for Multiple elements, you have to resort to making predicates (and we all know how ugly those get). So why didn’t MS implement ContainsAny (OR) and/or ContainsAll (AND). I couldn’t think of a good reason, so I made them myself. They are perhaps a bit over easy and not very performance friendly but they work.

Read More...

VB.Net: Linq and I keep forgetting

Problem I keep forgetting that it needs the System.linq namespace to work. And I keep forgetting that it is not set by default on my projects. I try not to overuse linq but sometimes it is easy. So what happened? I was trying this: vbnet Dim nics As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces() Dim result = From e In nics The solution And it came up with this error and a squiggly line under nics.

Read More...

What is deferred name resolution and why do you need to care?

So I posted a teaser in the puzzles forum. Without running this, try to guess what will happen? DECLARE @x INT SET @x = 1 IF (@x = 0) BEGIN SELECT 1 AS VALUE INTO #temptable END ELSE BEGIN SELECT 2 AS VALUE INTO #temptable END SELECT * FROM #temptable --what does this return This is the error you get Server: Msg 2714, Level 16, State 1, Line 12

Read More...

CentOS, Postfix, MySQL and a Typo

A little lesson in typo-trauma Today I finally got round to doing some admin on my primary home server, which (amongst many things) is my main mail server. After dusting a few cobwebs away, checking nobody had broken any of the furniture and such, I decided to run yum to get the latest updates (it had been almost a month since the last time I checked 88| but still, at least now it was about to be updated to all the shiny sparkly new things that CentOS had released for me…

Read More...

F# Developer Center

Microsoft has launched the F# Developer Center Here you can learn everything about Microsoft’s functional programming language F# (pronounced F sharp). There are links to forums, blogs, projects on codeplex, code gallery samples, videos and much more. Also check out the Getting Started with F# section, here you can download the latest F# CTP and three sample chapters of the Expert F# book are also available for preview

Read More...

Get A Free SQL Server 2008 Ebook

Download a trial version of Red Gate’s SQL Toolbelt 2008 and get Brad’s Sure Guide to SQL Server 2008 for free Products included in the SQL Toolbelt 2008: SQL Compare Pro SQL Data Compare Pro SQL Packager Pro SQL Prompt Pro SQL Doc Pro SQL Backup Pro SQL Data Generator SQL Dependency Tracker SQL Refactor SQL Multi Script SQL Comparison SDK I have been using Red Gate’s products since 2002 and must say that they have saved me tons of work/time many times.

Read More...