Private Sub ParseName(ByVal strInput, ByRef strFirstName, ByRef strLastName)
Try
' Split the string into it's constituent words
Dim strSplitName1() As String = strInput.Split(New Char() {" "})
' Ensure any leading or trailing spaces are trimmed within each word
Dim intIndex As Integer = 0
For intIndex = 0 To strSplitName1.Length - 1
strSplitName1(intIndex) = strSplitName1(intIndex).Trim
Next
' If only one word was found, treat it as a last name, with no first name
If (strSplitName1.Length <= 1) Then
strFirstName = ""
strLastName = strSplitName1(0)
Return
End If
' Check the first word for a title
If ( _
(String.Compare(strSplitName1(0), "Mr", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Mr.", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Mister", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Mrs", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Ms", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Ms.", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Miss", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Dr", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Dr.", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Sir", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Professor", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Prof", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Lord", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Lady", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Rev", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Rev.", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Reverend", True) = 0) OrElse _
(String.Compare(strSplitName1(0), "Judge", True) = 0) OrElse _
False _
) Then
' A title was found, so the second and last words should be first and last name respectively
If (strSplitName1.Length > 2) Then
strFirstName = strSplitName1(1)
strLastName = strSplitName1(strSplitName1.Length - 1)
Else
' Only a title and one other word was found, so treat the other word as a last name
strLastName = strSplitName1(1)
End If
ElseIf (strSplitName1(0).Length = 1) Then
' The first word is likely an initial, so use the first non-length-of-1 word as the last name
strFirstName = strSplitName1(0)
For Each strWord As String In strSplitName1
If (strWord.Length > 1) Then
strLastName = strWord
End If
Next
ElseIf (strSplitName1(0).Contains(",")) Then
' Check the first word for a comma, if it contains one, it's likely to be 'Last, First' format
strFirstName = strSplitName1(0).Replace(",", "").Trim()
strLastName = strSplitName1(1)
Else
' It's most likely to be a "First (Middle(s)) Last" format, so simply use the first and last words
strFirstName = strSplitName1(0)
strLastName = strSplitName1(strSplitName1.Length - 1)
End If
Catch ex As Exception
'EventLogger.LogException(ex)
End Try
End Sub
#!/usr/bin/perl -w
# To install the Flickr perl library on OSX with macports I do:
# sudo port install p5-flickr-api
# On Linux there's a similar package.
#
# Then to get Flickr::Photoset I do:
# sudo perl -MCPAN -e 'install Flickr::Photoset'
use Data::Dumper;
use Flickr::Photoset;
use Flickr::Photo;
use LWP::Simple;
use strict;
my $params = { api_key => 'your api key'};
my $info = {};
my $photoset = Flickr::Photoset->new($params);
# specify a photoset
if ($photoset->id({id => '72057594072478931'})) {
my $title = $photoset->title;
my $owner = $photoset->owner->real_name;
my $photos = $photoset->photos;
foreach my $p ( @$photos ) {
my $id = $p->id;
my $sizes = $p->sizes;
foreach my $s (@$sizes) {
if ( $s->{'label'} eq 'Original') {
$info->{$id} = {
source => $s->{'source'},
title => $p->title,
server => $p->server
};
my $ret = getstore(
$s->{'source'},
$p->title.'_'.$id.'.jpg'
);
print 'response was '.$ret.' for '.$p->title."/n";
}
}
}
}