{"id":1625,"date":"2005-01-20T17:44:41","date_gmt":"2005-01-21T00:44:41","guid":{"rendered":"http:\/\/8stars.org\/aa\/2005\/01\/20\/getting-with-the-program\/"},"modified":"2005-01-20T17:44:41","modified_gmt":"2005-01-21T00:44:41","slug":"getting-with-the-program","status":"publish","type":"post","link":"https:\/\/8stars.org\/a\/2005\/01\/20\/getting-with-the-program\/","title":{"rendered":"Getting with the program"},"content":{"rendered":"<p>\n<a href=\"http:\/\/de.icio.us\">Del.icio.us<\/a> is a &#8220;social bookmarks manager,&#8221; or in plain English, a web page that lets you keep a list of interesting websites. What makes it interesting is that it lets you use <em>tags<\/em> to classify your links a rough-and-ready sort of way (this kind of undisciplined tagging is now sometimes called &#8220;folksonomy&#8221;), lets you see links from other people with the same tags (or any tags) and shows you how many other people link to a given URL.\n<\/p>\n<p>\nI&#8217;ve been keeping a &#8220;hit and run&#8221; blog for some time, and this fulfills the same role for me as del.icio.us would, but I had been unwilling to switch over two del.icio.us for a couple of reasons: 1. The data doesn&#8217;t live on my machine; 2. It&#8217;s not easy to control the presentation&#8211;it is possible to republish your del.icio.us links on your own page, but you&#8217;re kind of stuck in terms of presentation. There are ways to get at the data programmatically, but that involves programming, and that means work, and I&#8217;m lazy.\n<\/p>\n<p>\nBut I finally decided to sit down and figure it out (as a way to avoid something even harder: my current translation job). Somebody has already provided a <a href=\"http:\/\/dustymatthews.com\/DeliciousPHP\/\">library of PHP tools<\/a> for messing with del.icio.us, and I know just enough about PHP to get myself in trouble. Here&#8217;s what I did [caution: entering geek mode]\n<\/p>\n<p><!--more--><\/p>\n<p>\nI took the sample script provided, hacked around with that, and made one modification to the <code>postsByCount<\/code> function, adding the following line:\n<\/p>\n<p><code>'extended' =&gt; $child_node-&gt;get_attribute('extended')<\/code><\/p>\n<p>This makes it possible to get the snarky comment, which the library&#8217;s author mysteriously omitted. To reduce load on the del.icio.us server, I modified the script to write its output to a stub file, and the stub file is included in this page. The script is <code>curl<\/code>&#8216;d once an hour by a cron job. For the record, here&#8217;s the script:<\/p>\n<pre><code>\n&lt;?php\n$thefile=\"\/path\/to\/stub\/file.html\"; \/\/ change this\n$tagurl='http:\/\/del.icio.us\/tag\/'; \/\/ this is just a convenience\nrequire_once('DeliciousData.class.php');\n$del = new DeliciousData('username','password'); \/\/ change username, password\n$myPosts = $del-&gt;postsBycount('',10); \/\/ gets 10 posts, all tags\n$delstub = '&lt;dl id=\"hitnrun\"&gt;';\nforeach ($myPosts as $post) {\n $delstub .= '&lt;dt&gt;&lt;a href=\"' . $post['href'] . '\"&gt;' . $post['description'] . '&lt;\/a&gt;';\n $delstub .= '&lt;dd class=\"xt\"&gt;' . $post['extended'] . '&lt;\/dd&gt;';\n  $delstub .= '&lt;dd class=\"tags\"&gt;&lt;ul&gt;';\n  foreach ($post['tags'] as $tag) {\n    $delstub .= '&lt;li&gt;&lt;a href=\"' . $tagurl . $tag . '\"&gt;' . $tag . '&lt;\/a&gt;&lt;\/li&gt;';\n  }\n  $delstub .= '&lt;\/ul&gt;&lt;\/dd&gt;';\n}\n$delstub .= '&lt;\/dl&gt;';\n$file=fopen($thefile, \"w+\");\nfwrite($file,$delstub);\nfclose($file);\n?&gt;\n<\/code><\/pre>\n<p><ins>[Later]<\/ins> To generate valid HTML, it would be a good idea to wrap the del.icio.us variables with the htmlspecialchars function, like this: <code>htmlspecialchars($post['href'])<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Or, How I Learned to Stop Worrying and Love Delicious<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[12,15],"tags":[],"class_list":["post-1625","post","type-post","status-publish","format-standard","hentry","category-meta-blogging","category-net-stuff"],"_links":{"self":[{"href":"https:\/\/8stars.org\/a\/wp-json\/wp\/v2\/posts\/1625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/8stars.org\/a\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/8stars.org\/a\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/8stars.org\/a\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/8stars.org\/a\/wp-json\/wp\/v2\/comments?post=1625"}],"version-history":[{"count":0,"href":"https:\/\/8stars.org\/a\/wp-json\/wp\/v2\/posts\/1625\/revisions"}],"wp:attachment":[{"href":"https:\/\/8stars.org\/a\/wp-json\/wp\/v2\/media?parent=1625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/8stars.org\/a\/wp-json\/wp\/v2\/categories?post=1625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/8stars.org\/a\/wp-json\/wp\/v2\/tags?post=1625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}