1. uniquefilename.e

I sent Rob a simple 7-character unique filename generator the other day. It was
inspired by CChris's recent "unique_filename() function".

"uniquefilename.e" is based on the Euphoria date() function -- every second a
new name is generated with no repeats -- at least for the next 25 years.

There's room for tweaking, so...

while (comments or suggestions) do
        ? appreciation
end while
}}}
<eucode>

Thanks,

jon }}}

new topic     » topic index » view message » categorize

2. Re: uniquefilename.e

jxliv7 wrote:
> 
> I sent Rob a simple 7-character unique filename generator the other day. It
> was inspired by CChris's recent "unique_filename() function".
> 
> "uniquefilename.e" is based on the Euphoria date() function -- every second
> a new name is generated with no repeats -- at least for the next 25 years.
> 
> There's room for tweaking, so...
> 
> }}}
<eucode>
> while (comments or suggestions) do
>         ? appreciation
> end while
> }}}
<eucode>
> 
> Thanks,
> 
> 
> --
> jon

I wrote a similar type function for compressing backups.

When using the dat, be sure to reverse the format, ie

yyyymmddhhmmss

That way your filename will always be sequential.

Chris



http://euallegro.wikispaces.com
http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/
http://members.aol.com/chriscrylex/EUSQLite/eusql.html

new topic     » goto parent     » topic index » view message » categorize

3. Re: uniquefilename.e

Chris Burch wrote:
> 
> I wrote a similar type function for compressing backups.
> 
> When using the dat, be sure to reverse the format, ie
> 
> yyyymmddhhmmss
> 
> That way your filename will always be sequential.
> 

That's what I did. But instead of a "ddmm" or "mmdd" sequence, I used the day of
the year ( date[8] ) from the date() function. That's easier to code (and decode)
as well as shorter than "mmdd" or "ddmm".

The result is [year][day of year][seconds of day] translated into base 26 (A-Z),
for a total of 6 characters.

Thanks for the comments,


--
jon

new topic     » goto parent     » topic index » view message » categorize

4. Re: uniquefilename.e

jxliv7 wrote:
> 
> The result is [year][day of year][seconds of day] translated into base 26
> (A-Z),
> for a total of 6 characters.
                 ^
Oops, I meant    7    characters...

--
jon

new topic     » goto parent     » topic index » view message » categorize

5. Re: uniquefilename.e

jxliv7 wrote:
> 
> > The result is [year][day of year][seconds of day] translated into base 26
> > (A-Z),
> > for a total of 6 characters.
>                  ^
> Oops, I meant    7    characters...

Doesn't seem to be working for me. It's only generating unique filenames every
5-10 seconds.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu