alexcrossley.net business intelligence and automation

3Sep/100

a simple twist of fate

Capo 4

C: x32010
Cmaj7: x32000
C7: x32310
F: 133211
Fm: 133111
G: 320033

Intro : C - Cmaj7 - C7 - F - Fm - C - G - F - C - G - C

C
They sat together in the park
Cmaj7
As the evening sky grew dark,
C7 F
She looked at him and he felt a spark tingle to his bones.
Fm C G F
twas then he felt alone and wished that hed gone straight
C G C
And watched out for a simple twist of fate.

They walked along by the old canal
A little confused, I remember well
And stopped into a strange hotel with a neon burnin bright.
He felt the heat of the night hit him like a freight train
Moving with a simple twist of fate.

A saxophone someplace far off played
As she was walkin by the arcade.
As the light bust through a beat-up shade where he was wakin up,
She dropped a coin into the cup of a blind man at the gate
And forgot about his simple twist of fate.

-Harmonica Solo-
(Same Progression)

He woke up, the room was bare
He didnt see her anywhere.
He told himself he didnt care, pushed the window open wide,
Felt an emptiness inside to which he just could not relate
Brought on by a simple twist of fate.

He hears the ticking of the clocks
And walks along with a parrot that talks,
Hunts her down by the waterfront docks where the sailers all come in.
Maybe shell pick him out again, how long must he wait
Once more for a simple twist of fate.

People tell me its a sin
To know and feel too much within.
I still believe she was my twin, but I lost the ring.
She was born in spring, but I was born too late
Blame it on a simple twist of fate.

Outro is the same, with harmonica.

29Aug/10Off

Cycle Sutherland to Bundeena via Lady Carrington dr.

Distance 40KM

Time 3 hours 30 mins

Not all cycling as to avoid the road you need to push, carry and climb some walking tracks with the bikes.  The 4.2 KM Wallumarra trail goes down to the Toonoum Creek which is at  at about 60m and then climbs to over 180m , this is in a distance of about 300m (see terrain map). There are other parts where you need to push and carry, like Big Marley beech.

sutho-bundenna

Filed under: Australia, Sport No Comments
27Aug/10Off

Using VBS write a SQL script to add default records to Dimention

sSQL_Tables = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = 'Delivery' AND left(TABLE_NAME,3) = 'D_D'"

sDefaultInt = "0"

sDefaultvarchar1 = "'?'"

sDefaultvarchar2 = "'X'"

sDefaultchar1 = "'?'"

sDefaultchar2 = "'X'"

sDB = ""

sSV = ""

sUN = ""

sPW = ""

Set oConn = CreateObject("ADODB.Connection")

oConn.Provider = "SQLOLEDB"

oConn.ConnectionString= "Data Source=" & sSV & ";Initial Catalog=" & sDB & ";User ID=" & sUN & ";Password=" & sPW & ";Provider=SQLOLEDB;Trusted_Connection=Yes"

oConn.Open

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.CreateTextFile("C:\\Documents and Settings\\alexc\\Desktop\\Update-012.sql")

Set oTables = oConn.Execute(sSQL_Tables)

Do until oTables.EOF '' Get the list of tables

sSQL_PKs ="SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE table_name = '" & oTables.Fields(0) & "'"

Set oPKs = oConn.Execute(sSQL_PKs)

if oPKs.eof = false then

sPrimaryKey = oPKs.Fields(0)

'''Set objFile = objFSO.CreateTextFile("C:\\Documents and Settings\\alexc\\Desktop\\Blanks\\Update - " & oTables.Fields(0) & ".sql")

sSQL_Fields ="SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '" & oTables.Fields(0) & "'"

Set oFields = oConn.Execute(sSQL_Fields)

Do until oFields.EOF '' Get the list of fields

IF oFields.Fields(0) <> sPrimaryKey then

sValue1 = ""

sValue2 = ""

IF right(oFields.Fields(0),3) = "_SK" then

sValue1 = "-1"

sValue2 = "-2"

elseIF oFields.Fields(0) = "Package_Name" then

sValue1 = "'Manual Script'"

sValue2 = "'Manual Script'"

elseif oFields.Fields(0) = "Batch_Id" then

sValue1 = "2010"

sValue2 = "2010"

elseif oFields.Fields(0) = "Create_Date" then

sValue1 = "getdate()"

sValue2 = "getdate()"

elseif oFields.Fields(0) = "Modified_Date" then

sValue1 = "getdate()"

sValue2 = "getdate()"

elseif oFields.Fields(1) = "int" then

sValue1 = sDefaultInt

sValue2 = sDefaultInt

elseif oFields.Fields(1) = "smallint" OR oFields.Fields(1) = "tinyint" OR oFields.Fields(1) = "numeric" OR _

oFields.Fields(1) = "bigint" OR oFields.Fields(1) = "nvarchar" OR _

oFields.Fields(1) = "decimal" OR oFields.Fields(1) = "int"  OR _

oFields.Fields(1) = "bit" then

sValue1 = sDefaultInt

sValue2 = sDefaultInt

elseif oFields.Fields(1) = "datetime" OR oFields.Fields(1) = "smalldatetime" then

sValue1 = sDefaultInt

sValue2 = sDefaultInt

elseif oFields.Fields(1) = "varchar" then

sValue1 =  sDefaultvarchar1

sValue2 =  sDefaultvarchar2

elseif oFields.Fields(1) = "char" then

sValue1 =  sDefaultvarchar1

sValue2 =  sDefaultvarchar2

END IF

sInsert_Fields = sInsert_Fields & ", [" & oFields.Fields(0) & "]"

sInsert_Values1 = sInsert_Values1  & ", " & sValue1

sInsert_Values2 = sInsert_Values2  & ", " & sValue2

if len(sUpdate_Values1) >2 then sUpdate_Values1 = sUpdate_Values1 & ", "

if len(sUpdate_Values2) >2 then sUpdate_Values2 = sUpdate_Values2 & ", "

sUpdate_Values1 = sUpdate_Values1 & "[" & oFields.Fields(0) & "] = " & sValue1

sUpdate_Values2 = sUpdate_Values2 & "[" & oFields.Fields(0) & "] = " & sValue2

END IF

oFields.MoveNext

Loop '' End of fileds list

if sPrimaryKey <> "" then

if right(sPrimaryKey,2) = "SK" then

sKeyValue0 = "0"

sKeyValue1 = "-1"

sKeyValue2 = "-2"

else

sKeyValue0 = "'Missing'"

sKeyValue1 = "'Invalid'"

sKeyValue2 = "'Not Applicable'"

END if

sDelete = "DELETE from Delivery." & oTables.Fields(0) & " where [" & sPrimaryKey & "] = " & sKeyValue0 & " OR [" & sPrimaryKey & "] = " & sKeyValue1 & " OR [" & sPrimaryKey & "] = " & sKeyValue2

sInsert1 = "INSERT INTO Delivery." & oTables.Fields(0) & "([" & sPrimaryKey  & "]" & sInsert_Fields & ") VALUES (" & sKeyValue1 & sInsert_Values1 & ")"

sInsert2 = "INSERT INTO Delivery." & oTables.Fields(0) & "([" & sPrimaryKey  & "]" & sInsert_Fields & ") VALUES (" & sKeyValue2 & sInsert_Values2 & ")"

sUpdate1 = "UPDATE Delivery." & oTables.Fields(0) & " SET " & sUpdate_Values1 & " where [" & sPrimaryKey & "] = " & sKeyValue1

sUpdate2 = "UPDATE  Delivery." & oTables.Fields(0) & " SET " & sUpdate_Values2 & " where [" & sPrimaryKey & "] = " & sKeyValue2

objFile.WriteLine("--" & oTables.Fields(0))

objFile.WriteLine(sDelete)

objFile.WriteLine("")

objFile.WriteLine(sInsert1)

objFile.WriteLine(sInsert2)

objFile.WriteLine("")

objFile.WriteLine(sUpdate1)

objFile.WriteLine(sUpdate2)

objFile.WriteLine("")

objFile.WriteLine("")

end if

sDelete = ""

sInsert0 = ""

sInsert1 = ""

sInsert2 = ""

sUpdate1 = ""

sUpdate2 = ""

sInsert_Fields = ""

sInsert_Values1 = ""

sInsert_Values2 = ""

sUpdate_Values1 = ""

sUpdate_Values2 = ""

sPrimaryKey = ""

'''objFile.Close

End if

oTables.MoveNext

Loop '' End of tables list

objFile.Close

oConn.Close

MsgBox ("Complete!")

Filed under: SQL, Visual Basic No Comments
7Aug/10Off

My top 5 favorite iPad apps # 1 - Flipboard (Aug 2010)

Cover Art Flipboard
Flipboard Inc.

iTunes

Release Date: 21 Jul 2010
Genre: News
© 2010 Flipboard Inc.

Filed under: Computers, iPad No Comments
7Aug/10Off

My top 5 favorite iPad apps # 2 - Kindle (Aug 2010)

Cover Art Kindle
Amazon.com

iTunes

Release Date: 13 Dec 2009
Genre: Book
© 2010 Amazon.com, Inc. or its Affiliates.

Filed under: Computers, iPad No Comments
7Aug/10Off

My top 5 favorite iPad apps # 3 - BBC News (Aug 2010)

Cover Art BBC News
BBC Worldwide

iTunes

Release Date: 01 Apr 2010
Genre: News
© 2010 BBC

Filed under: Computers, iPad No Comments
7Aug/10Off

My top 5 favorite iPad apps # 4 - Real Solitaire for iPad (Aug 2010)

Cover Art Real Solitaire for iPad
EdgeRift, Inc.

iTunes

Release Date: 02 Apr 2010
Genre: Games
© 2010 EdgeRift, Inc.

Filed under: Computers, iPad No Comments
7Aug/10Off

My top 5 favorite iPad apps # 5 - Ultimate Guitar Tabs (Aug 2010)

Cover Art Ultimate Guitar Tabs
Ultimate Guitar USA, LLC

iTunes

Release Date: 16 Mar 2010
Genre: Music
© 2010 Ultimate Guitar USA, LLC

Filed under: Computers, Music, iPad No Comments
4Aug/10Off

List files in a directory to a csv or txt file

'' Change the paths as required

Set oFSO = CreateObject("Scripting.FileSystemObject")

Set oDir = oFSO.GetFolder("c:\Program Files\Microsoft SQL Server\100\DTS\Packages\")

Set NewsFile = oFSO.CreateTextFile("C:\Documents and Settings\alex\Desktop\Index.txt", True)

For Each oFile In oDir.Files

NewsFile.WriteLine (oFile.Name)

Next

NewsFile.Close

msgbox("Done")

29Jul/10Off

Add an ODBC using VBS

sType = "REG_SZ"

sKeyType = &H80000002

sParentKey = "HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\"

sSubKey = "NAMEOFCONN"

snDriver = "Driver"

snDescription = "Description"

snServer = "Server"

snDatabase = "Database"

snLastUser = "LastUser"

snTrusted_Connection = "Trusted_Connection"

svDriver = "C:\WINDOWS\system32\SQLSRV32.dll"

svDescription = "Created Automatically"

svServer = "SERVERNAME"

svDatabase = "DBNAME"

svLastUser = "alexc"

svTrusted_Connection ="Yes"

Set objRegistry = CreateObject("Wscript.shell")

objRegistry.RegWrite  sParentKey & sSubKey,""

objRegistry.RegWrite sParentKey & sSubKey & "\" & snDriver,svDriver,sType

objRegistry.RegWrite sParentKey & sSubKey & "\" & snDescription,svDescription,sType

objRegistry.RegWrite sParentKey & sSubKey & "\" & snServer,svServer,sType

objRegistry.RegWrite sParentKey & sSubKey & "\" & snDatabase,svDatabase,sType

objRegistry.RegWrite sParentKey & sSubKey & "\" & snLastUser,svLastUser,sType

objRegistry.RegWrite sParentKey & sSubKey & "\" & snTrusted_Connection,svTrusted_Connection,sType
28Jul/10Off

Cronulla & Woolooware 12.7k prep for City to Surf (01h 06m)

cronulla

23Jul/10Off

Write registry with VBS

sKey = "HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\Costa Bookings\Server"

sVal = "CAUSTLSQ02"

sType = "REG_SZ"

Set objRegistry = CreateObject("Wscript.shell")

objRegistry.RegWrite sKey,sVal,sType