Drop all user tables statistics


SELECT 'DROP STATISTICS ' + Schema_NAME(d.Schema_id) + '.' +
OBJECT_NAME(a.object_id) + '.' +
a.name colum_name
FROM sys.stats a
INNER JOIN sys.Objects d ON d.Object_id = a.object_id
inner join sys.tables t ON t.object_id = a.object_id
WHERE t.type = 'U' AND auto_created = 1 and a.name LIKE '_WA_Sys%'

Using NTP to Sync Time

Keeping your system’s date and time accurate is easy to do using NTP.

Having an accurate clock on your server ensures that time stamps in emails sent from your machine are correct. An accurate clock is especially helpful when you need to look at the logs from a particular time of day.

If you don’t occasionally set the system clock yourself, the time will slowly drift away from a perfectly accurate setting. That’s when the network time protocol (NTP) is useful.

What is NTP?

NTP lets you automatically sync your system time with a remote server. The NTP can be used to update the clock on a machine with a remote server. This keeps your machine’s time accurate by syncing with servers that are known to have accurate times. NTP also keeps the clocks on several machines in sync, thus making it easier to match log entries for an event across multiple servers.

It’s easy to set up an NTP server to regularly adjust your machine’s clock. It’s also possible to make it a bit more complicated if you need your clock accurate down to the millisecond instead of just to the second.

Continue reading “Using NTP to Sync Time”

Reinstalling list of GEMs on a new server

#!/usr/bin/perl -w
# We're strict
use strict;
# Get list of installed gems
my @gems = qx(gem list);
chomp(@gems);
# Create commands
foreach my $gem (@gems)
{
    # Match gem and versions
    $gem =~ m/(S+)s((.+))/i;
    # Gem name
    $gem = $1;
    # Save them into array 
    my @gem_versions = split(/,/, $2);
    # Print out commands
    foreach (@gem_versions)
    {
        # Remove all whitespaces
        $_ =~ s/^s+//;
        print "gem install $gem --version=$_n";
    }
}
perl gems_install_list.pl

http://www.krzywanski.net/archives/451

Subversion

Backup your old Repository

svnadmin dump /path/to/repository > repo_name.svn_dump

Import your old repository into the new one

svnadmin load /path/to/repository < repo_name.svn_dump

Installation

# Install required packages
$ sudo apt-get install subversion libapache2-svn

# Create subversion repositories:
sudo mkdir /var/svn
sudo chown -R www-data:www-data /var/svn

 Continue reading "Subversion"

Ruby Enterprise Edition

http://www.rubyenterpriseedition.com/download.html
/opt/ree/bin/gem update –system 1.5.2

delete all gems in ree:
/opt/ree/bin/gem list --no-version | xargs /opt/ree/bin/gem uninstall -aIx

/etc/environment: PATH=”/opt/ree/bin ….”


sudo passenger-memory-stats
sudo passenger-status

http://www.linuxask.com/questions/how-to-tell-if-apache-2-is-using-prefork-or-worker-mpm
apache2 -V (verifica prefork sau itk)
apache2ctl -M (verifica modulele)