<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Segment for G4 TV’s Attack of the Show: Douchebag</title>
	<atom:link href="http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/</link>
	<description>Marina Orlova - Not your typical philologist. Etymology, philology, word origins, origin of, hot teacher.</description>
	<lastBuildDate>Fri, 19 Mar 2010 17:40:27 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Hs4Mm</title>
		<link>http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/comment-page-1/#comment-153130</link>
		<dc:creator>Hs4Mm</dc:creator>
		<pubDate>Sun, 20 Sep 2009 21:43:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotforwords.com/?p=7558#comment-153130</guid>
		<description>The code tag was not parsed properly;  trying again with tags between each line:

&lt;code&gt;
   Supposedly, one can determine number of visible characters via the function:
&lt;/code&gt; &lt;code&gt;
&lt;/code&gt; &lt;code&gt;
       $the_length = strlen( utf8_decode( utf8_encode( $the_string ) ) );  
&lt;/code&gt; &lt;code&gt;
       // preceding should return 13
&lt;/code&gt; &lt;code&gt;
&lt;/code&gt; &lt;code&gt;
   Supposedly, one can also use the &quot;/u&quot; modifier to search patterns ( http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php ):
&lt;/code&gt; &lt;code&gt;
&lt;/code&gt; &lt;code&gt;
       $max_length  = 20; 
&lt;/code&gt; &lt;code&gt;
       $is_short    = preg_match( &#039;/^.{1,$max_length}$/u&#039;,  uft8_encode( $the_author ) ) ); 
&lt;/code&gt; &lt;code&gt;
       // preceding should return 1
&lt;/code&gt; &lt;code&gt;
&lt;/code&gt; &lt;code&gt;
       $max_length  = 10; 
&lt;/code&gt; &lt;code&gt;
       $is_short    = preg_match( &#039;/^.{1,$max_length}$/u&#039;,  uft8_encode( $the_author ) ) ); 
&lt;/code&gt; &lt;code&gt;
       // preceding should return 0
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>The code tag was not parsed properly;  trying again with tags between each line:</p>
<p><code><br />
   Supposedly, one can determine number of visible characters via the function:<br />
</code> <code><br />
</code> <code><br />
       $the_length = strlen( utf8_decode( utf8_encode( $the_string ) ) );<br />
</code> <code><br />
       // preceding should return 13<br />
</code> <code><br />
</code> <code><br />
   Supposedly, one can also use the "/u" modifier to search patterns ( <a href="http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php" rel="nofollow" target="_blank" class="liexternal">http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php</a> ):<br />
</code> <code><br />
</code> <code><br />
       $max_length  = 20;<br />
</code> <code><br />
       $is_short    = preg_match( '/^.{1,$max_length}$/u',  uft8_encode( $the_author ) ) );<br />
</code> <code><br />
       // preceding should return 1<br />
</code> <code><br />
</code> <code><br />
       $max_length  = 10;<br />
</code> <code><br />
       $is_short    = preg_match( '/^.{1,$max_length}$/u',  uft8_encode( $the_author ) ) );<br />
</code> <code><br />
       // preceding should return 0<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hs4Mm</title>
		<link>http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/comment-page-1/#comment-153129</link>
		<dc:creator>Hs4Mm</dc:creator>
		<pubDate>Sun, 20 Sep 2009 21:39:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotforwords.com/?p=7558#comment-153129</guid>
		<description>Earlier today, I said there are two things that could be done to the present scheme for displaying the author&#039;s name and title of post in the Recent Comments box.

1) The first is that the length of the author might need to be truncated too -- for example, there was a time when PK had a very long name, it was something like, &quot;PK Vote Marina for sexiest geek&quot;.  You might already being doing this.

2) The second was that rather than truncate the author and title at a fixed length, it might be better to first truncate the author at a fixed length and to then truncate the title based (not on the length of the title but based) on the lenght of the line &quot;$the_aurhor in $the_title&quot;.  This way, if the author&#039;s name is short, then more characters can be used for the title. 

I was going to provide php code, but gave up after I could not come up with a good php scheme to determine the length of a string!  There are two issues with determining the length of a string:

A) What we want is the width in pixels (or inches) required to display $the_author (to see how the same number of characters can take up different lenghts on the display, see the lenghts of these two strings of 4 characters: &quot;mmmm&quot; and &quot;nnnn&quot;.).

The lenght of the display depends on the font being used -- and it is not worth creating a general function to determine the display length of a given string in a given font.  Here&#039;s an example of such a function for a particular font (Verdana, 10px, non-bold) http://www.php.net/manual/en/function.strlen.php#76043

B) The next best thing (to working with width in pixels or inches) is to work with width being the number of characters.  But php&#039;s &quot;strlen( $the_author);&quot; function returns the number of bytes required to store $the_author (for people knowing C, php&#039;s strlen() does not include any terminating null) which need not equal the number of visible characters in $the_author.  When $the_author is &quot;Hs4Mm&quot;, strlen( $the_aurhor ) returns 5 which is the number of displayed characters;  but when $the_author = &quot;&#1052;&#1072;&#1088;&#1080;&#1085;&#1072; &#1054;&#1088;&#1083;&#1086;&#1074;&#1072;&quot;; strlen( $the_aurhor ) returns a number bigger than 13 (the number of bytes required to store the 13 visible characters in &quot;&#1052;&#1072;&#1088;&#1080;&#1085;&#1072; &#1054;&#1088;&#1083;&#1086;&#1074;&#1072;&quot;).

I am at a loss as to how to handle strings with non-ASCII characters.  I tried various experiments along the lines indicated below but none of them worked!

&lt;code&gt;

   Supposedly, one can determine number of visible characters via the function:
   
       $the_length = strlen( utf8_decode( utf8_encode( $the_string ) ) );  
       // preceding should return 13
   
   Supposedly, one can also use the &quot;/u&quot; modifier to search patterns ( http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php ):
   
       $max_length  = 20; 
       $is_short    = preg_match( &#039;/^.{1,$max_length}$/u&#039;,  uft8_encode( $the_author ) ) ); 
       // preceding should return 1
   
       $max_length  = 10; 
       $is_short    = preg_match( &#039;/^.{1,$max_length}$/u&#039;,  uft8_encode( $the_author ) ) ); 
       // preceding should return 0
   
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Earlier today, I said there are two things that could be done to the present scheme for displaying the author&#8217;s name and title of post in the Recent Comments box.</p>
<p>1) The first is that the length of the author might need to be truncated too &#8212; for example, there was a time when PK had a very long name, it was something like, &#8220;PK Vote Marina for sexiest geek&#8221;.  You might already being doing this.</p>
<p>2) The second was that rather than truncate the author and title at a fixed length, it might be better to first truncate the author at a fixed length and to then truncate the title based (not on the length of the title but based) on the lenght of the line &#8220;$the_aurhor in $the_title&#8221;.  This way, if the author&#8217;s name is short, then more characters can be used for the title. </p>
<p>I was going to provide php code, but gave up after I could not come up with a good php scheme to determine the length of a string!  There are two issues with determining the length of a string:</p>
<p>A) What we want is the width in pixels (or inches) required to display $the_author (to see how the same number of characters can take up different lenghts on the display, see the lenghts of these two strings of 4 characters: &#8220;mmmm&#8221; and &#8220;nnnn&#8221;.).</p>
<p>The lenght of the display depends on the font being used &#8212; and it is not worth creating a general function to determine the display length of a given string in a given font.  Here&#8217;s an example of such a function for a particular font (Verdana, 10px, non-bold) <a href="http://www.php.net/manual/en/function.strlen.php#76043" rel="nofollow" target="_blank" class="liexternal">http://www.php.net/manual/en/function.strlen.php#76043</a></p>
<p>B) The next best thing (to working with width in pixels or inches) is to work with width being the number of characters.  But php&#8217;s &#8220;strlen( $the_author);&#8221; function returns the number of bytes required to store $the_author (for people knowing C, php&#8217;s strlen() does not include any terminating null) which need not equal the number of visible characters in $the_author.  When $the_author is &#8220;Hs4Mm&#8221;, strlen( $the_aurhor ) returns 5 which is the number of displayed characters;  but when $the_author = &#8220;&#1052;&#1072;&#1088;&#1080;&#1085;&#1072; &#1054;&#1088;&#1083;&#1086;&#1074;&#1072;&#8221;; strlen( $the_aurhor ) returns a number bigger than 13 (the number of bytes required to store the 13 visible characters in &#8220;&#1052;&#1072;&#1088;&#1080;&#1085;&#1072; &#1054;&#1088;&#1083;&#1086;&#1074;&#1072;&#8221;).</p>
<p>I am at a loss as to how to handle strings with non-ASCII characters.  I tried various experiments along the lines indicated below but none of them worked!</p>
<p><code></p>
<p>   Supposedly, one can determine number of visible characters via the function:</p>
<p>       $the_length = strlen( utf8_decode( utf8_encode( $the_string ) ) );<br />
       // preceding should return 13</p>
<p>   Supposedly, one can also use the "/u" modifier to search patterns ( <a href="http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php" rel="nofollow" target="_blank" class="liexternal">http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php</a> ):</p>
<p>       $max_length  = 20;<br />
       $is_short    = preg_match( '/^.{1,$max_length}$/u',  uft8_encode( $the_author ) ) );<br />
       // preceding should return 1</p>
<p>       $max_length  = 10;<br />
       $is_short    = preg_match( '/^.{1,$max_length}$/u',  uft8_encode( $the_author ) ) );<br />
       // preceding should return 0</p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hs4Mm</title>
		<link>http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/comment-page-1/#comment-153114</link>
		<dc:creator>Hs4Mm</dc:creator>
		<pubDate>Sun, 20 Sep 2009 17:59:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotforwords.com/?p=7558#comment-153114</guid>
		<description>Maybe I forgot something in the tinsy bit harder test;  try again:

&lt;code&gt;



&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Maybe I forgot something in the tinsy bit harder test;  try again:</p>
<p><code></p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hs4Mm</title>
		<link>http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/comment-page-1/#comment-153113</link>
		<dc:creator>Hs4Mm</dc:creator>
		<pubDate>Sun, 20 Sep 2009 17:57:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotforwords.com/?p=7558#comment-153113</guid>
		<description>OK, that&#039;s good enough!  To make a tinsy bit harder, since html tags are rejected, see if php tags are accepted:

&lt;code&gt;



&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>OK, that&#8217;s good enough!  To make a tinsy bit harder, since html tags are rejected, see if php tags are accepted:</p>
<p><code></p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hs4Mm</title>
		<link>http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/comment-page-1/#comment-153112</link>
		<dc:creator>Hs4Mm</dc:creator>
		<pubDate>Sun, 20 Sep 2009 17:53:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotforwords.com/?p=7558#comment-153112</guid>
		<description>Maybe that test was too hard.  Slightly hard test:

&lt;code&gt;

  function truncate_to( $the_string,  $max_length )         
  {                                                         
       $the_length = // correct way to get length -- NOT strlen( )  
                                                            
       if( $the_lenght &lt;= $max_length ) return $the_string; 
                                                            
                                                            
  }                                                         


echo &quot;author (85 bytes):$the_author,&quot; . strlen($the_author) . &#039;,&#039; . strlen( utf8_decode( $the_author ) ) . &#039;,&#039; .  &quot;&quot;; 
                                                                                                                             
if ( !preg_match(&#039;/^\w{,30}$/u&#039;, $the_author) )                                                                              
{                                                                                                                            
    echo &quot;author is over 30&quot;;                                                                                         
}                                                                                                                            
                                                                                                                


&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Maybe that test was too hard.  Slightly hard test:</p>
<p><code></p>
<p>  function truncate_to( $the_string,  $max_length )<br />
  {<br />
       $the_length = // correct way to get length -- NOT strlen( )  </p>
<p>       if( $the_lenght &lt;= $max_length ) return $the_string; </p>
<p>  }                                                         </p>
<p>echo &quot;author (85 bytes):$the_author," . strlen($the_author) . ',' . strlen( utf8_decode( $the_author ) ) . ',' .  ""; </p>
<p>if ( !preg_match('/^\w{,30}$/u', $the_author) )<br />
{<br />
    echo "author is over 30";<br />
}                                                                                                                            </p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hs4Mm</title>
		<link>http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/comment-page-1/#comment-153110</link>
		<dc:creator>Hs4Mm</dc:creator>
		<pubDate>Sun, 20 Sep 2009 17:50:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotforwords.com/?p=7558#comment-153110</guid>
		<description>Harder test failed!  &lt;code&gt; ... &lt;/code&gt; does not work :(</description>
		<content:encoded><![CDATA[<p>Harder test failed!  &lt;code&gt; &#8230; &lt;/code&gt; does not work <img src='http://www.hotforwords.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hs4Mm</title>
		<link>http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/comment-page-1/#comment-153109</link>
		<dc:creator>Hs4Mm</dc:creator>
		<pubDate>Sun, 20 Sep 2009 17:48:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotforwords.com/?p=7558#comment-153109</guid>
		<description>Harder test:
  
&lt;code&gt;
   
  non_existent_image.jpg

  blah blah

  &lt;a href=&quot;foo.html&quot; rel=&quot;nofollow&quot;&gt;should not end up as a link&lt;/a&gt;

&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Harder test:</p>
<p><code></p>
<p>  non_existent_image.jpg</p>
<p>  blah blah</p>
<p>  <a href="foo.html" rel="nofollow" class="liinternal">should not end up as a link</a></p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hs4Mm</title>
		<link>http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/comment-page-1/#comment-153108</link>
		<dc:creator>Hs4Mm</dc:creator>
		<pubDate>Sun, 20 Sep 2009 17:45:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotforwords.com/?p=7558#comment-153108</guid>
		<description>Yes!  Thanks a lot!</description>
		<content:encoded><![CDATA[<p>Yes!  Thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hs4Mm</title>
		<link>http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/comment-page-1/#comment-153107</link>
		<dc:creator>Hs4Mm</dc:creator>
		<pubDate>Sun, 20 Sep 2009 17:44:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotforwords.com/?p=7558#comment-153107</guid>
		<description>Test to see if &lt;code&gt; is supported:  Will try to print &gt; within &lt;code&gt; and &lt;/code&gt; tag.

&lt;code&gt;
 can I use &gt; directly:  &gt; ?
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Test to see if &lt;code&gt; is supported:  Will try to print &gt; within &lt;code&gt; and &lt;/code&gt; tag.</p>
<p><code><br />
 can I use &gt; directly:  &gt; ?<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hs4Mm</title>
		<link>http://www.hotforwords.com/2009/09/09/segment-for-g4-tv%e2%80%99s-attack-of-the-show-douchebag/comment-page-1/#comment-153096</link>
		<dc:creator>Hs4Mm</dc:creator>
		<pubDate>Sun, 20 Sep 2009 15:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotforwords.com/?p=7558#comment-153096</guid>
		<description>I noticed you have implemented truncation;  there are two things that can be done to the present scheme, one to make it safer and the other to make it better.  You may already have the &quot;make it safer&quot; thingy in place (can&#039;t tell by the display).  Will elaborate sometime today.</description>
		<content:encoded><![CDATA[<p>I noticed you have implemented truncation;  there are two things that can be done to the present scheme, one to make it safer and the other to make it better.  You may already have the &#8220;make it safer&#8221; thingy in place (can&#8217;t tell by the display).  Will elaborate sometime today.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
