The OFFICIAL Unofficial Achewood Message Board

Trivial Pursuits => Science & Nature => Topic started by: AugustWest on April 23, 2006, 02:39:11 am

Title: I need a simple program
Post by: AugustWest on April 23, 2006, 02:39:11 am
To do something simple.

I'd like to create a text file, or csv file, or whatever, that consists of a list of phrases or sentences.  The program would then select and display a random one from the list when I asked it to.

Anybody know a simple way to do this?
Title: Re: I need a simple program
Post by: acoxcae on April 23, 2006, 03:59:14 am
Sure.  Like, for a web page, or what?  Any particular language?

I could do something like this in Perl in about 1.5 seconds.  It'd take almost a minute if it had to be web-enabled.

Any particular format for the input file?
Title: Re: I need a simple program
Post by: AugustWest on April 23, 2006, 04:16:34 am
No, just for my personal use.  Generic text would be fine.
Title: Re: I need a simple program
Post by: jough on April 23, 2006, 05:00:43 am
I have a random quote come up on Jough.com, but I use a mySQL database since I use a mySQL database to keep track of everything (like whether I need eggs or milk, etc.) but yeah, let us know whether you want this on a web page or just on your PC, which of course would require you install Perl or something on your computer in order to run the script (I'd do it in PHP, though, since Perl is pretty much a dead language).
Title: Re: I need a simple program
Post by: acoxcae on April 23, 2006, 03:29:02 pm
(I'd do it in PHP, though, since Perl is pretty much a dead language).

You take that back.
Title: Re: I need a simple program
Post by: Gimpson on April 24, 2006, 10:39:51 am
(I'd do it in PHP, though, since Perl is pretty much a dead language).

Tell it to the Large Kansas Based Telecommunications Company that just hired me to maintain their perl based RF Engineering data warehouse.  (I do agree, though... Perl jobs are few and far between these days, but I've been lucky enough not to spend any time unemployed since 1997 or so.)
Title: Re: I need a simple program
Post by: wombat on April 24, 2006, 12:46:32 pm
Well, people are still hired to teach Latin, too.
Title: Re: I need a simple program
Post by: jough on April 24, 2006, 03:09:46 pm
Oh, I'm sure there are still large amounts of Cobol running throughout the country too, or banks whose systems are still written in Fortran, but they're not the exciting programming languages of the present, let alone the future.

I've chosen to "standardize" on PHP for numerous reasons: with version 5 it's finally up to the enterprise software task, object-orientation is no longer an afterthought, it has a HUGE installed base, it is fast and scalable, and it's still under near constant development and will continue to mature with each version.

Most of those things are also true of Perl, of course - except for the last part.  Also, there is really nothing that Perl has that PHP doesn't, but PHP has those other advantages.  Also, procedural PHP and Perl are so much alike in dignity that it is embarrassing (for PHP).  You can refactor Perl code into PHP as fast as you can read it.  The differences in the core functionality are largely ceremonial.
Title: Re: I need a simple program
Post by: AugustWest on April 24, 2006, 03:20:19 pm
I have an idea.  Why don't we have a race!  PERL vs. PHP!

Let's see who can write the program I need and post it to the board fastest.

Ready? GO!
Title: Re: I need a simple program
Post by: Mite on April 24, 2006, 05:01:48 pm
I have an idea.  Why don't we have a race!  PERL vs. PHP!

Let's see who can write the program I need and post it to the board fastest.

Ready? GO!
You, sir, are a genius. You must be one hell of a dad.
Title: Re: I need a simple program
Post by: AugustWest on April 24, 2006, 05:53:05 pm
You, sir, are a genius. You must be one hell of a dad.

Shhhh!  They'll catch on...
Title: Re: I need a simple program
Post by: AlohaDawg on April 24, 2006, 05:59:07 pm
As long as we are begging for free software....

Is there a script I can run that returns the Filenames only (no paths) of everything on a network drive? There are about 47,000 files on this drive and I want to check for duplicate files.

 
Title: Re: I need a simple program
Post by: acoxcae on April 24, 2006, 07:54:24 pm
Aug -

I took the middle road and made your app in C# - because I have a free version of Visual Studio and it's the one most likely to work well for you without an interpreter or anything.

Download it at http://edgecom.homelinux.com/Randomizer.exe, and then put a file called input.txt in the same directory - it picks a line at random and prints it.

Dawg -

Your problem is more complex - certainly possible, but definitely more in-depth.  On the plus side, I'm sure someone's solved that problem before.  In fact, I use to use a program like that when I worked at the National Archives - I'll see if I can find it, or at least find its name.
Title: Re: I need a simple program
Post by: theinevitable on April 24, 2006, 08:25:41 pm
wow.

I was about this (indicates roughly 1/4 of an inch) close to saying "oh, Dawg, I think there's a C program in "Cryptonomicon" that can do that for you, if you want."

isn't' there?
Title: Re: I need a simple program
Post by: AugustWest on April 24, 2006, 08:39:34 pm
Aug -

I took the middle road and made your app in C# - because I have a free version of Visual Studio and it's the one most likely to work well for you without an interpreter or anything.

Download it at http://edgecom.homelinux.com/Randomizer.exe, and then put a file called input.txt in the same directory - it picks a line at random and prints it.


YOU WIN!  That's just what I wanted.  A tiny can to you sir.  More when I remember.
Title: Re: I need a simple program
Post by: CortJstr on April 24, 2006, 09:12:45 pm
As long as we are begging for free software....

Is there a script I can run that returns the Filenames only (no paths) of everything on a network drive? There are about 47,000 files on this drive and I want to check for duplicate files.

I have ACDSee 7.0 it will do this.  It can compare just file names (fast) or actual contents regardless of file name (slower).

If you only need to do this once you could probably just install the 30-day trial, run the comparison and uninstall it. Or there's always eMule. I don't know about 8.0
Title: Re: I need a simple program
Post by: jough on April 24, 2006, 11:36:53 pm
Microsoft has a PowerToy called SyncTool which looks at two directories and can copy or delete files in either or both directions.  It's awesome for keeping travelling copies of stuff on a USB drive or something and then reconsiling the differences when you get home.

You can also use it to just make a list of the files that would be changed/added/deleted without actually performing the action, and you can even write that list to a log.