Monday, November 15, 2010

Windows 7 - Play more

Windows 7 new features

  1. Problem Steps Recorder. This app records your screen actions. Type psr in Run command textbox. This is particularly useful for support to troubleshoot window issue
  2. Attache vhd. Type diskmgmt.msc. Click on Action -> Attach VHD.
  3. Switch display. [Window] key + P.
  4. Calibrate display. Type dccw.
  5. Virtual WI-FI. Turn your computer into a virtual router. Download it from http://virtualrouter.codeplex.com/
  6. Resource Monitor. Type resmon. This is equivalent to WinXP Task Manager.
  7. Activate God mode. All control panel settings in 1 place. Create a folder and rename the folder to .{ED7BA470-8E54-465E-825C-99712043E01C}. i.e. GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}.
  8. Show Minimize, Maximize menu on running application. Press Ctrl+shift right-click on running application bar (bottom of the screen).
  9. Navigate over task bar. [Window] key +T to rotate task bar apps.
  10. Use 3M Note. Type StikyNot.exe.
  11. Run as different user. Hold down Shift, right-click on shortcut. you will see Run as different user menu.
  12. Open jumplist. Hold left mouse button on Task Bar and drag upwards.

Wednesday, June 09, 2010

Select distinct rows and sum columns in DataTable

How to filter distinct row from a DataTable column?
Use the [DataView].ToTable (bool, string[]) method. The following code returns a distinct category (no repeated rows in same category).

Example:
DataTable newTable = view.ToTable(true, "Category");


How to sum column total from a DataTable?
Use the DataTable Compute () function. This method performs aggregate function on the DataTable based on the filter criteria.

Example:
newTable.Compute("Sum(Sales)","Category='Pasta'");

Tuesday, April 06, 2010

How to describe Oracle table columns

SELECT column_name
FROM all_Tab_Columns
WHERE table_name= ''
ORDER BY column_name;

Tuesday, March 23, 2010

Select top 10 records in Oracle

Microsoft TSQL has select top records statement. How do you do it in Oracle PL/SQL?

TSQL:
select top(10) from tblStudents

PL/SQL:
select * from
(select IDStudent, FirstName, LAstName from tblStudents)
where rownum <10

Tuesday, March 16, 2010

Annoying ASP.NET postback - cursor on top

Scenario
Isn't it annoying that the mouse cursor is positioned to the top of the page for each post back. This happens to components that are not wrapped by a Ajax post-back and with control that has autopostback set to True.

Resolution
For .NET framework 3 and above, set the smartnavigation= true on the aspx Page declaration. Don't worry if the Page tag auto-complete doesn't give you the smartnavigation property.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Demo.Tricks._Default" smartnavigation="true"%>

Result
If a drop-down box at the bottom of the page is selected and post-back to the server, smartnavigation feature will re-position the cursor to where the post-back occurs. Brilliant!!

Window 7 Ultimate Aero preview does not work

Windows 7 user can preview the actual window when they hover their mouse over the application bar (at the bottom of the window). This is known as the Aero effect.

Problem:
The user can only see a rectangular box (no preview). Is my installation faulty? No.

Cause:
The Aero effect is not turn on by default for Windows 7 Ultimate edition. It depends on a window service called Desktop Window Manager Session Manager. The service is set to manual for default installation.

Resolution:
Set the "Desktop Window Manager Session Manager" start mode to "Automatic".

Step-by-step:
  1. Type services.exe into the Run textbox and press enter. This will open the window service listing.
  2. Locate Desktop Window Manager Session Manager service and right click on "Properties"
  3. Set the start mode to Automatic.
  4. For instance effect, start the service.
  5. Voila.

How to open network connections window

To open "Network Connections" window via command prompt

Type npca.cpl in Start->Run textbox (works with WinXP and Windows 7).

To open "Add Remove program" window via command prompt

Type appwiz.cpl in Start->Run textbox (works with WinXP and Windows 7).