FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » When a random file is not found then what?
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
When a random file is not found then what? [message #185194] Fri, 07 March 2014 22:22 Go to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
I want to set up a routine so that when a file does not exist, another file
is selected.

1) select the year randomly.
2) selectt one of 100 numbers.
3) combine the pair.
4) locate file and play.
5) if file does not exist, do it again until one is found.

My thinking is, create an array of file names.
Then cycle through that until a match is found.

Any other ways?
Re: When a random file is not found then what? [message #185195 is a reply to message #185194] Fri, 07 March 2014 22:56 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 3/7/2014 10:22 PM, richard wrote:
> I want to set up a routine so that when a file does not exist, another file
> is selected.
>
> 1) select the year randomly.
> 2) selectt one of 100 numbers.
> 3) combine the pair.
> 4) locate file and play.
> 5) if file does not exist, do it again until one is found.
>
> My thinking is, create an array of file names.
> Then cycle through that until a match is found.
>
> Any other ways?
>

On a clear disk, you can seek forever...

--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
Re: When a random file is not found then what? [message #185196 is a reply to message #185194] Fri, 07 March 2014 23:03 Go to previous messageGo to next message
Ben Bacarisse is currently offline  Ben Bacarisse
Messages: 82
Registered: November 2013
Karma: 0
Member
add to buddy list
ignore all messages by this user
richard <noreply(at)example(dot)com> writes:

> I want to set up a routine so that when a file does not exist, another file
> is selected.
>
> 1) select the year randomly.
> 2) selectt one of 100 numbers.
> 3) combine the pair.
> 4) locate file and play.
> 5) if file does not exist, do it again until one is found.

Why not select and play a file chosen randomly from those that do exist,
possibly filtered by some criterion such a the year?

--
Ben.
Re: When a random file is not found then what? [message #185197 is a reply to message #185196] Sat, 08 March 2014 08:47 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On Sat, 08 Mar 2014 04:03:15 +0000, Ben Bacarisse wrote:

> richard <noreply(at)example(dot)com> writes:
>
>> I want to set up a routine so that when a file does not exist, another file
>> is selected.
>>
>> 1) select the year randomly.
>> 2) selectt one of 100 numbers.
>> 3) combine the pair.
>> 4) locate file and play.
>> 5) if file does not exist, do it again until one is found.
>
> Why not select and play a file chosen randomly from those that do exist,
> possibly filtered by some criterion such a the year?

yeah that could work.
read the directory, build the array on what's in it.
select from the array.
Re: When a random file is not found then what? [message #185198 is a reply to message #185196] Sat, 08 March 2014 09:16 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 3/7/2014 11:03 PM, Ben Bacarisse wrote:
> richard <noreply(at)example(dot)com> writes:
>
>> I want to set up a routine so that when a file does not exist, another file
>> is selected.
>>
>> 1) select the year randomly.
>> 2) selectt one of 100 numbers.
>> 3) combine the pair.
>> 4) locate file and play.
>> 5) if file does not exist, do it again until one is found.
>
> Why not select and play a file chosen randomly from those that do exist,
> possibly filtered by some criterion such a the year?
>

That would make too much sense. Remember who you're talking to...

--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: php exec http url
Next Topic: switch with range of comparisons
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Oct 23 04:10:31 EDT 2017

Total time taken to generate the page: 0.00642 seconds