Social Networks
Building a Twitter Status Cloud
Submitted by Aldon Hynes on Fri, 02/06/2009 - 23:09Last week, I produced a word map of the statuses of the people I follow on Twitter. Willem Kossen asked if I could release the program under an open source license. Actually, I’ll do something I hope some of you will find even more helpful. I’ll produce it free, public domain, including my comments about how I put this together.
I actually started off trying to come up with some nice GraphViz images of various social networks I’m on. (For more about GraphViz, read my blog post Installing GraphViz in Drupal and Using GraphViz, a Brief Tutorial. You may also want to check out some of the GraphViz images I’ve uploaded to Flickr and a great Visualization of the Madoff Secruities “Feeder Funds”.
From my Flickr images, you’ll see that I like to create images of social networks using GraphViz, and I thought I would try to create an interesting image of my Identi.ca network. I like working with Identi.ca because it is open source and it uses open standards. For example, you can get my network on Identi.ca as a FOAF file. This is a standardized XML format that can easily be parsed.
In PHP, you can read a website, if you have curl installed fairly easily:
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,'http://identi.ca/'.$target.'/foaf');
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
$xmlstr = curl_exec($ch);
curl_close($ch);
This little snipped of PHP opens a channel which I’m calling $ch. It goes out and gets the FOAF file for whichever $target I specify. The result is saved in a string called $xmlstr.
With this, you can then parse the XML into an easy to use structure using SimpleXML.
try {
$xml = new SimpleXMLElement($xmlstr);
} catch (Exception $e) {
print "Skipping " . $target . "\n";
}
I use a ‘try’ around the calling of SimpleXMLElement in case the $xmlstr doesn’t contain valid XML. In my case, I just skip the records that don’t have valid XML.
The next part is where I’ve always needed to explore a little bit to make sure that I get the right syntax. XML documents can be multiple levels and they get mapped into structures within structures within structures in PHP with the SimpleXMLElement function.
In this case, the information about the first person in the FOAF document can be found as
$xml->Person[0]->holdsAccount->OnlineAccount->accountName[0];
The people that the person knows can be found by incrementing the index of Person. So, I wrote a loop to go through the structure and write out all the relationships in GraphViz format. I also built a list of other FOAF files to extract the relationships so I could get additional degrees of separation.
Unfortunately, I have a lot of friends on Identica, and most of them have lots of friends as well, and the graph became unmanageable. I kicked around building some filters to only track special friends, but didn’t come up with anything good, so I set aside the identi.ca graphing.
MyBlogLog also provides FOAF files. In addition, the MyBlogLog FOAF files includes links to other services that users have specified. Unfortunately, the MyBlogLog FOAF files does uses namespaces which complicates the parsing. In addition, I probably have even more friends on MyBlogLog than I do on identi.ca, so I set that aside.
Which takes me to Twitter. Twitter also gives you the ability to extract information in XML. As an example, you can get my most recent 100 friends on Twitter, including their name, screen name, location, description, and most recent status. For the status, there is information such as what it says, when it was created, what tool was used, etc.
As I noted, you can get up to 100 friends worth of statuses at a time. If you have lots of friends, you need to loop through all of them.
So, I used the curl and SimpleXML processing above, together with some extra looping to pull all the statuses. With that, here is the PHP program that I used:
<?php
$page = 1;
while(1) {
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,'http://twitter.com/statuses/friends/ahynes1.xml?p
age='.$page);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
$xmlstr = curl_exec($ch);
curl_close($ch);try {
$xml = new SimpleXMLElement($xmlstr);
} catch (Exception $e) {
exit;
}$i = 0;
$uname = $xml->user[$i]->name;
if ($uname == '') exit;
while($uname != '') {
$status = $xml->user[$i]->status->text;
print $uname . " : " . $status . "\n";
$i = $i + 1;
$uname = $xml->user[$i]->name;
}
$page = $page + 1;
}
?>
As you can see, you simply put the name of the person you want in the URL and off you go. Caveats: You don’t need to login to Twitter to be able to do this, and you can do it for anyone, providing the people they follow don’t have their Tweets protected. However, you will get limited if you try to do more a lot of pages at the same time.
What I did was save the results to a file that you can wee here. The next step was to paste the text into Wordle.net I then took a screen print of the page and saved it as an image. I could probably search around for some other word cloud software and do that as part of the process, but this is good enough for now.
A minor change and this could be used to show the description of the people that I follow, or the people that follow me. Someone else has already set up a word cloud generator like that, and you can see the word cloud of the bios of people that follow me at TwitterSheep
So, with that, here is my Friday evening word cloud of statuses of the people that I am following, thanks to a little PHP using curl and SimpleXML as well as the word cloud software at Wordle.net:
SimpleXML PHP and Top EntreCard droppers
Submitted by Aldon Hynes on Sat, 01/31/2009 - 12:41Today is a day that EntreCard has asked people to highlight those that have dropped the most cards on their site. It is easy to get this as an RSS feed, and I could have just done something like thrown it into the Drupal Feed Aggregator and put it up as a block. Or, I could have used one of many different widgets to highlight top droppers.
Instead, I’ve been playing with parsing XML with using SimpleXML in PHP. I’ll be writing more about this later. For the time being, let me present my top droppers, as retrieved as an RSS feed from EntreCard, formatted for this blog, along with some of my own comments.
Why Blog? Maslow’s Hierarchy of Needs.
Submitted by Aldon Hynes on Mon, 01/26/2009 - 15:34Last week, in a discussion about how to make sure that students are using the Internet in a safe and appropriate, the idea that everything one the web was put there with an agenda was brought up. The idea was that by helping children understand the agenda of the writer, the children could make better choices on what to do with the information posted.
I’m known in that group as a blogger, and it felt like people were wondering about my agenda in writing what I do online. I’ve often written about why people blog, but I thought it would be good to take another view at this, in the context of the agenda’s of the writers.
I glance at the tweets my friends are writing and at the top of the list is someone talking about the Cavs being undefeated at home so far this year. Yes, the person who wrote that had some agenda in writing it. It isn’t the same sort of grand agenda that people think about when they talk about making sure children understand the agenda of the writers of websites they visit, but it is part of the continuum.
Over on Facebook, a person writes about her frustrations of having to fix things breaking at home while money is tight during a recession. Again, there is an agenda there, but it is much different than the agenda of other sites.
Is there a good way to organize and think about these agendas? It seems like Abraham Maslow may provide some useful insights from his famous paper, A Theory of Human Motivation. We all have a hierarchy of needs, and what motivates us in what we write online is perhaps no different than what motivates us in other aspects of our lives.
The most primitive needs are physiological. We need food and shelter. Some people write for money, and some of that may simply be to put bread on the table, or simply to have a table that bread can be put upon. Amongst blogs, there are plenty of Make Money Online blogs. While they may be seeking money for other reasons as well, it seems like they fit in this category.
When you go to most online news sites, they are part of organizations that are trying to make money, via advertising to pay their staff. Again, this gets to those primitive needs of money for food and shelter, and also, perhaps, for a little bit more.
Any site that depends on advertising to make money is going to be concerned with visitors. They will want to give visitors what they want, entertainment, having their views reinforced, etc. They may claim to be ‘objective’, because that might be another quality that visitors are looking for, but it is about meeting basic physiological needs.
The next level up is safety needs. We all need to feel safe. In political blogs, we often find people talking about safety. How do we remain safe from terrorists? How do we remain safe from people that would do away with our rights for their own benefit? We send messages about accidents on Facebook and Twitter, perhaps, in part, to let other people know of dangers so that they can remain safe.
Beyond our needs of safety, we have social needs. All this talk about social media seems to point to our social needs. We need friendship and a sense of self worth. We get that by having friends follow us on social media and by letting them know what we are up to. In exchange, they let us know what we are up to.
Above this, in Maslow’s hierarchy, we find aesthetic needs. I visit some wonderful artblogs that seem to deal with this.
So, how does this relate to blogging as well as appropriate uses of the Internet? It seems like people worry about kids that disregard safety needs in search of friendship. I don’t think this is something specific to the Internet, and we need to help people, both parents and children understand the relationships between friendship and safety.
And why do I blog? Well, it would be nice to make a buck here and there, and I do hope that some of my writing helps me land good jobs from time to time. However, I also recognize that being outspoken can be a hindrance in meeting physiological and sometimes even safety needs.
I would like to think that my blogging serves some sort of good, some higher goal. For me, much of it is about getting people more involved in their communities and addressing problems of government that thwart that.
In the end, however, perhaps I don’t have a great clear reason why I blog. Perhaps many of us don’t. Nonetheless, I’d love to hear other bloggers thoughts about why they blog and how it relates to Maslow’s hierarchy of needs.
Inauguration Reflections
Submitted by Aldon Hynes on Tue, 01/20/2009 - 10:39In the background, CNN blares on the television. On my social network feeds, friends talk about how they are going to celebrate this day. I hear phrases like “this moment in history” and “a changed America”. I hear the stories of common people that have traveled great distances to be at the inauguration. CNN interviews people on the mall and various people break out into songs, old songs, folk song, songs remixed to become songs about the inauguration.
I listen to stories about the Metro stations being overwhelmed with passengers, and about the cellphone system struggling to keep up with all the volume.
What are you listening to, watching, or reading? What is your experience of this day?
Updates:
As I listen to various broadcasts, I hear people talking about the tradition of the inauguration and I think about it as a great symbol to other countries of what Democracy can look like.
Update 2:
My RSS feed updates Twitter and feeds out to other sites as well. On Facebook, I received three interesting comments:
Christine Cavalier at 11:01am January 20
Aldon I'm watching on CNN, combined with Facebook. It's awesome.
Deborah White at 11:02am January 20
My, how our lives have changed. I also have both TV and CNN/Facebook livestreaming, plus my Blackberry for email.
Joyce Bettencourt at 11:04am January 20
me too.. think these media mashups that also inspire a shared viewing experience are great :)
Update 3:
Recording a local inauguration party on Woodbridge Snow Cam
The Ordination and the Inauguration
Submitted by Aldon Hynes on Sun, 01/18/2009 - 11:23The small old clock radio on the bed stand showed 5:00 AM as it jarred me awake with “NPR News Headlines”. The news of the hour didn’t register. All that I was aware of was how warm and snugly it was in the bed and how cold and dark it was in the bedroom. Kim rolled over long enough to ask if she could sleep a little bit more as I took my shower.
Slowly, I climbed out of bed and downstairs to turn up the heat in the house. Outside, it was three degrees. I took a little longer in the shower than usual as I tried to wake up. As soon as everyone was showered and dressed, we would be hitting the road for Manchester, NH to attend the ordination of an old friend.
As Kim showered, I briefly checked my email and a few blogs. The Speaker of the Connecticut House had recently appointed his predecessor to a $120,000 senior advisory role and the previous nights discussion about politics as usual had continued on long past when I went to bed.
Soon, we were all showered and out the door. Traveling up to New Hampshire in sub-zero weather in January was nothing new for us. We had done it in 2004 and in 2008 in an effort to make our voices heard in the Presidential Primaries. Today, we were going up in a different way, to make our voices heard in celebration, affirmation and support of our friend’s ordination.
Despite the cold, it was an uneventful trip north, stopping only for gas, coffee and bacon, egg and cheese sandwiches on rolls. The town of Manchester, NH looked pretty much the same as it had a year earlier, the only notable difference being a for sale sign on a diner which had hosted many presidential candidates.
While we had never been to Grace Episcopal Church in Manchester, it felt even more familiar. A bright red door greeted us as we arrived and the stained glass and deeper red cushions all reminded me of so many Episcopal churches I’ve visited in the past.
Yet what was even more familiar looking were the faces. Yes, a few of them were mutual friends of our friend being ordained. Yet what was more familiar to me were the faces of the common man. It was almost as if strains of Aaron Copeland’s famous composition had followed these sturdy New Englanders and omnipresent church ladies in from the bitter cold of their daily lives.
My ancestors had scratched a living out of the rock strewn farms of New England and I suspect with a little genealogical investigation, I could of have found at least one distant relative sitting in a pew near me.
This sense of my historical roots was mingled with another sense of history. The old Anglican service, complete with incense, reminded me of the great Christian traditions that have sustained so many of my ancestors as the lowly farmer took comfort from the words of his Priests and Bishops.
The processional hymn was a favorite of mine, “Saint Patrick’s Breastplate”. It is a very long hymn that seems to be rarely sung in its entirety except for very special occasions. This was a very special occasion, and I was glad to add my voice.
I bind unto myself today
The strong Name of the Trinity,
By invocation of the same
The Three in One and One in Three.
The bishop celebrating the ordination was The Right Reverend V. Gene Robinson. Bishop Robinson came from farmers that worked the land in Kentucky and he seemed the perfect Bishop for the occasion, bringing together the fanfare for the common man with the fanfare for church celebrations.
Yet Bishop Robinson faces a much more daunting task. As the first openly gay priest to be ordained a Bishop in the Episcopal Church, or in any denomination, he has become the center for the Church’s struggle with the role of homosexuals in the Church. Perhaps some of this is why he is providing the invocation at the Inaugural Celebration at the Lincoln Memorial. He had to rush off to catch a plane to Washington part way through the service.
One of the questions during the ordination was whether Grace felt “called” to be a priest. At times, I’ve considered becoming a priest, or even a monk, yet I’ve never had a clear sense of calling. As I struggle with my own career, I’ve often wondered about being called. Are we all called to do something? If so, what is my calling? How many people have a clear sense of calling? How many people get a chance to celebrate their calling the way Grace and all of us gathered to celebrate her calling?
My mind wandered to President-Elect Obama. Does he have a sense of being called to his role? Does Bishop Robinson have a sense of his calling going beyond the calling of being a Priest and a Bishop to being the focal point of an important discussion in the Church? The Old Testament Lesson was the section from Isaiah where Isaiah says, “Here am I; send me”.
Another important aspect of the service, which is common to so many Episcopal services, is when the celebrant turns to the congregation and asks if everyone will do all in their power to support the person being ordained in their commitment.
I wish that the swearing-in of the elected officials had a similar selection. Chief Justice Roberts, after swearing-in President Obama would then turn to everyone attending the Inauguration and say, “Will you who witness these vows do all in your power to support this person in upholding the Constitution?”
At Grace’s ordination, we all loudly proclaimed that we would support her, and I hope that all American’s will support President Obama in upholding the Constitution. Yes, we can, and should argue about what it really means to uphold the Constitution, but we should all be engaged in that discussion.
As an aside, through Grace, I’ve met Thomas Beasley on Facebook. Thomas describes himself as a ‘Prison Missioner for the Diocese of Florida and Interim Chaplin at Baker Correctional Work Camp”. Rev. Beasley recently joined Born Again American which seems to be the closest I’ve found to answering that question that I wish Chief Justice Roberts would ask all of us.
This leads to the sermon during Grace’s ordination. The Reverend Matthew R. Lincoln exhorted Grace to “Keep finding new ways to listen”. It seemed like an appropriate quote to Twitter. Kim and I first met online. Kim first met Grace online. Through Grace, I’ve met Rev. Beasley online. The Internet can be a powerful new way to listen.
Grace captured some of this is a beautiful response to an online community that both she and Kim are part of,
I said to my very Jewish best-old-friend-from-middle-school when she called to congratulate me the instant Shabbat was over and she could use the phone, one of the things I love about the 21st century is being told "Mazel tov!" on my ordination as a female Episcopal priest by a gay bishop who's about to go to the inauguration of the biracial President whose middle name is Hussein.
This would be a great summary of the ordination, in and of itself. However, we Episcopalians are used to an exhortation at the end of the service to go forth in the world in peace to do the work God has given us to do. The words of traditional Zimbabwe song that we sang at the end of the Communion brought in some of this sense of going beyond Manchester and beyond our country, out into the whole world.
If you believe, and I believe and we together pray,
The Holy Spirit must come down and set God’s people free.
Getting up at 5:00 AM to drive to New Hampshire, either for political campaigns or to celebrate the ordination of a friend can be difficult, but it can also be very rewarding.
Update:
For those who watched the "We Are One" concert, and didn't see Bishop Robinson, here are a few posts about him not being on HBO:
The invisible, inaudible Bishop Gene Robinson and
We Are (Minus) One.