| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

auTIMator, Broken Link Generator

Page history last edited by Tim 15 years, 11 months ago

Back to Broken Links

auTIMator, Broken Link Generator

After using Tim's cool auTIMator utility, I thought I would share a couple of simple tools that I've used to turn the (Broken Links, Most Wanted) page generation process into an almost "one-click" operation. I use a computer running Microsoft Windows XP and some of the information here is relevant to that platform specifically. If you're using a computer with a different Operating System you may have to make some changes along the way. As with any project like this, if you're unsure as to what any of this does, it's probably best not to mess around with it. I take no responsibility if something goes hideously awry and you end up zombified or your computer blows up.

Creating the Toolset

  1. Compile the source for the broken link auTIMator
  2. Compile the source for Deadhead
  3. Copy the two exe files (deadlinks.exe and deadhead.exe) to a folder, I have one called elothtes_wiki
  4. Create the following batch file in the exe's folder (elothtes_wiki in this example). I named the batch file sorTIMat.bat, but you can call it what you like:
@ECHO OFF

del c:\backup\*.dat

dir c:\backup\*.* /b | find /v /i "every link" | find /v /i "Broken Link" | find /v /i "orphan pages" | find /v /i "most wanted" > c:\backup\in.dat

deadlinks.exe

sort c:\backup\out.dat /o c:\backup\_out.dat

deadhead.exe

del c:\backup\_out.dat

sort c:\backup\missing_ranked.dat /r /o c:\backup\missing_ranked.dat

Now your toolset has been created. You'll be happy to know that you only need to do this once.

Generating the Pages

Here is the fun part:

  1. Download a backup of the Wiki and extract it to the folder c:\backup (Tip: Winzip seems to handle ":" in filenames better than WinRAR at least in my experience)
  2. Run sorTIMat.bat

If you set everything up correctly, you'll see a bunch of text flashing by in the console/command prompt window and when the music stops, you will have several .dat files in the c:\backup folder. These are text files which you can open with your favourite text editor:

Some judicious copying and pasting later and you can update the relevant pages on the Wiki. Have fun and enjoy!


Deadhead (top)

Here is the source for Deadhead, which reformats the A-Z headers after the out.dat file has been sorted and copied to _out.dat by the batch file. This is probably horrible code or a bad way to do this, but C++ isn't really a language that I understand, I'm a PHP and C# ASP .net developer by trade -- and yes I did borrow Tim's code and bend it to my evil will. Mwahahahaaa *cough*

// deadhead.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int screen_output = 1;

int _tmain(int argc, _TCHAR* argv[])
{
        FILE *q = fopen("c:/backup/_out.dat","r");
        FILE *p = fopen("c:/backup/out.dat","w");

        char page_title[2048];
        char header_letter[10];

        while(fgets(page_title,2048,q))
        {
                page_title[strlen(page_title)-1]=0;
                if (screen_output) printf("Reading [%s]...n",page_title);

                for(int c='A';c<='Z';c++)
                {
                        sprintf(header_letter, "* [%c !!", c);
                        if (strstr(page_title, header_letter))
                        {
                                sprintf(page_title, "!!!%c", c);
                        }
                }
                fprintf(p,"%sn",page_title);
        }
        fclose(q);
        fclose(p);
        return 0;
}

Comments (0)

You don't have permission to comment on this page.