Michael Bommarito ([info]g0thm0g) wrote in [info]lj_nifty,
@ 2005-05-23 08:45:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Current music:Against Me! - [As The Eternal Cowboy #10] Turn Those Clapping Hands Into Angry Balled Fists [4:46]

Here we go again...
Please, if you don't trust either me or the communication line you're on, temporarily change your password to use the meme. Otherwise, look back to the last post and use my non-password version. I've kept the features as close as possible, except for the friends-only and 25-post constraints. I hope that OpenID or some other method (see [info]lj_dev) will soon provide I means for non-password authentication (i.e. generic nonces or fast-expiration session cookies).

[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]

Monthly Distribution of g0thm0g's Journal Entries

32
26
57
46
73
8
JanFebMarAprMayJun
23
25
41
16
35
37
JulAugSepOctNovDec

σ: 17.870536102928
σ2: 319.35606060606
Least-Squares Pentic Regression:
-0.014027149321269x5 + 0.44415449746338x4 + -4.7536250514199x3 + 18.216838920887x2 + -7.7951306046973x1 + -3.9545454545408x0

When do you post?
Username:
Password:
Created by g0thm0g!


<!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;">&nbsp;</div>' . $m_dist[$month];
    } else {
      $x = "&nbsp;";
    }
    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;">&nbsp;</div>' . $m_dist[$month];
    } else {
      $x = "&nbsp;";
    }
    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>&sigma;: '. $stats['stdev'] . '</div>';
echo '<div>&sigma;<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("<", "&lt;", $c);
$c = str_replace(">", "&gt;", $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.


(Post a new comment)


[info]pthalogreen
2005-05-24 11:58 pm UTC (link)
why do you need a password for that? can't you look at the calendar view and tally?

(Reply to this) (Thread)


[info]kunzite1
2005-05-24 11:59 pm UTC (link)
or just wait for openid to be stupidly easy to use?

(Reply to this) (Parent)(Thread)(Expand)

(no subject) - [info]supersat, 2005-05-25 12:03 am UTC (Expand)
(no subject) - [info]kunzite1, 2005-05-25 12:03 am UTC (Expand)

[info]bliss_street
2005-05-25 12:12 am UTC (link)
I'm not plugging my password into any meme. And you're right, there's probably a way to do the same thing using the calendar view.

(Reply to this) (Parent)(Thread)(Expand)

(no subject) - [info]g0thm0g, 2005-05-25 12:51 am UTC (Expand)

[info]missysedai
2005-05-25 12:08 am UTC (link)
Oooh, neato!

(Reply to this)


[info]trshtwns01
2005-05-25 12:12 am UTC (link)
Surely I'm not the only person who sees something incredibly wrong with any 'nifty' script that requires you to enter your password?

(Reply to this)


[info]ydna
2005-05-25 12:13 am UTC (link)
Dude, can you make a version that works sans my password; using only publicly available information? Thanks.

(Reply to this) (Thread)


[info]ladycalliope
2005-05-25 12:48 am UTC (link)
Wasn't that the original version of his meme? I ran this one last week or so: http://www.livejournal.com/users/g0thm0g/105577.html

(Reply to this) (Parent)


[info]g0thm0g
2005-05-25 12:52 am UTC (link)
Gladly would I do so if you were to show me how to fetch more than the last 25 posts from RSS. That's what I first until this version was requested...

(Reply to this) (Parent)


[info]jeffreyatw
2005-05-25 12:15 am UTC (link)
What the hell? I don't care how securely you might keep our info; making a meme that asks for a password is retarded, and probably against the LJ terms of service, too.

(Reply to this) (Thread)


[info]anonymous
2005-05-26 02:30 am UTC (link)
Fuckdummy.

(Reply to this) (Parent)(Thread)(Expand)

(no subject) - [info]jeffreyatw, 2005-05-26 07:25 am UTC (Expand)
this should be called ;)
[info]shadow_of_funk
2005-05-25 12:15 am UTC (link)
hah how to steal a thousand lj pws

(Reply to this)


[info]lexzev
2005-05-25 12:18 am UTC (link)
I guess if you don't want your pw possibly snagged, you could always change it right after you use the meme...?

(Reply to this) (Thread)


[info]sparhawk2k
2005-05-25 12:25 am UTC (link)
Heh. Theoretically, the meme could also be changed somewhere down the line (once people have more confidence in it and are using it more) to snag the password and change it automatically. So you wouldn't even get to do that because it'd be faster than you.

That said, I don't tend to be too paranoid about these sorts of thing... But it would be nice if there was a way to do it without the password.

(Reply to this) (Parent)(Thread)(Expand)

(no subject) - [info]supersat, 2005-05-25 12:31 am UTC (Expand)
(no subject) - [info]sparhawk2k, 2005-05-25 12:37 am UTC (Expand)

[info]naught
2005-05-25 12:30 am UTC (link)
Who cares? It's just your LJ password, it's not like it's the password to your banking account or credit card.

If you don't want to use it - don't.

(Reply to this) (Thread)(Expand)


[info]jackola
2005-05-25 12:43 am UTC (link)
i do.

(Reply to this) (Parent)(Thread)(Expand)

(no subject) - [info]xevinx, 2005-05-25 12:47 am UTC (Expand)
(no subject) - [info]jackola, 2005-05-25 12:50 am UTC (Expand)
(no subject) - [info]bubblesinmyhead, 2005-05-25 02:08 am UTC (Expand)
(no subject) - [info]artysmokes, 2005-05-25 03:02 am UTC (Expand)
(no subject) - [info]bubblesinmyhead, 2005-05-25 03:15 am UTC (Expand)
I'm the jealous type. ;) - [info]artysmokes, 2005-05-25 03:27 am UTC (Expand)
Re: I'm the jealous type. ;) - [info]bubblesinmyhead, 2005-05-25 03:28 am UTC (Expand)
(no subject) - [info]spatulistic, 2005-05-25 04:19 am UTC (Expand)
(no subject) - [info]bubblesinmyhead, 2005-05-25 04:23 am UTC (Expand)
(no subject) - [info]spatulistic, 2005-05-25 04:26 am UTC (Expand)
(no subject) - [info]bubblesinmyhead, 2005-05-25 04:27 am UTC (Expand)
(no subject) - [info]spatulistic, 2005-05-25 04:32 am UTC (Expand)
(no subject) - [info]bubblesinmyhead, 2005-05-25 04:35 am UTC (Expand)
(no subject) - [info]spatulistic, 2005-05-25 04:38 am UTC (Expand)
(no subject) - [info]bubblesinmyhead, 2005-05-25 05:47 am UTC (Expand)
(no subject) - [info]geoantada, 2005-09-12 07:46 am UTC (Expand)
(no subject) - [info]xevinx, 2005-05-25 12:49 am UTC (Expand)
(no subject) - [info]g0thm0g, 2005-05-25 12:50 am UTC (Expand)
(no subject) - [info]xevinx, 2005-05-25 01:07 am UTC (Expand)
(no subject) - [info]g0thm0g, 2005-05-25 01:13 am UTC (Expand)
(no subject) - [info]prunesnprisms, 2005-05-25 02:34 am UTC (Expand)
(no subject) - [info]g0thm0g, 2005-05-25 12:49 am UTC (Expand)

[info]vorona
2005-05-25 12:38 am UTC (link)
Any "meme" asking for ANY password is a bad idea, in my opinion. Getting used to the idea of throwing personal passwords around like that is just... not good. Bad policy, and I'd never do that.

It's not a matter of trust, it's a matter of using basic good sense.

(Reply to this) (Thread)(Expand)


[info]g0thm0g
2005-05-25 12:44 am UTC (link)
I agree entirely; I'm just working within the provided system at the time.

(Reply to this) (Parent)

(no subject) - [info]artysmokes, 2005-05-25 03:06 am UTC (Expand)

[info]scoticus
2005-05-25 12:42 am UTC (link)
"Fault Code: 2 Fault Reason: Invalid return payload: enable debugging to examine incoming payload"

(Reply to this)


[info]meridjet
2005-05-25 12:55 am UTC (link)
I liked it. I'd like to see the hourly version for locked entries. I for one am not too lazy to change my password long enough to use this.....

(Reply to this) (Thread)


[info]g0thm0g
2005-05-25 12:57 am UTC (link)
http://ohsonline.no-ip.com/ljdist.php

(Reply to this) (Parent)


[info]meridjet
2005-05-25 01:09 am UTC (link)
Thanks!

(Reply to this)


[info]kunzite1
2005-05-25 01:11 am UTC (link)
poor guy.

the idea is nifty. the people are skeptical about the password part.

i was thinking of another way to get the counts. something like creating a custom s2 layout, then use that to download the calendar pages in a format that makes it easy for the program to read. but being able to let php load a journal with a given s2id is tricky. it'd have to log in as you first or something.

so... my idea's also a dead end.

/me thinks a little more...

*lightbulb!*

/me hacks on an s1 layout

s1 style info.
my journal.
your journal.
news.

hmm... bummer. paid journals only. but i got it to work without passwords!

overrides:

(Reply to this) (Thread)


[info]g0thm0g
2005-05-25 01:15 am UTC (link)
Yeah, I'd toyed around with the idea, but my paid account ran out last year and I'm slim on cash to renew it. Gotta' love being a high school kid...

I was also working on implementing a pseudo-TrackBack method with S2 themes. Perhaps we could collaborate on that sometime, as I'd be very interesting to put together XML-RPC services and S2 styles to create entries that modify themselves to link back to any referring entries on LiveJournal.

(Reply to this) (Parent)(Thread)(Expand)

(no subject) - [info]kunzite1, 2005-05-25 01:17 am UTC (Expand)

[info]soichiro
2005-05-25 02:55 am UTC (link)
Even if I didn't trust you with my journal password, I need to change mine anyways. Looks nifty, so I'll try it. :D

(Reply to this)


[info]spatulistic
2005-05-25 04:22 am UTC (link)
Oy. What's everyone's problem. They complain that they want to include "all entries" but then they bitch when you ask for a password.. you JUST can't win.

Maybe you could make it a lj archive plugin or something..

(Reply to this)


[info]thefirebottle
2005-05-25 10:32 am UTC (link)
Been meaning to change my pass anyhow.

(Reply to this)


[info]lroberson
2005-05-25 12:37 pm UTC (link)
Just do it right! Sheesh.

(Reply to this)


[info]43686172
2005-05-25 01:17 pm UTC (link)
Looks like a nice effort, mate.

(Reply to this)


[info]dangermouse74
2005-05-25 10:40 pm UTC (link)
wow people just suck in general. they don't seem to recall the previous debate about how you were limited without a password. they have that one to use but bitch and moan anyway and even ask you to make one. besides which source code is included so they can see if it steals the password or not. i mean yeah i generally agree but this is the opposite case of fools just entering passwords, they foolishly follow the never enter a password, it's asking me it's bad. sheesh, no common sense. seems not worth putting shit on here, even on the first one you got mostly bitching. i'm sorry for that. but as LJ shows, most LJ'ers are young, just immature and a pain in the ass perhaps.

(Reply to this)


[info]brocklisoup
2005-06-25 03:28 pm UTC (link)
Two things:

1) It would be cool if it linked to the posts in question. Like, I have 2 posts over 900 words, and I'm curious to know what they were, but not curious to go digging.

2) Against Me! rocks.

(Reply to this)


Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…