Sunday, November 18, 2007

Backup and Restore SVN Repository

Issue the following command:

svnadmin dump /var/repo/myRepo > /home/username/myRepoBackup

To restore the repository to a different machine or a different repository, create the new repository by issuing the following command:

svnadmin create /home/username/repo

To restore the data, enter this command:

svnadmin load /home/username/repo < /home/username/myRepoBackup

For more information see the free svn book about the topic here.

Friday, July 13, 2007

Monitoring the status of servers

I have been studying options on how to manage servers the easy way and came across this study:

Attacking Log analysis tools

Wednesday, June 27, 2007

Detect Window Close Event

Need to detect when the client is about to leave the site.

The <body> tag fires an event onbeforeunload when a page is refreshed or unloaded in the browser window. This event can somehow prevent the user from navigating away from the page or closing the window.

An event listener can also be attached to the window object that can do some AJAX processing or cleanup because it cannot prevent the browser window from closing.

Example:

<script type="text/javascript">

// event below works both in IE6,7 and Firefox
window.onunload = function()
{
// do processing here
alert('bye!');
}

function showUnloading(evt){
//IE specific code to cancel the navigation
//if you put a text value in that property IE will try to confirm
//if you want to navigate off the page.
//The code also works with Firefox
evt.returnValue = "You are leaving.";

//Firefox GeckoDOM specific
//below is how to handle the cancelling of firefox
if (!confirm('Are you sure?'))
{
evt.preventDefault;
evt.stopPropagation; // this makes sure it does not bubble up
}

}
</script>

<body onbeforeunload="showUnloading(event); >
</body>


There are lot of uses for the web application that detects the unloading of the body. It will be application specific on how you handle the event. There are a thousand way a user can navigate away from a web page and as always never trust that those events are guaranteed to fire.

Tuesday, May 22, 2007

Use SSL in Apache 2.0

1. openssl genrsa -out www.mydomain.com.key 1024

2. openssl req -new -key www.mydomain.com.key -out www.mydomain.com.csr


3. openssl x509 -in www.mydomain.com.csr -out www.mydomain.com.crt -req -signkey www.mydomain.com.key -days 365

4.
cp www.mydomain.com.key /etc/httpd/conf/

5. cp www.mydomain.crt /etc/httpd/conf/


6. Apache 2.0 configuration:


NameVirtualHost *:443
<Virtualhost www.mydomain.com:443="">
DocumentRoot /var/www/html
SSLEngine on
SSLProxyEngine on
SSLCertificateFile conf/www.mydomain.com.crt
SSLCertificateKeyFile conf/www.mydomain.com.key
</virtualhost>

Friday, May 18, 2007

Adding a Second IP to an Existing Ethernet Card on Linux

1. Log in as root
2. Change directory
cd /etc/sysconfig/network-scripts
3. Locate the file ifcfg-eth0
4. Make a copy of it with a different name:
cp ifcfg-eth0 ifcfg-eth0:0
5. Edit the new file ifcfg-eth0:0. Locate the word DEVICE and change eth0 to eth0:0
DEVICE=eth0:0
6. Change the IP address besides the word IPADDR to the desired IP
IPADDR=192.168.1.201
7. Now save the changes and issue the command ./ifup eth0:0 to start listening on the new IP address

Saturday, February 24, 2007

Determining BIND version using dig

Here's a simple way to query a nameserver what version of BIND it is running.


# dig @yns1.yahoo.com version.bind chaos txt

; <<>> DiG 9.2.4 <<>> @yns1.yahoo.com version.bind chaos txt
; (1 server found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31576 ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;version.bind. CH TXT ;; ANSWER SECTION: version.bind. 0 CH TXT "9.2.3" ;; Query time: 238 msec ;; SERVER: 66.218.71.205#53(66.218.71.205) ;; WHEN: Sat Feb 24 19:10:14 2007 ;; MSG SIZE rcvd: 48 #

Thursday, January 04, 2007

Turn Off Low Disk Space Notification on Windows XP

If you have low disk space in your drives, then you may get annoying pop-up messages from Windows that you are low on disk space. This can get extremely annoying at times, to turn off low disk space notification follow these steps:

Start regedit, expand HKEY_CURRENT_USER and in Software – Microsoft – Windows – CurrentVersion – Policies - Explorer, and set the value of NoLowDiskSpaceChecks to DWORD = 1. (This modification requires a logoff or reboot to work)