krista and i are down at tryst and i'm overhearing two chicken hawks discussing iraq, iran and other foreign events. it's pretty funny to hear people who's outlook is so divergent from reality.
highlights:
as the poorman says there's only one good title for people like this: wanker.
after scouring the internet to find out how to do multipart post operations and finding nothing nothing, i decided to save someone else some time. the trick is that @ before the file name.
$fullflepath = 'C:\temp\test.jpg'; $upload_url = 'http://www.example.com/uploadtarget.php'; $params = array( 'photo'=>"@$fullfilepath", 'title'=>$title ); $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_URL, $upload_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); $response = curl_exec($ch); curl_close($ch);
had a good weekend. on friday we found the only restaurant that, at this point, i'd recommend in dc: amsterdam falafel shop, top your own falafel and eat some double fried fries. then we went and stocked away food so we wouldn't have to go out in the weekend's blizzard, that didn't really happen.
today was probably the worst day i've had, not because work was bad per se, but because i'm filling in for our receptionist and damn, let me tell you if ever there was a well earned day it's secretary's day. sweet baby jesus, i left a stack of unsorted mail on the desk, got through about half the faxes and just a even less of the whitehouse tour requests. i was doing stuff all day but i don't thinki finished anything. everytime i'd start to get going on something the phone would ring and i'd end up working on something else.
oh, and then all the anti-abortion wack-o's (who are here to mourn roe v wade) rolled into the office. you want to give us this rose in remembrance of all the not children? come on, you aren't even constituents, go bother someone else.
after my gallery albums got corrupted i started messing around with flickr and got hooked. i'd been pretty frustrated by gallery's rigid album structure, flickr's usage of tags and sets is much more to my liking. there's also an excellent api for those times when you need to roll your own app. the fact that they handle all the backup convinced me to throw down the $45 on a pro account.
now the task it to upload all of my photos to their servers. it's a good chance to go back and import all the old stuff that never made it into gallery. i'm starting with some albums i'd make using jason molenda's makethumbs shell script. i hacked together a perl script to parse the titles and descriptions from the description.txt file, upload the images, and add them to a set. click the read more link to view the script. i hope someone else may find it of use.
update: i finally got around to encoding it as valid html. copy and paste should work better.
#!/usr/bin/perl
use strict;
use warnings;
# upload a makethumbs album to flickr
#
# by andrew morton - http://drewish.com
#
# to use this script fill in the next three variables, then change
# to the directory with the makethumbs album and run it. email if
# you have problems.
my $flickr_email = 'your@email;
my $flickr_pass = 'secret';
my $photo_tags;
# shouldn't need to change anything below here.
# variables
my $flickr_key = '58ac590250ef4eeb81e6d853ee942034';
my @photo_ids; # id assigned after upload
my $config_file = 'descriptions.txt';
my $album_title; # album title
my $album_desc; # album description
my %image_title; # file titles
my %image_desc; # file descriptions
$|= 1; # auto flush
use Flickr::API;
use Flickr::API::Request;
use Flickr::Upload;
use LWP::UserAgent;
use XML::Parser::Lite::Tree::XPath;
ReadMakeThumbsData();
UploadToFlickr();
AddToNewSet();
print "All done.\n";
sub ReadMakeThumbsData() {
print "Loading makethumbs data from $config_file\n";
open(CONFIG, $config_file) or die "Can't open $config_file : $!\n";
# skip to short title section
while (<CONFIG>) {
last if /^\[short title\]/;
}
# suck up album title.
while (<CONFIG>) {
chomp;
last if /^\[longer page description\]/;
$album_title .= $_;
}
# suck up album description
while (<CONFIG>) {
chomp;
last if /^\[captions\]/;
$album_desc .= $_;
}
# suck up image titles
while (<CONFIG>) {
chomp;
next unless $_; # skip empty lines
last if /^\[descriptions\]/;
/^(\S*)\s(.*)/;
$image_title{$1} = $2;
}
# suck up image descriptions
while (<CONFIG>) {
chomp;
next unless $_; # skip empty lines
/^(\S*)\s(.*)/;
$image_desc{$1} = $2;
}
close CONFIG;
}
sub DebugPrintData() {
print("album title: $album_title\n");
print("album desc: $album_desc\n");
foreach my $key (keys %image_title) {
print "$key\n\ttitle: $image_title{$key}\n";
print "\tdesc: $image_desc{$key}\n";
}
}
sub UploadToFlickr() {
my $ua = LWP::UserAgent->new;
my $file;
my $id;
print "Uploading photos to flickr for $flickr_email\n";
foreach $file (sort(keys %image_title)) {
print "$file";
print "\n\ttitle: $image_title{$file}" if $image_title{$file};
print "\n\tdescription: $image_desc{$file}" if $image_desc{$file};
print "...";
$id = Flickr::Upload::upload(
$ua,
'email' => $flickr_email,
'password' => $flickr_pass,
'photo' => $file,
'title' => $image_title{$file},
'description' => $image_desc{$file},
# Everyone can view
'is_public' => 1,
'is_friend' => 1,
'is_family' => 1,
'tags' => $photo_tags
);
if ($id) {
push @photo_ids, $id;
print " assigned id $id\n";
} else {
print STDERR "Failed to upload $file";
}
}
}
sub AddToNewSet() {
my $api = new Flickr::API({'key' => $flickr_key});
my $response;
my $xpath;
my @nodes;
print "Creating set '$album_title' ...";
$response = $api->execute_method(
'flickr.photosets.create',
{
'email' => $flickr_email,
'password' => $flickr_pass,
'title' => $album_title,
'description' => $album_desc,
'primary_photo_id' => 3654245# $photo_ids[0]
}
);
$response->{success} or
die "Could not create the set : $response->{error_message} \n";
$xpath = new XML::Parser::Lite::Tree::XPath($response->{tree});
@nodes = $xpath->select_nodes('/photoset');
print " assigned id: $nodes[0]->{attributes}->{id}\n";
print "Adding photos to set...";
$response = $api->execute_method(
'flickr.photosets.editPhotos',
{
'email' => $flickr_email,
'password' => $flickr_pass,
'photoset_id' => $nodes[0]->{attributes}->{id},
'primary_photo_id' => $photo_ids[0],
'photo_ids' => join(', ', @photo_ids)
}
);
$response->{success} or
die "Could not add photos to set : $response->{error_message} \n";
print " finished.\n";
}
not much to say. went down to the protests. did the critical mass. it was all good fun. the one low spot that i would like to mention was the mutherfucking dumbass black bandana anarchists perched atop a bus stop trying to burn an american flag. personally, i'll never burn a flag or nor will i support it (that whole boy scout thing just made it taboo) but if you want to that's your business. but, watching them i couldn't quite make up my mind which was worse:
a) that the video footage of these morons was going to be used to represent the thousands of protestors that had come out
or
b) that the morons were too dumb to figure out how to light the flag on fire.
thinking about it a bit more, it was probably a combination of both. if they had, say, brought a cotton flag (instead of a synthetic one) or, say, soaked in gasoline it would have gone right up and that would have been that. instead they screwed around it for a good ten minutes letting the tv cameras get plenty of footage and giving the few republicans standing around a chance to do some (in my humble opinion) rather clever heckling. all i've got to say is fuck those guys. if the black bandana crew never showed up to another protest i'd be happy enough to piss myself.
we had an inch or so of snow today. dc is apparently even worse than portland when it comes to dealing with a bit of bad weather. that's pretty embarrassing when you consider that portland gets snow once ever ten years and dc gets it pretty much yearly.
i took my first snow-borne fixed gear ride home through the slush and snow tonight. it was actually pretty fun. traffic was super fucked again tonight so i did my fair share of riding between rows of stopped cars. i was just poking along trying not to wipe out.
in this town when it snows people just give up on traffic laws. stop lights apparently don't count if you might possibly skid if you considered stopping. i make sure to pull off for the tour buses full of republicans escorted by matching police cars with sires blaring and lights flashing. i wanted to be able to flip them off with two hands it just wouldn't have been prudent while riding, especially in the weather.
bush get's coronated tomorrow. i'm planning on hitting up the critical mass rides to celebrate. i plan on passing out copies of our last two issues. spaceman (who's in korea right now!) was good enough to ship them out to me.
funny-ness from back in portland:
rode to work today. had an interesting ride in this morning. when we got into town in was in the 70s, this week it's been in the low 30s. i'm not used to having to worry about skidding on the frost. the evening was much more fun. some dude decided to park his van downtown and tell the cops he had a bomb. as a precaution, they blocked off the surrounding blocks. by the time i headed home traffic was so amazingly fucked that i was riding from light to light between rows of parked cars. the hardest part was restraining myself from spitting on all the stalled cars with george bush stickers.
i've finally figured out how to walk through the metal detectors without setting them off. take big steps, i have no idea why it works, but it does. met one of the other new interns yesterday, strangely her name is also krista.
a funny exchange while walking around the building:
coworker: you can tell that they're republicans.
me: how's that?
coworker: the ties.
me: i didn't see them.
coworker: they were horrible. republicans have horrible taste in ties.
i got to spend some time writing replies to constituent mail. it's pretty tricky because you want to be sympathetic (it was anti-bush) but you have to be careful not to promise anything or offer up an opinion that doesn't jive with the congressman's.
went over to revolution cycles after work to buy a bike pump to replace the one i didn't bring. it's a cool shop staffed by some very nice people. i plan to take some zines by when the box of them arrives. i was pretty surprised at how much track stuff they had. i'll have to find someone out here to distribute zines and get them to sponsor us.
as i was walking over there krista called to let me know that her grandpa had died. he had the full set of cancers and was not doing well for the last few months. my heart goes out to her and the rest of the family.
i've had to do this enough times that it seemed worth putting up on the blog to reference.
' take the values from the specified field in the specified
' table and concatinate them into a comma separated list.
Public Function ConcatColVals(source As String, field As String) As String
Dim ret As String
' open a recordset, enumerate the records and build a string
With New Recordset
.Open source, Application.CurrentProject.Connection, _
adOpenForwardOnly, adLockReadOnly
If Not .EOF Then
ret = .Fields(field).Value
.MoveNext
Do While Not .EOF
ret = ret & ", " & .Fields(field).Value
.MoveNext
Loop
End If
End With
' return the value
ConcatColVals = ret
End Function
this morning i got my congressional id and off i went to the capitol tour training. they went through some of the construction history and then took us on the tour. i can't remember if i'd ever taken the tour but it was pretty cool. it probably helped that we had the tour guide trainer giving the tour (i have no idea how she manages to remember all the numbers and dates) but it's just an amazing building. i think i'll drag kirsta down there on thursday and try out the tour on her.
the bikes showed up today. it'll be real good to get out and riding again. i'm pretty done paying for the metro.
also, in finally finished grand theft auto 3: san andreas. it's one of the best video games i've ever played (and the $200 for the ps2 and game was some of the best i've spent). before coming to dc i kept talking about how i wanted to finish up a bunch of projects. i thinking finishing up a game i've been playing for two months counts as finishing a project... in a rather loose sense...
today was my first day in in congressman's office. it was pretty good experience all in all. started off with a quick tour of the office during which i was warned not to use the bathroom in the office (not really a problem as there's a men's room just down the hall). it just happens to share a wall with the congressman's personal office and the flushing sound is a bit... well... distracting.
i spent most of the morning sorting through mail and faxes (my single favorite fax was the one with NO MORE MEXICANS covering the bottom half of the page) and then learning to answer the phones. i now have inordinate amount of respect for the receptionist, jannet, at ppi, my old employer. without breaking a sweat she'd work four lines and talk to you across the counter. using only a single line i'm able to confuse the names of the caller and callee and then promptly transfer them to the wrong extension.
lunch was nice. niles, the intern coordinator, stuck his head in and asked if i was interested in going up to a reception for a little free food. i'd been looking forward to gobbling up a few of the crumbs that are dropped during the whole lobbying process so i jumped at the chance. on the way over he mentioned that if we hurried we might still catch lance.
apparently the discovery channel was one of the sponsors and they'd brought lance armstrong and his team in for a little pr. i was a bit surprised how natural it was to see him. i suppose it's just the way he comes off as a very humble, regular guy. he was sharing the stage was a ten or twelve year-old kid who was a five time cancer survivor (and one smart kid, i'm sure he'll be up to something important) and lance spent most of his time talking about how amazing the kid was and what he'd gone through. as athletes go he's probably the one i respect the most.
afterward i got to talking to niles about riding bikes and mentioned that my friend works at river city. it turns out he'd worked there a few years back and still knows most of the people who work down there. at least i know who to forward all the bike mail to now.
the afternoon consisted of sorting files into binders collecting just about every bit of position and legislation he's signed onto. it seems like i ought to complain about it but really it was one of those tasks that puts you on autopilot and then an hour later you realize your done.
i sat in on the staff meeting this afternoon, about half of it was over my head, i spent the time just trying to pay attention and soak up what i could. i don't know what i'll say at the end of the term but i could really dig a political job.
this morning i got my new shave and new shirt on and went down to see the office where i'll spend the next two and a half months. i'm pretty excited. getting off the metro and walking up to independence ave i finally got a good look at captial hill. until today i felt like i was in some generic east coast city, now it's pretty clearly washington dc.
kirsta and i made it safely to dc yesterday. we arrived at our apartment and were a bit suprised by it. it reminds me of the katherine house right after i first bought it. it needs a new coat of paint, different light fixtures and curtins. krista's first remark upon entering was something along the lines of "damn, i need another zanax".
this morning we decided to head out and do a bit of shopping. we'd heard that the crystal city was a pretty nice mall so we hopped on the metro to check it out. the only thing i can compare it to would be if you took park lane mall--scratch that--the strip mall anex, to park lane mall, removed the charm, burried it underground, and let it fester for a few years... we couldn't leave fast enough. the only up-side was that on the way down there we overheard some kids talking about how to get to the h&m. we stopped there on the way back and i was pretty impressed. i think those were the first new (non-bike) clothes i've bought in a year or so.
wandering back we found and stopped at: a really nice brew pub, an ethopian resturaunt, and a barber shop (it seemed to be straight out of grand theft auto, but after you play that game enough everthing seems to be straight from it).
sitting at the gate in pdx waiting for the plane. at some point they put free wifi in covering the entire airport. i've gotta say it's pretty cool.
we should be in dc by 17:00. i'm still getting used to the whole airlines-trying-to-charge-you-for-food thing. i've been flying southwest pretty exclusively for the last few years so being back on one of the old school dinosaur carriers is a bit of a slap in the face. i like the way southwest has some dignity, they don't try to sell you crappy ass airline food for an extra 5 bucks. if you want some food bring it on your damn self.