Re: CFDIRECTORY - previous & next

2005-06-23 Thread S . Isaac Dealey
My framework has a handfull of tags and functions (literally a
handful, less than 5) that manage file system access for one reason or
another... They all rely on a function to generate the path to the
target variable where information about a specific file and/or
directory is stored, so that file and directory reads can all be
cached, and so that any time a file is moved, deleted, created, etc.
the cache for the file and/or directory can be easily deleted to reset
the cache. The variable path is derived by a function to ensure that
all the tags/functions that manipulate file data use the same cache
and that if there's ever a reason to change the path it only needs to
be changed in one place.

Thread just got me thinking. :)

> Absolutely.  Filesystem access is always slow.  I'd
> probably read the
> directory once and store it in the application scope, and
> then just
> add a URL parameter that would allow regenerating it.
> Then it would
> never have to hit the filesystem unless you ask it to
> (after you
> publish something).

> cheers,
> barneyb

> On 6/23/05, B G <[EMAIL PROTECTED]> wrote:
>> Thanks to you both.  This may be academic, but reducing
>> CFDIR calls to as
>> few as possible would be prudent, no?  On a small scale
>> performance may not
>> suffer, but accessing the HDD can quickly create lag as
>> file sizes and
>> numbers grow.


s. isaac dealey 954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm


~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210458
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: CFDIRECTORY - previous & next

2005-06-23 Thread S . Isaac Dealey
> Thanks to you both.  This may be academic, but reducing
> CFDIR calls to as
> few as possible would be prudent, no?  On a small scale
> performance may not
> suffer, but accessing the HDD can quickly create lag as
> file sizes and
> numbers grow.

Well yeah... I just wasn't taking the time to address it. :)

Incidentally, if you just need to get an alphabetic list of the files
in a given directory, it's _MUCH_ more efficient to use

ListSort(createObject("java","java.io.File").init("mydirectory").list(
),"textnocase")

and of course you can parameterize either this or the directory into
an application or other persistent variable... except even if you
don't use cfdirectory, you can't use  and still get the
performance improvement because the function in the default attribute
of the cfparam tag executes before the cfparam tag executes, so you
have to use this instead



 get directory list ...



s. isaac dealey 954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm


~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210456
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: CFDIRECTORY - previous & next

2005-06-23 Thread Barney Boisvert
Absolutely.  Filesystem access is always slow.  I'd probably read the
directory once and store it in the application scope, and then just
add a URL parameter that would allow regenerating it.  Then it would
never have to hit the filesystem unless you ask it to (after you
publish something).

cheers,
barneyb

On 6/23/05, B G <[EMAIL PROTECTED]> wrote:
> Thanks to you both.  This may be academic, but reducing CFDIR calls to as
> few as possible would be prudent, no?  On a small scale performance may not
> suffer, but accessing the HDD can quickly create lag as file sizes and
> numbers grow.

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210454
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: CFDIRECTORY - previous & next

2005-06-23 Thread B G
Thanks to you both.  This may be academic, but reducing CFDIR calls to as 
few as possible would be prudent, no?  On a small scale performance may not 
suffer, but accessing the HDD can quickly create lag as file sizes and 
numbers grow.

>From: S. Isaac Dealey <[EMAIL PROTECTED]>
>Reply-To: cf-talk@houseoffusion.com
>To: CF-Talk 
>Subject: Re: CFDIRECTORY - previous & next
>Date: Thu, 23 Jun 2005 18:15:33 -0400
>
>Barney's suggestion should work... as an alternative suggestion, you
>could either use ListFindNoCase() against the cfdirectory's name
>column to locate the current image:
>
>
>
>And then use "index" to locate the next and last images in that
>cfdirectory query.
>
>Or you can pass the index of the image in that query to the page and
>omit the listfindnocase() statement all-together.
>
>When you have the index of an image you can easily get the names of
>the next and last images in the directory using
>cfdirectory.name[index+1] and cfdirectory.name[index-1] or compare
>against cfdirectory.recordcount to know if the current image is the
>last one in the directory.
>
>You do need to make sure you use a sort order in the cfdirectory tag,
>as cfdirectory will produce semi-random results otherwise.
>
>
>s. isaac dealey 954.522.6080
>new epoch : isn't it time for a change?
>
>add features without fixtures with
>the onTap open source framework
>
>http://www.fusiontap.com
>http://coldfusion.sys-con.com/author/4806Dealey.htm
>
>
>

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210453
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: CFDIRECTORY - previous & next

2005-06-23 Thread S . Isaac Dealey
Barney's suggestion should work... as an alternative suggestion, you
could either use ListFindNoCase() against the cfdirectory's name
column to locate the current image:



And then use "index" to locate the next and last images in that
cfdirectory query.

Or you can pass the index of the image in that query to the page and
omit the listfindnocase() statement all-together.

When you have the index of an image you can easily get the names of
the next and last images in the directory using
cfdirectory.name[index+1] and cfdirectory.name[index-1] or compare
against cfdirectory.recordcount to know if the current image is the
last one in the directory.

You do need to make sure you use a sort order in the cfdirectory tag,
as cfdirectory will produce semi-random results otherwise.


s. isaac dealey 954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm


~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210446
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: CFDIRECTORY - previous & next

2005-06-23 Thread Barney Boisvert
Do your CFDIRECTORY, and then do a QofQ to pull out the next/prev item
(this will get the next item, assuming you're going in filename
order);


  SELECT *
  FROM imageList
  WHERE [name] > 
  ORDER BY [name]


For previous, make it a < comparison, and add DESC to the ORDER BY
clause.  Just make sure you check to see that there was a record
returned.  If there isn't you'll know you either asked for the image
after the last image, or the image before the first one.

cheers,
barneyb

On 6/23/05, B G <[EMAIL PROTECTED]> wrote:
> I've been noodling around with a photo gallery which relies on Picasa2 to
> create thumbs and web friendly images.  The app use cfdirectory to read the
> list of jpegs in any given directory making it easy to add and delete at
> will without updating the static HTML pages Picasa2 generates.
> 
> It's basic, but works well.  My app is three basic pages.  A page which
> lists folders.  A page which lists thumbnails when the user chooses a
> folder, and of course a page which shows the large image when the user
> clicks on one of the thumbnails.  I've been wanting to add a PREVIOUS - NEXT
> feature on the main image page so the user doesn't have to always hit BACK
> to the thumbs to navigate to the next image.
> 
> I don't see any way of using CFDIRECTORY to determine which file is next
> based on the current position.  I'm guessing that I will have to create a
> list of filenames and keep it in a session so that I can call the filename
> based on list position.  Any other theories?
> 
> Thanks!
> 
> 
> 
> 

~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210440
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


CFDIRECTORY - previous & next

2005-06-23 Thread B G
I've been noodling around with a photo gallery which relies on Picasa2 to 
create thumbs and web friendly images.  The app use cfdirectory to read the 
list of jpegs in any given directory making it easy to add and delete at 
will without updating the static HTML pages Picasa2 generates.

It's basic, but works well.  My app is three basic pages.  A page which 
lists folders.  A page which lists thumbnails when the user chooses a 
folder, and of course a page which shows the large image when the user 
clicks on one of the thumbnails.  I've been wanting to add a PREVIOUS - NEXT 
feature on the main image page so the user doesn't have to always hit BACK 
to the thumbs to navigate to the next image.

I don't see any way of using CFDIRECTORY to determine which file is next 
based on the current position.  I'm guessing that I will have to create a 
list of filenames and keep it in a session so that I can call the filename 
based on list position.  Any other theories?

Thanks!



~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210439
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54