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.

C# Sorting winforms controls using linq

Use the power of linq Create a form with some controls on it and a textbox called textbox1. then but this in the load event of the form csharp textBox1.Clear(); IEnumerable<Control> query = from p in this.Controls.OfType<Control>() orderby p.TabIndex select p; foreach (Control c in query) { textBox1.AppendText(c.TabIndex + " " + c.Name + Environment.NewLine); } and you probably need these usings. csharp using System; using System.Collections.Generic; using System.Linq; using System.

Read More...

How to rename a column in a SQL Server table without using the designer

If you have a table and you want to rename a column without using the designer, how can you do that? First create this table CREATE TABLE TestColumnChange(id int) INSERT TestColumnChange VALUES(1) SELECT * FROM TestColumnChange As you can see the select statement returns id as the column name. you can use ALTER table ALTER Column to change the dataype of a column but not the name. Here is what we will do, execute the statement below

Read More...

Bazaar Version Control System – better than Subversion ?

Version Control? A Version Control System (VCS) is an essential tool for a development team (or even individual developer) to manage their code. The more it can allow multiple developers to work together easily on the same code and manage the various states of that code, the better. One of the most popular Version Control systems in the past was CVS, however in recent times this has been superseded by Subversion (SVN), which is a highly popular VCS that is well supported by a variety of client tools and is often embedded within software configuration management applications to manage file versioning (e.

Read More...

PHP: Writing a DAL the DAO way part 2

Part one of this series. I’m fairly new to the php development thing. But I’m learning fast. Of course I’m having to deal with newbie problems along the way. Today I was adding a class to my DAL. Nothing special, mainly copy paste stuff. But php wasn’t being very cooperative, it kept showing me an empty page whenever I added (require_once(“filepath”)) that file to my factory. Not very amusing. So after a little searching I found out that php doesn’t support classes with the same name.

Read More...

Solution folders are not being sorted alphabeticaly in Visual studio 2008

The Solution folders an apparently also the projects are not always sorted alphabetically. This is very annoying since my brain took years to get to this stage and it will take years to get used to them not being that way. And guess what I’m not the only one that has noticed this problem. There was a post on the MSDN forums An there is even a feedback about it but it is already closed as not being reproducible.

Read More...

You may receive an error message, or the computer may stop responding, when you host Web applications that use ASP.NET on a computer that is running Windows Server 2003

Got an email from a friend who is suffering from this problem Here are the symptoms When you host Web applications that use Microsoft ASP.NET on a computer that is running Microsoft Windows Server 2003, you may experience decreased performance. This issue may occur when you host the Web applications in multiple application pools on a multiprocessor computer. Additionally, you may experience one or more of the following issues when available memory is low:

Read More...

Nice articles on The Codeproject this week

Because I want you all to save some time ;-). I selected a couple of very nice articles that I read on the codeproject site this week. First up [NHibernate Best Practices with ASP.NET, 1.2nd Ed. By Billy McCafferty]1. This is a great article about nHibernate but not only for you ASP.Neters but also for windowsforms and WPF users. nHibernate or any other ORM is a must have for any OO developer.

Read More...

Printing to a zebra printer from VB.Net

This code is based on code I found from Rick Chronister, but I can’t find the article anymore. It was also using a deprecated method. I adapted to look like this. Imports System.IO Imports System.Runtime.InteropServices Namespace ZebraLabels ''' <summary> ''' This class can print zebra labels to either a network share, LPT, or COM port. ''' ''' Programmer: Rick Chronister ''' </summary> ''' <remarks>Only tested for network share, but in theory works for LPT and COM.

Read More...

Nice article on ASP.NET MVC

It is out there and we need to learn it before it is to late. This article tells you how to do it better. I also made an entry on dzone.

Read More...

Interview/Exam questions part 3

Read the previous post. So lets move on to question number 5. The question was “If you have a collection of Time elements what do you have to do to put SportsTime elements in it.“ Of course the answer is nothing because we used inheritance we can have SportsTime elements in a Time collection. It’s called polymorphism and it’s one of the strong points of OOP. Question number 6 “I have a collection of Time which also contains SportsTime elements.

Read More...