Recent Notes
Displaying keyword search results 1 - 10
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 woolf on December 29, 2011 11:18:11
Last update: December 29, 2011 11:18:11
Use the expand command to extract files from a .cab file:
expand [-r] source [destination] [-d source.cab ... Option Description [-r] Renames expanded files. [destination] Specifies where files are to be expanded. If source is multiple files and -r is not specified, destination must be a directory. destination can consist of a drive letter and colon, a directory name, a file name, or a combination of any of these. [-d source.cab] Displays a list of files in the source location. Does not expand or extract the files. [-f:files] Specifies the files in a cabinet (.cab) file that you intend to expand. You can use wildcards (* and ?). source.cab Specifies the files to expand. source can consist of a drive letter and colon, a directory...
Created by Fang on December 06, 2011 19:52:15
Last update: December 06, 2011 19:52:15
Resource files under the src/main/resources directory are copied verbatim to the target/classes directory during build. But resources can be filtered by turning on filtering in pom.xml :
<build> <resources> <resource> ... When filtering is turned on, constructs like ${...} are replaced with actual values if they are defined. For example, create a file test.properties : project.stage=${project.stage} The build command " mvn package " simply copies test.properties to target/classes/ . But if you build with: mvn -Dproject.stage=dev package the contents of target/classes/test.properties becomes: project.stage=dev Sometimes you want different resource definitions for different environments, e.g., dev vs. prod. You can achieve that by defining profiles in pom.xml : <profiles> <profile> <id>dev</id> ... In the above, dev is the default profile, prod is defined but not active unless...
Created by freyo on August 04, 2011 12:27:27
Last update: August 04, 2011 12:30:42
I got this error while building an APK:
[apply]
[apply] UNEXPECTED TOP-LEVEL ERROR...
Apparently the dx tool was running out of memory. The dx script (shell or bat) provides options to pass in Java options, but it's a lot easier just to bump up the default in dx :
# By default, give dx a max heap size of 1 gig. Th...
Here, I changed the default 1024M to 1624M and resolved the problem.
Created by freyo on August 01, 2011 16:06:40
Last update: August 03, 2011 08:32:01
To list all installed packages:
# pm list packages
To list all disabled packages:
# pm list packages -d
pm help:
# pm
usage: pm [list|path|install|uninstall]
...
Created by alfa on June 02, 2011 13:04:18
Last update: June 02, 2011 13:04:18
Some javap usage examples.
Start from HelloWorld.java :
@Deprecated
public class HelloWorld {
pu...
javap -c HelloWorld outputs:
Compiled from "HelloWorld.java"
public class He...
javap -v HelloWorld outputs ( -v for verbose mode):
Compiled from "HelloWorld.java"
public class He...
The output consists of:
" Compiled from... " header
Class attributes. For the HelloWorld example, there are two: SourceFile and Deprecated .
Minor and major class file version
Constant pool
Disassembled code
LineNumberTable for debugging purposes.
javap by default only prints package/protected/public members. To display all members including private, use the -p switch.
javap -v -p HelloWorld
Created by woolf on May 15, 2011 14:35:58
Last update: May 15, 2011 14:36:47
Assign IP adrress and network mask:
sudo ifconfig eth0 192.168.183.5 netmask 255.255.2...
Add default gateway:
sudo route add default gw 192.168.183.2
Add name server: " sudo vi /etc/resolv.conf " and add:
nameserver 192.168.183.2
Created by magnum on May 06, 2011 12:26:14
Last update: May 06, 2011 12:26:14
The bash environment variable PROMPT_COMMAND contains a regular bash command that is executed just before the command prompt is displayed.
For example:
$ export PROMPT_COMMAND=a
bash: a: command not ...
The command a is not valid so you get the error message every time you hit enter.
Echo something before $PS1 :
$ export PROMPT_COMMAND='echo -n Hi!'
Hi!$
...
PROMPT_COMMAND is regularly used to change the xterm window title. You may find this in /etc/bashrc :
case $TERM in
xterm*)
if [ -...
Created by freyo on April 20, 2011 12:50:09
Last update: April 20, 2011 12:50:09
To sign an Android APK from command line:
Sign the APK with jarsigner (using default keystore, android-root is the alias of the signing key):
$ jarsigner -signedjar HelloWorld-new.apk HelloWor...
Verify signature (optional)
$ jarsigner -verify -verbose -certs HelloWorld-new...
Align the APK (must use -v 4 option):
$ ~/android-sdk-linux_86/tools/zipalign -v 4 Hello...
Created by meiu on March 31, 2011 19:54:05
Last update: March 31, 2011 19:54:05
With StringBuffer/StringBuilder:
public class ReverseString {
private static...
Without StringBuffer/StringBuilder:
public class ReverseString {
private static...