How to fix _Can't open file: 'sessions.MYI'_ in Drupal
Fri, 03/10/2006 - 23:57 — sandipThis seems to occur if mysql crashes for some reason and corrupts the sessions table for Drupal.
Here is a quick way to resolve this and I have used it in the past...
mysql> REPAIR TABLE sessions QUICK;
You can also use phpmyadmin to repair the table.
Related Reading: MySQL Database Repair
- sandip's blog
- Login or register to post comments
Eliminate Command Line Histories with chattr (change attribute)...
Fri, 03/10/2006 - 10:26 — sandipIf you use bash as the default shell, it keeps a history of commands accessed via the `history` command for convenience. This could end up being a security problem if someone were able to compromise a users' home directory. In some cases, this could expose improperly used passwords or special privileges available to the user such as sudo.
Consider disabling this by changing the attribute of the file to lock out the ability to update the file. As root:
# cat /dev/null > ~user/.bash_history # chattr +i ~user/.bash_history
The user will still have a command line history, but it will only apply to the current session. When the user logs out, the information will not be saved. To have this apply to all future users, make the changes in the "/etc/skel" directory.
Compiling support for XSLT in PHP
Fri, 02/24/2006 - 22:49 — sandipXSLT, Extensible Stylesheet Language (XSL) Transformations is a language for transforming XML documents into other XML documents. It is a standard defined by The World Wide Web Consortium (W3C). Information about XSLT and related technologies can be found at http://www.w3.org/TR/xslt.
PHP XSLT extension only supports the Sablotron library from the Ginger Alliance. The extension does not come standard with Redhat Enterprise... and the compilation was a bit tricky. So if you are having difficulty, theses notes may help you some...
Training SpamAssassin
Sat, 02/11/2006 - 00:42 — sandipI use SquirrelMail and seperate out my missed spam email to a "Train/SPAM" folder and the wrongly tagged ones to "Train/HAM" folder and automate the process of training SpamAssassin via a daily cron.
Put the "SAtrain.sh" file in "/etc/cron.daily" directory.
#!/bin/bash # SAtrain.sh # Trains SpamAssassin with Spam and Ham mbox feeds... # Put this file in "/etc/cron.daily" directory. # chmod 700 "/etc/cron.daily/SAtrain.sh"echo "Training SpamAssassin Begin:" echo "Learning from Spam..." /usr/bin/sa-learn --spam --configpath=/etc/mail/spamass assin --showdots --mbox /home/user/mail/Train/Spam sleep 10 echo "Learning from Ham..." /usr/bin/sa-learn --ham --configpath=/etc/mail/spamass assin --showdots --mbox /home/user/mail/Train/Ham sleep 10 echo "Clearing Spam Feed..." cat /dev/null > /home/user/mail/Train/Spam echo "Clearning Ham Feed..." cat /dev/null > /home/user/mail/Train/Ham echo "Training SpamAssassin Completed!"
With spamassassin trained daily and my "required_hits set to 1.9" in my "~/.spamassassin/user_prefs" file, I have been able to get an accuracy of emails being tagged as spam for about 99.9% of my emails... Woohooo!!
Related Reading:
- sandip's blog
- Login or register to post comments
TCL and Eggdrop1.6.17 installation
Sat, 02/04/2006 - 01:49 — manojWhat is an eggdrop?
Eggdrop is an IRC bot which is the best , popular and most supported IRC bot that people use . Loads of functions can be done through eggdrop ( for eg . Channel management , userfile structures ) and the most popular part of an eggdrop is we can add modules and TCL scripts .
Setting up an eggdrop .
how to setup
You can see the manual on how to setup an eggdrop there .
But to make it quick , let me Write down some few stuffs .
- ssh to your shell
- manoj's blog
- Login or register to post comments
- Read more
AutoReject Rogue Virus / Worm Mail generating infected IP via sendmail access list
Wed, 02/01/2006 - 12:01 — sandipMailScanner is good at filtering out the emails with attached worms and viruses. However, it does this at the expense of a high server cpu load when there is a sudden influx of auto-generated email bombardment from an IP that has been infected.
Most recent of which causing havoc is the Nyxem.E (aliases: Email-Worm.Win32.Nyxem.e, Kama Sutra, W32/MyWife.d@MM) worm set to execute on the third of each month (e.g. February 3, 2006).
Here is a quick documentaion of what I have done to autoreject emails from ISPs that are generating rogue emails.
- sandip's blog
- Login or register to post comments
- Read more
How to create a favicon (icon displayed in the browsers location bar) with Gimp
Sun, 01/29/2006 - 19:10 — sandipIf you notice your http error logs with a lot of messages such as "File does not exist: ... favicon.ico". You are missing an icon for your website which is displayed in the browsers location bar and also within the browser bookmarks.
Here's an easy way to create one with Gimp:
-
Open the image you want to create the icon for, with Gimp.
Resize the image to a 16x16 pixel.
When you go to save, "Select File Type (By Extension)".
Save as "Microsoft Windows Icon" -- ico .
Name it "favicon.ico".
Upload the favicon.ico file to the websites home directory.
When you visit your website, you should now have a cool new icon displayed within the browsers location bar!!
- sandip's blog
- Login or register to post comments
- Read more
Sorting VARCHAR data in mysql
Thu, 01/26/2006 - 11:10 — sandipHere's a quick tip at sorting VARCHAR type data in mysql database with values in a column.
With the default sort, it would look something like below:
mysql> SELECT column FROM table_name ORDER BY column; column ====== 100 1000 10000200 2000 20000 ...
Now with "... ORDER BY column+0", I get it sorted right:
mysql> SELECT column FROM table_name ORDER BY column+0; column ====== 100 200 1000 2000 10000 20000 ...
This is a quick fix instead of sorting to CAST operator.
Pixel Ads at LinuxWeBLOG.com
Sun, 01/22/2006 - 13:47 — sandipSupport LinuxWeBLOG by purchasing pixels at the pixels homepage. It is being introduced for just 10 cents a pixel for a limited time, so don't miss out the opportunity to advertize your site and begin receiving traffic from us.
The site is already spidered by the bigger search engines like -- google, yahoo, msn, aol etc...
This is a one time deal and your link remains on the site forever. With the growing hits and membership on the site, the cost will not remain the same... Buy Pixels NOW !!
- sandip's blog
- Login or register to post comments
- Read more
Listing image files in folders and subfolders with PHP
Wed, 01/11/2006 - 11:09 — sandipHere's a quick way to create a listing of images uploaded to a folder with php:
<?php // file name: list_pics.php global $startDir; /** * List Directories function, which transverses sub-folders * listing out the image files that exists within it. */ function listDir( $path ) { global $startDir; $handle = opendir( $path ); while (false !== ($file = readdir($handle))) { if( substr( $file, 0, 1 ) != '.' ) { if( is_dir( $path.'/'.$file ) ) { listDir( $path.'/'.$file ); } else { if( @getimagesize( $path.'/'.$file ) ) { /* // Uncomment if using with the below "pic.php" script to // encode the filename and protect from direct linking. $url = 'http://domain.tld/images/pic.php?pic=' .urlencode( str_rot13( substr( $path, strlen( $startDir )+1 ).'/'.$file ) ); */ $url='http://domain.tld/images /'. substr( $path, strlen( $startDir )+1 ).'/'.$file; // You can customize the output to use img tag instead. echo "<a href='".$url."'>".$url."</a ><br>"; } } } } closedir( $handle ); } // End listDir function $startDir = '.'; listDir( $startDir ); ?>
- sandip's blog
- Login or register to post comments
- Read more