Displaying keyword search results 1 - 10
Created by magnum on October 22, 2012 20:03:05 Last update: October 22, 2012 20:03:05
First, the test command that sleeps random number of seconds ( sleeper.sh ):
#!/bin/bash stime=$[$RANDOM % 20] sleep $sti...As comparison, synchronous pipe code:
#include <sys/wait.h> #include <stdio.h> #in...Asynchronous pipe code:
#include <sys/wait.h> #include <stdio.h> #in...
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 rlwrapCreate 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 timo on January 25, 2012 20:13:13 Last update: January 25, 2012 20:13:13
The MIPS CPU is able to run both big-endian and little-endian. So a system built on MIPS can be either big-endian (mips) or little-endian (mipsel). The file command shows the architecture:
$ file ls ls: ELF 32-bit LSB executable, MIPS, ...but readelf will tell the endianness:
$ readelf -h ls ELF Header: Magic: 7f 45...
Created by Dr. Xi on January 09, 2012 09:13:38 Last update: January 09, 2012 09:14:18
Unlike CVS, svn does not have a tag command, you create a new tag with copy :
$ svn copy http://svn.example.com/repos/calc/trunk...The -r flag may be used to create a tag from an earlier revision:
-r [--revision] ARG : ARG (some commands al...
Created by freyo on August 25, 2011 09:07:40 Last update: August 25, 2011 20:45:43
This is a list of built-in Android permission values: Permission Description Since API Level android.permission.ACCESS_CHECKIN_PROPERTIES Allows read/write access to the "properties" table in the checkin database, to change values that get uploaded. 1 android.permission.ACCESS_COARSE_LOCATION Allows an application to access coarse (e.g., Cell-ID, WiFi) location 1 android.permission.ACCESS_FINE_LOCATION Allows an application to access fine (e.g., GPS) location 1 android.permission.ACCESS_LOCATION_EXTRA_COMMANDS Allows an application to access extra location provider commands 1 android.permission.ACCESS_MOCK_LOCATION Allows an application to create mock location providers for testing 1 android.permission.ACCESS_NETWORK_STATE Allows applications to access information about networks 1 android.permission.ACCESS_SURFACE_FLINGER Allows an application to use SurfaceFlinger's low level features 1 android.permission.ACCESS_WIFI_STATE Allows applications to access information about Wi-Fi networks 1 android.permission.ACCOUNT_MANAGER Allows applications to call into AccountAuthenticators. Only the system can get this permission. 5 android.permission.AUTHENTICATE_ACCOUNTS...
Created by magnum on June 23, 2011 20:15:49 Last update: June 23, 2011 20:29:45
Linux services startup order in general: kernel runs /sbin/init /sbin/init reads /etc/inittab and runs script defined by this line:
si::sysinit:/etc/init.d/rcSswitches to runlevel defined by
id:3:initdefault:which causes /etc/init.d/rc to be called with the current run level. /etc/init.d/rc calls the scripts under the /etc/rc <current_run_level> .d directory (symbolic links to actual scripts under /etc/init.d/ ) in this order: The KILL scripts first (scripts with name starting with K, i.e., rc?.d/Knn name ): "script_name stop" then, the START scripts (scripts with name starting with S, i.e., rc?.d/Snn name ): "script_name start" Within each group (KILL or START), run scripts from lower priority number (i.e., the nn in the symlink name) to higher priority number. The Upstart init daemon does not use /etc/inittab . Instead, it...
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/CallPhone.java to handle button click and start the built-in phone dialer with Intent :
package com.android.intenttest; 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 installThe 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 com.android.phone.OutgoingCallBroadcaster 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,...
Created by Dr. Xi on January 31, 2011 16:24:31 Last update: January 31, 2011 16:24:58
Perl file test operators are unary operators that takes one argument, which can be a file name, a filehandle, or dirhandle. If the argument is omitted, it tests $_ , except for -t , which tests STDIN. Syntax: -X FILEHANDLE -X EXPR -X DIRHANDLE -X where X is: Operator Meaning -r File is readable by effective uid/gid. -w File is writable by effective uid/gid. -x File is executable by effective uid/gid. -o File is owned by effective uid. -R File is readable by real uid/gid. -W File is writable by real uid/gid. -X File is executable by real uid/gid. -O File is owned by real uid. -e File exists. -z File has zero size (is empty). -s File has nonzero size (returns size in bytes)....
Created by Dr. Xi on October 26, 2010 04:47:37 Last update: January 11, 2011 20:00:36
<!doctype html> <html> <head> <style typ...