Thursday, September 24, 2009

Get Class name from Static method in C#.NET

In order to get class name from the static method I used the following code, using .NET reflection

String className = MethodBase.GetCurrentMethod().DeclaringType.Name;

Thursday, September 10, 2009

Remove registry keys and subtrees

In order to remove the registry key and all sub-tree beneath it, create file with extension .reg and put this text in the file and double click the file. In following example all registry keys and sub trees under MyProgram will be deleted

Windows Registry Editor Version 5.00


Disable monitor timeout from Ubuntu server console

To disable monitor auto off from Ubuntu Server console, I used following commands

$setterm -blank 0
$setterm -powersave off
$setterm -powerdown 0

Tuesday, September 08, 2009

Disable Ubuntu monitor auto turn off

To disable auto turn off monitor for Ubuntu Server console I changed /etc/console-tools/config and made BLANK_TIME=0

Friday, August 21, 2009

Check the memory taken by files and directory

Check the memories taken by the files and directory I used this command

du -h -s -c *

Monday, July 13, 2009

Change Hostname of Ubuntu server machine

Edit the file /etc/hostname and put hostname in this file.

and execute /etc/init.d/ start

Also edit /etc/hosts file and change hostname in that file.

Monday, July 06, 2009

Disable Windows XP active screensaver

From registry editor... (Run=> regedit)

HKEY_USERS -> .DEFAULT -> CONTROL PANEL -> DESKTOP, Set the "ScreenSaveActive" value to 0 and the "ScreenSavetimeOut" value to 0 to disable active screen saver.

Friday, June 05, 2009

Change Hostname of Ubuntu Machine

To change hostname of Ubuntu machine use following commands

Edit file /etc/hostname and change the hostname in that file

run the command sudo /etc/init.d/ start

run the command sudo sysctl kernel.hostname=newHostname

Change UUID of Virtual Box Disk (VDI)

In order to change UUID of Virtual Box Disk Image (VDI) use following command from DOS command prompt.

VBoxManage internalcommands sethduuid "c:\diskName.vdi".

VBoxManage is command is located at C:\Program Files\Sun\xVM VirtualBox. You can add it to Environmental variable and then execute above command from the directory where VDI file is located

Tuesday, May 19, 2009

Visual Studio Tweaking

Visual Studio every time says loading for first time...

To avoid this do

Click on the Tools > Options

Select "Import and Export Settings",

Edit the path for "Automatically save my settings to this file:" to a path on disk drive but not My Documents or any network drive.

Wednesday, May 13, 2009

IF Statment for MS-DOS batch file

SET FrontEnd="false"
SET BackEnd="false"
SET Translations="false"

IF %FrontEnd% == "true" GOTO FrontEnd
IF %BackEnd% == "true" GOTO BackEnd
IF %Translations% == "true" GOTO Translations

ECHO I am FrontEnd

ECHO I am BackEnd

ECHO I am Translations


SET and GET values in DOS Batch file

Set a variable in DOS Batch file using following syntax

SET myVariable="Hello"

Get the value of the variable in DOS Batch file using following syntax


Friday, March 13, 2009

Delete all Objects (Images) from Excel Workbook

Select the workbook
Press F5
Click Special
Select Objects
Click OK
Press Delete key from Keyboard

Friday, January 30, 2009

Install Flash Player for Firefox on Ubuntu

Install Flash Player on Ubuntu linux, use following command

sudo apt-get install flashplugin-nonfree

Thursday, January 29, 2009

Know the Ubuntu version

Use following command to know the Ubuntu OS version

cat /etc/issue

Monday, January 26, 2009

KDE on Install on Ubuntu Server

Install KDE desktop on Ubuntu Server

- sudo aptitude update

- sudo aptitude install kubuntu-desktop

Wednesday, January 21, 2009

Remove Hyperlink from multiple cells in Excel

In a blank cell, enter the number 1 .
Copy that cell.
Select the cells with the hyperlinks.
Right click on the seleted cells and click Paste Special.
Under operations, select multiply and click OK.

Tuesday, January 20, 2009

Get XML element inner text

XmlDocument xmlDocument = new XmlDocument(); // Creates new instance of XMLDocument

xmlDocument.Load(filePath); // Loads the XMLString which is XML file in one single string

XmlNode XMLElement = xmlDocument.SelectSingleNode("//data[@name='BrowserString1']//value"); // Gets the List of all XML elements foun

String value = XMLElement.InnerText;