Archive for web 2.0 Social Networking for Endurance Athletes

Posted in Health/Fitness, Social Networking with tags , , , on October 7, 2008 by webzealot

Social networking websites are all the rage these days, so it makes sense that we would eventually start seeing sites directly at specific sectors of users. is one such site, with a focus on the triathlon sports: running, swimming, and cycling.

I joined up a couple weeks ago and have had some time to go through it and live with it on a daily basis, and so far I am pretty impressed… But first the background… DailyMile is run by its two founders Ben Weiner and Kelly Kroevec, two fitness buffs who had the foresight to see there might be a future in combining their love of fitness into a combination workout log and social site.  And so progress began in May of 2008.

DailyMile is visually intuitive, and has all the “gee-whiz” web 2.0 feel that folks are used to on sites like FaceBook and Twitter.  They are still in invitation-only mode, although it looks like most anyone who asks will get an invite (hey, they accepted me, right?).  For a site that’s only been up for a few months, I have yet to encounter my first script or server error.

The site functions like a light weight workout log.  There are any number of online logs out there, and some are better than others.  DailyMile keeps it pretty simple… Enter your workout, how far you went and for how long… No need to wax eloquent about weather conditions, heart rate, diet, etc etc.  Just KISS… Keep It Simple Stupid.  I like that.  It’s really not a log for stat geeks, and endurance athletes tend to be big stat geeks.

You can add friends and follow their workouts as well, and they can follow yours.  You can comment on workouts posted by others…  There is the possibility to get some good advice and training critiques, and watch others make mistakes.

I will say at this point the total number of folks using the site seems low… Seems like I am seeing the same two or three dozen folks all through the site, but I guess that’s to be expected.  For the most part I would say the user base leans toward the novice side of things.  Lots of first time marathoners and triathletes, but overall probably a pretty good cross section of the general endurance athlete population.

The site does lack a couple things that some other networking sites have.  First, there doesn’t appear to be a phone interface.  Log into the site on your Blackberry and the site is virtually unusable.  Also, there is no means for posting messages to the site via SMS or email, or to get SMS alerts delivered to your phone.  Minor complaints, but that sort of functionality is becoming the norm these days rather than the exception.

One issue I’ve noticed with the site is the inability to edit ALL of the information for previous workouts.  I posted a run to the site, but made a mistake and posted it for the wrong date.  Well, there doesn’t seem to be a way to go back and fix it now.  Another oddity is the “points system” the site uses.  People who post events, or answer questions in the forums are awarded points.  However, there does not look to be a way to figure out how many points a person has earned.  And not that it matters as there doesn’t seem to be much solid information on the site even explaining what the points are for anyway.  I suspect this may be a beta feature that has only been partially developed.

But all-in-all seems very complete, polished, and functions very well, and I for one certainly plan on continuing to use it!


PHP Script for parsing inbound email and saving attachments to a web host

Posted in Social Networking, Web Programming with tags , , , , , , on July 18, 2008 by webzealot

Ever wondered how BrightKite, TwitPic, and some of these other Web 2.0 websites have managed to reverse engineer email?  It used to be that websites would send YOU email, but that’s not all that exciting anymore.  Newsletters, notices, and alerts generated by web scripts are pretty common in even the most mundane of websites.

The trend recently has been to flip email on it’s head.  Now people can email (or send SMS text) to a specific address, and the contents of that message can be instantly parsed and posted on a website.  Particularly intriguing to me was the ability of a site like BrightKite or Flikr to save an attached image, more or less instantly, and have it post to the web.

That got me to wondering… How are they doing that?

As a long time ASP coder, I could see lots of trouble ahead.  In the world of Windows hosting, there are some very wide chasms between web services, and email services.  I asked around, looked high and low, and tinkered.  To make a long story short, I don’t think there is any way, or at least any good way, this functionality can be implemented through ASP.  I could be wrong about that, but I sure couldn’t find even a hint of a way to do it.  If I’m wrong, I would love if somebody could please respond and set the record straight.

What I did find is that this is NOT the case in the world of Unix and PHP!  In fact, PHP has many very nice tools to bridge the gap between email and web hosting… Many of these nifty toys can be found at the website.  So, I dove in and started playing!

What I came up with was the following script.  To give proper credit, the main function (called “parsepart”) was originally written by some fellow in the UK named John… That’s all I know about him, and his script is posted on the site along with others.  I did modify his script in a few spots, specifically in decoding the file name of any attachments.  But this script is a foundation for doing what TwitPic, Flikr, FaceBook, and others are doing.  I looked and played long and hard to come up with this… I hope somebody else can benefit from it as well…  Also, this doesn’t handle SMS, just email.  SMS is a task for another day!

//script will fetch an email identified by $msgid, and parse its parts into an
//array $partsarray
//structure of array:
//$partsarray[<name of part>][<attachment/text>]
//if attachment- subarray is [filename][binary data]
//if text- subarray is [type of text(HTML/PLAIN)][text string]

//$partsarray[1][attachment][filename]=filename of attachment in part 3.1
//$partsarray[1][attachment][binary]=binary data of attachment in part 3.1
//$partsarray[2][text][type]=type of text in part 2
//$partsarray[2][text][string]=decoded text string in part 2
//$partsarray[not multipart][text][string]=decoded text string in message that isn’t multipart

function parsepart($p,$i){
global $mbox,$msgid,$partsarray;
//where to write file attachments to:
$filestore = ‘[full/path/to/attachment/store/(chmod777)]’;

//fetch part
//if type is not text
if ($p->type!=0){
//decode if base64
if ($p->encoding==3)$part=base64_decode($part);
//decode if quoted printable
if ($p->encoding==4)$part=quoted_printable_decode($part);
//no need to decode binary or 8bit!

//get filename of attachment if present
// if there are any dparameters present in this part
if (count($p->dparameters)>0){
foreach ($p->dparameters as $dparam){
if ((strtoupper($dparam->attribute)==’NAME’) ||(strtoupper($dparam->attribute)==’FILENAME’)) $filename=$dparam->value;
//if no filename found
if ($filename==”){
// if there are any parameters present in this part
if (count($p->parameters)>0){
foreach ($p->parameters as $param){
if ((strtoupper($param->attribute)==’NAME’) ||(strtoupper($param->attribute)==’FILENAME’)) $filename=$param->value;
//write to disk and set partsarray variable
if ($filename!=”){
$tempfilename = imap_mime_header_decode($filename);

$partsarray[$i][attachment] = array(‘filename’=>$filename,’binary’=>$part);
//end if type!=0

//if part is text
else if($p->type==0){
//decode text
if ($p->encoding==4) $part=quoted_printable_decode($part);
//if base 64
if ($p->encoding==3) $part=base64_decode($part);

//OPTIONAL PROCESSING e.g. nl2br for plain text
//if plain text

if (strtoupper($p->subtype)==’PLAIN’)1;
//if HTML
else if (strtoupper($p->subtype)==’HTML’)1;
$partsarray[$i][text] = array(‘type’=>$p->subtype,’string’=>$part);

//if subparts… recurse into function and parse them too!
if (count($p->parts)>0){
foreach ($p->parts as $pno=>$parr){

//Open the connection to IMAP server
$mbox = imap_open(“{}”, “”, “password”)
or die(“can’t connect: ” . imap_last_error());

$status = @imap_status($mbox, “{}INBOX”, SA_ALL);

//$message_to_read = imap_uid($mbox, $status->uidnext – 1);
$msgid = $status->messages;

if ($msgid == 0) {
die(“No messages in inbox.”);

//fetch structure of message

//see if there are any parts
if (count($s->parts)>0){
foreach ($s->parts as $partno=>$partarr){
//parse parts of email

//for not multipart messages
//get body of message
//decode if quoted-printable
if ($s->encoding==4) $text=quoted_printable_decode($text);
if (strtoupper($s->subtype)==’PLAIN’) $text=$text;
if (strtoupper($s->subtype)==’HTML’) $text=$text;

$partsarray[‘not multipart’][text]=array(‘type’=>$s->subtype,’string’=>$text);

$header = imap_fetchheader($mbox,$msgid);
$obj = imap_rfc822_parse_headers($header);

//And heres the header info… Store it in a database, display it, whatever you like…

echo “Subject: ” . $obj->subject . “<br>”;
echo “From: ” . $obj->reply_toaddress . “<br>”;
echo “Plain Text: ” . $partsarray[‘not multipart’][‘text’][‘string’] . “<br>”;
echo “Text: ” . $partsarray[1][‘text’][‘string’] . “<br>”;
echo “Attachment file name: ” . $partsarray[1][‘attachment’][‘filename’] . “<br>”;

//here you can respond back with a confirmation email to the sender…
$headers = “From:”;
imap_mail ($obj->reply_toaddress,”Thanks for posting!”,”Your message was received!”,$headers);

//here we delete the message once parsed, clean out the mailbox, and close it all up…
imap_delete($mbox, $msgid);

I’ll be the first to admit I’m a bit of a PHP hack, and there may be better ways of doing this… But this script, in fewer than 150 lines, seems to do the trick!

Life with Twitter Continues

Posted in Social Networking with tags , , on May 4, 2008 by webzealot

The very first post in this blog was about my first week with Twitter. If you’ve read it, you know I sounded a bit skeptical. I wasn’t really sure I “got it” as far as what all the hype and hub-bub was about.

So now that I have been using Twitter for a bit, I thought maybe it was time to revisit the topic… And the truth is, I’m not sure my opinion has changed. I’m still not sure I get it. But, I am using it. Using it a lot in fact. And recommending it to others. Just call me a walking/talking dichotomy. Here I am referring my friends to this thing which I myself seem strangely skeptical of.

But it does have its hooks in me. I check it just about every day, usually several times a day. I am following close to 50 people now, and for some reason I have managed to attract nearly 100 followers of my own. I have installed a couple of Twitter clients, and I occasionally find myself texting in updates via my BlackBerry.

So what gives? I have given it some thought, and I can only come up with one conclusion. It’s ego. Yeah, I hate to admit it, but that’s what I think is going on here.

I’m not proud of this mind you. But the fact that there are nearly 100 folks out there (most of whom I have never met) who care enough to read short little updates about me several times a day… Well… You’d get a big head too. Now I realize that most (okay, maybe all) of my followers are just skimming my updates for something that catches their eye. For the most part I’m sure they are ignoring what I write (with the exception, of course, of my Mom, but just the thought that maybe, just maybe these people care… Boom! There, my head just grew two sizes.

I can see where Twitter does have some practical uses. My Mom does now get a virtual play-by-play of my life, probably more so than she does in our weekly phone calls. Usually she will ask “So what’s new?” to which my inner-teenager rises up with the stock “Oh, nothing really.” Now with Twitter on the scene, I find she asks me questions that take me a second to figure out… Then I realize “Oh yeah, I posted that on Twitter…” So, she’s probably learning more about her grandchildren than she is ever likely to learn from me directly!

But aside from the practical (or impractical) purpose of Twitter, there was the looming question in the back of my mind… How does it make money?

The answer dawned on me about a week ago. Simply put, it doesn’t. At least not yet. What Twitter is all about (and I suspect a great many other of these little nifty Web 2-point-oh aps) is that what this is really all about is eyeballs. Get lots and lots of traffic on your site. Make it indispensable. Then when the time comes, and you have a proven track record of a few millions visits per day, a player like Microsoft, or Time Inc., or Google will swoop in and write the big check. If you are willing to sit back and wait for that day, then the paycheck can be big… Big enough to justify the lack of revenue leading up to that point. That seems to be pretty much the way it played out for YouTube, MySpace, and others. It’s the Field of Dreams principal. “Build it, and the money will come…” Or at least you hope so.

In the meantime, I dig Twitter. It has grown on me and become part of my daily routine. Enough so I don’t mind that it may be my set of eyeballs that helps to make somebody a millionaire some day.

My First Week with Twitter

Posted in Social Networking with tags , , on March 21, 2008 by webzealot

twitter.pngSo after all the hype and hub-bub from the TWiT Geeks, I finally decided to check out Twitter. I mean, seems like half the world must be on it based from all the hyperbole.

Well, yeh, everyone is, if your world is somewhere around 950,000 folks.

I signed up Monday. Sign-up is quick and easy. What’s not so easy is figuring out exactly what happens next. All you see is a web form that asks you what you’re doing, and only gives you 140 characters to do so. Hmm. Okay.

So, I started adding friends. Started with Leo Laporte. He’s the only person I know for sure is on Twitter, although he doesn’t know me from Adam. Then, I looked at who his friends are, and I recognized some names. Still, none of these people know me, but that’s okay.

I posted a few things. Nothing exciting. Then I get an email. Somebody is following me… On Twitter? Yes, on Twitter! Then another email. Than another…

Now, after my first workweek, I am following about 30, and being followed by about 20.

On top of that I was on Steve Gillmour’s NewsGang podcast on Thursday. A brush with fame? Hardly. But it was fun.

Okay, I think the hype is more than the reality. Twitter is a blast. It really is. But is it all that? You can make a few friends, and there’s some interesting dialog… But color me skeptical.

I’ll keep using it and see what comes of it.

Come check me out at