24 May
We will sell no wine before its time…. An Agile Development Allegory
12 May
Classic ASP ( You mean ancient right? )
I find myself writing VBScript in a broken ASP Application that I did not originally develop. It does not seem too long ago that I was excited about <%%> tags. Now its a drag. On Error Resume Next. Wow! So the problem turns out to be
AspMaxRequestEntityAllowed
JT
PS When are they gonna sunset this thing?
12 May
Duh! It was commented out
Today,
I bumped into my old nemesis commented code. I spent several hours tweaking and tweaking an IIS 7.5 site’s custom errors only to discover my custom error section looked similar to this
<customErrors mode="On" defaultRedirect="MyErrorPage.htm">
<error statusCode="404" redirect="My404.htm" />
</customErrors>
–>
I fixed the system.web portion in IIS 7. Checked everything. My eyes just glossed over the fact that the darn thing was commented out of the web.config.
What an idiot. I will not forget this now. (Until the next time I forget)
JT
10 May
SQL Search for Text
I use the following stored procedure to search for Text in a database. This works for medium sized databases in SQL Server. Sometimes in analyzing an existing database you need to find where a value resides. I wrote this to assist with that. Use at your own risk.
Create Procedure FindTextWithTempTable
@searchterm varchar(50),
@ignoreTable varchar(100) = '',
@exactMatch bit = 0
as
Begin
IF @exactMatch = 0
BEGIN
set @searchterm = ' like ''%' + @searchTerm + '%'''
END
ELSE
BEGIN
set @searchterm = ' = ''' + @searchTerm + ''''
END
Declare @sql varchar(max)
Declare @QueryText varchar(max)
Declare @tempsql varchar(max)
Declare @RowCounter int
declare @tmp table
(
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[FIELD_DATA] varchar(max) NOT NULL,
[FIELD_NAME] varchar(100) NOT NULL,
[TABLE_NAME] varchar(100) NOT NULL
)
Declare QueryCursor CURSOR FAST_FORWARD FOR
Select CASE
WHEN DATA_TYPE = 'TEXT' Then
'SELECT CONVERT(varchar,[' + COLUMN_NAME + ']) as FIELD_DATA ' + ' , ''' + COLUMN_NAME + ''' as [FIELD], '''
+t.TABLE_NAME + ''' as [TABLE] FROM [' + t.TABLE_NAME
+ '] where CONVERT(varchar,[' + column_name + ']) ' + @searchTerm
WHEN DATA_TYPE = 'float' Then
'SELECT CONVERT(varchar,[' + COLUMN_NAME + ']) as FIELD_DATA ' + ' , ''' + COLUMN_NAME + ''' as [FIELD], '''
+ t.TABLE_NAME + ''' as [TABLE] FROM [' + t.TABLE_NAME
+ '] where CONVERT(varchar,[' + column_name + ']) ' + @searchTerm
WHEN DATA_TYPE = 'numberic' Then
'SELECT CONVERT(varchar,[' + COLUMN_NAME + ']) as FIELD_DATA ' + ' , ''' + COLUMN_NAME + ''' as [FIELD], '''
+ t.TABLE_NAME + ''' as [TABLE] FROM [' + t.TABLE_NAME
+ '] where CONVERT(varchar,[' + column_name + ']) ' + @searchTerm
ELSE
'SELECT [' + COLUMN_NAME + '] as FIELD_DATA ' + ' , ''' + COLUMN_NAME + ''' as [FIELD], '''
+ t.TABLE_NAME + ''' as [TABLE] FROM [' + t.TABLE_NAME
+ '] where [' + column_name + '] ' + @searchTerm
END as QueryText from INFORMATION_SCHEMA.COLUMNS
INNER JOIN INFORMATION_SCHEMA.TABLES t on INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = t.TABLE_NAME
Where DATA_TYPE in ('varchar','nvarchar','text')
and Lower(t.TABLE_NAME) != Lower(@ignoreTable)
OPEN QueryCursor
FETCH NEXT FROM QueryCursor
INTO @QueryText
Set @RowCounter = 1
set @sql = '';
WHILE @@FETCH_STATUS = 0
BEGIN
-- do row specific stuff here
Insert into @tmp (FIELD_DATA,FIELD_NAME,TABLE_NAME)
exec(@QueryText)
FETCH NEXT FROM QueryCursor
INTO @QueryText
END
CLOSE QueryCursor
DEALLOCATE QueryCursor
Select * from @tmp
order by FIELD_DATA
Select COUNT(*) as ValueInstanceCount, TABLE_NAME,FIELD_NAME
from @tmp
Group By TABLE_NAME,FIELD_NAME
Order By TABLE_NAME
END
examples of how I used it
Examples
execute jtFindTextWithTempTable ‘F3′
this looks for all but ignores the table AccountTransactions
execute jtFindTextWithTempTable ‘F3′, ‘AccountTransactions’
this looks for all but ignores the table AccountTransactions and only looks for exact matches of the text
execute jtFindTextWithTempTable ‘F3′, ‘AccountTransactions’,1
10 May
Query All SQL 2008 Database File locations
I am using the following code to list all the DBs file location. select CHAR(13) + 'use [' + name + ']' + CHAR(13) + CHAR(13) + ' select physical_name from sys.database_files' + CHAR(13) + 'GO' from sys.databases
6 Jan
Running Vista Now
Well there is a lot to like about Vista Unfortunately this new bad ass Vista box cannot be my everyday machine because of Cisco. Cisco does not support Vista 64bit with their current client software. So anytime I have to connect. I am going to need to get off of this machine and go to the “old” one. Bummer
11 Feb
Daylight Savings Time
This one snuck up on me as a coder. This year on March 11 We “spring forward” a full month early of normal. I have to scramble on some applications that have scheduling components.
10 Feb
Bio stuff
I saw this on a Buddy’s site so I decided to steal the idea.
Four jobs I’ve had in my life
- Chicken Catcher
- Tobacco Cropper
- Hotel Security Guard
- Vegatable Truck Loader
Four movies I can watch over and over
- Lean on Me
- Grumpy Old Men
- Dirt Harry
- The Longest Yard (70s version)
Four places I have lived
- Tifton, Ga
- Baton Rouge, La
- Tallahassee, Fl
- San Pedro, Ca
Four TV shows I love to watch
- 2 and Half Men
- The Wire
- The Sopranos
- Entourage
Four places I have been on vacation
- Seattle, Wa
- Atlantic Beach, NC
- Gatlinburg, TN
- Cleveland, OH
Four of my favourite dishes
- Fettucine Alfredo
- Grilled Steak
- Fried Chicken
- Chili
Four websites I visit daily
Four places I would rather be right now
I wish I could think of someplace. But I kinda dig what happens day to day
Four Unspeakable Abominations
- Test Based Education (Teaching to the Test) in public schools
- Racism (All directions. Think about it!)
- Death Metal
- Hate (See #2)
Four albums I can’t live without
- Dream Theater – Images and Words
- Megadeth — Rust in Peace
- Buddy Rich — Stick It
- Ted Nugent — Double Live Gonzo
Six cars I’ve owned
- ’78 Fiat X-19
- ‘83 Cutlass
- ‘78 Volkswagen Scirocco
- ‘99 Chevy Malibu
- 75 VW Dasher (With conferderate Flag courtesy ET)
- 72 Mercury Montego Station Wagon (The “Battle Cruiser”)
25 Jul
Coding Habits
For those of you who are programmers. How do you get motivated to write code. Is it money? Maybe a few years ago it was. There was huge money in it for marginal programmers. My motivations are probably ego driven. I can’t code for just myself. I have to code for someone who is going to use the software. It is a giant ego boost when someone can use what you have created. I know coders who are into themselves so much that they don’t care who uses their stuff. Only if it is elegant and proper code. Curious about your opinions.
Later
J