Just a quick note which took me some time and advice asking to find out. I have a database with two drupal installations separated by a table prefix, say drupal1_ and drupal2_. Lets call my database simply myDB.

If I’d like to backup only certain tables to an SQL file using mysqldump, I’d have to list all the table names separately. This is not nice at least since module installations and upgrades might add prefixed tables to the database dynamically over time. The other catch is that I want to do this without PHP.

One solution which works for me to backup only drupal1_ prefixed tables is to run the following script on the command line (in one line): mysql -u myUsername -p myPassword myDB -e "show tables like 'drupal1_%';" | sed '1d' | xargs mysqldump -u myUsername -p myPassword myBD > drupal1_tables_dump.sql

If you have a better solution feel free to comment. I usually leave out the myPassword part and enter the password (twice) when the script asks for it.

IT Mill Toolkit has been renamed to Vaadin and the new website has been released together with a preview version of the RIA framework.

If you’re even slightly into Java-based developing of Ajax web pages, please check out this project since it might just make your life much easier. Especially if you make rich internet applications.

Check out the site: http://www.vaadin.com

I’ve grown tired of changing the template for my Eclipse projects which uses the built in ${user} variable while generating JavaDoc comments. Mostly this variable is not my real name and often not even a proper nick name, so I like to change it to be my real name.

So, by editing the eclipse.ini file and adding a flag -vmargs ... -Duser.name=Jonas Granvik I get this changed and now the ${user} variable is my real name instead of my user name which I logged in to the OS with.

I have a Java String with some xml-formatted xhtml code. First I parse this into a Document with

public Document getDocumentFromString(String xml) throws SAXException, IOException, ParserConfigurationException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder();

	return db.parse(new InputSource(new StringReader(xml)));
} </code> <!--break--> After some time I transform this back to a String with  <code lang="java">
public String getStringFromDocument(Document doc) throws TransformerException {
	StringWriter writer = new StringWriter();
	StreamResult result = new StreamResult(writer);
	
	TransformerFactory tf = TransformerFactory.newInstance();
	Transformer transformer = tf.newTransformer();
	
	DOMSource source = new DOMSource(doc);
	
	transformer.transform(source, result);
	
	
	return writer.toString();
} </code>

The thing is that in my StringWriter I get an extra

tag, which is not XHTML compliant since it does not have an closing tag. This regarless if I have a valid meta tag included or not.

After some research I found that these properties set to the Transformer helped and gave me the original String back. public static String getStringFromDocument(Document doc) throws TransformerException { StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer);

	TransformerFactory tf = TransformerFactory.newInstance();
	Transformer transformer = tf.newTransformer();
	transformer.setOutputProperty(OutputKeys.METHOD, "xml"); // make sure Transformer does not add an invalid <META> tag.
	transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
	
	DOMSource source = new DOMSource(doc);
	
	transformer.transform(source, result);
	
	
	return writer.toString();
} </code>

This is a quick note on how to get Orbeon Forms 3.7.0beta nightly running on JBoss Portal 2.7.1 bundled with JBoss AS. These instructions seems to missing in the Orbeon docs. 1. First setup and run the portal normally and check that you get the portal first page ok at http://localhost:8080/portal

  1. Get the orbeon WAR (I got some nightly of January 2009 of the 3.7.0 version) and add the following files to WEB-INF:
    • portlet-instances.xml <!DOCTYPE deployments PUBLIC "-//JBoss Portal//DTD Portlet Instances 2.6//EN" "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
OrbeonPortletInstance OrbeonFormsPortlet

</code>

  • orbeon-object.xml <!DOCTYPE deployments PUBLIC "-//JBoss Portal//DTD Portal Object 2.6//EN" "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
default.default overwrite Orbeon Forms portlet OrbeonPortletInstance center 1

</code>

  • jboss-portlet.xml
OrbeonFormsPortlet

</code> 3. In my case I had to uncomment the following in the web.xml, since the resource was present in jboss-web.xml file:

<resource-ref>
    <description>DataSource</description>
    <res-ref-name>jdbc/db</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>  </code> 4. Deploy modified WAR to $JBOSS_PORTAL_DIR/server/default/deploy
  1. The deployer should automatically deploy the WAR and if you refresh the first page on the portal, you will see that the orbeon portlet view has appeared on the page. Check the terminal or logs for issues during deployment if you have some problems.

NOTE: This is just me testing if it Orbeon works on JBoss Portal so no guarantees are given. Hopefully this’ll give someone a nudge at the right direction, though.