Debugging .NET 1.1 With Visual Studio 2003 on Windows XP x64

January 24, 2008 Leave a comment

In order to debug .NET 1.1 properly, it is necessary to uninstall the .NET 2.0 framework when you want to debug. The command to uninstall is:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -u

The command to reinstall when your are done is:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

Categories: Uncategorized

Selecting a specific number of rows in TSQL

December 25, 2007 Leave a comment

The other day I had the need to select an exact number of rows in a TSQL stored procedure. The circumstances constrained me in multiple ways and I just so happened to come across this little gem of a trick for selecting a set number of rows without using TOP.

All one must do is use the following assigment:

SET @@ROWCOUNT = # of Rows To Select

Then perform the select statement and your in business!

Categories: Uncategorized

Insert Multiple TSQL Rows

December 4, 2007 Leave a comment

The only easy way to insert multiple records in TSQL (and it’s quick!):

INSERT INTO TableName(Columns…)
SELECT Val1, Val2…
UNION ALL
SELECT Val1, Val2…

etc.

Categories: SQL, TSQL

Upload Large Files in ASP.NET

December 3, 2007 Leave a comment

Here’s the simple solution to uploading large files in ASP .net.

Add a new key in the web.config. The fileSize (maxRequestLength) is in kilobytes with a default size of 4.

The key to add is

<httpRuntime maxRequestLength=”2000000″/>

Categories: .NET, ASP, File

Import CSV Using Rails Migration

October 10, 2007 5 comments

Reposted from Rails Weenie:

Install FasterCSV (‘gem install fasterCSV’)

The code to use inside the migration is similar to:

FasterCSV.foreach(“#{RAILS_ROOT}/lib/symbols_database/security_list.csv“, :row_sep => “\r”) do |row|
field1,field2,field3 = row
Foo.create(:field1 => field1, :field2 => field2, :field3 => field3)
end

Categories: Ruby, RubyGems, Uncategorized

Comparing Directories Ruby Style

October 8, 2007 Leave a comment

I recently needed to recursively compare 2 directories by filename. Here’s the solution:

require 'ftools' 
srcDir = "/home/Music/"destDir = "/home/Music/iTunes/iTunes Music"

mHash = Hash.newiHash = Hash.new
 #Add all files to hash Dir[srcDir + '/**/*.mp3'].each do |path|    mHash[path.split('/').last] = pathend

#Add all files to second hash Dir[destDir + "/**/*.mp3"].each do |path|    iHash[path.split('/').last] = pathend

puts "Source # Files: " + mHash.length.to_sputs "Dest # Files: " + iHash.length.to_s

#Compare Hashes and copy Any datam Hash.each_key do |key|     if iHash[key] == nil         puts "Copying " + mHash[key] +" to " + destDir         File.copy(mHash[key],destDir+"/")         end end
Categories: Ruby

Superators

September 13, 2007 Leave a comment

This is just to cool. Superators are a way to overload the traditional, non logical ruby operators. Check it out.

Categories: Ruby