2014/04/12

How to set thousands separator in Java?

The following will work:

int no = 124750;
String str = String.format("%,d", no);
ENJOY!

How to convert from int to String? (Java)

Integer.toString(i) or String.valueOf(i) will work.

Enjoy!

How to convert string to int in Java?

int foo = Integer.parseInt("1234");

How do you pause in android (Java)?

First you have to create a Handler();, then you have to use the postDelayed function to pause the code.

public class MyActivity extends Activity {
    private Handler mHandler = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mHandler.postDelayed(new Runnable() {
            public void run() {
                doStuff();
            }
        }, 5000);
    }

    private void doStuff() {
        System.out.println("Hellow World After 5 seconds!");
    }
}

2010/06/10

Enabling xp_cmdshell in SQL Server

EXEC master.dbo.sp_configure 'show advanced options', 1

RECONFIGURE

EXEC master.dbo.sp_configure 'xp_cmdshell', 1

RECONFIGURE

2010/05/04

SSIS Deployment to SQL Server

SSIS Deployment to SQL Server


1) Go to SSIS project folder\bin\, double click the DeploymentManifest file
2) Choose “SQL Server deployment”.
3) Fill in the information then you are done.

2010/04/22

SSIS - read excel column as text (string)

Case: when you use SSIS to input excel data, and one of the column contains number and letter like this:

[Column A]
700
700
800
800A

When you try to use SSIS to read the excel and import to MSSQL database, 800A will then become null value and you have no idea what the heck is going on...

To solve the problem:
In SSIS, click on your connection manager in connection manager panel. Look up ConnectionString in properties panel (on your right hand side) and fix your connection string like this:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Profiles\alanhui\Desktop\CMP Data Conversion\template\DataConversion-Step1.xls;Extended Properties="EXCEL 8.0;HDR=YES;IMEX=1;";

IMEX=1 is the key factor to solve this problem.

To learn more about this, you can go to the following website:
http://support.microsoft.com/kb/194124

Enjoy