Loading ...
Sorry, an error occurred while loading the content.

sorting question

Expand Messages
  • Bryan Irvine
    This can get a little confusing so hang on :-) We have an ad-processing system that will process all ads in alphebetical order. All the file names are numbers
    Message 1 of 2 , May 2, 2003
    • 0 Attachment
      This can get a little confusing so hang on :-)

      We have an ad-processing system that will process all ads in
      alphebetical order. All the file names are numbers so in an
      alphebetical sort 121212 is less than 800. The problem occurs when we
      have a ton of people dumping ads into the queue for processing. Some
      will sit for hours (it would be theoretically possible for an ad never
      to be processed, although it would never happen because the volume
      simply isn't there).

      The queuing system is pretty rudimentary. It's a directory (on a
      windows 2000 server) that gets scanned and the first file (according to
      alphebetical rules) gets processed. The filenames cannot be changed as
      the ad system is expecting them to arrive and won't understand if the
      filename is changed.

      What I'd like to do, is setup the ads to go to a different directory,
      then have a perl script scan the queue directory, and if it is empty
      move the next file into it according to the time it was created. So it
      would become a true fifo type of system.

      I have a handle on how to check if anything is in the directory
      (although win32 always confuses me, why can't it be unix?) but how would
      I make the script understand the creation time and move files according
      to that? Not only that but the script would need to run as a win32
      daemon right?

      --Bryan
    • Hans Ginzel
      ... perldoc -f sort; ... perldoc -f opendir; perldoc -f readdir; perldoc -f closedir; Can perl put some triger on a directory, so the OS will sent a signal
      Message 2 of 2 , May 3, 2003
      • 0 Attachment
        On Fri, May 02, 2003 at 09:32:36AM -0700, Bryan Irvine wrote:
        > alphebetical sort 121212 is less than 800. The problem occurs when we
        > have a ton of people dumping ads into the queue for processing. Some

        perldoc -f sort;

        > I have a handle on how to check if anything is in the directory
        > (although win32 always confuses me, why can't it be unix?) but how would

        perldoc -f opendir;
        perldoc -f readdir;
        perldoc -f closedir;

        Can perl put some triger on a directory, so the OS will sent a signal
        when it changed (added/removed) file? Under linux? Is there, in libc, a
        function supporting this under lInux?

        > I make the script understand the creation time and move files according
        > to that? Not only that but the script would need to run as a win32

        perldoc -f stat;

        > daemon right?

        Search the Inet about how to create sevices under Windows.


        Hans
      Your message has been successfully submitted and would be delivered to recipients shortly.