ToString is superior than Message. Very useful for debugging purposes!
using System;
using System.Collections.Generic;
using System.Text;
namespace ExceptionToString
{
public class MyClass {}
public class ArgExceptionExample
{
static void Main(string[] args)
{
MyClass my = new MyClass();
string s = "sometext";
try
{
int i = s.CompareTo(my);
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}\n", ex.ToString());
Console.WriteLine("Error: {0}", ex.Message);
Console.Read();
}
}
}
}
Tuesday, June 8, 2010
Friday, May 14, 2010
Flash Player installation instructions for OpenSolaris
Installation instructions for Solaris x86
The following assumes that you have unpacked the archive flash_player_10_solaris_x86.tar.bz2 into the top level of your user directory. Your user directory is referred to as $HOME.The Adobe Flash Player can be installed in two ways:
A. Install Adobe Flash Player system-wide, making it available to all users of the computer
-or-
B. Install Adobe Flash Player in a user account, making it available only to that user.
A. Installing Adobe Flash Player System-Wide:
- You will need root access to the computer to install Adobe Flash Player system-wide.
- Copy Adobe Flash Player (libflashplayer.so) into the Firefox/Mozilla plug-in directory (/usr/lib/firefox/plugins).
- Restart Firefox/Mozilla.
- Verify the installation by typing about:plugins in the location bar or by choosing Help > About Plugins. You should see Adobe Flash Player listed as "Shockwave Flash Player 10.0"
- To test Adobe Flash Player go to: http://www.adobe.com/go/flashplayerversion
B. Installing the Adobe Flash Player in a User Account:
- If you have not already used Firefox/Mozilla from the user account, launch Netscape/Mozilla and close it. This will create a preferences directory (/.mozilla) in your home directory.
- Create a directory named "plugins" in the Firefox/Mozilla preferences directory. If the mkdir command reports the error "cannot make directory: File exists", this means that the directory was already present and did not need to be created.
- Copy libflashplayer.so and flashplayer.xpt into the plug-in directory.
- Restart Firefox/Mozilla
- Verify the installation by typing about:plugins in the location bar or by choosing Help > About Plugins. You should see Adobe Flash Player listed as "Shockwave Flash Player 10.0"
- To test Adobe Flash Player go to: http://www.adobe.com/go/flashplayerversion
Wednesday, May 5, 2010
Validate contract in C# using REGEX
String strToTest;
String rePattern = "^[FGHJKMNQUVXZ][0-9]$";
Console.Write("Enter a String to Test for Contract:");
strToTest = Console.ReadLine();
Regex regexPattern = new Regex(rePattern);
Console.WriteLine(regexPattern.IsMatch(strToTest) == true ? "OK" : "KO");
strToTest = Console.ReadLine();
String rePattern = "^[FGHJKMNQUVXZ][0-9]$";
Console.Write("Enter a String to Test for Contract:");
strToTest = Console.ReadLine();
Regex regexPattern = new Regex(rePattern);
Console.WriteLine(regexPattern.IsMatch(strToTest) == true ? "OK" : "KO");
strToTest = Console.ReadLine();
Wednesday, April 21, 2010
tcpdump in OpenSolaris
tcpdump -s 0 -w file.pcap -i e1000g0 port 10689
Labels:
Capture packets,
Network,
OpenSolaris,
tcpdump
Bluetooth “Access Denied” issue and resolution
Today one of my co-workers have a problem activating her Bluetooth mouse. Here is the solution I found in this place:
- Open Services:
- To still type things out, start the on-screen keyboard by going to Start > Programs > Accessories > Accessibility > On-Screen Keyboard. From there, you can then doStart > Run and then type services.msc
- To directly access Services, do Start > Control Panel > Administrative Tools > Services
- Find & select the Bluetooth Support Service, right click and select Properties.
- Click the Stop button on the General tab.
- Select the Log On tab, and select the radio button next toLocal System account, then click Apply.
- Go back to the General tab and click the Start button.
- Click OK to close the Properties dialog.
- Restart computer to make sure the change takes and things work.
Tuesday, April 13, 2010
Last Sunday of the Month in UNIX shell
cal | grep '^[23]' | tail -1 | cut -d' ' -f1
Several months later I don't remember why the grep part?
cal | tail -1 | cut -d' ' -f1
AWK version:
#!/bin/bash
cal | awk '
{ last = $1 }
END { print last }'
##END##
Several months later I don't remember why the grep part?
cal | tail -1 | cut -d' ' -f1
AWK version:
#!/bin/bash
cal | awk '
{ last = $1 }
END { print last }'
##END##
Subscribe to:
Posts (Atom)