Programmers, how can I do this?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Groove
    Confirmed User
    • Jan 2003
    • 3852

    #1

    Programmers, how can I do this?

    I want to use CityDesk, a desktop content management program:

    http://www.fogcreek.com/CityDesk/

    to manage some static HTML freesites.

    However CityDesk adds a metatag to all pages which I want to get rid of.

    I could publish the pages locally, do a search and replace, then upload to the servers. But it would be MUCH more efficient to do an automated search and replace on the servers.

    Would it be difficult to write a server-side script that deletes the metatag from all pages, bearing in mind that these pages will published across multiple domains and multiple virtual hosts? Also please note that I'd prefer to run the script on demand rather than as a CRON job.

    If this is something that you could write for me, please describe your proposed solution and provide a ballpark cost.
  • Groove
    Confirmed User
    • Jan 2003
    • 3852

    #2
    Bump

    Comment

    • grumpy
      Too lazy to set a custom title
      • Jan 2002
      • 9870

      #3
      download the stuff...multifile replace and upload the stuff.
      But arent those pages generated on the fly...meaning they would have to modify there script?
      Don't let greediness blur your vision | You gotta let some shit slide
      icq - 441-456-888

      Comment

      • grumpy
        Too lazy to set a custom title
        • Jan 2002
        • 9870

        #4
        im downloading the demo now to see what the options are.
        Don't let greediness blur your vision | You gotta let some shit slide
        icq - 441-456-888

        Comment

        • grumpy
          Too lazy to set a custom title
          • Jan 2002
          • 9870

          #5
          see what you mean
          Don't let greediness blur your vision | You gotta let some shit slide
          icq - 441-456-888

          Comment

          • Intrigue
            Confirmed User
            • Feb 2004
            • 662

            #6
            Your best bet's probably a perl script you can run via cgi, to go through the files, and use a regex on each one. If you want me to do it, you'll have to get ahold of our sales guy:

            AIM: Avanteguard
            MSN: matt [ at ] imadigan.com
            Email: matt [ at ] imadigan.com
            ICQ: 314942262

            and he'll take care of you.

            Comment

            • Betray
              Confirmed User
              • Oct 2002
              • 346

              #7
              ^^^ exactly what he said, this would be your best bet.. but you would still have to run the script everytime you want to update it. unless you put the script on a timer ;)

              Comment

              • Varius
                Confirmed User
                • Jun 2004
                • 6890

                #8
                If you're in UNIX, you can just have a script using "rep" on files you upload.

                If Windows, I dunno maybe a .bat file?
                Skype variuscr - Email varius AT gmail

                Comment

                • Groove
                  Confirmed User
                  • Jan 2003
                  • 3852

                  #9
                  Originally posted by Varius
                  If you're in UNIX, you can just have a script using "rep" on files you upload.

                  If Windows, I dunno maybe a .bat file?
                  All servers will be Unix of some description.

                  Comment

                  • Varius
                    Confirmed User
                    • Jun 2004
                    • 6890

                    #10
                    Originally posted by Groove
                    All servers will be Unix of some description.
                    Ok, so you have few options:

                    1 - crontab script, but you said you wanted to avoid that

                    2 - get your server to execute a script whenever 'x' is uploaded. Probably the most complicated as you have to hack some sources and recompile stuff.

                    3 - have script you run manually. Just make a super easy shell script that will execute rep.

                    ie.

                    #!/bin/sh

                    rep -R 'metag tag line' '' /dir/*
                    Skype variuscr - Email varius AT gmail

                    Comment

                    • Groove
                      Confirmed User
                      • Jan 2003
                      • 3852

                      #11
                      Originally posted by Betray
                      ....but you would still have to run the script everytime you want to update it. unless you put the script on a timer ;)
                      Actually giving it a bit more thought... a CRON job may not be such a bad idea. It could be configured to run hourly, but only process files added since the last run.

                      Comment

                      • iwantu
                        Confirmed User
                        • Aug 2004
                        • 570

                        #12
                        Use this script

                        You owe me NOTHING!



                        sub replace;

                        $recursive = 0;

                        sub Printmenu {
                        print "Usage is: recureplace [option] 'find text' 'replace text' file1 file2 ... \n\n";
                        print " Replace the specified text in the specified files.\n\n";
                        print " options are:\n";
                        print " -e file_extension to replace word only in files matching the\n";
                        print " extension\n";
                        print " -R Recursive Perform recursively the replacement on all the\n";
                        print " files of all directories\n";

                        exit;
                        }


                        while ($ARGV[0] =~ /^-/) {
                        if ($ARGV[0] eq "-R") { $recursive = 1;}
                        elsif ($ARGV[0] eq "-e") { shift; $extension = $ARGV[0];}

                        shift;
                        }
                        if (($ARGV[0] eq "") ||
                        ($ARGV[1] eq "")) { &Printmenu;}

                        $find_txt = $ARGV[0]; shift;
                        $replace_txt = $ARGV[0]; shift;

                        &find('.');

                        [zeus@baileys (Aug 06 - 3:17am) - /home/zeus] ls -la /usr/local/bin/rep
                        -rwxr-xr-x 1 root wheel 2386 Jul 1 2002 /usr/local/bin/rep
                        [zeus@baileys (Aug 06 - 3:17am) - /home/zeus] more /usr/local/bin/rep
                        #!/usr/bin/perl

                        sub replace;

                        $recursive = 0;

                        sub Printmenu {
                        print "Usage is: recureplace [option] 'find text' 'replace text' file1 file2 ... \n\n";
                        print " Replace the specified text in the specified files.\n\n";
                        print " options are:\n";
                        print " -e file_extension to replace word only in files matching the\n";
                        print " extension\n";
                        print " -R Recursive Perform recursively the replacement on all the\n";
                        print " files of all directories\n";

                        exit;
                        }


                        while ($ARGV[0] =~ /^-/) {
                        if ($ARGV[0] eq "-R") { $recursive = 1;}
                        elsif ($ARGV[0] eq "-e") { shift; $extension = $ARGV[0];}

                        shift;
                        }
                        if (($ARGV[0] eq "") ||
                        ($ARGV[1] eq "")) { &Printmenu;}

                        $find_txt = $ARGV[0]; shift;
                        $replace_txt = $ARGV[0]; shift;

                        &find('.');

                        sub find {
                        local($dir,$nlink) = @_;
                        local($dev,$ino,$mode,$subcount);

                        ($dev,$ino,$mode,$nlink) = stat ('.') unless $nlink;

                        opendir(DIR,'.')|| die "Can't open $dir";
                        local(@filenames)= readdir(DIR);
                        closedir(DIR);

                        if (!($recursive)) {
                        @filenames = @ARGV;
                        }

                        $subcount = $nlink - 1;
                        for (@filenames) {
                        next if $_ eq '.';
                        next if $_ eq '..';

                        $name= $_;

                        if (!(-d $name)){
                        if ($extension ne '') {
                        next if (!(m/.*\.$extension$/i))
                        }
                        replace($name);
                        }
                        next if $subcount hahahaha0;

                        ($dev,$ino,$mode,$nlink) = lstat($_);
                        next unless -d _;

                        if ($recursive) {
                        print "\nDirectory: $dir/$name\n";
                        chdir $_ || die "Can't cd to $name";
                        &find($name,$nlink);
                        chdir '..';
                        --$subcount;
                        }
                        }

                        }


                        sub replace {
                        local ($filename)= @_;

                        if ((-r $filename) && (-w $filename) && (-s $filename)) {
                        $size = (-s $filename);

                        print "Replacing $find_txt by $replace_txt in $filename ($size)\n";

                        open(FILE,"<$filename");
                        read(FILE, $file_text, $size, 0);
                        close(FILE);

                        $file_text =~ s/$find_txt/$replace_txt/g;

                        open(FILE,">$filename") || die "Could not create $filename\n";
                        print FILE $file_text;
                        close(FILE);
                        }
                        else {
                        print "I have no right to modify $filename";
                        }
                        }


                        $100 PPS Promotion



                        --------
                        Michael M
                        ICQ: 551-376
                        http://affiliate.IwantU.com
                        Our members get laid, our affiliates get paid

                        Comment

                        • Groove
                          Confirmed User
                          • Jan 2003
                          • 3852

                          #13
                          Originally posted by iwantu
                          Use this script

                          You owe me NOTHING!


                          Many thanks!

                          Any chance of a brief description of what it does?
                          And installation/configuration requirements?

                          Comment

                          • arachnO
                            Confirmed User
                            • Jan 2004
                            • 1327

                            #14
                            Originally posted by Groove
                            And installation/configuration requirements?
                            I think you don't need anything to use this script cause Perl is standart application for all *nixes.
                            All news from Adult Industry: new sites, new galleries, updated sites, PPS days and much more!
                            TrafficHolder.com - Buy/Sell Adult Traffic

                            Comment

                            • grumpy
                              Too lazy to set a custom title
                              • Jan 2002
                              • 9870

                              #15
                              http://discuss.fogcreek.com/citydesk...68&ixReplies=1

                              I just asked them... there is your answer. So next time i think ist easier when you ask their support :-)
                              Don't let greediness blur your vision | You gotta let some shit slide
                              icq - 441-456-888

                              Comment

                              • Groove
                                Confirmed User
                                • Jan 2003
                                • 3852

                                #16
                                Originally posted by grumpy
                                http://discuss.fogcreek.com/citydesk...68&ixReplies=1

                                I just asked them... there is your answer. So next time i think ist easier when you ask their support :-)
                                Many thanks for posting the question

                                But I DID ask Fog Creek support prior to posting on GFY and they replied:

                                That tag is not merely cosmetic, it serves a purpose:

                                http://www.fogcreek.com/CityDesk/kb/...EveryFile.html

                                You would need to remove it from the published files
                                The response to your question (which I suspect was posted by a user) is a little more helpful than the one Fog Creek gave me. But it doesn't tell me how to "post-process your output HTML files before they're uploaded to the server". So I've posted a follow-up question.
                                Last edited by Groove; 08-06-2004, 07:24 AM.

                                Comment

                                Working...