Kayıtlar

2013 tarihine ait yayınlar gösteriliyor

The regex for money and currency field.

This code is grapping the number  and currency.    //var txt='200TL';       //var txt='200 TL';       //var txt='200 ';       //var txt='2000$';       //var txt='2.000.000 TL';       var txt= '2,000,000 Euro';       //var txt='20.000.000 TL';       //var txt='20.000.000';       //var txt='20.000TL';       //var txt='20.000.000TL';       var re1='(\\d*(?:\\.?\\d*\\.?\\d*))';    // Non-greedy match on filler             var re2='((?:[a-zA-Z(?\\s|\\S)]*))';// Word 1            var p = new RegExp(re1+re2,["i"]);       var m = p.exec(txt);       if (m !== null)  ...

Android Emulator Shortcuts

1. Main Device Keys Home         Home Button F2             Left Softkey / Menu / Settings button (or Page up) Shift+f2     Right Softkey / Star button (or Page down) Esc         Back Button F3             Call/ dial Button F4             Hang up / end call button F5             Search Button 2. Other Device Keys Ctrl+F5     Volume up (or + on numeric keyboard with Num Lock off) Ctrl+F6     Volume down (or + on numeric keyboard with Num Lock off) F7             Power Button Ctrl+F3     Camera Button Ctrl+F11     Switch layout orientation portrait/landscape backwards Ctrl+F12     Switch layout orientation portrait/lands...

void... params in java

There are several ways to simulate optional parameters in Java: Method overloading. void foo ( String a , Integer b ) { //... } void foo ( String a ) { foo ( a , 0 ); // here, 0 is a default value for b } foo ( "a" , 2 ); foo ( "a" ); One of the limitations of this approach is that it doesn't work if you have two optional parameters of the same type and any of them can be omitted. Varargs. a) All optional parameters are of the same type: void foo ( String a , Integer ... b ) { Integer b1 = b . length > 0 ? b [ 0 ] : 0 ; Integer b2 = b . length > 1 ? b [ 1 ] : 0 ; //... } foo ( "a" ); foo ( "a" , 1 , 2 ); b) Types of optional parameters may be different: void foo ( String a , Object ... b ) { Integer b1 = 0 ; String b2 = "" ; if ( b . length > 0 ) { if (!( b [ 0 ] instanceof Integer )) { ...

Setting JAVA_HOME Variable in Windows

In this example we will set the JAVA_HOME variable in Windows. The JAVA_HOME variable is used by applications to find the Java Development Kit installation. Find JDK Installation Directory First you need to know the installation path for the Java Development Kit. Open the default installation path for the Java Development Kit C:\Program Files\Java or C:\Program Files (x86)\Java There should be a subdirectory like C:\Program Files\Java\jre6 or C:\Program Files (x86)\Java\jre6 Set the JAVA_HOME Variable Once you have the JDK installation path: Right-click the My Computer icon on your desktop and select Properties. Click the Advanced tab. Click the Environment Variables button. Under System Variables , click New. Enter the variable name as JAVA_HOME . Enter the variable value (one of the paths mentioned above) as the installation path for the Java Development Kit. Click OK . Click Apply Changes . You might ...

Android loading screen

Start Activity class package com.gsm.androidproject; import android.app.Activity; import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import android.os.AsyncTask; import android.os.Bundle; import android.widget.ProgressBar; import android.widget.TextView; public class StartActivity extends Activity {     //private Thread thread;     private TextView dbCreatedInfo;     private TextView loadingText;     private ProgressBar bar ;     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_start_layout);         /*         dbCreatedInfo =  (TextView) findViewById(R.id.dbLoadLabel);         bar = (ProgressBar) findViewById(R.id.pr...

Scroll on RelativeLayout on Android

< ScrollView xmlns : android = "http://schemas.android.com/apk/res/android" android : fillViewport = "true" android : padding = "10px" android : layout_height = "fill_parent" android : layout_width = "fill_parent" > < RelativeLayout android : id = "@+id/scrollable_places" android : layout_height = "wrap_content" android : layout_width = "wrap_content" > </ RelativeLayout > </ ScrollView >