Recent Notes
Displaying keyword search results 1 - 10
Created by James on November 27, 2011 12:43:24
Last update: November 27, 2011 12:59:01
An easy to digest stylesheet example for XSLT for Atom. Simply list entry titles and summary:
<?xml version="1.0" encoding="utf-8"?>
<xsl:sty...
To show the first 3 items in atom feed:
<?xml version="1.0" encoding="utf-8"?>
<xsl:sty...
Created by James on November 23, 2011 13:57:51
Last update: November 23, 2011 13:57:51
An easy to digest stylesheet example for XSLT for RSS. Simply list item titles descriptions:
<?xml version="1.0" encoding="utf-8"?>
<xsl:sty...
URL for Google news feed: http://news.google.com/news?ned=us&topic=h&output=rss
Created by nogeek on November 03, 2010 20:52:49
Last update: November 23, 2011 08:54:44
My problem is simple: in my XML data, a timestamp is provided as a long integer (number of milliseconds since the "the epoch"). When I do XSLT, I want to display it as a readable string, such as "Mon Nov 01 18:08:48 CDT 2010". After hours of struggle, I found: It's not so easy to get the job done with JDK 1.6 There are tons of garbage on the web in this space (suggestions, code snippets that simply don't work) Simple Xalan extension functions was the only resource that's somewhat informative. Even there some of the examples don't work. Below is a list of what worked and what didn't. This works:
<xsl:stylesheet version="1.0" xmlns:xsl="h... This does not (providing long value to Date constructor): <xsl:stylesheet version="1.0" xmlns:xsl="h......
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 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 meiu on July 21, 2011 09:05:31
Last update: July 21, 2011 09:05:31
To configure:
Click Run -> External Tools -> External Tools Configurations...
Select "Ant Build", click the "New" icon on the top left
Enter a name (e.g. "Ant Build"), select a Buildfile ( build.xml ), set
the Base Directory.
Click "Apply".
To run:
Click Run -> External Tools -> Ant Build (the name entered in Step 2 above)
Created by freyo on June 09, 2011 15:52:12
Last update: June 09, 2011 15:52:30
Follow these steps to add a device administrator application to Android, i.e., make the application appear in the "Select device administrators" screen (Settings -> Location & Security -> Select device administrators):
Add a receiver in AndroidManifest.xml :
<receiver android:name="android.app.admin.DeviceAd...
All elements and attributes listed above are needed. The attribute android:description must be a string resource, not a literal string. The meta-data element points to an XML resource.
Create the meta-data resource res/xml/admin_app_resource.xml :
<device-admin xmlns:android="http://schemas.androi...
Define values for string resources ( res/values/strings.xml ):
<?xml version="1.0" encoding="utf-8"?>
<resourc...
Created by nogeek on November 11, 2010 00:26:08
Last update: November 11, 2010 00:29:43
This one is even more weird: it worked on Windows but failed on Linux, using default tools JDK1.6.0_20 on both. The exception thrown was:
java.lang.RuntimeException: Invalid conversion fro...
And the stack trace:
java.lang.RuntimeException: Invalid conversion fro...
This was the XSL used:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
The problem was , DateUtil.java had two getDate methods, one taking long parameter, the other taking a String parameter. And Java's XSLT get confused about which one to use:
import java.util.Date;
import java.text.SimpleD...
Created by nogeek on November 04, 2010 20:00:15
Last update: November 05, 2010 14:38:43
Following are some bugs in the Xalan jar shipped with JBoss 5.1.0 GA and JBoss 6.0. The Xalan jar file is located in jboss-5.1.0.GA/lib/endorsed ( %JBOSS_HOME%/common/lib for JBoss 6.0).
Test xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
...
Test xsl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
XSLT Java code:
import org.w3c.dom.*;
import javax.xml.parsers....
DateUtil.java
import java.util.Date;
public class DateUti...
XSLT output:
Transformer Factory class: class org.apache.xalan....
Apparently, the output is wrong. The string "A test event" should not have been displayed.
Created by nogeek on November 04, 2010 20:55:31
Last update: November 05, 2010 14:36:09
Following part 1 , change to stylesheet to:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
The XSLT output becomes:
java Xslt test.xml test.xsl
Transformer Fac...
Parameter is not passed!
The Xalan version that comes with JDK 1.6 processed this correctly:
java -Djavax.xml.transform.TransformerFactory=com....