
[edit2]
Check out this link to see a visualization of the global meme hits. Perl + XML + Java.
Source included!
[/edit2]
[edit]
If anyone is interested in viewing the spread of the meme through user entries, go check this out!
import re e = list() p = re.compile("/users/([A-Za-z0-9_]+)/([0-9]+).html") for l in open('access.log'): if (l.find('ljstat') != -1) or (l.find('ljdist') != -1) or (l.find('ljmdist') != -1): try: m = p.findall(l).pop() if m[0] != 'g0thm0g': uri = 'http://www.livejournal.com/users/' + m[0] + '/' + m[1] + '.html' if not uri in e: e.append(uri) except (IndexError): pass for entry in e: print '<div><a href="' + entry + '">' + entry + '</a></div>'
[/edit]
Jan | Feb | Mar | Apr | May | Jun |
Jul | Aug | Sep | Oct | Nov | Dec |
-0.014027149321269x5 + 0.44415449746338x4 + -4.7536250514199x3 + 18.216838920887x2 + -7.7951306046973x1 + -3.9545454545408x0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head><title>LJ Time Chart - Complete Journal!</title><style type="text/css">body { font-family:Verdana, Sans-serif; font-size:12px; }</style></head> <body> <?php //PEAR libs require_once("XML/RPC.php"); require_once 'Math/Stats.php'; //check out phpMath for PHP JAMA and PDL require_once 'JAMA/build-05/Matrix.php'; //least-squares regression for arbitrary-degree polynomial function polyfit($X, $Y, $n) { for ($i = 0; $i < sizeof($X); $i++) for ($j = 0; $j <= $n; $j++) $A[$i][$j] = pow($X[$i], $j); for ($i=0; $i < sizeof($Y); $i++) $B[$i] = array($Y[$i]); $matrixA = new Matrix($A); $matrixB = new Matrix($B); $C = $matrixA->solve($matrixB); return $C->getMatrix(0, $n, 0, 1); } //iterate through coefficient vector and format polynomial function printpoly( $C = null ) { for($i = $C->m - 1; $i >= 0; $i-- ) { $r = $C->get($i, 0); if ( abs($r) <= pow(10, -9) ) $r = 0; if ($i == $C->m - 1) echo $r . "x<sup>$i</sup>"; else if ($i < $C->m - 1) echo " + " . $r . "x<sup>$i</sup>"; else if ($i == 0) echo " + " . $r; } } class LJ_Client { var $if = null; var $user = null; var $password = null; function LJ_Client($user=null, $password=null, $proxy_host=null, $proxy_port=null, $proxy_user=null, $proxy_password=null) { $this->user = $user; $this->password = $password; $this->if = new XML_RPC_Client('/interface/xmlrpc', 'www.livejournal.com', 80, $proxy_host, $proxy_port, $proxy_user, $proxy_password); } function getEvents($n = 50, $before = null) { if($before == null) { $before = date("Y-m-d H:i:s"); } $msg = new XML_RPC_Message('LJ.XMLRPC.getevents', array(XML_RPC_encode(array('username' => $this->user, 'hpassword' => md5($this->password), 'selecttype' => 'lastn', 'howmany' => $n, 'ver' => 1, 'beforedate' => $before)))); $resp = $this->if->send($msg); if (!$resp) { echo 'Communication error: ' . $this->if->errstr; exit; } if (!$resp->faultCode()) { $val = $resp->value(); $data = XML_RPC_decode($val); return $data['events']; } else { echo '<b style="color:#f00;">'; echo 'Fault Code: ' . $resp->faultCode() . "\n"; echo 'Fault Reason: ' . $resp->faultString() . "\n"; echo '</b>'; } } } $user = $_REQUEST['user']; $pass = $_REQUEST['password']; $c = new LJ_Client($user, $pass); $events = $c->getEvents(50); while($o = end($events)) { $ldate = $o['eventtime']; $r = $c->getEvents(50, $ldate); if(sizeof($r) == 0) { break; } else { $events = array_merge($events, $r); } } $m_dist = array(); foreach ($events as $e) { $r = split('-', current(split(' ', $e['eventtime']))); $m = (int)$r[1]; $m_dist[$m]++; } if(sizeof($m_dist) > 1) { $s = new Math_Stats(); $s->setData($m_dist); $stats = $s->calcFull(); } $inc = 128 / max($m_dist); ob_start(); echo '<div><b>Monthly Distribution of ' . $_REQUEST['user'] . '\'s Journal Entries</b></div><br />'; echo '<table style="border:1px solid #000;background-color:#eee;">'; echo '<tr>'; foreach(range(1,6) as $month) { $box_height = $inc * (int)$m_dist[$month]; if($box_height != 0) { $x = '<div style="background-color:#000;height:' . $box_height . 'px;color:#000;"> </div>' . $m_dist[$month]; } else { $x = " "; } echo '<td style="vertical-align:bottom;text-align:center;vertical-align:bottom;font-weight:800;padding:8px;color:#000;">' . $x . '</td>'; } echo '</tr><tr>'; foreach(range(1,6) as $month) { echo '<td style="text-align:center;padding:4px;color:#000;">' . date("M", mktime(null, null, null, $month)) . '</td>'; } echo '</tr>'; echo '<tr>'; foreach(range(7,12) as $month) { $box_height = $inc * (int)$m_dist[$month]; if($box_height != 0) { $x = '<div style="background-color:#000;height:' . $box_height . 'px;color:#000;"> </div>' . $m_dist[$month]; } else { $x = " "; } echo '<td style="vertical-align:bottom;text-align:center;vertical-align:bottom;font-weight:800;padding:8px;color:#000;">' . $x . '</td>'; } echo '</tr><tr>'; foreach(range(7,12) as $month) { $box_height = $inc * (int)$m_dist[$month]; echo '<td style="text-align:center;padding:4px;color:#000;">' . date("M", mktime(null, null, null, $month)) . '</td>'; } echo '</tr>'; echo '</table>'; echo '<br />'; echo '<div>σ: '. $stats['stdev'] . '</div>'; echo '<div>σ<sup>2</sup>: '. $stats['variance'] . '</div>'; $r = array(); for($n = 1;$n < 13;$n++) { if(isset($m_dist[$n])) { $r[$n] = $m_dist[$n]; } else { $r[$n] = 0; } } $points = new Matrix(array(range(1, 12), $r)); echo '<div><b>Least-Squares Pentic Regression:</b><br />'; printpoly(polyfit(range(1, 12), $r, 5)); echo '</div>'; echo '<br />'; echo '<form style="padding:8px;" action="http://ohsonline.no-ip.com/ljmdist.php" method="post"><b>When do you post?</b><div style="margin:4px;"><b>Username</b>: <input style="padding:2px;vertical-align:middle;border:1px solid #000;font-size:11px;" type="text" name="user" value="' . $_REQUEST['user'] . '" /></div><div style="margin:4px;"><b>Password:</b> <input style="padding:2px;vertical-align:middle;margin:4px;border:1px solid #000;font-size:11px;" type="password" name="password" /></div><input type="submit" value="Chart!" /></form>'; echo '<div><b>Created by <a href="http://livejournal.com/users/g0thm0g" style="font-weight:800;">g0thm0g</a>!</b></div>'; $c = ob_get_contents(); $c = str_replace("<", "<", $c); $c = str_replace(">", ">", $c); ob_end_flush(); echo '<div><b>Meme HTML:</b></div>'; echo '<textarea cols="80" rows="8">' . $c . '</textarea>'; ?> </body> </html>
So it's a little sloppy, but she gets the job done. Have fun.
← Ctrl ← Alt
Ctrl → Alt →
← Ctrl ← Alt
Ctrl → Alt →