Navigation


Blu-Ray / DVD Image Comparison Utility

Tuesday, July 08 2008, Home, gio, 0 comments

I've been working on a Silverlight application to compare two images. One from an HD source (such as blu-ray) and one from a standard definition source (DVD). The goal is to see how much of an improvement one can expect if they were to repurchase a movie on blu-ray. Right now, the tool offers a few comparison modes: 1) Dual View - This allows you to see two images as if they were 1. When you move the mouse left or right, you can see more of one image and less of the other. 2) Swap View - This allows you to see one image in its entirety, and then, when mousing over, you can see the other image....

Continue

Modifying DateTime variable while debugging in C#

Friday, May 09 2008, Home, gio, 0 comments

One of the great things about Visual Studio 2005 is how it easily allows us to change the values of our variables while we are debugging. For example, while debugging a program, you have a boolean variable that is currently set to false. Setting it to true will allow you to step into a piece of code that you test. This can be easily done by highlighting the variable and waiting for the popup that shows you the current value. You can then change this value by clicking on it. The other option is to go to the quickwatch window and modify it in there. The only type that has given me trouble is a DateTime...

Continue

Disabling Foreign Keys and Triggers - Sql Server 2005

Saturday, May 10 2008, Home, gio, 0 comments

Sometimes it's just necessary to get rid of foreign key constraints and triggers in order to do maintenance on a database. Imagine trying to delete all records from 100+ tables, but you now have to put them in dependency-order in order to do it. While foreign key constraints help maintain relational integrity, it can be a huge pain in the rear when you are trying to do basic operations. Of course doing this should only be done when you know-for-sure that you won't ruin the overall integrity of the database. Disable all Constraints on a table ALTER TABLE yourtable NOCHECK CONSTRAINT ALL This will...

Continue

Changing Sql Identity Seed

Saturday, May 10 2008, Home, gio, 0 comments

While working on a project, I needed to change the identity column for a certain set of tables to be negative while keeping the current positive values that it already had. I found a quick and easy way to do it using the following: DBCC CHECKIDENT( 'your_table' , RESEED, new_identity_value) There were however a few drawbacks to this: 1) You cannot set the identity increment along with it. This means if you change it to negative, you cannot start at 0 or -1 if your increment is positive. Your only real solution is to put it at a huge negative number such as -1 billion or -2^31 and have it count...

Continue

Dynamic determination of primary key in SQL Server

Saturday, May 10 2008, Home, gio, 0 comments

One of the recent projects I've been working on forced me to do the following: Delete from tableName where its primary key=X. The tricky part is this: We don't know the column_name of the primary key. The reason for this is because the table_name may be different each time i run the statement; The sql statement is completely dynamically built. The table name is determined by grabbing it from a table that stores table names (along with other info) So now, I have the table name, but need to get the primary key's name. I found two ways to do this: SELECT col.name FROM sysindexes indx INNER JOIN sysobjects...

Continue

Sql Server update/insert

Saturday, May 10 2008, Home, gio, 0 comments

I had a project where I needed to have a SQL Server database replicate/mirror another database. The goal was to import a huge set of ascii files (each file representing a table), and perform bulk inserts. This was done once a month to ensure that the entire database was exactly up to date. Additionally, every day there would be a set of addendum tables. This was a much smaller set of tables that contained a relatively small amount of data, and some records would need to be inserted while others needed to be updated. In order to ensure that we do not add duplicate records, I needed a way to go through...

Continue


Converted to Graffiti by Rich Mercer