Archive

Archive for the ‘Uncategorized’ Category

This Blog will be moving!

December 16, 2008 Leave a comment

This blog, along with all of its contents, will be moving to http://www.parallelcoding.com. Come read and enjoy!

Categories: Uncategorized

SEO 301 Redirects for ASP .NET 1.1

February 26, 2008 Leave a comment

I recently worked on a project where any URL following the form of http://www.mydomain.com/subDomain/Default.aspx needed to 301 redirect to http://www.mydomain.com/subDomain/. Basically this calls for stripping the ‘Default.aspx’ off of any request that has it. The project was to be completed using Visual Basic .NET 1.1.

The solution is  is to add a few lines of code in the Global.asax.vb file inside of the  Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) function. The final product looks like this:

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Dim oPath As String = Request.CurrentExecutionFilePath.ToLower
If Not oPath.EndsWith(“default.aspx”) Then Return

Response.Status = “301 Moved Permanently”
Response.AddHeader(“Location”, “http://www.myDomain.com” + oPath.Substring(0, oPath.IndexOf(“default.aspx”)))

End Sub

Categories: Uncategorized

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

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