Recent Notes

Displaying keyword search results 1 - 3
Created by Dr. Xi on February 06, 2012 12:14:11    Last update: February 07, 2012 15:39:35
Oracle sqlplus command line tools does not support command line editing out-of-the-box. But on Linux there's a handy utility that enables command line editing with any command line tool: rlwrap - readline wrapper. Install rlwrap: $ sudo apt-get install rlwrap Create a keywords file .sql.dict (optional, but convenient): false null true access add as asc begin by chec... It would be nice to add the tables names also. Create an alias for sqlplus (put it in .bashrc ): alias sqlplus='rlwrap -f $HOME/.sql.dict sqlplus'
Created by freyo on May 05, 2011 09:00:36    Last update: May 05, 2011 09:07:27
This example uses an Intent with Uri scheme tel: to invoke the phone dialer. Create a new project with: $ ~/android-sdk-linux_86/tools/android create proj... Update the layout res/layout/main.xml to add a text field and a button: <?xml version="1.0" encoding="utf-8"?> <LinearL... Update the Java class src/com/android/intenttest/ to handle button click and start the built-in phone dialer with Intent : package; import andr... Update AndroidManifest.xml to add CALL_PHONE permission: <?xml version="1.0" encoding="utf-8"?> <manifes... Install to the emulator and test: ant install The phone dialer will be invoked when you click the "Call" button. So how did this happen? The CallPhone activity creates an Intent with action Intent.ACTION_CALL and Uri tel:<a number> and sends it off to Android. Android starts the activity because the intent matches the...
Created by Dr. Xi on April 27, 2011 15:58:31    Last update: April 27, 2011 20:05:22
From JavaDoc : java.util.concurrent.locks.ReentrantLock is a reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor lock accessed using synchronized methods and statements, but with extended capabilities. The extended capabilities are: tryLock() : acquire the lock if possible, otherwise immediately return false. tryLock(long timeout, TimeUnit unit) : acquire the lock within the timeout, return false after timeout. lockInterruptibly() : try to acquire the lock and enter wait state, but can be interrupted by other threads and exit waiting. The following shows how java.util.concurrent.locks.ReentrantLock can be used. Start two threads to manipulate the same counter, one incrementing, the other decrementing. Since the counter is incremented and decremented the same number of times, in the end, it should be 0. Without locking,...