Monday, July 27, 2009

Convert "man page" into text file

Save a man page into text file

Option #1



man -P cat ls > man_ls.txt


Option #2:



man ls | col -b > ls.txt

Wednesday, July 15, 2009

First try in C#

Here is my first try in C#


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace dotNet
{
class Greeting
{
public static int displayGanesh()
{
Console.WriteLine("Ganesh Here !!");
return 0;
}
public static int displayVishnu()
{
Console.WriteLine("Vishnu Here !!");
return 1;
}
}

delegate int delGreetings();

class Program
{
static void Main(string[] args)
{
int choice = 1;
delGreetings[] Greetings =
{
new delGreetings(Greeting.displayGanesh),
new delGreetings(Greeting.displayVishnu)
};
int return_ = Greetings[choice - 1]();
Console.Write("Return Value ");
Console.WriteLine(return_);
return;
}
}
}



delegate is basically defines the function pointer.
In the below snippet, it defines a function pointer which
takes no arguments and returns an int value.


delegate int delGreetings();




Happy Hacking !!

Tuesday, July 14, 2009

Visual Studio .Net 2008 Cheat sheet

For all the C# fans out there, today I came across this excellent keyboard cheat sheet and Jeff's Summary Macro to generate the full list of VS 2008 cheat sheet in HTML format.

Here is the steps to generate the cheatsheet for yourself. Skip to down under if you wish to get the generated cheatsheet.

Download the Keyboard shortcut Summary macro

How to install and run the macro ??
  1. go to Tools - Macros - IDE
  2. Create a new Module named "KeyboardShortcuts" under "MyMacros"
  3. Paste the above code into the module
  4. Add a reference to the System.Data.dll and System.XML.dll ; make sure it builds with no errors
  5. Close the macro IDE window
  6. go to Tools - Macros - Macro Explorer
  7. A new macro named "List" will be under "KeyboardShortcuts." Double-click it to run the macro
  8. The macro will take a moment to write the keyboard shortcuts to a HTML file, then open the HTML file in the IDE.
This is tested against VS 2008 and the macro generates the HTML file :

C:\Users\mganesh\Documents\Visual Studio .NET 20xx Keyboard Shortcuts.htm

This is the file location in my Win 7 OS.

The cheat sheet result for the Visual Studio 2008 default C# keyboard shortcuts is posted to save people the trouble of getting the macro running. It's here.