AndrewGioia.com | News The personal and professional webspace of Andrew Gioia. http://andrewgioia.com October 8, 2008 New MLB Gameday data project. <p>I've been scratching my head a lot lately over how to improve my fantasy baseball free agent/draft picks, but aside from reading articles and looking at Yahoo's sortable stats, I feel like I'm just not getting any better. About a month ago I started looking into getting detailed at-bat statistics to run queries on, with the hope of predicting streaks better, and came across some incredible resources with more data than I honestly thought even existed.</p> <p><a href="http://www.retrosheet.com">Retrosheet</a>, for one, has near-complete archived stats for each at-bat of every game going back to about 1953 (with some older years too), plus a ton of other data on players, parks, games, etc. While writing some scripts to parse that and put it in a working database, I found that the <a href="http://gd2.mlb.com/components/game/mlb/">MLB</a> actually puts up XML files with all of their Gameday information. Not only are the at-bat and detailed game stats there, but since like mid-2007 they've included the incredibly detailed <a href="http://tangotiger.net/wiki/index.php?title=PITCHf/x" target="_blank">PITCHf/x</a> data, with things like start and end velocity, break points, etc.</p> <p>Anyway, I decided to go with Retrosheet for all the historic data and managed to put everything from 1957 to 2006 into a MySQL database. Now, the hard part is writing a script to parse those XML files at mlb.com and update the database for 2007 and 2008, and then nightly after that, formatted like the Retrosheet data. I can't wait to start contributing to the <a href="http://www.hardballtimes.com/">awesome</a> <a href="http://www.baseballprospectus.com/">sabermetrics</a> <a href="http://fastballs.wordpress.com">community</a>, and once I get steamrolling on this I'll recount how I did everything and put up the scripts/database dumps for download. I was actually surprised someone hasn't released a Retrosheet-compatible database of all Gameday stats yet, but that's definitely the plan once I get the bugs worked out of this. http://andrewgioia.com/news/#4 http://andrewgioia.com/news/#4 Tue, 12 Aug 2008 8:00:00 EDT Magpie RSS for Flickr. <p>I've been messing around (poorly) with RSS feeds for a while and last week I came across <a href="http://magpierss.sourceforge.net/">Magpie RSS</a>, a super simple php class to handle pretty much any feed you can throw at it. Right now the <a href="asides/">Asides page</a> uses Magpie for the Delicious bookmarks and Flickr photos; the bookmarks were pretty straightforward but I was having some trouble displaying the photos correctly. This is pretty rough, but if you're looking for some sample code to plug in here's what I'm currently using:</p> <div class=\"code\"><pre> if ($url) { // Set $url to your Flickr url $rss = fetch_rss($url); $count = 0; foreach ($rss-&gt;items as $item) { if ($count == 14) { break; // to limit it } else { $image = $item['description']; $image_ary = explode(&quot;\\n\\n&quot;,$image); $image_img = str_replace(&quot;_m.jpg&quot;, &quot;.jpg&quot;, $image_ary[0]); $image_img_ary = explode(&quot;&lt;/p&gt;&quot;, $image_img); $image = $image_img_ary[1]; $image = str_replace(&quot;&lt;p&gt;&quot;, &quot;&quot;, $image); $image = str_replace(&quot;.jpg&quot;, &quot;_s.jpg&quot;, $image); $image = preg_replace(&quot;/width=&quot;d+&quot;/&quot; , '', $image); $image = preg_replace(&quot;/height=&quot;d+&quot;/&quot; , '', $image); echo &quot;$image&quot;; } $count++; } }</pre></div> <p>You can set $url to your Flickr rss feed, and make sure to include the mapgpierss file ;) I'm pretty sure I'm adding some unnecessary steps in there, but it gets the job done. Feel free to test it out or email me if you've got something. http://andrewgioia.com/news/#3 http://andrewgioia.com/news/#3 Fri, 4 Jan 2008 8:00:00 EST New site design finally. <p>I finally found some free time over Christmas break to give this thing a much needed layout and brush up my neglected php skills. It's pretty trimmed down right now but I'm definitely still going to keep it bare bones this time. I also finally signed up for a <a href="http://del.icio.us/">del.icio.us</a> account; I've been looking for a way to sync bookmarks across computers and I'm not sure why I waited so long on this, but it's definitely worth it. More coding! http://andrewgioia.com/news/#2 http://andrewgioia.com/news/#2 Fri, 28 Dec 2007 8:00:00 EST Merry Christmas! <p>First semester is finally over and I just got back from another great weekend in Grand Rapids :) Looking forward to Christmas with the fam. http://andrewgioia.com/news/#1 http://andrewgioia.com/news/#1 Mon, 24 Dec 2007 8:00:00 EST