Friday, September 14, 2012

Improve your XP's shutdown speed

Improve your XP's shutdown speed. 1) This tweak reduces the time that XP takes before automatically closing any running programs when you give it the command to shutdown. Press WinKey + R and type in "regedt32" and press Enter. Find "HKEY_CURRENT_USER\Control Panel\Desktop", double click "WaitToKillAppTimeout" and change the value to "1000", and press Enter. Double click "HungAppTimeout", change the value to "1000". Press Enter and find "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control", double click "WaitToKillServiceTimeout" and change the value to "1000", and press Enter.

Taken from this site http://www.wikihow.com/Dramatically-Speed-up-Windows-XP

2) people have mentioned that disabling the terminal services greatly expedites the shut down process. The Terminal Services are used for remote assistance, remote desktop, and fast user switching. If you do not use any of these features, then the Terminal Services can be safely disabled. You can access the services console by entering the SERVICES.MSC command at the Run prompt.

3) Another potential cause of slow system shut downs is that Windows contains an option to erase the system’s virtual memory and system hibernation cache at shut down. These security features are disabled by default because they take a long time to complete, and cause the system shutdown to look like it has frozen. Although these features are disabled by default, some privacy software will enable it. To determine whether or not these features are enabled on your PC, enter the GPEDIT.MSC command at the Run prompt to load the Group Policy Editor. Now, navigate through the console tree to Computer Configuration | Windows Settings | Security Settings | Local Policies | Security Options. At this point, locate the Shutdown: Clear Virtual Memory Pagefile option in the column to the right and verify that it is disabled, If this option is enabled, you can disable it by double clicking on the setting and choosing the Disabled option.


http://www.aumha.org/win5/a/shtdwnxp.htm 

Friday, August 24, 2012

Bank IFSC Code

 Get the code from here: http://banksifsccode.com

you have to choose 1) Bank Name 2) State 3) District and 4) Branch

Sunday, July 22, 2012

Excel to PDF in C# Win Form


These link have important information about this topic:

http://stackoverflow.com/questions/769246/xls-to-pdf-conversion-inside-net

http://stackoverflow.com/questions/5499562/excel-to-pdf-c-sharp-library

http://tinyway.wordpress.com/2011/03/30/how-to-convert-office-documents-to-pdf-using-open-office-in-c/


Using Open Office:-

1)Install the Open Office and Open Office SDK
2)Add references in the project i.e, Add following dll's from OpenOffice SDK file:
cli_basetypes.dll
cli_cppuhelper.dll
cli_oootypes.dll
cli_ure.dll
cli_uretypes.dll 


Copy and Paste the below code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using uno.util;
using unoidl.com.sun.star.lang;
using unoidl.com.sun.star.uno;
using unoidl.com.sun.star.bridge;
using unoidl.com.sun.star.frame;
using unoidl.com.sun.star.text;
using unoidl.com.sun.star.beans;
using unoidl.com.sun.star.util;
using System.Diagnostics;
namespace PDFGenerator
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string excelFile = "file:///C:/244.xls";
            string pdfFile = "file:///C:/244.pdf";

            int NewOpenOfficeID = 0;
            int PreviousTotalOpenOfficeID = 0;
            int NextTotalOpenOfficeID = 0;
            foreach (Process p in Process.GetProcessesByName("soffice.bin"))
                PreviousTotalOpenOfficeID = PreviousTotalOpenOfficeID + p.Id;
            if (PreviousTotalOpenOfficeID > 0)
            {
                MessageBox.Show("Please Close the Open Office before going to further","Mesaage");
                return;
            }
            else
            {
                // Start OpenOffce or get a reference to an existing session
                XComponentContext localContext = Bootstrap.bootstrap();
                XMultiServiceFactory multiServiceFactory = (XMultiServiceFactory)localContext.getServiceManager();
                XComponentLoader componentLoader = (XComponentLoader)multiServiceFactory.createInstance("com.sun.star.frame.Desktop");

                foreach (Process p in Process.GetProcessesByName("soffice.bin"))
                    NextTotalOpenOfficeID = NextTotalOpenOfficeID + p.Id;

                NewOpenOfficeID = NextTotalOpenOfficeID - PreviousTotalOpenOfficeID;

                // Open file hidden in read-only mode
                PropertyValue[] loadProps = new PropertyValue[2];
                loadProps[0] = new PropertyValue();
                loadProps[0].Name = "ReadOnly";
                loadProps[0].Value = new uno.Any(true);
                loadProps[1] = new PropertyValue();
                loadProps[1].Name = "Hidden";
                loadProps[1].Value = new uno.Any(true);

                // Open the file
                XComponent sourceDoc = componentLoader.loadComponentFromURL(excelFile, "_blank", 0, loadProps);

                // Conversion parameters - overwrite existing file, use PDF exporter
                PropertyValue[] conversionProperties = new PropertyValue[3];
                conversionProperties[0] = new PropertyValue();
                conversionProperties[0].Name = "Overwrite";
                conversionProperties[0].Value = new uno.Any(true);
                conversionProperties[1] = new PropertyValue();
                conversionProperties[1].Name = "FilterName";
                conversionProperties[1].Value = new uno.Any("calc_pdf_Export");

                // Set PDF export parameters
                PropertyValue[] filterData = new PropertyValue[3];

                // JPEG compression quality 70
                filterData[0] = new PropertyValue();
                filterData[0].Name = "Quality";
                filterData[0].Value = new uno.Any(70);
                filterData[0].State = PropertyState.DIRECT_VALUE;

                // Max image resolution 300dpi
                filterData[1] = new PropertyValue();
                filterData[1].Name = "ReduceImageResolution";
                filterData[1].Value = new uno.Any(true);
                filterData[1].State = PropertyState.DIRECT_VALUE;
                filterData[2] = new PropertyValue();
                filterData[2].Name = "MaxImageResolution";
                filterData[2].Value = new uno.Any(300);
                filterData[2].State = PropertyState.DIRECT_VALUE;

                conversionProperties[2] = new PropertyValue();
                conversionProperties[2].Name = "FilterData";
                conversionProperties[2].Value = new uno.Any(filterData.GetType(), filterData);

                // Save as PDF
                XStorable xstorable = (XStorable)sourceDoc;
                xstorable.storeToURL(pdfFile, conversionProperties);

                // Close document
                ((XCloseable)sourceDoc).close(false);
                ((XCloseable)xstorable).close(false);

                Process pro = Process.GetProcessById(NewOpenOfficeID);
                pro.Kill();
            }

        }
    }
}