Twitter - Saving your Tweets

by agrace 19. December 2009 19:44

Follow me on Twitter In my ever ending search for a tool/technology to manage my inflow of information from the Web, I opened a Twitter account that could also act as a set of pseudo-bookmarks. My IE8 and Firefox bookmarks already stretch to the floor when expanded. Plus, I'm convinced that there must be some unknown aspect of HCI that dictates that once something is saved as a bookmark, it is never opened again. Bookmarks drop downs are about as user-friendly as crotch rot. I've looked at Evernote and OneNote, the latter being the most promising to date. I plan to take another look at the products from Microsoft Live Labs.

Recently, I passed the 700 tweet mark and decided to archive what I had. But how? I gleaned the following tidbits from "Twitter Tips, Tricks, and Tweets" by Paul McFedries - founder and CEO of Mashable. You can save a local copy of your tweets by entering the following URL in your browser:

http://twitter.com/statuses/user_timeline/account.xml?count=n

where account = your account name, and
n = number of tweets

 

Tweets XML

 

This will open n number of your tweets to date in XML in your browser. From here, you can import your saved XML file into Excel 2007 as follows:

1) In Excel, click on the Data tab

2) Data -> From Other Data Sources - From XML Data Import

3) Click a cell where you want to import the data to

4) Save as, using the id of the last tweet

Save Tweets

 

Tweets URL

 

The reason I include the last Tweet id# is to make it easy to archive next time, starting where I left off and using the following syntax:

http://twitter.com/statuses/user_timeline/account.xml?since_id=6839319097

 

If you look at the Excel sheet you will see that the last tweet had an ID of 6839319097. This will download an XML version of all my tweets since then. Now I have a proper archive of my tweets that I can search on :-)

From here, you might want to take a look at the TweetSharp API - a complete .NET library allowing you to build Twitter applications in C# and .NET 3.5. I've started reading a great book on the topic: "Professional Twitter Development with Examples in .NET 3.5" by Daniel Crenna.

kick it on DotNetKicks.com

Tags:

twitter




Follow me on Twitter Two weeks ago I decided to prep my development VMWare Workstation in anticipation of the yet-to-be-announced SharePoint 2010 beta 2 release. After some futile attempts at installing W2K8 server, I realized that it was time to upgrade my VM software from version 6 to 7. After forking out the $99 (well worth it IMHO), I encountered the first hurdle when attempting to create the VM: my machine was not "VT enabled"... Apparently my host machine, which is a HP dt5000 desktop with 8GB of RAM and two quad cores wasn't up to the task :-O VT stands for Virtualization Technology and it's basically the processor equivalent of a V8 Dodge Challenger.

Some machines are VT-capable but are not VT-enabled when shipped. It's pretty common for laptops not to have this enabled. I called HP Support and ended up re-booting my machine and updating the BIOS to enable VT-Threading. Not so long ago, PC support technicians would respond to such a request with "do it but keep a fire extinguisher handy"...

Here are my machine specs...

Intel Core2 Quad CPU Q9450 2.66GHz 4 cores
Bios: American Megatrends 5.16 6/19/2008
Vista Ultimate 6.0.6002 SP2 Build 6002

 

...and the steps to perform this task - steps should be similar irrespective of the machine:

1. Turn off the PC and then again turn on the PC
2. After you get the HP logo screen immediately keep tapping the f10 key after the HP logo screen to enter in to BIOS set up screen
3. In the BIOS set up screen select the “Power” tab
4. Under the Power tab you will find the option “Virtualization Technology”
5. You need to enable it and then press f10 key on the keyboard to save and exit
6. Re-start machine

 

From the moment PDC09 began, the blogosphere has been alight with posts about installing this beta, so I'm not going to give overly-detailed instructions. Instead, I want to focus in on the gotchas that can make this an unpleasant experience for non-admin devs like myself. I'm also providing the links you need at the end of this post.

Developer in Admin Role As I write, I have just (successfully) re-created the install of SharePoint on my VM for the third time, in an efort to get this right. Previous attempts resulted in various errors, which though unforseen, were still my fault. One tip: I use VirtualCloneDrive to mount my ISO (DVD) images when creating VMs and it works on 64-bit. I also use ClamWin Anti-Virus for 64-bit. Create a strong password for your (admin) account with a mix of at least capital and small letter and numbers - you'll see why in a bit.

After the OS is installed, if you start getting license activation errors in the log, go to Start -> Control Panel and click on the "Change Product Key" link. When prompted, enter your valid licensed product key and the product activation will complete successfully.

You may also want to install the KB 971831 hotfix which "provides a method to support the token authentication without transport security or message encryption in WCF is available for the .NET Framework 3.5 SP1."

Now it's time to install SQL Server 2008 - 2005 will work also but involves different patches:

Script to open SQL Server ports:
http://support.microsoft.com/default.aspx/kb/968872

SQL Server 2008 SP1:
http://bit.ly/9QGGhX

CU2 for SP1:
http://support.microsoft.com/kb/970315

Add your admin account in SSMS and grant permissions for the following roles:

* securityadmin fixed server role
* dbcreator fixed server role

Important: If you plan to run Windows PowerShell cmdlets that affect a database, this account must be a member of the db_owner fixed database role for the database.

Next, grab Powershell 2.0 and install it. The SharePoint Pre-Requisites checker failed on this for me several times because of the older version of Powershell being present.

Install Menu

 

Next install SharePoint 2010. When the SharePoint Server 2010 menu appears, first click on the "Install software prerequisites" link. After this successfully completes, click on the link to actually install SharePoint Server. Choose Server Farm and Complete from the wizard menu options. This is the part that catches most people. The terminology here leaves a lot to be desired and I'm surprised that it's still being used in this version - <rant>they let the marketing assholes rename almost everything else so why stop there?</rant>

Important: Do not run the Products and Technologies Configuration Wizard after the wizard completes.

Install Type

 

With the 2010 version we cannot automatically run everything with a local account. This is retarded because in most cases people do not want to set up AD and DC for a simple dev VM. Luckily, there is a workaround with Powershell - just follow the simple steps and use the strong password we created earlier, when prompted.

Now we can run the Products Configuration Wizard from the Start menu and use our local account when prompted for such info by the wizard. On completion, you will be presented with the Farm Configuration Wizard - take the dummies option (default) and you will be led by the reins to the complete setup of your site collection and top level home site. This is a huge improvement over the 2007 version. What's even better is that with the introduction of the new Service Application Architecture we no longer have to go through the process of creating the now deprecated Shared Services Provider (SSP).

Home Page
 

 

Next task will be to install VS 2010 Ultimate and SharePoint Designer 2007...

UPDATE - 12-12-2009:

I have since been re-building my machine and I would like to point out something that I missed the first time around: before manually installing Powershell 2.0, you have to uninstall the 1.0 version that comes with the OS. You can do this by clicking on the 'Remove Feature' link in Server Manager.

kick it on DotNetKicks.com




Incorrect Format

 

Here's the scenario: I'm building a basic 3-layer Web application for a client with business and data layers. Queries are performed in stored procedures, just basic ADO.NET. The table I am attempting to insert a record into has a range a field types such as strings, ints, decimals, etc.

If the user is entering integer or decimal values via texboxes, which is usually the case, then you have to expect either no data or a string of possibly mal-formed data. You must filter out the mal-formed data with validation and/or convert the resulting input data to the expected database type.

If you have a database field called SquareFeet of type int and you attempt to insert the following in your code-behind insert method, you will probably see this error:

// Results in error message
AddSomething(int squareFeet)
{
    Convert.ToInt32(SquareFeetTxtBox.Text.Trim());   
}

 

You must be careful if you are trying to fetch, say, an int or decimal as input:

// Correct way if SquareFeet field is an int
int squareFeet
if (int.TryParse(squareFeetTxt.Text.Trim(), out squareFeet))
    squareFeet = Convert.ToInt32(squareFeetTxt.Text.Trim());
else
     squareFeet = 0;
// Now insert the value as part of the record

 

// Correct way if SquareFeet field is a decimal
int squareFeet
if (decimal.TryParse(squareFeetTxt.Text.Trim(), out squareFeet))
    squareFeet = Convert.ToDecimal(squareFeetTxt.Text.Trim());
else
     squareFeet = 0.0m;
// Now insert the value as part of the record

 

References

Refer to these links for the differences between Convert.ToInt, int.Parse and Int.TryParse:
http://dotnetperls.com/int-parse-conversion
http://dotnetperls.com/int-tryparse

Refer to this link for an explanation of the 0.0m decimal syntax:
http://msdn.microsoft.com/en-us/library/364x0z75(VS.80).aspx

Moral of the Story
If you are learning any language, your first priority must be to understand the types thoroughly. Resist the temptation to gloss over the grammar just to get to the fancy stuff! :-)

kick it on DotNetKicks.com

Tags: , ,

ASP.NET | C#