ZNAG - Browsing Utilities

  1. Convert Encoding Utility

    Prelude (skip):

    I had another one of those "utilicous" moments again.

    I ran into a familiar problem that I've met before:

    I had a site written in ANSI encoding (default behavior by Visual Studio BTW) , with some localized Hebrew content. The default settings if the web site in IIS were indeed ANSI for reading the files, and UTF-8 for displaying the files.
     
    Peaches, everything was working fine..
     
    Then I had to move the site to a different server..
    Suddenly my site looked like a wingdings party.
    The new server had different regional settings, and UTF-8 as the default for reading files.
    I soon realized I had to go over the entire site, saving all files to UTF-8
    (Yes, a better practice would have been to do so from the beginning, and override the default file encoding in the web.config).

    Suddenly the "utilicous" feeling was all over me again, Time for a utility!

    Thus the Convert Encoding Utility Was Born…

    Ok, so I got the idea for what was needed, a small WinForm application that'll choose a root folder, and perhaps even file extensions to modify.

    After finishing the WinForm, I got that "hmm this could be useful for others" feeling.

    After some refactoring, and I separated the solution to 3 projects:

    1. Base library

      Exposes methods that alter the file encoding either of a single file, or of a folder (with the possibility to filter by file extensions)

    2. Console application

      Uses the library above. Can get command line arguments such as single file to modify or a root directory (with the possibility to filter by file extensions)

    3. WinForm application

      Same as the console, but with UI

    If you have any problems with the utilities, code or the documentation, please report it at Issues section

    Enjoy,

    Erik

    Tags: Utilities, C#


  2. Joy of writing utilities

    Every now and then I get to a point where I need to do some repetitious and most likely boring task.
    This point usually leads to 3 possible options

    1. I Google for a utility that saves me the time for doing the task automatically.
    2. I can’t find any workaround, while banging my head, I slowly do the exhausting task.
    3. I write a small utility that does the task for me.

    Although option 1 is usually the fastest way to overcome the hideous task, writing the utility by myself is much more satisfying.

    Furthermore, it usually leads to the following scenario (in case it works of course)

    1. I used the newly created tool to finish the horrible task.
    2. I’m filled with childish satisfaction feeling of “this is so cool” and “this saves me so much time” (even if writing the tool took more that it would have to do the actual task).
    3. After the euphoric thrill is over, I start to ponder if this tool could be useful for someone else.
    4. I refactor the code, fix all the “quick-code smells”.
    5. I continue my pondering (recognize a pattern perhaps?), what more could this tool do?
    6. I add the “so needed” features (usually to fast, which get’s me to need to do step 4 again).
    7. Now comes the crucial point:
      Will I stop repeating 5,6,4 and be satisfied?
      If no, then the tool will never be shared/published, at some point I’ll have to focus on something else, and I’ll probably forget to come back and finish the tool.
      If yes, I’ll continue to 8.
    8. I’ll start wasting time on creating some kind of documentation and sample
      (which BTW is nowadays so much easier thanks to Github)
    9. Another crucial point like 7 will occur, and as before, if it doesn’t get out in a reasonable timeframe, it might be forgotten.
      Writing the documentation and sample might trigger some point 5 style pondering, thus adding the possibility to reenter some heavy pondering->repeating writing/refactoring loop action.

    After this tedious routine is done, the by far most exciting moment is to see someone actually use the tool and perhaps even see them get the point 2 feeling.

    There was a period when I was in Customer Support, that I encountered lots of “utililicous” opportunities that could need tools to solve problems, both for customers and for the supporters.
    The result was a line of a dozen or so utilities, some of them even used sometimes! :)

    Anyhuwze, this post is a prelude to YAUIHTW which I'll write about shortly.

    Cheers,
    Erik

    Tags: Utilities, General, Personal