• A Great friend to the HardForum with a great kid that he is trying to get a scholorship to continue his schooling. Please give hime a vote! Only 24 hours left! Thanks.
    If you have an VOTE FOR KEENAN!

finding random messages to embed

MadJuggla9

2[H]4U
Joined
Oct 9, 2002
Messages
3,515
You've seen all the church websites where they may have a saying each day, or each time you refresh a page. With our growing community, just a large textfile dump of sayings would be great for all kinds of purposes.

It's not to the point where it needs to be a newsfeed, but some place that holds, say, large textfiles with random quotes about misc things. Where do church websites get their sayings from; I know the webmaster doesnt type the file up and randomly include one, there must be some large source out there on the net.

Anyone know of a dumpster text file type website with a lot of quotes/sayings that could easily be thrown into a file and randomly picked to embed on page loads?
 
I wrote one twenty years ago; you can still find it if you search the web for NJQUOTER. But I don't think many of the quotes would be appropriate for the front of a church.

I'm curious about where the churches come up with them, too. I've noticed they're often the same from church to church, even comparing churches across great distances (as when travelling).
 
Something like a feed from Daily Word?

Today's Daily Word message on your Web site

If you have a Web site and would like to share Daily Word with your visitors, dailyword.com now offers an easy and dynamic way of displaying today's message on your Web site.

Just paste the following code into your Web site and each day it will automatically display the current day's title and affirmation with a link to the full message on dailyword.com, viewable absolutely free.
http://www.dailyword.com/rss/
 
RSS would be OK as I have familiarized myself with XML parsing, but it'd be much easier to find a website with a database of text files that have quotes in certain areas/fields/genres. That way I can download the textfile, parse it by line breaks, commas, or however the file is cutup, to randomly grab a line of the file and display it each day.

I currently have a church one, but I wondered if any expanded outside of that ...... for instance at my school we have a large tech file of intriguing sayings. Each time i SSH into school i have my .bashrc execute the perl script to display a random quote each time. I have no idea where the university got the file from, but Im sure they didn't do it by hand.

Here's the code with a few of the 1.5megs worth of lines below.

Code:
#!/usr/bin/perl -w

use strict;
srand;

sub get_rand_fortune{
	my $file = '';
	open(FILE, '/usr/local/bin/fortune/fortunes.txt');
	foreach my $line (<FILE>){
		$file .= $line;
	}
	close FILE;
	my @fortunes = split('\[\d+\]', $file);
	my $for = ($fortunes[(rand() * 234234) % scalar @fortunes]);
	chomp $for;
	$for = reverse($for);
	chomp $for;
	$for = reverse($for);
	chomp $for;
	return $for;
}


print get_rand_fortune() . "\n";


some quotes:
Code:
[04252]
Unquestionably, there is progress.
The average American now pays out twice as much in taxes as he formerly
got in wages.

[04253]
What this country needs is a good five cent microcomputer.

[04254]
When choosing between two evils, always try
the one you have never tried before.

[04255]
When your only tool is a hammer, you tend to treat everything you find like
a nail.

[04256]
With a rubber duck, one's never alone.

	-- The Hitchhiker's Guide to the Galaxy

[04257]
You are growing sleepy, very sleepy. At midnite tonite, you will write a
blank check in the amount of the balance of your check book and mail it
to me at...

[04258]
You have been targeted for termination.

[04259]
" If All Fails, READ THE DOCS ! "

[04260]
Vuja De -- The Feeling You've Never Been Here

[04261]
Marriage, n. a community consisting of a master, a mistress, and two slaves,
making in all, two.

	-- Ambrose Bierce

[04262]
Never wear anything that panics the cat.

[04263]
Abstract art is a product of the untalented sold by the unprincipled to the
utterly bewildered.

	-- Al Capp
 
Why not just come up with your own? I have something like that on my blog (the tagline changes with each refresh) and the lines are all from songs I listen to, movies I've seen, or famous quotes (things most of the people I know can easily relate to, in other words). There's also a couple of joke ones I've thrown in for fun, like a MySQL DB error, which was something people saw when I was having problems with my server.
 
It's fun to implement this so that the whole file doesn't need to be scanned and parsed every time.
 
mikeblas said:
It's fun to implement this so that the whole file doesn't need to be scanned and parsed every time.

I have been looking into cron, so that i can parse a single line into a file at certain intervals, then simply read the result file once with its 1 line of quotation. I won't have too much in my file for the time being I don't suspect, but if i do ill resort to what ive read on cron.

To CEpeep .... because it takes time and I dont want to grammatically sit and type :p
Not to mention how limited and stupid my own sayings would be. Ive havent googled much up, but I do suppose a joke site would be a good place to rip and format text from to put into a file that you can then parse.

I guess bible verses, jokes, and other misc stuff can be gnabbed manually. It wouldnt take as much time as I was originally thinking. Ill just have to make sure i don't screw up where ill be regular expression checking when making the input file ...... something really easy like 'tard-stop-here' should do the trick.

Thanks guys!
 
Back
Top