Friday, August 24, 2007

apache: /libphp5.so: cannot restore segment prot after reloc: Permission denied

If apache cannot start, with error: /libphp5.so: cannot restore segment prot after reloc: Permission denied, try the following:

% setenforce 0

VsFTP 500 OOPS: cannot change directory

cannot change directory:/home/***
500 OOPS: cannot change directory:/home/*******
500 OOPS: child died

Solution (in prompt)
% setsebool ftpd_disable_trans 1
% service vsftpd restart

To make the effect working even reboot, add option -P in setsebool

Reference: http://www.phpchina.com/14881/viewspace_8888.html

Wednesday, June 20, 2007

Using find command in Unix

Just for my memory...

find . -exec grep "keywords" '{}' \; -print

This handly statement finds files contains "keywords" and print the line and the file name as well.

Ref: http://www.athabascau.ca/html/depts/compserv/webunit/HOWTO/find.htm#EX03

Tuesday, June 19, 2007

Context level of Moodle

From lib/accesslib.php

25 // context definitions
26 define('CONTEXT_SYSTEM', 10);
27 define('CONTEXT_PERSONAL', 20);
28 define('CONTEXT_USER', 30);
29 define('CONTEXT_COURSECAT', 40);
30 define('CONTEXT_COURSE', 50);
31 define('CONTEXT_GROUP', 60);
32 define('CONTEXT_MODULE', 70);
33 define('CONTEXT_BLOCK', 80);

Friday, June 15, 2007

MS Word closed right after it starts

Whenever you experience this sort of problem, most likely it will be the problem of file: normal.dot

Try to seek and delete that file to solve the problem.

Ref: http://word.mvps.org/FAQs/AppErrors/ProbsOpeningWord.htm

Tuesday, June 12, 2007

Create create VPN connection in Windows XP

In Windows XP, make sure the Telephony, Remote Access Connection Manager, and Remote Access Auto Connection Manager services are running.

Ref: http://support.microsoft.com/default.aspx?scid=kb;en-us;329441

Wednesday, June 6, 2007

php_mysql.dll problem in Apache

Apache startup error message:

PHP Startup: Unable to Load Dynamic library 'C:\PHP\ext\php_mysql.dll - The specified module could not be found.

Solution:

Copy the libmysql.dll from the main php folder to \windows\system32

Sunday, June 3, 2007

Using EditItemTemplate for InsertItemTemplate in FormView (ASP.NET)

There is a nice way to reuse your hardly made EditItemTemplate in the InsertItemtemplate. Found in ASP.NET forum:
protected void FormView1_Init(object sender, EventArgs e) {

   FormView1.InsertItemTemplate = FormView1.EditItemTemplate

}

protected void FormView1_DataBound(object sender, EventArgs e) {     

  if (FormView1.CurrentMode == FormViewMode.Edit) {

       LinkButton InsertButton = FormView1.FindControl("InsertButton") as LinkButton;

       LinkButton UpdateButton = FormView1.FindControl("UpdateButton") as LinkButton;

       InsertButton.Visible = false;

       UpdateButton.Visible = true;

  } else if (FormView1.CurrentMode == FormViewMode.Insert) {

       LinkButton InsertButton = FormView1.FindControl("InsertButton") as LinkButton;

       LinkButton UpdateButton = FormView1.FindControl("UpdateButton") as LinkButton;

       InsertButton.Visible = true;

       UpdateButton.Visible = false;

  }

}

Ref: http://forums.asp.net/t/1102469.aspx

Wednesday, May 30, 2007

Friday, May 25, 2007

String Concatenation in SQL Server

When using '+' to concatenate two string field in SQL server (e.g. a+b), if one of them is NULL, then the whole string will become NULL. There is one solution to solve it:

COALESCE(a,'') + COALESCE(b,'')

So if any of the field is NULL, it will evaluate as an empty string. That's it!

CSP on Apache

To add CSP to root if sort of funny. The following will NOT work for most cases !!     <LocationMatch "^/$">        Header s...