Thursday, November 15, 2007

Moodle error: Query failed in load_user_capability

In Moodle 1.8 platform, whenever you encounter the captioned error during login, the /var is likely to be full.

The solution, obviously... clean up the /var to feed more free space to it.

Thursday, November 1, 2007

Tracing IP and e-mail header information

I found some resources for tracing IP and e-mail header stuff...

Find the IP of the e-mail sender via header:
http://www.infobanc.com/articles/faida5_12.htm

Trace the IP location:
http://visualroute.visualware.com/

Wednesday, October 31, 2007

List and comparisons of emulators...

Mayank Sharma provided a nice articles on some alternative emulators other than VPC:

Ref:  http://www.linux.com/articles/60742

They are QEMU, Bochs, Virtual Box, VMware Player and VMware server...

Wednesday, September 5, 2007

phpgraphy album title length

The title length of albums could be modified at:
found in file "/base/include/yorsh-varval-request_data.inc.php"

field dirtitle

verison 0.93.

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!

Monday, May 7, 2007

Just played around with Greasemonkey

I'm not a javascript expert, but just played around using js in greasemonkey, quite funny.

// ==UserScript==
// @name FilterGuruEntry
// @description Filter Guru Entry
// @include http://www.guru.com/pro/search_results.cfm*
// ==/UserScript==

var allTRs, thisTR;

allTRs = document.getElementsByTagName('SPAN');

for (var i = 0; i < allTRs.length; i++) {

thisTR = allTRs[i];

if (thisTR.getAttribute("class") == "btblue") {
      myTR = thisTR.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;

myTD = thisTR.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;

if (myTR.nodeName == "TR") {

myTR.removeChild(myTD);

}

}

}

Thursday, May 3, 2007

SQL Express installation messages

In case you just skip the post-installation messages... that may helps :P

Configuring and Managing SQL Server Express
·    For improved manageability and security, SQL Server 2005 provides more control over the SQL Server surface area on your system. To minimize the surface area, the following default configurations have been applied to your instance of SQL server:

o    TCP/IP connections are disabled
o    Named Pipes is disabled
o    SQL Browser must be started manually
o    OPENROWSET and OPENDATASOURCE have been disabled
o    CLR integration is disabled
o    OLE automation is disabled
o    xp_cmdshell is disabled

To enable or disable features and services, run the SQL Server Surface Area Configuration tool from the Start menu.

·    To install SQL Server Management Studio Express Edition, download it from the SQL Server Developer Center on MSDN (http://go.microsoft.com/fwlink/?linkid=51793).

Documentation and Samples
To install SQL Server 2005 Books Online, download them from the SQL Server Developer Center on MSDN (http://go.microsoft.com/fwlink/?linkid=51793).

To install the .NET Framework SDK, see "Installing the .NET Framework SDK" in SQL Server Books Online.

To install sample databases and code samples, download the SQL Server Samples from the SQL Server Developer Center on MSDN (http://go.microsoft.com/fwlink/?linkid=51793).

Thursday, April 12, 2007

AutoIncrement in .NET and Autonumber in ACCESS

From my experience, try to avoid turning on both AutoIncrement (in DataColumn) in .NET and Autonumber in MSAccess at the same time. As somehow there is just no communication between them. They just work on their own.

For example, when you have records in ACCESS having ID (1,2,3,4) and suppose the next ID be 10 (as doing some record add and delete before). AutoIncrement in .NET just don't know about it as it's AutoIncrementSeed can just automatically set to 5.

Then 10 vs 5, I hope you can see how the problem being occurred. So avoid having them both at the same time.

Tuesday, April 3, 2007

Literal vs Label

When working with .NET, you may wonder the difference between Literal and Label.

Actually, when both controls are converted to become HTML, Label will add a pair of <span></span> tag, while Literal keeps everything unchanged.

So most of the time if would be better to use Literal instead of Label for the sake of simplicity.

Sunday, February 18, 2007

Re-installing WMI

For those folks out there using Windows Server 2003 SP1 Build 1277 along with the SQL Server 2005 December CTP, you may be unable to install SQL Server 2005 with the following error: Microsoft SQL Server 2005 Beta 3 Setup

The SQL Server System Configuration Checker cannot be executed due to WMI configuration on the machine SI4P64LF3-05 Error:2147749907 (0x80041013).

The cause of this error is a corrupt install of WMI, caused by upgrading Windows Server 2003 to SP1 build 1277. To fix this issue, copy the following into notepad and save it with either a .cmd or .bat extension. Then run the script to re-install WMI:

%SYSTEMDRIVE%
CD %windir%\system32\wbem
Mofcomp.exe cimwin32.mof
Regsvr32 /s wbemupgd.dll
Regsvr32 /s wbemsvc.dll
wmiprvse /regserver


If that doesn't work, try the info here posted on MSDN.

Ref: http://blogs.msdn.com/jpapiez/archive/2004/12/09/279041.aspx

Sync multiple git repo at once

Use the following command in Linux will do the job:  ls -d RepoNames* | xargs -I{} git -C {} pull