Tuesday, December 15, 2009

How To Recursively Delete .svn Folders

Today, using versioning system on a software development is a must. This is to avoid the replacement of a file that can occur while the development process.

When using versioning system such as Subversion, the system will automatically create a .svn folder on each folder we have. The bad things come whenever we have to send a project folder to other people. It's not convenient if we send them a project folder with .svn folder in it. Yes, we need to clean the .svn folder.

On a Linux environment, go to your project folder and type the syntax below :

rm -rf `find . -type d -name .svn`

On a Windows environment, please create one batch file for example cleansvn.bat and put the code below to that batch file :

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q "%%G"

Execute your batch file on a Windows command line and give your project folder as a parameter (in this example: d:\master\htdocs\vivanews.com is a project folder which we want to clean from .svn)

D:\>cleansvn.bat d:\master\htdocs\vivanews.com

And voila ... your project folder is clean from .svn files. Hope this help.

Wednesday, December 02, 2009

Editing HOSTS File on Windows 7

HOSTS file is a file that contains the mappings of IP addresses to host names. It's used by Microsoft TCP/IP for Windows or TCP/IP for Linux.

If you're a developer or programmer or even an administrator, i'm sure you will often edit this file. You can found this HOSTS file on C:\Windows\System32\drivers\etc\hosts (for Windows XP, Windows 2003 Server, Windows Vista, Windows 7) or on /etc/hosts (for Linux family).

In previous Windows version (Windows XP or 2003 Server), you can change the content of this HOSTS file and simply save your changes without problem. But, if you try to edit this HOSTS file on Windows 7 you will face an error something like this "This is a read-only document".

The solution is simple. If you are using Notepad or EditPlus or another editor application to edit this HOSTS file, make sure that you run the Notepad or EditPlus as an Administrator.

The question now is how to make sure that my editor application is run as administrator?

Ok. This is a sample if you're using Notepad as an editor.

Go to Start -> All Programs -> Accessories. You will see the Notepad icons there. Right-click on Notepad and choose "Run as administrator". Then open the HOSTS file using that Notepad.

And now you can edit your HOSTS file without problem.