<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Random Text</title>
	<link>http://www.davewooding.com/random-text/</link>
	<description></description>
	<pubDate>Sat, 22 Nov 2008 08:18:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Brian</title>
		<link>http://www.davewooding.com/random-text/#comment-62</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Tue, 11 Mar 2008 20:02:18 +0000</pubDate>
		<guid>http://www.davewooding.com/random-text/#comment-62</guid>
		<description>Robert, 

I tested your line of code and it worked fine.      

How can I tell, which line of code is the prefered to use on my website?     You indicate that it cuts out a few steps and works with files edited on a Mac.   

Based on that idea, I will use your code Robert.     

Dave?</description>
		<content:encoded><![CDATA[<p>Robert, </p>
<p>I tested your line of code and it worked fine.      </p>
<p>How can I tell, which line of code is the prefered to use on my website?     You indicate that it cuts out a few steps and works with files edited on a Mac.   </p>
<p>Based on that idea, I will use your code Robert.     </p>
<p>Dave?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Plank</title>
		<link>http://www.davewooding.com/random-text/#comment-59</link>
		<dc:creator>Robert Plank</dc:creator>
		<pubDate>Mon, 10 Mar 2008 18:00:24 +0000</pubDate>
		<guid>http://www.davewooding.com/random-text/#comment-59</guid>
		<description>Sorry, typo in the code.  It should be:

$contents = array_map("trim", file($file));

Doing it that way cuts out a few steps.  You avoid the calls to fopen, fread, and that way works even on files edited on a Mac (they use "\r") or if line breaks are delimited in ASCII (using "\r\n" instead of just "\n").

Your longer way still works, but it's more unnecessary code.</description>
		<content:encoded><![CDATA[<p>Sorry, typo in the code.  It should be:</p>
<p>$contents = array_map("trim", file($file));</p>
<p>Doing it that way cuts out a few steps.  You avoid the calls to fopen, fread, and that way works even on files edited on a Mac (they use "\r") or if line breaks are delimited in ASCII (using "\r\n" instead of just "\n").</p>
<p>Your longer way still works, but it's more unnecessary code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.davewooding.com/random-text/#comment-56</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 10 Mar 2008 02:28:35 +0000</pubDate>
		<guid>http://www.davewooding.com/random-text/#comment-56</guid>
		<description>Brian,

QUESTION:  Should I replace your line: $contents = explode("\n", trim($content)); with Robert's suggested code?

I am not sure what he meant by " but the 2nd way is less hairy for me to do over... and over... and over.... " ?

ANSWER:  I tried this code and didn't get it to work for me - and I didn't go any further with it.

Dave</description>
		<content:encoded><![CDATA[<p>Brian,</p>
<p>QUESTION:  Should I replace your line: $contents = explode("\n", trim($content)); with Robert's suggested code?</p>
<p>I am not sure what he meant by " but the 2nd way is less hairy for me to do over... and over... and over.... " ?</p>
<p>ANSWER:  I tried this code and didn't get it to work for me - and I didn't go any further with it.</p>
<p>Dave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.davewooding.com/random-text/#comment-55</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 10 Mar 2008 02:27:49 +0000</pubDate>
		<guid>http://www.davewooding.com/random-text/#comment-55</guid>
		<description>Brian,

Regarding this:  "I am asking a lot here, but why should I stop? Your information is great!

How can I take datafeed paragraphs from a vendor and automatically break them into sentences (break at the period) and add a carriage return at the end of each period so that the vendor datafeed ends up as individual lines in my new text file?

Then I can simply open that file and add some more text lines relevant about that particular product and use your script to reassemble the text. This would be a fast way to randomize the orginal datafeed content with lots of unique content lines mixed in."

I plan on doing something similar to this for the datafeed site I am creating - break up the sentences that that vendor provides and rearranging them.

Dave</description>
		<content:encoded><![CDATA[<p>Brian,</p>
<p>Regarding this:  "I am asking a lot here, but why should I stop? Your information is great!</p>
<p>How can I take datafeed paragraphs from a vendor and automatically break them into sentences (break at the period) and add a carriage return at the end of each period so that the vendor datafeed ends up as individual lines in my new text file?</p>
<p>Then I can simply open that file and add some more text lines relevant about that particular product and use your script to reassemble the text. This would be a fast way to randomize the orginal datafeed content with lots of unique content lines mixed in."</p>
<p>I plan on doing something similar to this for the datafeed site I am creating - break up the sentences that that vendor provides and rearranging them.</p>
<p>Dave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.davewooding.com/random-text/#comment-54</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Mon, 10 Mar 2008 01:57:44 +0000</pubDate>
		<guid>http://www.davewooding.com/random-text/#comment-54</guid>
		<description>Another question in this code.     Robert Plank suggested to use this line in the code:

$contents = array_map("trim", file($content));

Should I replace your line:   $contents = explode("\n", trim($content));    with Robert's suggested code?      

I am not sure what he meant by "  but the 2nd way is less hairy for me to do over... and over... and over.... "  ?

I didn't know PHP had hair!</description>
		<content:encoded><![CDATA[<p>Another question in this code.     Robert Plank suggested to use this line in the code:</p>
<p>$contents = array_map("trim", file($content));</p>
<p>Should I replace your line:   $contents = explode("\n", trim($content));    with Robert's suggested code?      </p>
<p>I am not sure what he meant by "  but the 2nd way is less hairy for me to do over... and over... and over.... "  ?</p>
<p>I didn't know PHP had hair!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.davewooding.com/random-text/#comment-53</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Mon, 10 Mar 2008 01:46:32 +0000</pubDate>
		<guid>http://www.davewooding.com/random-text/#comment-53</guid>
		<description>Hey Dave,

I just used that new code that you put up.   Loaded onto my website and everything is working perfect.      

The possible ways to use this are incredible for developing unique content.  
   
------------------------

I am asking a lot here, but why should I stop?     Your information is great!

How can I take datafeed paragraphs from a vendor and automatically break them into sentences (break at the period) and add a carriage return at the end of each period so that the vendor datafeed ends up as individual lines in my new text file?     

Then I can simply open that file and add some more text lines relevant about that particular product and use your script to reassemble the text.     This would be a fast way to randomize the orginal datafeed content with lots of unique content lines mixed in.</description>
		<content:encoded><![CDATA[<p>Hey Dave,</p>
<p>I just used that new code that you put up.   Loaded onto my website and everything is working perfect.      </p>
<p>The possible ways to use this are incredible for developing unique content.  </p>
<p>------------------------</p>
<p>I am asking a lot here, but why should I stop?     Your information is great!</p>
<p>How can I take datafeed paragraphs from a vendor and automatically break them into sentences (break at the period) and add a carriage return at the end of each period so that the vendor datafeed ends up as individual lines in my new text file?     </p>
<p>Then I can simply open that file and add some more text lines relevant about that particular product and use your script to reassemble the text.     This would be a fast way to randomize the orginal datafeed content with lots of unique content lines mixed in.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simonne</title>
		<link>http://www.davewooding.com/random-text/#comment-50</link>
		<dc:creator>Simonne</dc:creator>
		<pubDate>Sun, 09 Mar 2008 20:25:06 +0000</pubDate>
		<guid>http://www.davewooding.com/random-text/#comment-50</guid>
		<description>This is interesting. I'm currently running a database driven affiliate website, and I've always customized my pages manually. But doing it your way, things can happen faster.</description>
		<content:encoded><![CDATA[<p>This is interesting. I'm currently running a database driven affiliate website, and I've always customized my pages manually. But doing it your way, things can happen faster.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.davewooding.com/random-text/#comment-46</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 09 Mar 2008 14:15:35 +0000</pubDate>
		<guid>http://www.davewooding.com/random-text/#comment-46</guid>
		<description>Hi Brian,

Sorry about that. 

It was pointed out by someone else that copy and pasting PHP code from my blog would not work as Wordpress puts some strange characters into the code I post.

Since then I have modified wordpress to allow copy/paste properly.  

What is posted in the comment above and here again should work.  If it still doesn't, let me know, and I'll zip it up and send it over.

Thanks.

Dave

$file = "file.txt";
$min = 2;
$max = 5;
$fh = fopen($file, "r");
$content = fread($fh, filesize($file));
$contents = explode("\n", trim($content));
if ($max &gt; count($contents)) $max = count($contents);
$contentnew = array_rand($contents,rand($min,$max));
foreach ($contentnew as $number) {
print $contents[$number]." ";
}</description>
		<content:encoded><![CDATA[<p>Hi Brian,</p>
<p>Sorry about that. </p>
<p>It was pointed out by someone else that copy and pasting PHP code from my blog would not work as Wordpress puts some strange characters into the code I post.</p>
<p>Since then I have modified wordpress to allow copy/paste properly.  </p>
<p>What is posted in the comment above and here again should work.  If it still doesn't, let me know, and I'll zip it up and send it over.</p>
<p>Thanks.</p>
<p>Dave</p>
<p>$file = "file.txt";<br />
$min = 2;<br />
$max = 5;<br />
$fh = fopen($file, "r");<br />
$content = fread($fh, filesize($file));<br />
$contents = explode("\n", trim($content));<br />
if ($max > count($contents)) $max = count($contents);<br />
$contentnew = array_rand($contents,rand($min,$max));<br />
foreach ($contentnew as $number) {<br />
print $contents[$number]." ";<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
