Displaying keyword search results 1 - 5
Created by freyo on May 17, 2011 11:13:17 Last update: May 17, 2011 11:13:17
This is an odd-ball content provider in that it doesn't provide database records, but provides a resource as a stream. It can be used to provide media files or XML resources. Start the project with:
tools/android create project --package com.android...Create assets directory and add an XML file ( assets/demo.xml ):
<? xml version="1.0" encoding="UTF-8"?> <people...Edit the layout ( res/layout/main.xml ):
<?xml version="1.0" encoding="utf-8"?> <LinearL...Edit src/com/android/cptest/Dummy.java :
package com.android.cptest; import java.io....Add content provider ( src/com/android/cptest/XmlResource.java ):
package com.android.cptest; import java.io....Update AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?> <manifes...Add this section to the end of build.xml :
<target name="-package-resources"> <ech...Build and install:
ant installScreenshot: Remove the Dummy activity ( AndroidManifest.xml ):
<?xml version="1.0" encoding="utf-8"?> <manifes...Create a new project for...
Created by freyo on May 17, 2011 08:46:50 Last update: May 17, 2011 08:47:35
When I used AssetManager to open an XML file in a ContentProvider :
getContext().getAssets().openFd("demo.xml");it failed with this exception:
java.io.FileNotFoundException: This file can not b...It turned out that openFd only works for asset files that are not compressed. It works on media files such as .mp3 , .jpg , .wmv etc., which are not compressed during packaging. XML files are compressed by dedault, causing openFd to fail. An Android ticket was opened on this issue. Till that is fixed, the workaround is to add an exclusion in build.xml :
<?xml version="1.0" encoding="UTF-8"?> <pro...
Created by voodoo on July 30, 2010 14:53:33 Last update: July 30, 2010 14:54:52
The -d switch for cURL sends HTTP POST with data from the command line. To verify the data being posted, this is a CGI script that echos the data back:
#!C:/perl/bin/perl.exe ## ## echo -- echos ...Examples: POST data from command line:
C:\>curl -d input1=value1^&input1=value2 http://lo...POST data from stdin (with @ before the - symbol):
C:\>curl -d @- http://localhost/cgi-bin/echo.pl ...POST data from a file (with @ before the - symbol and input redirect):
C:\tmp>cat data.txt abcd 1234 xyz ...For some reason, @ with file name didn't work as expected:
C:\tmp>curl -d @data.txt http://localhost/cgi-bin/...One thing to notice is that cURL removes the new line characters when posting (thus the echo back is only one line instead of three). This can...
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 December 12, 2007 20:30:01 Last update: December 12, 2007 20:32:23
This is a script to tail a log file through the web browser. It uses AJAX, apache web server, mod_python, UNIX utilities tail (requires the --lines switch) and wc . The log file may reside on the web server or any other host accessible from the web server through SSH. Although it's written in python, it should be easy to port to other languages such as Perl. Apache httpd.conf :
LoadModule python_module modules/mod_python.so ...Python script:
import time, os from os.path import basename ...