Monday, April 25, 2011
Sunday, April 24, 2011
How to auto restart services when linux reboots
Use chkconfig command.
To list services:
To add service:
To remove service:
To change level of service:
To list services:
chkconfig --list [service]
To add service:
chkconfig --add {service}
To remove service:
chkconfig --del {service}
To change level of service:
chkconfig [--level {level}] {service} {on|off|reset|resetpriorities}
Sendmail start-up error
Problem:
This means that somewhere between the path of "/" to "/etc/mail/" is a World writable directory or a 777. In my case it was "/etc".
Change the permission to 755:
Start sendmail:
451 4.0.0 /etc/mail/sendmail.cf: line 91: fileclass: cannot open '/etc/mail/local-host-names': World writable directory
451 4.0.0 /etc/mail/sendmail.cf: line 588: fileclass: cannot open '/etc/mail/trusted-users': World writable directory
This means that somewhere between the path of "/" to "/etc/mail/" is a World writable directory or a 777. In my case it was "/etc".
Change the permission to 755:
[root@linux]# chmod 0755 /etc
Start sendmail:
[root@linux]# service sendmail start
Sunday, November 23, 2008
Safari focus() at beginning of text instead of end of text
Safari browser has a weird textbox.focus() behavior. Instead of putting the cursor after text like the other browsers, it puts the cursor at the beginning of the text. My workaround for this problem to is use focus() then changing the value of the textbox.
element.focus();
element.value += '';
If the textbox needs to be changed anyway, just put the focus() right before changing the value.
element.focus();
element.value = 'some text';
*Using Safari 3.1.2
Tuesday, March 25, 2008
Apache updating wrong log files
When renaming apache log files, restart apache server.
If apache is not restarted, there is a possibility that the old log file even though renamed/moved will still be updated because apache is still accessing its file descriptor.
If apache is not restarted, there is a possibility that the old log file even though renamed/moved will still be updated because apache is still accessing its file descriptor.
Monday, June 18, 2007
MySQL error: Field doesn't have a default value
When inserting a new record with varchar or text field that is required and has no default value. This error will display for example:
error : Field 'description' doesn't have a default value
The possible reason is that sql-mode in my.ini is set to STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION.
Change the value to
sql-mode = ""
Update 2011/4/25:
Add Default value "" if possible to avoid changing mysql setting.
error : Field 'description' doesn't have a default value
The possible reason is that sql-mode in my.ini is set to STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION.
Change the value to
sql-mode = ""
Update 2011/4/25:
Add Default value "" if possible to avoid changing mysql setting.
Wednesday, January 31, 2007
Print Button
You can easily add a print button or link to your web page. To add a button use the following code:
The button looks like this:
To add a link you code it like this:
print
The link looks like this: print
You can also easily control what parts of your page print out by adding a special stylesheet that will be used for printing to the head section of your page like this:
<link rel="stylesheet" href="print.css"
type="text/css" media="print" />
The print.css file should contain the following:
body {visibility:hidden;}
.print {visibility:visible;}
Now all you need to do is to assign class="print" to whatever parts of your web page that you want to have print out. Anything on the page not assigned to this class will not print.
The button looks like this:
To add a link you code it like this:
The link looks like this: print
You can also easily control what parts of your page print out by adding a special stylesheet that will be used for printing to the head section of your page like this:
<link rel="stylesheet" href="print.css"
type="text/css" media="print" />
The print.css file should contain the following:
body {visibility:hidden;}
.print {visibility:visible;}
Now all you need to do is to assign class="print" to whatever parts of your web page that you want to have print out. Anything on the page not assigned to this class will not print.
Wednesday, October 11, 2006
PHP: Uploading larger files than default PHP setting.
In php.ini, please change the following values to appropriate MB value:
upload_max_filesize - limit of PHP's allowable size per file.
post_max_size - total size of form data including the files uploaded.
Example:
upload_max_filesize = 5M
post_max_size = 80M
Restart Apache server everytime php.ini is changed.
Reminders
upload_max_filesize - limit of PHP's allowable size per file.
post_max_size - total size of form data including the files uploaded.
Example:
upload_max_filesize = 5M
post_max_size = 80M
Restart Apache server everytime php.ini is changed.
Reminders
- Upload directory must be writable.
- Form enctype should be multipart/form-data
Subscribe to:
Posts (Atom)