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.

CSP on Apache

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