Tuesday, 20 January 2015

Hide soft keyboard on android after clicking Button

Follow this code

public static void hideSoftKeyboard(Activity activity) {
            InputMethodManager inputMethodManager = (InputMethodManager)  activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
            inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
        }

Its working fine.

Monday, 8 December 2014

Gradle DSL method not found: 'runProguard'

By used 'minifyEnabled' instead of 'runProguard' its working properly.

Ex.

Previous Code:

buildTypes {
    release {

        runProguard false // this line has to be changed
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

}


Current Code:

buildTypes {
        release {

            // runProguard false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

        }

    }

Saturday, 6 December 2014

Replace a newline in TSQL

In Case we import data from MSSQL or MYSQL to excel sheet or flat file, new line create a problem, like that single row data split into another another row.
Via this query we can get freedom to newline issue.

SELECT replace(replace([field],char(10),' '),char(13),' ') FROM [table]

MySQL: Grant all privileges on database

Hi Guys,

When you want to set privileges to user for specific database.

Follow up:

GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'%' WITH GRANT OPTION;

The asterisks in this command refer to the database objects.

mysql error: Specified key was too long; max key length is 767 bytes

There is no real solution for this issue. Your only options are to either reduce the size of the column, use a different character set (like UTF-8), or use a different engine (like MyISAM). In this case I switched the character set to UTF-8 which raised the maximum key length to 255 characters.

Ex.  create index IDX_Name on tableName (a(50), b(255), c(200));

It's means maximum key length will be 255 characters.