Sunday, October 24, 2010

Replace Files - v2.0

I've never mentioned this project on my blog before. This is based on the requirement when you have to place a file somewhere in a directory (maybe many locations) and you do not know where. This is a search and replace tool which will do the job for you, only in smarter way.

Short steps on how to use
  1. Select source folder where your new files are.
  2. Select destination folder where you want your files to be replaced to.
  3. If you don't know exact target folder, you may select "Recursive" option (it will search in sub-folders too).
  4. If you are worried about taking a backup before replacement, you can select that option too. The original file will be renamed to <original-name>.old. Just beware that if you replace the files again with backup feature on, the original old file will be overwritten.
  5. Select the type of files that you are operating on. eg. - *.exe, *I*don't*know*, H?ll*.txt, mspaint.exe [;)] etc. These patterns are based on normal DOS search wildcards.
  6. If there are some files that you want to avoid to be operated on, put them in Exclude list section. These do not use wildcards. eg. - if you want to avoid EXE files (search filter: *.exe) with name containing obsolete, then you add a filter by the same name. Hence, out of these files - abc.exe, aobsoletebc.exe, haha.obsolete.exe - only abc.exe will be searched and replaced.
  7. Click Find button. Wait for it to finish.
  8. Once done, the files which differ in target locations are highlighted in yellow color. You have option of deleting the list items, if you don't want them to be replaced.
  9. Click "Set up" button, and it's done. If you will run Find again immediately, then you can see that there will empty lists (unless you manually intervened.) This is a sign that your files are already placed.

Features:
  1. CRC32 based accurate checks for file content.
  2. Fast file search.
  3. Option available to use GAC Util (for assemblies to be put in ASSEMBLY folder in Windows). For this, for now, you have to run this tool from Visual Studio Command Prompt. That way, it locates the gacutil.exe. Supports Visual Studio 2005, 2008 and 2010.
  4. You can run external diff tools from inside the tool. It has been configured by default for Winmerge (still need some more testing on that), but if you use any other diff tool, provide the path in the Configure->Options menu.

Version 2.0 is the first public release. So don't worry, you have not missed earlier versions :)
Please report bugs here.
Download: Zipped Binaries

Tuesday, October 19, 2010

Auto Save in Paint - ver 1.7.0.1 - Patch Release

This is a small post to post a minor patch on top of release version 1.7

Fixes:
1. The "Options" dialog pops-up "The file [] doesn't exist! Please enter a valid file path." message even when the "Use custom application to save images" is unchecked. This message should only pop-up when the aforementioned checkbox is selected and the file path provided leads to invalid file path.

I'm only uploading the binary+source for the patch, instead of the whole package. Please download ver 1.7 first and then apply the patch.

Download links for Auto Save in Paint v1.7.0.1 patch:
Binary
Source

Saturday, October 16, 2010

Auto Save in Paint - ver 1.7

Auto Save in Paint is back! :)

In the last post, I said that I was out of ideas on how to go further on with this project. Thanks to the users of this tool (special thanks to tflamb!) I got some nice inputs. Seems like I am not the only one who likes it :)

So, what is new in this version? Here is the list:
  1. Options menu - Tflamb and I discussed on the behavior of MS Paint in different OS version. The tool was originally created on Windows XP. MS Paint of XP has different save algorithm than that in Windows 7. In Windows 7, default MS Paint seems perform both ways - sometimes it will bloat up an image, other times, it will shrink it good. Now with option available to choose an application which can do the save part, you can use your own tool. For example: you have MS Paint from Windows XP copied on Windows 7 in some folder, and you want XP Paint to run with this tool rather than Win 7 Paint. Now, you can do it. Just browse to the file location where your tools is kept and you're done.
  2. Don't ask again option - If the constant pop-us bother you, you can disable them. This information goes into a .config file which is created in the folder where your application resides. It's XML file.
  3. Some minor segregation of the projects (source code) - I am providing source code of the "main" tool in this version. This is by demand too! :) But remember that I've not provided all the source files. There are some custom libraries that I have created (as DLLs) and they can be used for building up the code. You can set them in references, and I hope you'll be able to build the code. (I'll not go into details here on how to configure projects and all.)
If there is any bug that you have found, or are unable to build the code, please let me know.

Thanks again for using Auto Save in Paint! :)

Download links for Auto Save in Paint v1.7:
Release Binaries
Source Code

Sunday, October 3, 2010

Are we smart or what

I have been developing application in more than 7 computer languages for about 7-8 years. Sometimes I wonder how many people out there are truly passionate about technology and have dedicate some part of their life for self-improvement.

Most of the coders hired by big companies are freshers. Anybody can code, true. Then there are people like me who have to study each and everything in order to maintain that soggy piece of software.

But this post is not about criticizing ways of the world. I'm highlighting how much a readable code means to a maintenance/sustenance team. One of the tip is this -

If you have see a function having a boolean argument, do not use it, if possible. Try to break that function down in two functions with readable names which depict their intentions clearly.

Why do I say so? I say because boolean parameters are not made for readability. They are just a type to differentiate two ways of processing. For example:

void Greet(string message, bool world)
{
    if (world)
        Console.Writeln(message + " world!");
    else
        Console.Writeln(message + " me!");
}

Now, using it seems strange:

Greet("Hello", false);
Greet("Hello", true);

If we break it down to two functions, namely, GreetWorld and GreetMe, then it becomes more readable and understandable.

void GreetWorld(string message)
{
    Console.Writeln(message + " world!");
}

void GreetMe(string message)
{
    Console.Writeln(message + " me!");
}

//Usage
GreetWorld("Hello");
GreetMe("Hello");


There are many standards set for coding. But most of them are same old crap. Think differently.