LINQ (Language Integrated Query) to SQL is a great tool because it allows developers to concentrate on business problems instead of worrying about writing SQL. Unfortunately, generated code typically comes with a catch. My general rule of thumb is that "I never trust any tools that have a wizard or generate code". After all, every time you release code into production you are putting your reputation on the line. Therefore, don't you think it is important to know what your code is really doing under the covers? Since I started getting involved with Database Administration about 3 years ago I have become extremely conscious of the SQL that my code generates. After all, most database performance problems stem from the fact that developers test on empty databases and everything seems to work fine until millions of records trickle into the system. Then ugly problems like missing indexes, functions in the where clause and poorly written queries bubble to the surface. The occurrenc... [More]
A while ago, I wrote an article about how to use Ruby with SQL Server 2005. The post generated a lot of comments and most of them dealt with the fact that the libraries I used in the original tutorial are now either being deprecated or near impossible to find. In addition to that, most of my readers are .NET developers. So, I thought it would make sense to write an article about Ruby from the perspective of a .NET developer. Therefore, this tutorial not only teaches you how to use Ruby on Rails with SQL server hosting but it will also help you see similarities between the features in ASP.NET stack and Ruby on Rails framework where applicable.
A Little Background Information
Ruby originated in Japan in the mid 1990s and was initially developed by Yukihiro "Matz" Matsumoto. Ruby supports multiple programming paradigms, including functional, object oriented, imperative and reflective. It also has a dynamic type system and automatic memory management; it is therefore similar in varying r... [More]
WMI or Windows Management Instrumentation has been around for years. As a .NET developer and a DBA I have been using it to collect information about the servers in my enterprise. WMI gives me the ability to collect information about important things such as disk space, OS patch levels and ACLs. The cool thing about WMI is that it uses a SQL like syntax. This makes it easy for most developers to use because we typically all have experience using T-SQL.
In case you didn't know, most management tools like SCOM and HP Openview will leverage WMI to pull information from servers. In addition, certain applications like SQL Server will register a set of WMI classes during the install. Lets start out by looking at a sample WMI query that retrieves some basic OS information from a server:
SELECT Caption, TotalVirtualMemorySize, ServicePackMajorVersion, ServicePackMinorVersionFROM Win32_OperatingSystem
Pretty simple, huh? Now lets take this query and integrate i... [More]
There are occasions when you want your end users to page records by using something other than just numbers. For example, what if you are viewing a list of business contacts and you know you are looking for someone with the last name of Doe? Do you know what page you could find records starting with a "D" on? In reality, this person's information could be on page 1 or 50. Therefore, wouldn't it make more sense in this scenario to page by people's last name? Absolutely! Alphabetical paging is actually very simple. We start by building a pager that displays all the letters in the alphabet as hyperlinks. In my application I display all the letters all the time. You could however build more intelligence behind your pager so you only display the letters that have 1 or more records. For example if I had a Contact table with a column title LastName I could use the following query to build my pager: select distinct( cast( LastName as CHAR(1))) from Contact
I will howev... [More]
When each year comes to an end people tend to reflect on the past year and their accomplishments. For a programmer this often results in a look through the previous years source code. Of all the projects that I did last year my favorite project was the asteriods silverlight clone that I built. The asteroids clone was my first attempt at a Silverlight game and it was really fun to build. The project was developed over the course of a weekend and it helped me to get acquainted with Silverlight. I will go through some of the source code in case you are considering building something similar and need some tips to on how to get started. Getting Started Like most games, you need to have a main loop where you can draw and redraw sprites based on some variables. This is accomplished by created a DispatcherTimer that invokes a drawing routine at a predefined interval. The drawing routine is responsible for looping through all the objects on the canvas and updating their positions. For exam... [More]