Monday, December 01, 2008

How to add/remove program via Run command

Click Start->Run, type in appwiz.cpl.

Thursday, November 27, 2008

C# .NET force control to refresh programatically

public partial class MainWindow : Form
{
List _latestPriceList = new List();
public MainWindow ()
{
    InitializeComponent();
    

    // Set the DataSource property of the ListBox called priceListBox1
    priceListBox1.DataSource = _latestPriceList;
}

}


private void AddNewPrice(double newprice)
{
    // Insert the string at the front of the List.
    _latestPriceList.Insert(0, newprice);

    // Force a refresh of the ListBox.
         ((CurrencyManager)priceListBox1.BindingContext[_latestPriceList]).Refresh();
}

Thursday, November 06, 2008

How to disable MSN Messenger on XP

It's very annoying that MSN Messenger loaded when window starts. This is how you can get rid of it.

Save the following text as DisableMSN.reg. Double click and run the content. Done.

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Messenger]

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Messenger\Client]
"PreventRun"=dword:00000001

Wednesday, November 05, 2008

How to make asp.net textbox readonly

A asp.net2 textbox control will not perform any postback if the readonly is set to true. Thus, no validation could be performed if required.

Why not setting the atttribute client side? This disables the user from editing the value. Moreover, it supports post back. Cool. :)

// Make the textbox readonly at client side
txbDailyAllowance.Attributes.Add("readonly", "readonly");

Tuesday, November 04, 2008

Oracle PLSQL Cursor Example

DECLARE

CURSOR c_emp (p_dept VARCHAR2) IS
SELECT ename, salary
FROM emp
WHERE deptno = p_dept
ORDER BY ename;

r_dept DEPT%ROWTYPE;

BEGIN

OPEN c_emp (r_dept.deptno);
LOOP
FETCH c_emp INTO v_ename, v_salary;
EXIT WHEN c_emp%NOTFOUND;

END LOOP;
CLOSE c_emp;

END;

Tuesday, October 21, 2008

Sqlplus command to connect to Oracle server

How to connect to oracle database via sqlplus
  1. Check tns entry is valid
  2. Type sqlplus /nolog
  3. Connect as SYS

Command to install Window Service with differrent name

@echo off
%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\installutil.exe /ServiceName="Script Automation Service" autoscriptservice.exe
PAUSE

Tuesday, July 15, 2008

Remote desktop to existing session

Type the following into windows run command

mstsc /console.

The remote desktop dialog appears and log in as normal.

Friday, May 23, 2008

Netmeeting to share desktop

There is an easier way to share the screen with another computer user. VNC is one of the choice but sometimes required port 5900 set up correctly through the firewall/router.

Why not try netmeeting?

1) How to set up
Type 'conf' (without the quotation mark) in the Start -> Run dialog. Go through the default configuration until the netmeeting application appears.

The remote user does the same. Type 'conf' in the run menu.

2) How to connect?

Click on netmeeting menu Help-> About window netmeeting
. This will show your ip address.

The remote user types the ip address (destination machine ip) in the and press the call button.

Thursday, May 08, 2008

Window Management Instrumentation (WMI)

Wmi enables application to obtain enterprise data and automate administrative tasks on local/remote computers via .net programming languages (c#, vb.net or vbscript) .

It uses namespace System.Management. Find out more from the following link

http://msdn.microsoft.com/en-us/library/ms186147(VS.80).aspx