Sunday, April 25, 2010

Determine list of printers installed in C# (.Net Framework)

1. Add System.Drawing library as reference.

2. Import the System.Drawing.Printing.
using System.Drawing.Printing;

3. PrinterSettings.InstalledPrinters is a string collection of the printer names installed on the machine

Example to output all printers on Console:


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Printing;
using System.Windows.Forms;

namespace PrintersDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            for(int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
            {
                Console.WriteLine(PrinterSettings.InstalledPrinters[i]);
            }

            Console.ReadLine();
        }
    }
}

JDeveloper: ORA-01882: timezone region found found

When trying to deploy your web application using JDeveloper to the integrated WebLogic, if you get the following error:

(oracle.jbo.JboException) JBO-29000: Unexpected exception java.sql.SQLDataException, msg=ORA-01882: timezone region not found


then to resolve this issue,

1. Goto Application menu and select Project Properties
2. In the Project Properties window, On the left pane, select Run/Debug/Profile
3. On the right pane, Edit the Default configuration (or double click on Default)
4. In the Edit run configuration window, select Launch Settings
5. For 'Java option' text box, add -Duser.timezone="+04:00"

You will probably need to save and restart JDeveloper for the changes to take effect.

Saturday, April 24, 2010

Command to launch Remote Desktop Connection

Just type mstsc in the Run window or the command prompt window, and the Remote Desktop Connection window will pop up ...