Monday, May 23, 2011

UtahPolitics Retweeter

Phil Windley's Technometria | A Retweeting Twitterbot in Perl

#!/usr/bin/perl -w
use strict;

use Net::Twitter;
use DateTime;
use DateTime::Format::HTTP;
use Fcntl;
use SDBM_File;
use File::Copy;

my $dt = DateTime->now;
$dt->subtract( minutes => 60);

my $class = 'DateTime::Format::HTTP';
my $since = $class->format_datetime($dt);

my $today_string = $dt->strftime("%M");
my $seen_dir = "./seen";
my $seen_file = "$seen_dir/latest.db";
my $backup_file = "$seen_dir/$today_string.db";

# make a backup of the hash and open it
unless(-e "$backup_file.pag") {
copy("$seen_file.pag","$backup_file.pag");
copy("$seen_file.dir","$backup_file.dir");
}

my %seen;
tie %seen, "SDBM_File", $seen_file, O_CREAT|O_RDWR, 0644 ||
die "Can't link to $seen_file, $!\n";

# set your own username and password here
my $user = 'put_your_twitter_screenname_here';
my $password = 'put_your_password_here';

my $twit = Net::Twitter->new(
username=>$user,
password=>$password,
source => "Utah Politics Retweeter",
clientname=>"UtahPolitics ReTweeter");

# find replies
my $retweets = [];
my $twit_replies =
$twit->friends_timeline({since => $since, count=>100}) ;

foreach my $reply (@{ $twit_replies }) {
my $text = $reply->{'text'};
my $id = $reply->{'id'};
my $name = $reply->{'user'}->{'screen_name'};
print ".";
if($text =~ m/utahpolitics|#utpolitics/ &&
! $seen{$id}
){
unshift @{ $retweets},
{'name' => $name,
'id' => $id,
'text' => $text
} unless $name eq $user;
}
}

print "\n";

foreach my $retweet (@{ $retweets }) {
print ".";
my $status = "(@".$retweet->{'name'}.") ".
$retweet->{'text'};
my $code = $twit->update($status);
$seen{$retweet->{'id'}} = 1 if $code;
}

print "\n";

1;

News of the day

Joplin tornado kills 89; toll could climb

Pile of debt would stretch beyond stratosphere | Reuters

Gold & Silver Coins to Be Legal Currency in Utah | The Blaze

Herman Cain announces presidential bid | Iowa Caucuses

Tim Pawlenty announces presidential bid - The Washington Post

Newt Gingrich says he's an outsider: 'I'm the people's candidate' - latimes.com LoL, no you're not.

Miami turns heat up against Bulls in Game 3: Fan reaction - NBA - Yahoo! Sports  Miami 2; Chicago 1

 

 

Saturday, May 21, 2011

Setting up a Twitterbot–UTFood

I have had this idea for the last while that I could put together a Utah Food and Restaurant Review twitter postings.  I think the hashtag #utfood would be good to search and post.  I just spent a couple hours trying to put one together.
http://twitter.com/#!/UTFood
I got the idea from #utpol hashtag and what they do.  This isn’t nearly as good and has it limitations between Yahoo! Pipes and Twitterfeed.
I followed this tutorial on how to set them up.  And after some tweaking I think I am close.  If anyone would test the #utfood hashtag out it would be great.
Next – how to aggregate which restaurants are getting good, bad, or whatever reviews.

OnStar Sweepstakes–Alternate Entry

(2) Alternate Means of Entry: Hand-print your complete name, address, city, state, zip/postal code, email address, date of birth and phone number on a 3"x5" piece of paper and mail your entry via first-class mail in a No. 10 business-size envelope with sufficient postage to: "ONSTAR PUSH-ON SWEEPSTAKES," P.O. Box 1202, Franklin, TN 37065. One entry per outer envelope. Mail-in entries must be postmarked by May 31, 2011, and must be received by June 6, 2011. Limit three (3) entries per person, regardless of entry method. No pre-printed entry forms allowed. Proof of mailing does NOT constitute proof of receipt. LIMIT ONE ENTRY VIA THE BLUE ONSTAR BUTTON PER VEHICLE.

http://www2.onstar.com/web/portal/pushon

Scribefire - test

I am using Scribefire to test the availability of writing in a blog.  It is a Firefox extension that allows you to add posts to your blog.  This is my first time using it.  I don't know whether I am a fan or not.  My first impression is that Microsoft's Live Write is better than this.  The Live Writer has a very, very friendly interface.  It didn't require me to hit F8 - I know hard right.  Live Writer has a template of the blog and how it is going to be presented....This one I'm guessing just like blogger. 

Blogger vs BlogIT vs Scribefire vs Window's Live Writer

Clear winner so far is the Window's Live Writer.

Friday, May 20, 2011

Test from Windows Live Writer

This is a test to see how the Windows Live Writer works.  So far I haven’t had much success with the other blog writing software.  The BlogIT for Facebook is a total farce.  Hopefully this will work much better. 

Resume

I just posted my resume on the site.  I look at it and I feel like it is a wall of text that crits you for 9000.  It looks ok on 2 pages of paper, but on the web it isn't so flattering.

At work, I am learning more html, email marketing, and putting together an email campaign.  Hopefully, it will add sales.

another test - blog it fb

My last test showed that blogger posted 3 times from blog it. not a good option so far.

Test from Blog It in Facebook

I am testing out Blog IT app on Facebook. I have created 3 new blogs and am going to try and keep them active and going. I know...create a new blog...so original...well either way I can see which one I like for what and why.

Jeff