Thursday, February 25, 2010

Setup SVN server in Windows with apache server * from http://lifehacker.com/188582/hack-attack-how-to-set-up-a-personal-home-subversion-server

Hack Attack: How to set up a personal home Subversion server

by Adam Pash

Subversion is open sourceversion control software used primarily by developers that keeps every revision of important, frequently changing files. However, Subversion can be useful for many different purposes, whether you're a web developer or a novelist - especially if you like to work in plain text.

Think of Subversion as a wiki-like repository for your files. Each time you make a change to a file or group of files that you're happy with, you can commit those changes to your Subversion repository. If you don't like where the changes got you, Subversion can compare your current version with any previously-committed version and pick out the best of the best so you never have to worry about finding your way back to a good or working version of a file.

In this first of my two-part Subversion series, I'll show you how to set up and run your own Subversion server. Next week, we'll get into the nitty gritty of using Subversion.

Please note: You can choose to run Subversion without the server component (Apache) and it still works wonders for keeping versioned copies of your files. The only catch is you won't be able to access your files from other computers. If you'll only be using it as a personal repository on one computer, you can skip the steps geared toward Apache (marked with an asterisk [*]).

If you're not sure if Subversion is for you, I'd recommend trying it without Apache first. Setting up Subversion by itself is VERY easy, but if you do decide to run the web server in conjunction with Subversion, make sure your computer's properly patched and beefed up on security. Oh, it is? Good, let's go!

Setting up your Subversion server

  1. * Download and install Apache 2.0... - for Windows, you want the Win32 Binary (MSI Installer) about half way down the page - you don't want 2.2.... When you're installing Apache, you can keep all the defaults unless you know what you're doing and have your own good reasons for switching things up.
  2. Download and installSubversion 1.3.2 (the svn-1.3.2-setup.exe download). Again, just accept all of the defaults in the setup, making sure that "Install and configure Subversion modules..." is checked.
  3. Download and install TortoiseSVN (TortoiseSVN-1.3.5.6804-svn-1.3.2.msi), an attractive Subversion client for Windows that makes dealing with Subversion repositories a breeze via right-click.
  4. * Edit your Apache httpd.conf file at C:\Program Files\Apache Group\Apache2\conf\httpd.conf (make a backup first in case something goes awry) to add the following lines of code to the end of the file:
    # Configure Subversion repository
    <Location /svn>
    DAV svn
    SVNPath "C:\svn"
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile "c:\svn_conf\passwd"
    Require valid-user
    </Location>

    Save and close the httpd.conf file, then restart Apache.

  5. Create two folders on your C:\ drive - one called svn and another called svn_conf (svn_conf is not necessary if you're using Subversion without Apache).
  6. * Password protect your Subversion repository by firing up the command line and typing the following commands:
    cd "C:\Program Files\Apache Group\Apache2\bin"
    htpasswd -c C:\svn_conf\passwd adam

    substituting your name for adam.

Create your first repository

The last thing we're going to do this week is create our repository. Go to your C:\ drive, right-click the svn folder and select TortoiseSVN -> Create repository here... command. If all goes well, TortoiseSVN should ask you what type of repository you'd like to create. Select Native filesystem (FSFS) and click OK. You will get a message telling you that "The Repository was successfully created." Congrats!

Finally, let's import the directory of files that you want to keep under version control into your newly-minted repository. Right-click on your to-be-controlled folder and select TortoiseSVN -> Import.... You need to give TortoiseSVN the directory of your repository, so browse for C:\svn. Click OK and all of the files under your chosen directory will be imported into your Subversion repository at C:\svn.

If you set up Subversion with Apache, you can test it out by directing your browser tohttp://localhost/svn and entering your username and password. If you're not using Apache, you can verify that everything worked by right-clicking on a new folder and checking out your files from the repository (right-click -> SVN Checkout...). Just direct TortoiseSVN to the directory of your Subversion repository.

We've really just skimmed the surface of what you can do with Subversion, so if you still aren't quite sure what the point is, be sure to tune in next week when I'll demonstrate the glory of Subversion in action. In the meantime, you might want to play around with your repository, checking out and committing files, to get familiar with its most basic functions.

I'd love to hear how Lifehacker readers use version control (or how they'd like to use it), so let us know in the comments or at tips at lifehacker.com.

Adam Pash is an associate editor for Lifehacker who takes comfort in the knowledge that he can always go back to a file from two weeks ago if he really messes something up. His special feature Hack Attack appears every Tuesday on Lifehacker. Subscribe to the Hack Attack RSS feed to get new installments in your newsreader.

Tuesday, February 23, 2010

iBatis SQLMap - Query

You know?
to write "<" as the iBatis SQL query, you would have to place them within <![CDATA[ < ]]>

e.g.

SELECT * FROM tbl WHERE id  <![CDATA[ < ]]> 90

Wednesday, February 10, 2010

V2P (Virtual-to-Physical) for VirtualBox

V2P (Virtual-to-Physical) for VirtualBox

So you might have had a great Virtual Machine which has your development environment or may be a specific build environment. You think the time has come now to free this VM and give its own dedicated hardware. Or even none of the above is true, you want to do it because you can :)

You will have to go do what is called as v2p (Virtual to Physical) migration. So lets just think about what exactly we are trying to do. We have Virtual Machine running inside a VirtualBox which has its own virtual hard disk. The converting a virtual machine to a physical machine is mainly about changing this virtual machine operating system boot from a physical real hard disk than virtual hard disk on which it was running when inside VirtualBox.

VirtualBox comes with one hidden command under its hood, convettoraw! This can be used in following manner,

VBoxMange internalcommands converttoraw your.vdi your.raw

So now you have a raw image of your VM (pleaes note that if you have a VM of say, 16GB dynamically expandable virtual hard disk, when you create a raw image it will actually create a file which will occupy 16GB on your disk! so make sure you have that much of space on your disk before procedeeing). Now this raw image can be deployed to another disk very easily.

Connect the disk on which you want to deploy the raw image that you just created to your existing system. Now depending upon on the Operating system that you are running the actual command may very. I will pick Linux as my host operating system on which I will assume the VirtaulBox is running. So this second physical disk appears as /dev/sdb on my Linux box, so I execute,

dd if=/location-of-your-raw of=/dev/sdb

Once its done, connect this disk as primary master to the system that you are planning run. At first boot, make sure the system is started with -r option to re-configure the devices.



Is this solution work?
i haven't test, anyone can tell me whether this work out?