Okhelp.cz

Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

Wordpress comments


AD MOB

Jak povolit komentáře je přihlášeným uživatelům.
Spam v komentářích je nepříjemný a zatěžuje server. Jednou z metod, jak jej omezit je povolit přidávat komentáře jen registrovaným členům. Toho ve Wordpress dosáhneme v administraci z menu Settings - Discussion kde zaškrtneme políčko Users must be registered and logged in to comment a nastaveni uložíme.

397LW NO topic_id




AD

Další témata ....(Topics)


300

Do not hardcode /data/ use Context.getFilesDir().getPath() | do-not-hardcode-data-use-context-getfilesdir-getpath



// warning
private static String DB_PATH =  "/data/data/cz.okhelp.german_czech_phrases/databases/";

// OK
   public DataBaseHelper(Context context) {	 
    	super(context, DB_NAME, null, 1);
        this.myContext = context;
        // OK
         DB_PATH = context.getFilesDir().getParentFile().getPath()
              + "/databases/";
    }
350

fragment Binary XML file line Must specify unique android:id, android:tag, or have a parent with an id for | fragment-binary-xml-file-line-must-specify-unique-androidid-androidtag-or-have-a-parent-with-an-id-for


FrameLayou, fragment have to unique id android:id="@+id/your_id_unique"

<FrameLayout xmlns:android="//schemas.android.com/apk/res/android"
    xmlns:tools="//schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <fragment
        android:id="@+id/your_id_unique"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="cz.okhelp.notepad.AddNoteFragment"
        tools:layout="@layout/add_note" />

</FrameLayout>
82

Switch Statement Java basic example | switch-statement-java-basic-example


Switch statement with numbers and array of strings Java example.


public class MainClass {
	public static void main(String[] arg) {
		String[] arrayOfString = { "One", "Two", "Three", "Four" };

		int i = 2;
		switch (i) {
			case 1: {
				System.out.println(arrayOfString[i]);
				break;
			}
			case 2: {
				System.out.println(arrayOfString[i]);
				break;
			}
			case 3: {
				System.out.println(arrayOfString[i]);
				break;
			}
			default: {
				System.out.println("Enter a valid value.");
			}
		} // END of switch
	}
}
/*
 * Three
 */




Possible:

case 1:
 System.out.println(arrayOfString[i]);
break;

// i love this notation 
case 1:{
 System.out.println(arrayOfString[i]);
}break;

case 1:{
 System.out.println(arrayOfString[i]);
 break;
}

71

For cycle loop in Java example | for-cycle-loop-in-java-example


Cycle for in Java example

public class MainClass {
	public static void main(String[] arg) {
		String[] arrayOfString = { "Hello", "people", "hello", "world!" };

		for (int i = 0; // start position , first cycle i == 0
                      i < arrayOfString.length; // if i < 4 (length of array) do loop
                       i++ // incrementation after cycle
                       ){
			System.out.println(arrayOfString[i]); 
                       // i++ incrementation
		}
	}
}

212

Accessibility Missing contentDescription attribute on image | accessibility-missing-contentdescription-attribute-on-image


Android Emulator warning:[Accessibility] Missing contentDescription attribute on image

Workaround example code:
android:contentDescription="@string/desc"

            <ImageView
                android:id="@+id/imageViewOil"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
            android:contentDescription="@string/desc"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:layout_marginLeft="84dp"
                android:src="@drawable/tank_silver" />


Editace: 2011-09-14 21:09:28
Počet článků v kategorii: 397
Url:wordpress-comments

AD
11 Share
Share
Tweet