戰地連結︰ Home My Flickr NBA.com About

2009年4月7日星期二

U-Boot related documentation

Overview

I have been fighting with embedded Linux system for the past two months, here is what I found when the card crash and I have to flash the Kernel.

Reference

U-Boot bootloader Wiki (Gumstix)

U-Boot Environment Variables

Some JavaScript / AJAX Resources

Overview

Including Script.aculo.us and others scripts.

Reference

20 Top Script.aculo.us Scripts you can’t live without

80 AJAX solutions that are excellent and useful

70 New, Useful AJAX And JavaScript Techniques

Concurrent remote desktop sessions in Windows XP sp3

Overview

This is a hack for allowing concurrent remote desktop sessions in Windows XP sp3

Reference

Concurrent Remote Desktop Sessions in Windows XP SP2

Enabling Concurrent Remote Desktop Sessions on Windows XP SP3 - Patched file included

2009年2月14日星期六

Cannot view the contents of a (.chm) file

Overview

I just get an e-book and find that all of the pages are dead. With some searching I find that the file is blocked by windows.

The solution is to unlock the .chm file. To do this:

  1. Right-click on the .chm file, select "Properties"
  2. Click "unlock"
  3. Done!

Reference

解决打开CHM格式文件出现“网页不能浏览”错误的方法

You cannot open HTML Help files....

2009年2月5日星期四

Add a select / deselect all checkbox to an ASP.NET checkbox list control

Overview

The code below demonstrate how to use JavaScript to get all the checkbox elements of a particular checkbox list, and then check / unchecked them base on the status of another checkbox (the sender).

This technique is also useful when you want to do other operation (e.g. ensure single selection) to all checkboxes of a checkbox list.

Reference

Check/Uncheck all items in a CheckBoxList using ASP.NET and Javascript

Code Snippet

This code is directly copied from Check/Uncheck all items in a CheckBoxList using ASP.NET and Javascript

function CheckBoxListSelect(cbControl, state)

{  

    var chkBoxList = document.getElementById(cbControl);

    var chkBoxCount= chkBoxList.getElementsByTagName("input");

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

    {

        chkBoxCount[i].checked = state;

    }

 

    return false;

}

2009年2月3日星期二

Multi-line Text boxes (Text area) behave incorrectly with Default Button in Firefox

Overview

I open form with a default button and a Multi-line ASP.NET text box (text area) in Firefox 3. When I hit "Enter" key in the text area, I expect the text area to start a new line. However, the default button is triggered.

Reference

Multiline Textboxes and DefaultButton in Firefox

2009年1月21日星期三

Restrict date range in Calendar

Overview

By default, Calendar control won't allow you to restrict the selectable date range. However, we can achieve this by doing two things:

  1. Restrict user from navigating to a month outside the range
  2. Restrict user from selecting a day outside the range

Reference

Visual Studio .NET - restrict date range in Calendar - eggheadcafe

Disable calendar day select link - eggheadcafe

Steps

Restrict user from navigating to a month outside the range

To achieve this, we can set the "NextMonthText" and "PrevMonthText" fields of the Calendar control to hide the link navigating to next or previous month.

Code Snippet:

protected void Cal_PreRender(object sender, EventArgs e)

        {

 

            if (Cal.VisibleDate.Year > 2009 || (Cal.VisibleDate.Year == 2009 && Cal.VisibleDate.Month >= 12))

            {

                Cal.NextMonthText = string.Empty;

            }

            else

            {

                Cal.NextMonthText = ">";

            }

 

            if (Cal.VisibleDate.Year < 2000 || (Cal.VisibleDate.Year == 2000 && Cal.VisibleDate.Month <= 1))

            {

                Cal.PrevMonthText = string.Empty;

            }

            else

            {

                Cal.PrevMonthText = "<";

            }

        }

Restrict user from selecting a day outside the range

This can be achieved by controlling the "IsSelectable" field in the "onDayRender" event handler of the Calendar.

Code Snippet:

protected void Cal_DayRender(object sender, DayRenderEventArgs e)

        {

            if (e.Day.Date.Year == 2009)

            {

                e.Day.IsSelectable = false;

            }

        }