The 2011 Scripting Games Advanced Event 7: Map User's Names and Twitter Names with PowerShell

The 2011 Scripting Games Advanced Event 7: Map User's Names and Twitter Names with PowerShell

  • Comments 9
  • Likes

2011 Scripting Games badge

Summary: Advanced Event 7 in 2011 Scripting Games uses Windows PowerShell to map user's names to Twitter names.

About this event

Division

Advanced

Date of Event

4/12/2011 12:15 AM

Due Date

4/19/2011 12:15 AM

Event scenario

You are enjoying using Twitter. Unfortunately, Twitter usernames are not always easily understandable. You would like to be able to map a Twitter username with the person’s actual name. To do this, you plan to retrieve this information from a SQL Saturday networking web page, such as the one shown in the following image. Then you plan to create a comma-separated value (CSV) file with the Twitter username, and the person’s actual name as fields.

Design points

  • You should include a function in your script that provides the ability to perform a lookup from the CSV file that will “translate” a user’s name to a Twitter username. The function should also be able to translate from a Twitter username to a person’s real name.
  • For the purposes of this exercise, use the Columbia, South Carolina Networking page for the SQL Saturday #70 (March 19, 2011) event. The URL for the networking page of this event is:
    http://www.sqlsaturday.com/70/networking.aspx
  • If you use a temporary file during the process of obtaining Twitter usernames from the networking page, delete the file prior to completing the script.
  • When you are obtaining the Twitter usernames, do not include the at sign or twitter.com. Therefore, the Twitter username is ScriptingGuys, not twitter.com/scriptingguys or @ScriptingGuys.
  • Extra points for reusable code.
  • Extra points for adding useful Help information complete with sample usage.
  • Although there are certain similarities with Advanced Event 6, there are significant differences. You might be better off starting from “scratch” when you approach this event (or not—depending on how you wrote the solution for the previous event).

2011 Scripting Games links

2011 Scripting Games: All Links on One Page

Submit your scripts on PoshCode

Support our Sponsors!

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. Good luck as you compete in this year’s Scripting Games. We wish you well.

Ed Wilson, Microsoft Scripting Guy

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • So does the script get the users from a csv file, or from the web page?  I get the output is a csv file, but you lost me on the input.

  • @Glenn - I'm pretty sure you GET the info from the SQL Sat. Networking webpage & then SEND the ifo to a CSV.

    Scenario:

    "To do this, you plan to retrieve this information from a SQL Saturday networking web page, such as the one shown in the following image. Then you plan to create a comma-separated value (CSV) file with the Twitter username, and the person’s actual name as fields."

    Then after ya get the info from the web page into a CSV - create a function that will do translations from the info in the CSV file (Twitter name to Real Name and Real Name to Twitter Name)

    That's my interpretation at least

  • That's funny. In the last event I was thinking "it would probably be helpful to have the person's actual name in addition to their username." But I decided to keep it simple and just focus on the required information.

  • I thought about that too from AE6, but I also didn't want to go too crazy and go outside the requirements any more than I already did. I agree with @Mike.Wells and believe that we have to pull that info from the site and add it into a CSV.

  • @Glenn Sizemore sorry if I was unclear. My thinking (and the prototype I wrote for this event) was that you would get all of the twitter id's and usernames from the SQL Saturday #70 web page. You would store them into a CSV file as a CHEAP/EASY type of data storage. You would then be able to open the CSV file in an Excel Spreadsheet and that would you to be able to do a quick lookup to resolve a users twitter id to the users actual name.

  • @ Mike.Wells yep ... that is it!

  • @Jason Hofferle there have been SO many times that I wanted to send a direct message to a particular user on Twitter, and I did not know their twitter name ... I actually wrote something similiar to this for my own use ... I then thought it would make a COOL event for the 2011 Scripting Games.

  • @Boe Prox not going too crazy with the games? hehehe that is part of the fun. It is actually one of the things I look forward to each year ... seeing what the contestants come up with ... comparing my personal approach to the way the contestants answer the questions ... and looking at the "extensions" that are incorporated into the scripts.

  • Well I guess that is settled then. Grab the names from the same web page it is.