Recent Notes

Displaying keyword search results 1 - 7
Created by freyo on September 13, 2011 16:20:08    Last update: February 06, 2013 20:46:22
From ADB shell: show Android routing table: # cat /proc/net/route or # ip route show show DNS server: # getprop net.dns1 # getprop net.dns2 set DNS server: # setprop net.dns1 107.86.113.12 # setprop net.... add a default gateway # route add default gw 192.168.0.1 dev wifi I just learned that the DNS server properties can also be dhcp.eth0.dns1 and dhcp.eth0.dns2 for wifi. On my Samsung phone, DNS for wifi was configured through dhcpcd in /system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf , the relevant section looked like this: set_dns_props() { case "${new_domain...
Created by Dr. Xi on June 17, 2012 13:14:25    Last update: June 17, 2012 13:14:25
Link to official Java networking properties page: http://docs.oracle.com/javase/7/docs/technotes/guides/net/properties.html http.keepAlive (default: true) Indicates if keep alive (persistent) connections should be supported. Persistent connections improve performance by allowing the underlying socket connection be reused for multiple http requests. The default is true and thus persistent connections will be used with http 1.1 servers. Set to 'false' to disable the use of persistent connections. http.maxConnections (default: 5) If HTTP keep-alive is enabled, this value is the number of idle connections that will be simultaneously kept alive, per-destination.
Created by nogeek on December 30, 2011 13:25:28    Last update: December 30, 2011 13:57:37
By default, tomcat uses an enhanced java.util.logging implementation called JULI, which can be configured at two different levels: Globally, with the ${catalina.base}/conf/logging.properties file. Per web application, with WEB-INF/classes/logging.properties . The configuration file is a normal Java properties file: Logging handlers are specified with the handlers property. handlers = 1catalina.org.apache.juli.FileHandler, ... The root logger can define its set of handlers using the .handlers property. .handlers = 1catalina.org.apache.juli.FileHandler,... A prefix may be added to handler names. The prefix starts with a digit and ends with a dot ( . ), for example: # 1catalina. is a prefix 1catalina.org.apache.j... System property replacement is performed for property values which contain ${systemPropertyName} . Each handler can have its own specific properties: 3manager.org.apache.juli.FileHandler.level = FINE ... Loggers can define their own...
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 Fang on November 10, 2011 09:26:12    Last update: November 10, 2011 09:26:12
Syntax highlighted XML schema for JSF 2.0 Application Configuration Resource File ( faces-config.xml ). Almost 3000 lines! <?xml version="1.0" encoding="UTF-8"?> <xsd:sch...
Created by Dr. Xi on July 19, 2010 21:58:34    Last update: July 23, 2010 21:37:23
Parsing XML in Java is really simple: import java.io.*; import javax.xml.parsers.Docu... The parser implementation details are hidden behind the JAXP API. In case you want to know which parser implementation is used, this is what the JavaDoc for DocumentBuilderFactory.newInstance says: Use the javax.xml.parsers.DocumentBuilderFactory system property. Use the properties file " lib/jaxp.properties " in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. The jaxp.properties file is read only once by the JAXP implementation and it's values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to...
Created by Dr. Xi on November 19, 2008 00:22:27    Last update: January 07, 2010 23:00:36
There is a open source project named [ini4j] for processing Windows .ini configuration files. However, I found it an overkill for my purposes. So here is my simple implementation of a .ini parser. It mimics the standard java.util.Properties class with enhancements to get and set properties by section name. There are only a few simple rules: Leading and trailing spaces are trimmed from section names, property names and property values. Section names are enclosed between [ and ] . Properties following a section header belong to that section Properties defined before the appearance of any section headers are considered global properties and should be set and get with no section names. You can use either equal sign ( = ) or colon ( : )...