Displaying keyword search results 1 - 6
Created by freyo on September 07, 2011 16:46:14 Last update: September 07, 2011 19:23:00
The Android unit test framework is based on JUnit 3 , not JUnit 4. Test cases have to extend junit.framework.TestCase or a subclass (such as android.test.InstrumentationTestCase ). Tests are identified by public methods whose name starts with test , not methods annotated with @Test (as in JUnit 4). An Android test suite is packaged as an APK, just like the application being tested. To create a test package, first you need to identify the application package it is testing. Google suggests to put the test package source in a directory named tests/ alongside the src/ directory of the main application. At runtime, Android instrumentation loads both the test package and the application under test into the same process. Therefore, the tests can invoke methods on...
Created by Dr. Xi on March 01, 2011 16:11:50 Last update: March 01, 2011 16:11:50
Java PrintWriter is buffered. You can turn on autoFlush, but it does'nt work for all methods. Test code:
import java.io.*; public class TestPrintWri...Output:
[START] Test PrintWriter Auto-flush only work...
Created by Dr. Xi on August 03, 2010 16:29:35 Last update: August 03, 2010 16:36:50
This utility converts unicode escape strings in a file to UTF-8 encoded. Suppose you received a properties file with contents like:
# @(#)codepoint_zh_CN.properties 1.4 05/09/27 #...You can use this utility to convert it to UTF-8 and view or edit.
import java.io.*; /** * Reads file with...This utility is equivalent to:
native2ascii -reverse -encoding utf-8using the standard Java native2ascii utility.
Created by voodoo on July 11, 2009 15:14:55 Last update: July 29, 2010 22:45:48
cURL is a command line tool for transferring files with URL syntax. The main purpose and use for cURL is to automate unattended file transfers or sequences of operations. It's really easy to see HTTP headers with curl:
C:\>curl --head http://www.google.com HTTP/1.0 ...or, headers and page together (dump headers to stdout):
$ curl --dump-header - http://www.google.com HTTP/...Download openssl from openssl.org:
C:\>curl --help Usage: curl [options...] <url> ...
Created by Dr. Xi on January 08, 2010 03:53:37 Last update: January 08, 2010 03:54:56
This is an Ant custom task to merge Properties files I lifted from http://marc.info/?l=ant-user&m=106442688632164&w=2 , with some minor bug fixes. Example usage:
<taskdef name="mergeProperty" classname="ant.task....Implementation:
package ant.task.addon; import java.io.Buff...
Created by Dr. Xi on October 18, 2008 03:16:24 Last update: October 18, 2008 03:17:21
Normally the browser opens a page if it knows how to. For example, text files are usually displayed in the browser window. You can set the Content-Type and Content-Disposition headers in the HTTP response to force the browser to popup the download dialog. Python example:
def download_log(req, app = None, file = None): ...Java example:
public void service(HttpServletRequest req, Ht...