• Anonymouse (unregistered) in reply to clm
    It's at this point that the file collapses in on itself.
    OH SHI-
  • (cs) in reply to MeBerserk
    MeBerserk:
    I think C++ just scared the shit out of him and tried to solve it by using VB =)
    Oh my. A real language for real men, producing shit language output. I wonder why didn't he do everything in VB then, seeing he doesn't like C#...

    This looks as creepy as the INSERT-generating SELECTs I've seen in some apps. Moreso that the "trick" could've been done with pure C#, even if it would still look like a cheap hack. Which it is.

  • (cs) in reply to Anon
    Anon:
    All my comments look like this

    [...]

    x = x + 1; // add 1 to x

    Mine look like

    x += 1 # Add 1 to x

    Obviously I'm using the better programming language.

    Also: CS's code highlighter cannot recognize an escaped backslash at the end of a string. Or was that some other highlighter?

  • Anon (unregistered) in reply to Lego
    Lego:
    sxeraverx:
    Lego:
    Anon:
    Anon:
    With the Matryoshka doll comment I was expecting to see it zip individual files, then zip the folder of zip files recursively giving you a zip of zips of zips, and so on. But this, is so much more insidiously retarded.

    Or, repeatedly zip the same file until you reach the singularity of the 1 bit file.

    Actually, once the zips of zips reached a sufficiently high level of disorder the combined size of all the zips would start to grow because each iteration adds a small amount of overhead to the file. Eventually the process would create a file consuming all secondary storage on the host system.

    -Lego

    Whoosh!

    Sorry, my mistake! I thought, for a moment, that intelligent discussion was a possibility in this forum.

    Silly me.

    -Name removed to protect the guilty

    First day on the internet? Don't worry, you'll get used to it.

  • Anon (unregistered) in reply to derula
    derula:
    Anon:
    All my comments look like this

    [...]

    x = x + 1; // add 1 to x

    Mine look like

    x += 1 # Add 1 to x

    Obviously I'm using the better programming language.

    Also: CS's code highlighter cannot recognize an escaped backslash at the end of a string. Or was that some other highlighter?

    Well, I could have done:

    x += 1;

    or even

    x++;

    But, I like to write it out in full to make it clear what I'm adding one to (and then reinforce in the comments).

    On the other hand, using # for comments is just plain silly. # belongs in the names of programming languages.

  • Confused (unregistered) in reply to Anon
    Anon:
    cod3_complete:
    //my name:
    The real WTF is the comments:

    //find temp directory; dwRetVal = GetTempPath(dwBufSize, //buffer length lpPathBuffer); //path buffer

    //get the windows directory; dwRetVal = GetWindowsDirectory(lpPathBuffer1,dwBufSize); //path buffer

    Without these comments I'd have spend all of, err, 1 nano-second working out that GetTempPath let me find a temp directory and that GetWindowsDirectory would let me, err, get the windows directory.

    Prime example of why comments should tell why not what. I only hope the young whippersnappers are listening.

    All my comments look like this

    x = x + 1 // add 1 to x

    I prefer to eliminate confusion altogether...

    x = x + 1; // add 1 to x (so x is one bigger (or much, much smaller))

  • (cs) in reply to Anon
    Anon:
    On the other hand, using # for comments is just plain silly. # belongs in the names of programming languages.

    It's better than --.

  • Wodin (unregistered) in reply to halcyon1234
    halcyon1234:
    Anon:
    Anon:
    With the Matryoshka doll comment I was expecting to see it zip individual files, then zip the folder of zip files recursively giving you a zip of zips of zips, and so on. But this, is so much more insidiously retarded.

    Or, repeatedly zip the same file until you reach the singularity of the 1 bit file.

    I've been doing that for a while now. I think the process is almost done.

    1 <== The entire Internet.

    You must have made a mistake. I get 0.

  • Rahim (unregistered) in reply to Confused
    Confused:
    Anon:
    cod3_complete:
    //my name:
    The real WTF is the comments:

    //find temp directory; dwRetVal = GetTempPath(dwBufSize, //buffer length lpPathBuffer); //path buffer

    //get the windows directory; dwRetVal = GetWindowsDirectory(lpPathBuffer1,dwBufSize); //path buffer

    Without these comments I'd have spend all of, err, 1 nano-second working out that GetTempPath let me find a temp directory and that GetWindowsDirectory would let me, err, get the windows directory.

    Prime example of why comments should tell why not what. I only hope the young whippersnappers are listening.

    All my comments look like this

    x = x + 1 // add 1 to x

    I prefer to eliminate confusion altogether...

    x = x + 1; // add 1 to x (so x is one bigger (or much, much smaller))

    We are paid by the line of code and therefore it is much demanded that we document our code as thoroughly as possible to provide the greatest value to our customer, therefore we document each line similar as follows

    x = x + 1; // take the value represented by the variable x and add 1 to it so that it becomes one larger, though possibly much, much smaller if an overflow occurs, then assign this new, possibly incorrect, value back to the variable x

  • Zahim (unregistered) in reply to Rahim
    Rahim:
    Confused:
    Anon:
    cod3_complete:
    //my name:
    The real WTF is the comments:

    //find temp directory; dwRetVal = GetTempPath(dwBufSize, //buffer length lpPathBuffer); //path buffer

    //get the windows directory; dwRetVal = GetWindowsDirectory(lpPathBuffer1,dwBufSize); //path buffer

    Without these comments I'd have spend all of, err, 1 nano-second working out that GetTempPath let me find a temp directory and that GetWindowsDirectory would let me, err, get the windows directory.

    Prime example of why comments should tell why not what. I only hope the young whippersnappers are listening.

    All my comments look like this

    x = x + 1 // add 1 to x

    I prefer to eliminate confusion altogether...

    x = x + 1; // add 1 to x (so x is one bigger (or much, much smaller))

    We are paid by the line of code and therefore it is much demanded that we document our code as thoroughly as possible to provide the greatest value to our customer, therefore we document each line similar as follows

    x = x + 1; // take the value represented by the variable x and add 1 to it so that it becomes one larger, though possibly much, much smaller if an overflow occurs, then assign this new, possibly incorrect, value back to the variable x

    Rahim, you are fired. I tell you time and time again that comments must stand out separate from our code so customer can follow them. The proper format is followed:

    // Comment for next line of code starts below: // take the value represented by the variable // x and add 1 to it so that it becomes one // larger, though possibly much, much smaller // if an overflow occurs, then assign this new, // possibly incorrect, value back to the variable x x = x + 1;

  • (cs) in reply to Wodin
    Wodin:
    halcyon1234:
    Anon:
    Or, repeatedly zip the same file until you reach the singularity of the 1 bit file.

    I've been doing that for a while now. I think the process is almost done.

    1 <== The entire Internet.

    You must have made a mistake. I get 0.

    Store it in /dev/null and we're done.

  • (cs) in reply to halcyon1234
    halcyon1234:
    Wodin:
    halcyon1234:
    I've been doing that for a while now. I think the process is almost done.

    1 <== The entire Internet.

    You must have made a mistake. I get 0.
    Store it in /dev/null and we're done.
    Then you can be proud of having accidentally the whole Internet.

  • Lev (unregistered) in reply to Zahim
    Zahim:
    Rahim:
    Confused:
    Anon:
    cod3_complete:
    //my name:
    The real WTF is the comments:

    Prime example of why comments should tell why not what. I only hope the young whippersnappers are listening.

    All my comments look like this

    x = x + 1 // add 1 to x

    I prefer to eliminate confusion altogether...

    x = x + 1; // add 1 to x (so x is one bigger (or much, much smaller))

    x = x + 1; // take the value represented by the variable x and add 1 to it so that it becomes one larger, though possibly much, much smaller if an overflow occurs, then assign this new, possibly incorrect, value back to the variable x

    // Comment for next line of code starts below: // take the value represented by the variable // x and add 1 to it so that it becomes one // larger, though possibly much, much smaller // if an overflow occurs, then assign this new, // possibly incorrect, value back to the variable x x = x + 1;

    Adding another Matryoshka.

  • Nathan (unregistered) in reply to Lev

    Aaah, finally, a good old-fashioned WTF. No silly made-up story. Just painful code. Code that even (probably?) works, but leaves you scratching your head and wondering why any sane individual would think that was a good idea. Thank you, Mark, for a quite enjoyable post.

  • (cs) in reply to Phil
    Phil:
    Schmuli:
    How is this zipping? What part of that script actually zips anything?
    It first creates a small empty ZIP file by actually writing a valid header (and nothing else) to the destination ZIP. It then uses the Windows shell extensions to add the required files to the ZIP via a "Copy" operation--like copying files from one folder to another. Since Windows treats ZIP files like folders that can be copied into, this adds them to the ZIP. Actually it's a rather clever idea to avoid the use of complex (sometimes unreliable) third-party libraries, but it's implemented a bit strangely.
    You mean complex (sometimes unreliable) third-party libraries like libzip?
  • ab (unregistered) in reply to Zylon
    Zylon:
    TRWTF is that the "Full Article" view displays the exact same thing as the Summary view.
    They had some trouble compressing it.

    At least the summary isn't larger than the full article.

  • Dan (unregistered) in reply to James
    James:
    I don't know why everybody's acting like this makes their eyes bleed. Is it dumb to have your C++ code write your VBScript for you? Sure. But if you're stuck on an XP machine (and you know it will *always* be at least XP) and there are procedural hurdles to importing/using 3rd-party software, VBScript is the way to go. Sad, but true.

    I grant you that he should have broken out the VBScript in a separate file and just invoked it as if it were a command-line zip util...

    Or made use of the #import statement in VC++ and skipped VBS entirely.

  • ysth (unregistered) in reply to halcyon1234
    halcyon1234:
    Anon:
    Or, repeatedly zip the same file until you reach the singularity of the 1 bit file.
    I've been doing that for a while now. I think the process is almost done.

    1 <== The entire Internet.

    When I did that, I got a 0. Can you check your code?

  • Boyd (unregistered) in reply to Anon
    Anon:
    Anon:
    All my comments look like this

    x = x + 1 // add 1 to x

    Yikes! I fail, left out the semi-colon

    x = x + 1; // add 1 to x

    Much better now.

    It should now be:

    // add 1 to x // [2009-09-09] Added a semicolon to resolve compiler error 0x22c (see ticket 87654334) x = x + 1;

  • Phil (unregistered) in reply to rfsmit
    rfsmit:
    You mean complex (sometimes unreliable) third-party libraries like libzip?
    Exactly. That have been around for years and still aren't even at version 1.0 yet because they haven't worked the bugs out.
  • Easy Pie (unregistered)
    system 'zip -r folder.zip folder';

    Oops, you're using Windows. Sorry. You have my sympathies.

  • Uncle Sam (unregistered) in reply to derula
    derula:
    Anon:
    On the other hand, using # for comments is just plain silly. # belongs in the names of programming languages.

    It's better than --.

    The DoD has used ADA for years without nuking us yet!

  • (cs) in reply to Anon
    Anon:
    Anon:
    With the Matryoshka doll comment I was expecting to see it zip individual files, then zip the folder of zip files recursively giving you a zip of zips of zips, and so on. But this, is so much more insidiously retarded.

    Or, repeatedly zip the same file until you reach the singularity of the 1 bit file.

    Complaints, complaints, complaints.

    You're just too cheap to buy a quantum computer, aren't you?

    (Strictly speaking, a singularity would be a 0-bit file. Gets a bit hairy at the boundaries though. Now, what was I saying about a quantum computer?)

  • (cs) in reply to Tim
    Tim:
    "Jeez - just pay for Winzip command line already."

    Glad you didn't write this either! The best solution would be to use the minizip library (in zlib/contrib).

    By "The best," I assume you mean "A plausible alternative."

    By all means, stay unregistered. An occasional brain scan for lesions might be advisable, however.

  • (cs) in reply to Zylon
    Zylon:
    TRWTF is that the "Full Article" view displays the exact same thing as the Summary view.
    TRWTF is that you didn't realise this before you clicked on the link.

    Yer gettin' old and weak: your WTForce is waning, old man. I mean, what extra goodies did you expect?

  • (cs) in reply to derula
    derula:
    Then you can be proud of having accidentally the whole Internet.
    I didn't even know accidentally was a verb. LSNED.
  • Jeesh (unregistered)
    <clue>

    To be honest in this case again the original developer is more genius than the poor guy who is trying to "maintain" the code and unfortunately do not have a clue.

    My questions: why to send this one to thedailywtf in the first place? And even more the question to Alex: what is really the WTF? Comma in wrong place, wrong indentation or something more catastrophic in horizon? The code is beautiful hack when management says that no 3rd party software allowed. MS full stop.

    As a teaser to the original poster and to the others : how you will implement the same functionality?

    • in Windows
    • not using any 3rd party tools
    • implementing it in 120 minutes (above is just assumption because part of the code is cut and paste; sorry lads)

    And please put the timer on and let me know.

    </clue>

    -- Jeesh - I am getting old.

  • (cs) in reply to danixdefcon5
    danixdefcon5:
    MeBerserk:
    I think C++ just scared the shit out of him and tried to solve it by using VB =)
    Oh my. A real language for real men, producing shit language output. I wonder why didn't he do everything in VB then, seeing he doesn't like C#...

    This looks as creepy as the INSERT-generating SELECTs I've seen in some apps. Moreso that the "trick" could've been done with pure C#, even if it would still look like a cheap hack. Which it is.

    I'm getting sick of being defensive about C++, which has its place and has spent the last ten years or so not encroaching on any other language's, but ...

    What on Earth does "producing shit language output" mean?

    I'd be the first to admit that <insert Sturgeon percentage here/> of projects written in C++ are crap. I'm not aware of any statistics that report this as either a higher or lower figure than Java (which I think is a fair comparison) or even COBOL (which I suppose might be considered to lie in a different application domain).

    Bottom line is, it's trivially easy to spot a crap C++ programmer -- and that's about 95% of applicants who claim they've got 2+ years' of C++ experience. It's nowhere near as easy to spot a crap programmer in Perl or in <insert Web framework of choice>.

    Of course, that leaves you with an awkward choice:

    (1) It's completely the wrong language for the job, but it works, and I can pretty much avoid retards. (2) It's absolutely the correct language, framework, platform, and indeed burn-scented-offerings-to-the-agile-god-of-my-ancestors choice, but I'm gonna be pestered by retards from half past eight in the morning until I shut my mobile off at 3:30 am on Sunday morning.

    A tricky choice, that. But we're all computer scientists here. We can all do the Boolean.

    ("I was working in a Data Center, late one night, when my eyes beheld a hideous sight ...")

  • (cs) in reply to Code Dependent
    Code Dependent:
    derula:
    Then you can be proud of having accidentally the whole Internet.
    I didn't even know accidentally was a verb. LSNED.
    Don't be a Fool!

    All Grammar Nazis imbibe, with their Mother's Milk, the indisputable fact that it is permissible in the English Language (American Deviation) for one to Verb Nouns.

    It is Inadvisable to Verb Adjectives, because an Adjective might accidentally be a Gerundive, which has therefore already become an Adjectavili[s|z]ed Verb.

    There is, however, no rule in the Grammar Nazi Handbook to forbid, or even to deprecate, the Verbing of Adverbs. Clearly, an Adverb without a Verb is the grammatical equivalent of a deserted single mother: without its partner, it is responsible for doing the best job that it can.

    Do not, however, attempt to Conjunctivise a Preposition. This is possible, but very dangerous indeed. (Usually, it takes an Awful Lot of Squinting.) It is best left to Experts.

    As for Hanging Prepositions -- well, I'm not alone in saying that hanging's too good for 'em. I'd quote Leviticus on this, but I'm sure we're all Good People here.

    Now, if you'll excuse me, I'm off to get Stoned.

  • dag (unregistered) in reply to cod3_complete
    cod3_complete:
    //my name:
    The real WTF is the comments:

    //find temp directory; dwRetVal = GetTempPath(dwBufSize, //buffer length lpPathBuffer); //path buffer

    //get the windows directory; dwRetVal = GetWindowsDirectory(lpPathBuffer1,dwBufSize); //path buffer

    Prime example of why comments should tell why not what. I only hope the young whippersnappers are listening.

    Got it, thanks. So that should be:

    // I need the temp path
    dwRetVal = GetTempPath(dwBufSize, //wants buffer length
         lpPathBuffer); // wants path buffer
    

    ;-)

  • Xythar (unregistered)

    Where exactly do the Matryoshka Dolls come in to this?

  • (cs) in reply to Jeesh
    Jeesh:
    <clue>

    To be honest in this case again the original developer is more genius than the poor guy who is trying to "maintain" the code and unfortunately do not have a clue.

    My questions: why to send this one to thedailywtf in the first place? And even more the question to Alex: what is really the WTF? Comma in wrong place, wrong indentation or something more catastrophic in horizon? The code is beautiful hack when management says that no 3rd party software allowed. MS full stop.

    As a teaser to the original poster and to the others : how you will implement the same functionality?

    • in Windows
    • not using any 3rd party tools
    • implementing it in 120 minutes (above is just assumption because part of the code is cut and paste; sorry lads)

    And please put the timer on and let me know.

    </clue>

    -- Jeesh - I am getting old.

    Well, as pointed out upthread the overall code quality is pretty terrible. But I'd say the WTF is the use of a complicated hack involving using one language to output another, when there must be a simpler way. Creating the empty zip file could have been done from C. And I'm not a windows programmer, but I find it hard to belive that if there's a VB copyHere() function there isn't an equivalent in the C windows API. Indeed, a look at MSDN yields http://msdn.microsoft.com/en-us/library/bb787866.aspx although it's not clear to me from this documentation if it can be accessed from C.

  • Jeesh (unregistered) in reply to misha
    <clue>

    Well, as pointed out upthread the overall code quality is >pretty terrible. But I'd say the WTF is the use of a >complicated hack involving using one language to output >another, when there must be a simpler way.

    Sorry, I did not find it, even though I really read all the posts. I suggest that you do same for my post. Try again. I think I gave some carrot.

    And I'm not a windows programmer, but I find it hard to >belive that if there's a VB copyHere() function there isn't >an equivalent in the C windows API. Indeed, a look at MSDN >yields

    And your point after all is?

    it's not clear to me from this documentation if it can be >accessed from C.

    Ditto.

    </clue>

    -- Jeesh - I am getting old.

  • (cs)

    He should have used BARF compression, guaranteed to compress any file down to zero bytes in size.

  • David (unregistered) in reply to dkf

    [quote user="dkf]But goodness me, it's a fragile lash-up; if only there were zip tools that could be driven directly from the command line... [/quote]

    Time to clear all the red tape required to get a third party zip tool installed on the system: 5 months (and lose your sanity in the process).

    Time to hack together a nasty but workable solution in a mess of C# and command line VBS - 1 hour (at the cost of other people's sanity).

  • Jeesh (unregistered) in reply to David
    <clue>

    Time to clear all the red tape required to get a third >party zip tool installed on the system: 5 months (and lose >your sanity in the process).

    Time to hack together a nasty but workable solution in a >mess of C# and command line VBS - 1 hour (at the cost of >other people's sanity).

    Thank you David, you got it. Wo/ any technical BS. It is after all question of money and not the beauty of the code.

    BTW, to all you wannabe hackers, it is always question of the money what ever you are going to do.

    </clue>

    -- Jeesh - I am getting old.

  • (cs) in reply to derula

    TRWTF is around this line: strcat(lpPathBuffer1,"\syswow64\"); Someone's syntax highlighter fails miserably here.

    derula:
    Anon:
    All my comments look like this

    [...]

    x = x + 1; // add 1 to x

    Mine look like

    x += 1 # Add 1 to x

    Obviously I'm using the better programming language.

    Also: CS's code highlighter cannot recognize an escaped backslash at the end of a string. Or was that some other highlighter?

    ADDIU $A0, $A0, 0001 ;add 1 to $A0

  • Anonymoose (unregistered) in reply to Leak
    Leak:
    Anon:
    With the Matryoshka doll comment I was expecting to see it zip individual files, then zip the folder of zip files recursively giving you a zip of zips of zips, and so on.
    Why reinvent the wheel? 42.zip exists...
    42.zip is for wimps. Tell me, how do these apples agree with you? http://www.contrib.andrew.cmu.edu/~edanaher/quine.zip
  • (cs) in reply to Anon
    Anon:
    Anon:
    All my comments look like this

    x = x + 1 // add 1 to x

    Yikes! I fail, left out the semi-colon

    x = x + 1; // add 1 to x

    Much better now.

    x = x + 1 /* add 1 to x */ ;

  • Geoff (unregistered) in reply to Anon
    Anon:
    Lego:
    Anon:
    Anon:
    With the Matryoshka doll comment I was expecting to see it zip individual files, then zip the folder of zip files recursively giving you a zip of zips of zips, and so on. But this, is so much more insidiously retarded.

    Or, repeatedly zip the same file until you reach the singularity of the 1 bit file.

    Actually, once the zips of zips reached a sufficiently high level of disorder the combined size of all the zips would start to grow because each iteration adds a small amount of overhead to the file. Eventually the process would create a file consuming all secondary storage on the host system.

    -Lego

    No, no, no. You just don't have good enough compression algorithms. My project is to zip the entire contents of the universe down to a single bit which will then be tied to the state of the light switch in my office.

    Light switch on = universe exists Light switch off = ...well....you don't want to know what happens when I turn the lights off!

    Note to self: Leave a note for the cleaners telling them to please not turn off the lights.

    dies laughing at the cleaners reference

  • John Muller (unregistered)

    C#...

    Sometimes a simple bit of code needs a comment.

    // Adds one to the given integer, using efficent binary operators.
            static public int AddOne(int x)
            {
                // Use MinValue of an int as a flag,
                // since that cannot possibly be the result after adding one.
                int r = int.MinValue;
    
                // Start with empty carry bits.
                int c = 0;
    
                // Start by toggling the least signifigant bit.
                int n = 1;
    
                // Check for invalid input
                if (x == int.MaxValue)
                {
                    // If the input value was invalid, throw an exception.
                    throw new Exception("Cannot AddOne to int.MaxValue!");
                }
    
                // Add one to x;
                while ((r = ((x ^ n) & ~(c ^= ((n <<= 1) >> 2)))) < x);
                
                //Return the result
                return r;
            }
    
  • (cs) in reply to //my name
    //my name:
    The real WTF is the comments:

    //find temp directory; dwRetVal = GetTempPath(dwBufSize, //buffer length lpPathBuffer); //path buffer

    //get the windows directory; dwRetVal = GetWindowsDirectory(lpPathBuffer1,dwBufSize); //path buffer

    Without these comments I'd have spend all of, err, 1 nano-second working out that GetTempPath let me find a temp directory and that GetWindowsDirectory would let me, err, get the windows directory.

    Sure but would you have figured out that dwBufSize was the buffer LENGTH? Or that lpPathBuffer1 was the path buffer? That stuff is HARD to figure out.

  • (cs) in reply to Jeesh
    Jeesh:
    <clue>

    My questions: why to send this one to thedailywtf in the first place? And even more the question to Alex: what is really the WTF? Comma in wrong place, wrong indentation or something more catastrophic in horizon? The code is beautiful hack when management says that no 3rd party software allowed. MS full stop.

    As a teaser to the original poster and to the others : how you will implement the same functionality?

    • in Windows
    • not using any 3rd party tools
    • implementing it in 120 minutes (above is just assumption because part of the code is cut and paste; sorry lads)

    And please put the timer on and let me know.

    </clue>

    Why post it to TheDailyWTF? Because it is WTF code. A few people have already pointed out some of the problems with it.

    I don't know how I would have done it. I don't know the requirements. I probably would have created a folder, placed the files in the folder. Then called zip on the folder.

    Or perhaps do most of the work in C/C++. Create the folder, even send the copy commands. Why create a VBS script then execute the script?

  • Anonymouse (unregistered)

    TRWTF is how many people keep saying this code is C#.

  • Bigwig (unregistered)

    In case there was no third party library available for free I'd say:

    IF SOMETHING IS STUPID AND IT WORKS, IT AIN'T STUPID.

  • (cs) in reply to James
    James:
    I don't know why everybody's acting like this makes their eyes bleed. Is it dumb to have your C++ code write your VBScript for you? Sure. But if you're stuck on an XP machine (and you know it will *always* be at least XP) and there are procedural hurdles to importing/using 3rd-party software, VBScript is the way to go. Sad, but true.
    Yeah, because it's obviously impossible to do what the script does from straight C++. The script tunnels to an alternate reality where they can do COM and all that jazz... Obviously. That, or I can't spot topcod3r.
  • (cs) in reply to Jeesh
    Jeesh:
    <clue>

    To be honest in this case again the original developer is more genius than the poor guy who is trying to "maintain" the code and unfortunately do not have a clue.

    My questions: why to send this one to thedailywtf in the first place? And even more the question to Alex: what is really the WTF? Comma in wrong place, wrong indentation or something more catastrophic in horizon? The code is beautiful hack when management says that no 3rd party software allowed. MS full stop.

    As a teaser to the original poster and to the others : how you will implement the same functionality?

    • in Windows
    • not using any 3rd party tools
    • implementing it in 120 minutes (above is just assumption because part of the code is cut and paste; sorry lads)

    And please put the timer on and let me know.

    </clue>

    -- Jeesh - I am getting old.

    FCOL (for crying out loud). Just use the classes in the System.IO.Compression namespace of the .NET framework. Directly accessible from C#, VB.NET, Fortran.NET, Cobol.NET and even C++/CLI

    Minimum requirement is to have .NET Framework 2.0

    Addendum (2009-02-10 03:45): And even better is System.IO.Packaging if you have .NET 3.0 or higher

  • (cs) in reply to David
    David:
    dkf:
    But goodness me, it's a fragile lash-up; if only there were zip tools that could be driven directly from the command line...
    Time to clear all the red tape required to get a third party zip tool installed on the system: 5 months (and lose your sanity in the process).

    Time to hack together a nasty but workable solution in a mess of C# and command line VBS - 1 hour (at the cost of other people's sanity).

    What about the time to write code in the outer language to directly create the initial file and make COM calls to Explorer to add the content? Obviously no need to go through the Bureaucracy for that, since there's already approval to use the outer lang...

    The complicated crap of VBS generation and execution just isn't necessary. Not unless the original developer of it is one of those who'd be better off staying in Programmers' Kindergarten.

  • Anonymous (unregistered)

    A short while ago I needed to satisfy very similar requirements - enable ZIP compression/decompression without using any third party tools. I created a ZIP compressor in .NET using the GZipStream class (System.IO.Compression, since .NET 2.0). All in, it took about 30 minutes. The problem was that files compressed with this utility actually came out LARGER than the original source files. I've never gone back to GZipStream.

  • asdf (unregistered)

    What makes me WTF is how someone could come up with such a clever (albeit kludgy) hack and implement it in a way that's just plain 100% clueless.

Leave a comment on “Zipping Files - The Matryoshka Doll Way”

Log In or post as a guest

Replying to comment #:

« Return to Article