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.
Monitor Delayed Job in rails
Install monit:
sudo apt-get install monit
Edit the /etc/default/monit file and enable the start up flag, which ensures that the configuration is done so that monit can start.
# vim /etc/default/monit startup=1
Configure monit:
sudo vim /etc/monit/monitrc
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
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)
Search in stored procedures
SELECT OBJECT_NAME(id)
FROM syscomments
WHERE [text] LIKE '%foobar%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1
GROUP BY OBJECT_NAME(id)
Ubuntu 12.04 setup Apache 2 with RoR 3
Setting Up A Magento Staging Area
Installing ImageMagick on Debian
1. Install the delegate libraries
http://www.imagemagick.org/download/delegates/
- freetype
- ghostscripts (pdf)
- libpng
- jpegsrc
- etc…
2. Install ImageMagick
http://www.imagemagick.org/download/
tar xvzf ImageMagick.tar.gz
cd ImageMagick-X.Y.Z
./configure
make
sudo make install
/sbin/ldconfig /usr/local/lib —-f important
http://rmagick.rubyforge.org/install-linux.html
http://www.krzywanski.net/archives/630