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


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



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


108

Turn screen ON OFF Android sample code | turn-screen-on-off-android-sample-code


WakeLock, PowerManager,uses-permission Android sample.
Main.java

public class Main extends Activity {
	    private SensorManager mSensorManager;
	    private PowerManager mPowerManager;
	    private WindowManager mWindowManager;
	    private WakeLock mWakeLock;
	    private Button button;
	    private TextView textView;

	    /** Called when the activity is first created. */
	    @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
try{
	        // Get an instance of the SensorManager
	        mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);

	        // Get an instance of the PowerManager
	        mPowerManager = (PowerManager) getSystemService(POWER_SERVICE);

	        // Get an instance of the WindowManager
	        mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
	        mWindowManager.getDefaultDisplay();

	        // Create a bright wake lock
	        mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, getClass()
	                .getName());

	        setContentView(R.layout.main);
	        textView = (TextView)findViewById(R.id.textView1);
	        button = (Button)findViewById(R.id.button1);
	        button.setOnClickListener(mButtonStopListener);
	       
	        
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			Log.e("onCreate", e.getMessage());
		}
} // END onCreate
	    
	    View.OnClickListener mButtonStopListener = new OnClickListener() {
	    	public void onClick(View v) {
		        try {
					mWakeLock.release();
					textView.setText("mWakeLock.release()");
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					Log.e("onPause",e.getMessage());
				}
	    	
	    	}
	    };

	    @Override
	    protected void onResume() {
	        super.onResume();
	        /*
	         * when the activity is resumed, we acquire a wake-lock so that the
	         * screen stays on, since the user will likely not be fiddling with the
	         * screen or buttons.
	         */
	        
	        try {
				mWakeLock.acquire();
				textView.setText("mWakeLock.acquire()");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				Log.e("onResume", e.getMessage());
			}

	    }

	    @Override
	    protected void onPause() {
	        super.onPause();

	        // and release our wake-lock
	        try {
				mWakeLock.release();
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				Log.e("onPause",e.getMessage());
			}
	    }
}



AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="//schemas.android.com/apk/res/android"
      package="cz.okhelp.Main"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="7" />
    <uses-permission android:name="android.permission.HARDWARE_TEST"></uses-permission>
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>

<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".ScreenBrightnessActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>


271

Eclipse - How open deleted project from workspace | eclipse-how-open-deleted-project-from-workspace


If project is in workspace and only not visible in project explorer using this:



Click on some project in project explorer
Menu:
File
Import project
Existing Projects into Workspace


190

Error android.widget.LinearLayout.measureHorizontal LinearLayout.java | error-android-widget-linearlayout-measurehorizontal-linearlayout-java


Code with error:

ImageView imgV = (ImageView)findViewById(R.id.myView);
        imgV.setLayoutParams(new ViewGroup.LayoutParams(
        		ViewGroup.LayoutParams.WRAP_CONTENT,
        		0));


If you get error try this code:

        ViewGroup.LayoutParams layoutParams = imgV
				.getLayoutParams();
		layoutParams.height = 0;
		imgV.setLayoutParams(layoutParams);




java.lang.ClassCastException: android.view.ViewGroup$LayoutParams
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:659)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:311)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
178

HTC Desire HD | htc-desire-hd


HTC Desire HD cena od 7 000 KCZ Kč (únor.2012)
HTC Desire HD je chytrý telefon běžící na operačním systému Android.
HTC Desire HD je (22.února2012) druhým nejpoužívanějším chytrým telefonem u programu Sky Map viz tabulka.

Smartphone má hliníkový unibody design, vybaven je Androidem 2.2 (Froyo) a HTC Sense displayem. Na zadní straně jsou dvě plastové krytky, jedna obsahuje baterii, druhá SIM kartu a paměťovou kartu microSDHC. Telefon je vybaven 4,3 palcovým WVGA LCD TFT dotykovým displayem, 8 megapixelovým fotoaparátem (lze nahrávat 720p video), podpora pro HSPA / W-CDMA a quad-band GSM / GPRS / EDGE.


Telefon je vybaven 1 GHz CPU Scorpion MSM8255 procesorem. Tato druhá generace Snapdragon procesoru má nízkou spotřebu energie.

HTC HD má 768 MB RAM a 1,5 GB interní paměti flash. K dispozici je také slot pro microSDHC / XC kartu s kapacitou až 32 GB dat.

HTC Desire HD photo pic image
samsung galaxy s2
Zdroj obrázku: wikipedia
164

Immutable bitmap passed to Canvas constructor - Android error | immutable-bitmap-passed-to-canvas-constructor-android-error


Try this source code:

Bitmap myBitmap = BitmapFactory.decodeResource(getResources(),R.drawable.my_image)
.copy(Bitmap.Config.ARGB_8888, true);
Canvas c = new Canvas(myBitmap);
// etc.  ....... 


Issue: Immutable bitmap passed to Canvas constructor
Solution: Bitmap myBitmap = BitmapFactory.decodeResource(getResources(),R.drawable.my_image)
.copy(Bitmap.Config.ARGB_8888, true);


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