Twitter

Follow SQLQuill on Twitter

Subscribe

MN Pass

Powershell Script for SQLSaturdays and Twitter

SQL Saturdays and Twitter go together like peas and carrots. I’ve found the networking page of any SQL Saturday site is very valuable to not only get in contact with people about the event, but also to stay in contact and build long term relationships. Helping plan, organize and speak at SQLSaturday #99, I didn’t want to loose the conncections I had made, so I decided to check out all the twitter accounts of the people who had registered for for it.

What’s the easiest way to do this? POWERSHELL!!!

I stumbled a few times (one time I opened 83 tabs in Chrome and had to stop using twitter for an hour), but here is the script I came up with.

Notes on the script:

#--------------------------------------------------------------------------------------
#Open a tab in Chrome for each twitter account on a SQLSaturday Networking Page
#Created by Andy Lohn - http://www.sqlfeatherandquill.com/
#--------------------------------------------------------------------------------------

$url = "http://www.sqlsaturday.com/99/networking.aspx" #Change this for any SQLSaturday Networking Page
[int]$StartCount = 0
[int]$PageCount = 4 #note this is 0 relative, so this plus 1 for number of tabs to be opened

$chrome = (gi ~\AppData\Local\Google\Chrome\Application\chrome.exe ).FullName
#This didn’t work on one of my machines, so I just set it to the full path of chrome and it worked.
$webclient = New-Object system.net.webclient
$file1="c:\temp\SQLSatDownload.txt"
$file2="c:\temp\SQLSatList.txt"
$file3="c:\temp\SQLSatListwithAddress.txt"
$TURL = "www.twitter.com/"
$file4="c:\temp\SQLSatCounter.txt"

#Create the files if they don't exist
If (!(Test-Path $file1) )
{New-Item $file1 -Type file}
If (!(Test-Path $file2) )
{New-Item $file2 -Type file}
If (!(Test-Path $file3) )
{New-Item $file3 -Type file}

#Set the counter to keep track for multiple runs - 0 if new
If (Test-Path $file4)
{$SCWork = (get-content $file4)
[int]$StartCount = $SCWork.ToString()}
Else
{New-Item $file4 -Type file
add-content $file4 1
[int]$StartCount = 0}

If ($StartCount -eq 0)  #Populate the local file.
{Clear-Content $file1
$webclient.DownloadFile($url,$file1)

$test = get-content $file1
Clear-Content $file2
Clear-Content $file3
$Tester = $test | Select-String -pattern "<a href=""<a href="http://www.twitter.com/"">http://www.twitter.com/"</a> |
% {$_ -replace "<span id=""ContentPlaceHolder1.*<a href="http://www.twitter.com/"">http://www.twitter.com/"</a>, ""} |
% {$_ -replace """ class=""noarrrow"">.*</span>", ""} |
% {$_ -replace "<a href="http://twitter.com/#!/"">http://twitter.com/#!/"</a>, ""} |
% {$_ -replace "                    ", ""} |
where {$_ -ne ""}

foreach ($T in $Tester)
{Add-content $file3 ($TURL + $T)}
}
$TestMethod = (Get-Content $file3)[$StartCount .. ($StartCount + $PageCount)]     $TestMethod | % { &amp; $chrome $_ }
Clear-Content $file4
Add-Content $file4 ($StartCount + $PageCount + 1)

#To restart or change url, run this:
#remove-item $file4

This has to be real easy to change for linkedin – I’m more a twitter guy at this point.  If you do alter it, to work for linkedin, let me know!

SQL Saturday #99 Sponsors – Cheers!

I’ve learned that if you want to make your point, sometimes you’ve got to embarrass yourself stretch your comfort zone – i.e. the StrateSQL Pass Videos.  I’ve been “Cheersing” my college buddies for years now, so here’s a collection of cheers to the SQLSaturday #99 Sponsors.  Thank you very much for your support – it wouldn’t have been possible without you.

You Rock Sponsors

Quest – You get the blue glass cheers!

HP Microsoft – You get the clean cut Tiger cheers!

Breakfast Sponsor

Digineer – You get the coffee and mullet cheers!

Gold Sponsors

Emergent Networks – You get the money glass cheers!

Virteva – You get the cool hat cheers!

Idera – You get the full beard close up cheers!

RBA – You get the long hair, long neck cheers!

GNet Group – You get the Northwestern hat cheers!

Fusion-IO – You get the stocking cap, ‘stache cheers!

Superior Consulting Services – You get the nearly bald cheers!

Data Education -You get the clean face, long hair cheers!

Silver Sponsors

PASS – You get the high hat cheers!

Intertech – You get the extreme close up cheers!

Solutions Design Group – You get the hat down business time cheers!

Confio – You get the “Check out my beard” cheers!

Nimbele Storage – You get Reds Sweatshirt cheers!

Magenic – You get the young, shy, no glass cheers!

Bronze Sponsors

SSWUG – You get the too cool to lift the glass ‘stached cheers!

O'Reilly – You get the running cheers!

WROX – You get the White Goodman tough guy stare down cheers!

The 50 Lunch Sponsor

BlackDog – You get the bike gear cheers!

Once again, thank you and cheers!

SQL Saturday #99 – Wrap up

Planning

SQLSaturday #99 was last Friday (11/11/11) and man it was really great to be a part of it.  I told many people that, for the preparation, I did very little work and spent most of my time learning from Jason Strate and Dan English on what needs to be done for an event such as this.  Dan and I were in charge of the sponsors – I sent a few emails to a few people.  What really happened was I’d get an email that would have a question that I thought I could answer, by the time I actually started to type a respond, Dan had sent at least one very good response.  He would answer the original question, ask a follow up question and make a few suggestions to help the sponsor/potential sponsor – I couldn’t add much value to most of them.  It was great to learn from him.  Tim Plas, Steve Hughes and Bill Preachuk did a great job on all the other details as well.

My Sessions:

SQL Community and Social Networking –Roundtable

I had the privilege of being on a panel with Dan English (T), Jason Strate (T), and Steve Hughes (T) for the “SQL Community and Social Networking –Roundtable” Session.  The moderator was Ted Krueger (T), so it was a very fun group.  Jason’s videos were a hit.  Unfortunately Ted was not wearing his sun glasses, so not many people recognized him – joking of course.

Here are some useful links from the session:

TSQL Tips and Tricks

This was my first full fledged technical session – and I thought it went well – no major issues with the demos, I did forget to mention the drag and drop features of SSMS (drag and drop columns from the object browser rather than use select * For that matter drag and drop object names of all types to prevent mistyping), but I did cover the material and I didn’t run out of stuff.

Click here to download the presentation with the demos.

Here are the links I mentioned during the session that I would post:

One more thing…the guy who asked me about turning off a trigger for a transaction, I came up with a potential solution…you have to alter the trigger and add a table to the database, so if you can’t do that, you don’t have to read the rest of this.  If you can do that…you may be able to add a new table, and in the trigger you that you want to turn off, add some logic checking for the existence in of the ID in the new table – if the record doesn’t exist, execute the trigger, if it does, skip the trigger.  That way you could just insert records to table when you don’t want to execute the trigger and remove them when you are done.  You also keep transactional consistency by not turning off the trigger for the entire table.  Just a thought, hope it helps.

SQL Saturday #99 – This Friday – Update

sqlsat99_webDan English (B/T) sums up the recent updates best with his post here:

Other good links from around the information superhighway are:

SQL Saturday #99 – This Friday

SQL Saturday #99 is coming up on Friday – 11/11/11 the last binary date of our lives (thanks to Lara Rubbelke (B/T) for pointing that out last January).

SQLSaturday#99 is a free one day training event for SQL Server professionals and those interested in SQL Server. The event will be held Nov 11, 2011 at Grace Church Eden Prairie, 9301 Eden Prairie Road, Eden Prairie, MN, 55347 (use door 4 on the east side of the building, check in will be inside that door).  Note the event is full, but register and get on the waiting list if you would still like to attend.  For more information about SQL Saturdays please visit SQLSaturday.com.  Follow this event on Twitter with hashtag #sqlsat99, and get news on all our events with #sqlsaturday.

Check these details out:

Remember – A lot can go on between Thursday and Saturday…