<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: comments code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 06:52:24 GMT</pubDate>
    <description>DZone Snippets: comments code</description>
    <item>
      <title>Perform Comment Recount for WordPress</title>
      <link>http://snippets.dzone.com/posts/show/5493</link>
      <description>Run from the command line and uncomment line #2 if your mysql adapter is installed via RubyGems. Fast as hell.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/ruby&lt;br /&gt;#require 'rubygems'&lt;br /&gt;require 'mysql'&lt;br /&gt; &lt;br /&gt;db = Mysql.real_connect("host", "username", "password", "database")&lt;br /&gt;ids = db.query("SELECT `ID` FROM `wp_posts` WHERE 1")&lt;br /&gt; &lt;br /&gt;ids.each_hash do |post|&lt;br /&gt;  id = post['ID']&lt;br /&gt;  num = 0&lt;br /&gt;  comments = db.query("SELECT COUNT(1) FROM `wp_comments` WHERE `comment_post_ID`='#{id}' AND `comment_approved`='1';")&lt;br /&gt;  comments.each {|x| num = x[0]}&lt;br /&gt;  up = db.query("UPDATE `wp_posts` SET `comment_count`='#{num}' WHERE `ID`='#{id}';")&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 14 May 2008 23:11:28 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5493</guid>
      <author>breakerjump (Josh)</author>
    </item>
    <item>
      <title>RSS Feed for DZone Snippets Comments</title>
      <link>http://snippets.dzone.com/posts/show/5031</link>
      <description>&lt;a href="http://feed43.com/8055673348816228.xml"&gt;http://feed43.com/8055673348816228.xml&lt;/a&gt;</description>
      <pubDate>Wed, 23 Jan 2008 14:23:09 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5031</guid>
      <author>timmorgan (Tim Morgan)</author>
    </item>
    <item>
      <title>Remove comments from a file</title>
      <link>http://snippets.dzone.com/posts/show/4174</link>
      <description>Remove all comment lines from a file.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sed -e '/^#/d' $1 | more&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;or to output it to a new file&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sed -e '/^#/d' $1 &gt; $1.nocomments&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 20 Jun 2007 18:24:22 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4174</guid>
      <author>fak3r (fak3r)</author>
    </item>
  </channel>
</rss>
