<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thoughts Electrique &#187; Development</title>
	<atom:link href="http://www.sebastian.himberger.de/blog/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sebastian.himberger.de/blog</link>
	<description>Sebastian Himbergers blog about technology and software development</description>
	<lastBuildDate>Thu, 08 Jul 2010 17:05:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Overview of OpenCms Resourcetype IDs</title>
		<link>http://www.sebastian.himberger.de/blog/2010/02/13/overview-of-opencms-resourcetype-ids/</link>
		<comments>http://www.sebastian.himberger.de/blog/2010/02/13/overview-of-opencms-resourcetype-ids/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 23:37:46 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[OpenCms]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=598</guid>
		<description><![CDATA[I constantly forget the resource type IDs of the OpenCms resource types and then have to dig into the configuration to find them. So here is a list of all resource type IDs of the OpenCms core. Maybe it is useful to someone else.
List of resource type IDs



Resourcetype
ID
Comment




Folder
0
OpenCms Core


Plain Text File
1
OpenCms Core


Binary File
2
OpenCms Core


Image
3
OpenCms Core


JSP [...]]]></description>
			<content:encoded><![CDATA[<p>I constantly forget the resource type IDs of the OpenCms resource types and then have to dig into the <a title="opencms-vfs.xml" href="http://cvs.opencms.org/viewvc.cgi/opencms/webapp/WEB-INF/config/opencms-vfs.xml?revision=1.57&amp;view=markup" target="_blank">configuration</a> to find them. So here is a list of all resource type IDs of the OpenCms core. Maybe it is useful to someone else.</p>
<h3><span id="more-598"></span>List of resource type IDs</h3>
<table style="border: 1px solid #333333;">
<thead>
<tr>
<th>Resourcetype</th>
<th>ID</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>Folder</td>
<td>0</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>Plain Text File</td>
<td>1</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>Binary File</td>
<td>2</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>Image</td>
<td>3</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>JSP File</td>
<td>4</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>Pointer</td>
<td>5</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>XmlPage</td>
<td>6</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>Generic XmlContent</td>
<td>7</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>Image Gallery</td>
<td>8</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>DownloadGallery</td>
<td>9</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>Link Gallery</td>
<td>10</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>Html Gallery</td>
<td>11</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>Table Gallery</td>
<td>12</td>
<td>OpenCms Core</td>
</tr>
<tr>
<td>TemplateOne Microsite</td>
<td>19</td>
<td>Template One</td>
</tr>
<tr>
<td>TemplateOne E-Mail Form</td>
<td>60</td>
<td>Template One Form</td>
</tr>
<tr>
<td>TemplateOne News</td>
<td>30</td>
<td>Template One Modules</td>
</tr>
<tr>
<td>Template One FAQ</td>
<td>35</td>
<td>Template One Modules</td>
</tr>
<tr>
<td>Template One Event</td>
<td>40</td>
<td>Template One Modules</td>
</tr>
<tr>
<td>Template One Job</td>
<td>45</td>
<td>Template One Modules</td>
</tr>
<tr>
<td>Template One Linklist</td>
<td>50</td>
<td>Template One Modules</td>
</tr>
<tr>
<td>Template One Layout</td>
<td>51</td>
<td>Template One Modules</td>
</tr>
<tr>
<td>Template Two Preset</td>
<td>70</td>
<td>Template Two</td>
</tr>
<tr>
<td>Template Two Config</td>
<td>71</td>
<td>Template Two</td>
</tr>
<tr>
<td>Template Two Textbox</td>
<td>72</td>
<td>Template Two</td>
</tr>
<tr>
<td>Template Two Listbox</td>
<td>73</td>
<td>Template Two</td>
</tr>
<tr>
<td>Template Two Style</td>
<td>74</td>
<td>Template Two</td>
</tr>
<tr>
<td>Template Two Options</td>
<td>75</td>
<td>Template Two</td>
</tr>
<tr>
<td>Template Two Linkbox</td>
<td>76</td>
<td>Template Two</td>
</tr>
<tr>
<td>Template Two Search</td>
<td>77</td>
<td>Template Two</td>
</tr>
</tbody>
</table>
<p>I have not included other Open Source modules or the OAMP suite. I may update this list later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2010/02/13/overview-of-opencms-resourcetype-ids/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSP to download OpenCms resources as a ZIP</title>
		<link>http://www.sebastian.himberger.de/blog/2009/06/25/jsp-to-download-opencms-resources-as-a-zip/</link>
		<comments>http://www.sebastian.himberger.de/blog/2009/06/25/jsp-to-download-opencms-resources-as-a-zip/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 18:09:38 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[OpenCms]]></category>
		<category><![CDATA[Sourcecode]]></category>
		<category><![CDATA[ZIP]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=443</guid>
		<description><![CDATA[What often bugged me is that I can upload a set of files into OpenCms as a ZIP file but can not download a tree of files as such (without the use of the database export feature). I had hacked together this little JSP some time ago. It allows you to dynamically download a set [...]]]></description>
			<content:encoded><![CDATA[<p>What often bugged me is that I can upload a set of files into OpenCms as a ZIP file but can not download a tree of files as such (without the use of the database export feature). I had hacked together this little JSP some time ago. It allows you to dynamically download a set of OpenCms resources as a ZIP file.</p>
<p>The JSP has no interface since I mainly use it for development. Simply create a JSP somewhere in the OpenCms VFS and then open the file via the browser. E.g.:</p>
<p>&#8220;http://workplace.com/system/createzip?<strong>source</strong>=<em>/system/modules/foo</em>&amp;<strong>filename</strong>=<em>foo-module.zip</em>&#8221;</p>
<p>The <strong>source</strong> parameter specifies which directory to zip up and the <strong>filename</strong> parameter which filename to use for the generated file. You can only zip up resources with a total size of 10 megabytes. This is mainly to prevent OutOfMemory errors to happen. You can easily increase the size by altering the variable <strong>maxSourceSize</strong> to any value you need.</p>
<p>If you find any bugs or want to give feedback simply leave a comment or send me an email.</p>
<p><span id="more-443"></span></p>
<pre class="file">&lt;%@page import="org.opencms.util.*,
                org.opencms.jsp.*,
                org.opencms.file.*,
                java.util.*,
                java.io.*,
                java.util.zip.*
" %&gt;&lt;%

// Maximum filesize to prevent OutOfMemory errors
long maxSourceSize = 1024*1024*10; // 10 Megabytes

// The filename to use as output
String filename = request.getParameter("filename");

// The directory to zip
String source = request.getParameter("source");

if (CmsStringUtil.isEmpty(filename) || CmsStringUtil.isEmpty(source )) {
  // Ensure that all parameters are given
  throw new IllegalArgumentException("Please specify the 'source' and the 'filename' parameter");
}

if (!source.endsWith("/")) { source = source + "/"; }

CmsJspActionElement cmsa = new CmsJspActionElement(pageContext,request,response);
CmsObject cmso = cmsa.getCmsObject();
List zipResources = new ArrayList();

// Collect all the resources
CmsResource sourceResource = cmso.readResource(source);
if (!sourceResource.isFolder()) {
  throw new IllegalArgumentException("Please specify a folder to zip");
}
List cmsResources = cmso.readResources(source,CmsResourceFilter.DEFAULT);
for (Iterator i = cmsResources.iterator(); i.hasNext();) {
  zipResources.add(i.next());
}

// Create the zip file
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ZipOutputStream zipfile = new ZipOutputStream(bos);

long currentSize = 0;
for (Iterator i = zipResources.iterator(); i.hasNext(); ) {
  CmsResource res = (CmsResource) i.next();

  currentSize += res.getLength();
  if (currentSize &gt; maxSourceSize) {
    // Ensure that we don't zip up too much
    throw new RuntimeException("Source size is bigger than: " + (maxSourceSize/1024) + " kilobytes");
  }

  String sourcePath = cmso.getRequestContext().getSitePath(res);
  String targetPath = sourcePath;
  if (targetPath.startsWith(source)) {
    targetPath = targetPath.substring(source.length());
  }

  //out.println("Zipping " + sourcePath + " as " + targetPath + "&lt;br/&gt;");
  if (res.isFile()) {
  ZipEntry zipentry = new ZipEntry(targetPath);
  zipfile.putNextEntry(zipentry);
      CmsFile file = cmso.readFile(res);
      zipfile.write(file.getContents(),0,file.getLength());
  }
}

zipfile.close();
byte[] content = bos.toByteArray();

response.setContentType("application/octet-stream");
response.setContentLength((int)content.length);
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"" );

response.getOutputStream().write(content,0,content.length);
response.getOutputStream().flush();

%&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2009/06/25/jsp-to-download-opencms-resources-as-a-zip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenCms and Google App Engine</title>
		<link>http://www.sebastian.himberger.de/blog/2009/06/24/opencms-and-google-app-engine/</link>
		<comments>http://www.sebastian.himberger.de/blog/2009/06/24/opencms-and-google-app-engine/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 10:07:44 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[App Engine]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[OpenCms]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=415</guid>
		<description><![CDATA[Especially with the new JPA driver for OpenCms by Georgi Naplatanov the question of running OpenCms on Google App Engine came up quite often at the OpenCms Days 2009. I had the same Idea when I first heard of the Java support for App Engine and did some quick research on how to do this. [...]]]></description>
			<content:encoded><![CDATA[<p>Especially with the new JPA driver for OpenCms by Georgi Naplatanov the question of running OpenCms on <a title="AppEngine Java page" href="http://code.google.com/intl/de-DE/appengine/docs/java/overview.html" target="_blank">Google App Engine</a> came up quite often at the OpenCms Days 2009. I had the same Idea when I first heard of the Java support for App Engine and did some quick research on how to do this. The research showed that running OpenCms on Google App Engine would require a huge rewrite of some OpenCms core functionalities.</p>
<p><span id="more-415"></span></p>
<p>The problem with OpenCms and App Engine is that the applications on App Engine run in a restricted sandbox which limits what you can do in terms of Java API functionality. There&#8217;s also a JRE whitelist which limits the classes you can access in your application. If you look at the scalability model promoted by App Engine these limitations make a lot of sense but unfortunately they make running OpenCms on there nearly impossible. You can find a<a href="http://code.google.com/intl/de-DE/appengine/docs/java/runtime.html"> detailed description of the App Engine runtime at Google code</a>. The main problems are:</p>
<ul>
<li><strong>No filesystem access: </strong>OpenCms uses the filesystem for some very important tasks:
<ul>
<li>The JSP files are exported into the WEB-INF directory to be executable. This means there could be no dynamic updates or adds of JSP files through the workplace.</li>
<li>The configuration is stored in the filesystem and dynamically updated if e.g. the search configuration is updated or a module is installed. The configuration would have to be stored in the database.</li>
<li>The search index is stored in the filesystem. This could be circumvented if a Lucene database store like the one shipped with <a href="http://www.compass-project.org/" target="_blank">Compass </a>is used. Nevertheless this would have to be implemented.</li>
</ul>
</li>
<li><strong>No threading:</strong> OpenCms makes uses of threading for scheduled tasks, publishing and other tasks. Since App Engine doesn&#8217;t allow threads this would have to be implemented otherwise.</li>
<li><strong>Response-Time-Limit: </strong>App Engine imposes a time limit to handle request on the application. Escpecially the publishing mechanism in OpenCms causes very long response times. These parts would have to be rewritten.</li>
<li><strong>Persistent data has to be stored in the datastore</strong>: OpenCms uses an in memory HashMap to store the locking information (file locks). This makes it difficult to cluster OpenCms and also limits the use in Googles App Engine. This also affects the Flex-Cache: Publishing events would have to be propagated and I&#8217;m not sure if this would work with App Engine (comments are very welcome on this point).</li>
</ul>
<p>I had a short talk with Alexander about this topic and it at least seemed to us that making OpenCms run on the App Engine would be an enormous task and is currently not worth doing without excessive sponsoring.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2009/06/24/opencms-and-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restrict visibility of OpenCms templates to certain folders</title>
		<link>http://www.sebastian.himberger.de/blog/2009/06/03/restrict-visibility-of-opencms-templates-to-certain-folders/</link>
		<comments>http://www.sebastian.himberger.de/blog/2009/06/03/restrict-visibility-of-opencms-templates-to-certain-folders/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 15:51:26 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[OpenCms]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=401</guid>
		<description><![CDATA[Since I&#8217;m currently working on an OpenCms mutli site solution I was looking for a possibility to restrict the available templates of a site. I know this can be done via permissions but the manual implementation of this is rather painful. I&#8217;m currently in the process of extending the OpenCms security manager to take care [...]]]></description>
			<content:encoded><![CDATA[<p>Since I&#8217;m currently working on an OpenCms mutli site solution I was looking for a possibility to restrict the available templates of a site. I know this can be done via permissions but the manual implementation of this is rather painful. I&#8217;m currently in the process of extending the OpenCms security manager to take care of this but while doing this I found an (to me) unknown feature.</p>
<p>By usage of the property <em>folders.available</em> (you might have to define it first) on a template you can specify a list of comma seperated folders in which the template is available (in the dropdown).</p>
<p>Unfortunately this property works only on file level and can not be inherited via the folder hierarchy. Also it does not provide a secure solution since the template can always be set via the advanced property dialog.</p>
<p>But you never know when a feature could come in handy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2009/06/03/restrict-visibility-of-opencms-templates-to-certain-folders/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using jQuery UI themes for your own applications</title>
		<link>http://www.sebastian.himberger.de/blog/2009/02/23/using-jquery-ui-themes-for-your-own-applications/</link>
		<comments>http://www.sebastian.himberger.de/blog/2009/02/23/using-jquery-ui-themes-for-your-own-applications/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 10:55:36 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[Webdesign]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=329</guid>
		<description><![CDATA[It&#8217;s often the case that you need icons and graphics for your own applications, but there is no real style guide available and the customer just wants something decent and coherent. I recently started using the jQuery UI wizard to create the look and feel for my entire application. So far I am very pleased [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s often the case that you need icons and graphics for your own applications, but there is no real style guide available and the customer just wants something decent and coherent. I recently started using the jQuery UI wizard to create the look and feel for my entire application. So far I am very pleased with the results.</p>
<p>You can even create the CSS and images using a wizard: <a href="http://jqueryui.com/themeroller/">http://jqueryui.com/themeroller</a></p>
<p>The resulting themes are dual licensed under the GPL and MIT license.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2009/02/23/using-jquery-ui-themes-for-your-own-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A case against the almighty project document</title>
		<link>http://www.sebastian.himberger.de/blog/2008/12/20/a-case-against-the-almighty-project-document/</link>
		<comments>http://www.sebastian.himberger.de/blog/2008/12/20/a-case-against-the-almighty-project-document/#comments</comments>
		<pubDate>Sat, 20 Dec 2008 14:41:58 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Opinionated]]></category>
		<category><![CDATA[Project-Management]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=275</guid>
		<description><![CDATA[To create good documentation is an art for itself and most often underestimated by us fellow software developers, architects and software project management folks. I won&#8217;t go into the detail of what makes a good documentation (in my point of view) in this blog post too deeply (maybe in the future, if you are interested?). [...]]]></description>
			<content:encoded><![CDATA[<p>To create good documentation is an art for itself and most often underestimated by us fellow software developers, architects and software project management folks. I won&#8217;t go into the detail of what makes a good documentation (in my point of view) in this blog post too deeply (maybe in the future, if you are interested?). Instead I want to point out a negative point which I run into quite frequently: <strong>The almighty project document</strong>.</p>
<p><span id="more-275"></span></p>
<p><a title="Andreas Rüpings website" href="http://www.rueping.info/en_index.html" target="_blank">Andreas Rüping</a> suggests in his book <a title="The book at Amazon" href="http://www.amazon.com/exec/obidos/ASIN/0470856173/"><em>Agile documentation</em></a> to create small and highly focused documents, targeted at:</p>
<ul>
<li><em>An explicit target audience</em> (This dictates for example the kind of information and the tongue the document is written in)</li>
<li><em>Readers interested in a special part of the project/information</em> (This dictates the contents and structure of the document)</li>
</ul>
<p>These documents are laid out in a <em>document landscape</em>. The landscape is formed by different types of documents (for example: Requirements specification, conceptual description, business goals, architecture overview, API description, etc.). The landscape is developed over time by creating template and example documents. If you start a specific project you simply pick the matching documents and fill them with contents. The maintenance of the landscape can be a project in itself or you can just develop it while you are working. The result is a (more or less) coherent set of documents across multiple projects which are short (easily digestible), focused and easy to navigate. You will become more and more familiar with the types of document over time and find the relevant information more quickly.</p>
<p>The Antagonist of this type of documentation is <strong>the almighty project document</strong>. It is a chimera born out of all different kinds of project documents and information. Most of the time it&#8217;s this kind of document which is shown to clients who <em>really care about documentation</em>. Often supported with sentences like &#8220;Look, we produced over 200 pages of documentation&#8221;. If you take a closer look at the document you will most often notice that the contents consists of:</p>
<ul>
<li>A (too) general introduction to the topic of the project</li>
<li>A definition of goals</li>
<li>Copy and pasted examples from the manuals of the libraries used in the project</li>
<li>Duplicated reference manual sections of the libraries used in the project</li>
<li>The complete source code/config files (of course not in sync with the VCS any more)</li>
<li>No really clear statements of what should be done/has been done</li>
<li>Information from different time frames (planning/implementation/review)</li>
<li>&#8230;</li>
</ul>
<p>This information is often not structured in a very good way and delivered in a PDF without a navigateable table of contents (so that page numbers in the ToC differ from the real page numbers) or hyperlinks. The fellow developers or administrators who have to work with the documentation will only get half of the needed information out of the it and will waste time checking back with the management folks. The resulting product will most certainly miss some important aspects and if you have to look back at the project you will surely be confused.</p>
<p>Additionally this document violates an important principle of concurrent access to a resource (speaking: <em>teamwork</em>): <strong>Keep the chunks which need to be accessed by multiple persons at the same time (programs) as small as possible</strong>. In a web project you often separate the program into a set of files defining the output (templates, view files, you name it) and a set of libraries/scripts/whatever. This is not <span style="text-decoration: underline;"><em>only</em></span><em> </em>to keep the webdesigners from having to read the program code but also to allow the presentation and the program to be edited at the same time. Do yourself a favour and not only spend time designing your software, also design your project documentation.</p>
<p>One last word: Of course I consider myself guilty of having produced some kind of an almighty project document (although maybe not as evil as described above) from time to time. You simply can&#8217;t do  everything right in a constrained environment like the real world. But the more often we stress the importance of good documentation and information design we will maybe come to a point where good documentation is considered really valuable and therefore honoured and budgeted with time,dedication and respect.</p>
<p><strong>Do you have your own thoughts documentation? Ever or never produced a real beast? Please comment.</strong></p>
<div id="attachment_282" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.dilbert.com"><img class="size-full wp-image-282" title="Dilbert on documented processes" src="http://www.sebastian.himberger.de/blog/wp-content/uploads/2008/12/dilbert2005071744002.gif" alt="" width="500" height="175" /></a><p class="wp-caption-text">Dilbert on documented processes</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2008/12/20/a-case-against-the-almighty-project-document/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manipulating OpenCms XMLContent programatically (some examples)</title>
		<link>http://www.sebastian.himberger.de/blog/2008/12/12/manipulating-opencms-xmlcontent-programatically-some-examples/</link>
		<comments>http://www.sebastian.himberger.de/blog/2008/12/12/manipulating-opencms-xmlcontent-programatically-some-examples/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 15:12:15 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[OpenCms]]></category>
		<category><![CDATA[Sourcecode]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=253</guid>
		<description><![CDATA[Because someone asked on the mailing list and I keep forgetting the respective API calls to manipulate an OpenCms XMLContent programatically.
This is just a raw code dump not a step by step tutorial.
You can also download a ZIP file for importing it into OpenCms. But you have to adjust the paths manually.


Example JSP calls
&#60;%@ page [...]]]></description>
			<content:encoded><![CDATA[<p>Because someone asked on the mailing list and I keep forgetting the respective API calls to manipulate an OpenCms XMLContent programatically.</p>
<p><strong>This is just a raw code dump not a step by step tutorial</strong>.</p>
<p><a href="http://www.sebastian.himberger.de/blog/wp-content/uploads/2008/12/example-xmlcontent-20081212.zip">You can also download a ZIP file</a> for importing it into OpenCms. But you have to adjust the paths manually.<a href="http://www.sebastian.himberger.de/blog/wp-content/uploads/2008/12/example-xmlcontent-20081212.zip"><br />
</a></p>
<p><span id="more-253"></span></p>
<h3>Example JSP calls</h3>
<pre class="file">&lt;%@ page import="org.opencms.file.*,
                 org.opencms.jsp.*,
                 org.opencms.xml.*,
                 org.opencms.xml.content.*,
                 org.opencms.xml.types.*,
                 org.opencms.util.*,
                 java.util.*" %&gt;&lt;%

// The resource to read
String resource = "/system/modules/de.himberger.sebastian.site/schemas/publication/manipulate.html";

// The locale to use
Locale locale = new Locale("en");

// The names of the elements
String versionElement = "Version";
String fileElement = "File";

CmsJspActionElement cmsa = new CmsJspActionElement(pageContext,request,response);
CmsObject cmso = cmsa.getCmsObject();

// read the resource
CmsResource xmlContentResource = cmso.readResource(resource);
CmsFile xmlContentFile = CmsFile.upgrade(xmlContentResource,cmso);

// Output current xml
out.println("&lt;h1&gt;Before&lt;/h1&gt;");
out.println("&lt;pre&gt;" + CmsStringUtil.escapeHtml((new String(xmlContentFile.getContents()))) + "&lt;/pre&gt;");

// build up the xml content instance
CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(cmso,xmlContentFile);

// This is a new version (in this case it is a nested schema
I_CmsXmlContentValue addedVersionValue = xmlContent.addValue(cmso,versionElement ,locale,0);

// Add a new element to the created version (nested schema)
I_CmsXmlContentValue addedFileValueRaw = xmlContent.addValue(
  cmso,addedVersionValue.getPath() + "/" + fileElement,locale,0);
CmsXmlVfsFileValue addedFileValue = (CmsXmlVfsFileValue ) addedFileValueRaw;
addedFileValue.setStringValue(cmso,resource);

// manipulate an element
I_CmsXmlContentValue theSameValueWeAdded = xmlContent.getValue(
  addedVersionValue.getPath() + "/" + fileElement,locale);
// ... do the same as above

// add and remove a value
I_CmsXmlContentValue secondAddedVersionValue = xmlContent.addValue(cmso,
  versionElement,locale,addedVersionValue.getIndex()+1);

out.println("&lt;h1&gt;After adding&lt;/h1&gt;");
out.println("&lt;pre&gt;" + CmsStringUtil.escapeHtml((new String(xmlContent.marshal()))) + "&lt;/pre&gt;");

xmlContent.removeValue(secondAddedVersionValue.getPath(),locale,0);

out.println("&lt;h1&gt;After removing&lt;/h1&gt;");
out.println("&lt;pre&gt;" + CmsStringUtil.escapeHtml((new String(xmlContent.marshal()))) + "&lt;/pre&gt;");

// In the real world you would now do
// xmlContentFile.setContents(xmlContent.marshal());
// cmso.writeResource(xmlContentFile);
%&gt;</pre>
<h3>Version schema</h3>
<pre class="file">&lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"&gt;

       &lt;xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/&gt;
       &lt;xsd:element name="XmlContentPublicationVersions"
                    type="OpenCmsXmlContentPublicationVersions"/&gt;

       &lt;xsd:complexType name="OpenCmsXmlContentPublicationVersions"&gt;
               &lt;xsd:sequence&gt;
                       &lt;xsd:element name="XmlContentPublicationVersion"
                                    type="OpenCmsXmlContentPublicationVersion"
                                    minOccurs="0" maxOccurs="unbounded"/&gt;
               &lt;/xsd:sequence&gt;
       &lt;/xsd:complexType&gt;

       &lt;xsd:complexType name="OpenCmsXmlContentPublicationVersion"&gt;
              &lt;xsd:sequence&gt;
                      &lt;xsd:element name="Title" type="OpenCmsString" /&gt;
		      &lt;xsd:element name="PublicationDate" type="OpenCmsDateTime" /&gt;
                      &lt;xsd:element name="Description" type="OpenCmsString" /&gt;
                      &lt;xsd:element name="File" type="OpenCmsVfsFile" minOccurs="0"
                                   maxOccurs="10" /&gt;
              &lt;/xsd:sequence&gt;
              &lt;xsd:attribute name="language" type="OpenCmsLocale" use="optional"/&gt;
       &lt;/xsd:complexType&gt;

&lt;/xsd:schema&gt;</pre>
<h3>Publication schema</h3>
<pre class="file">&lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"&gt;

       &lt;xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/&gt;
       &lt;xsd:include
            schemaLocation="opencms://system/modules/de.himberger.sebastian.site/schemas/publication/publication-version.xsd"/&gt;

       &lt;xsd:element name="XmlContentPublications" type="OpenCmsXmlContentPublications"/&gt;

       &lt;xsd:complexType name="OpenCmsXmlContentPublications"&gt;
               &lt;xsd:sequence&gt;
                       &lt;xsd:element name="XmlContentPublication"
                                    type="OpenCmsXmlContentPublication"
                                    minOccurs="0" maxOccurs="unbounded"/&gt;
               &lt;/xsd:sequence&gt;
       &lt;/xsd:complexType&gt;

       &lt;xsd:complexType name="OpenCmsXmlContentPublication"&gt;
              &lt;xsd:sequence&gt;
                      &lt;xsd:element name="Title" type="OpenCmsString" /&gt;
                      &lt;xsd:element name="Subtitle" type="OpenCmsString" /&gt;
                      &lt;xsd:element name="Description" type="OpenCmsHtml" /&gt;
                      &lt;xsd:element name="Version"
                                   type="OpenCmsXmlContentPublicationVersion"
                                   minOccurs="0" maxOccurs="unbounded" /&gt;
              &lt;/xsd:sequence&gt;
              &lt;xsd:attribute name="language" type="OpenCmsLocale" use="required"/&gt;
       &lt;/xsd:complexType&gt;

&lt;/xsd:schema&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2008/12/12/manipulating-opencms-xmlcontent-programatically-some-examples/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Use the power of JSP tag files in OpenCms</title>
		<link>http://www.sebastian.himberger.de/blog/2008/12/12/use-the-power-of-jsp-tag-files-in-opencms/</link>
		<comments>http://www.sebastian.himberger.de/blog/2008/12/12/use-the-power-of-jsp-tag-files-in-opencms/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 09:22:38 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[OpenCms]]></category>
		<category><![CDATA[Sourcecode]]></category>
		<category><![CDATA[Taglibs]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=220</guid>
		<description><![CDATA[Since version 7 OpenCms is a Servlet 2.4 and JSP 2.0 conforming application. In addition to the improved expression language (EL) JSP 2.0 also brings in the possibility of developing custom tags(actions) using JSP rather than writing Java code. This allows for some pretty neat things and enables you to go one step further towards [...]]]></description>
			<content:encoded><![CDATA[<p>Since version 7 OpenCms is a <em>Servlet 2.4</em> and <em>JSP 2.0</em> conforming application. In addition to the improved expression language (<em>EL</em>) JSP 2.0 also brings in the possibility of developing custom tags(actions) using JSP rather than writing Java code. This allows for some pretty neat things and enables you to go one step further towards cleaner view code. I&#8217;ve used this in one of my last projects extensively to refactor common code like pagers and link generation. For example:</p>
<pre class="file">&lt;cms:include file="/system/modules/com.example.ocms.commons/elements/pager"&gt;
  &lt;cms:param name="currentPage"&gt;
    &lt;c:out value="${model.currentPage}"/&gt;
  &lt;/cms:param&gt;
  &lt;cms:param name="pageCount"&gt;
    &lt;c:out value="${model.pageCount}"/&gt;
  &lt;/cms:param&gt;
&lt;/cms:include&gt;</pre>
<p>Became:</p>
<pre class="file">&lt;wt:pager model="${model}"/&gt;</pre>
<p>Not does it only look cleaner and is much more focused, it also decouples your view more from the underlying CMS solution. Of course you could also develop a custom tag library using Java (which I have done a few times) but using a JSP the advantage that code can be changed on the fly and even from a web designer. You can always refactor your JSP taglib into a Java one if you need to do it. There are some limitations of JSP tag files (like you can&#8217;t use scriptlets in the body) but they are easy to get around.</p>
<p><strong>But as always:</strong> This is no silver bullet. There are problems with tag files which may not be obvious at the first glance.</p>
<p><span id="more-220"></span></p>
<h3>How to create a tag</h3>
<p>Creating a tag is easy. I will show you the necessary steps while developing a tag which allows the user to loop over the contents of an OpenCms <a href="http://www.opencms-wiki.org/Virtual_File_System">VFS</a> directory.</p>
<h4>Preparing your module</h4>
<p>As normal Java libraries too, JSP tags need to be exported into the filesystem to be read by the <a href="http://en.wikipedia.org/wiki/Java_Servlet#Servlet_containers">Servlet-Container</a>. Normally the tag files reside under a directory like <em>${yourwebapp}/WEB-INF/tags/mylibrary</em>. So what we will do is adding a new export point to the module containing our tag files.</p>
<p>First we create a new directory called <em>tags </em>inside the module we want to contain our tags (normally I create a module for each site). The resulting structure will look something like this</p>
<div id="attachment_227" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sebastian.himberger.de/blog/wp-content/uploads/2008/12/create-tags-folder.png"><img class="size-full wp-image-227" title="The tags folder inside the module directory" src="http://www.sebastian.himberger.de/blog/wp-content/uploads/2008/12/create-tags-folder.png" alt="The tags folder inside the module directory" width="500" height="154" /></a><p class="wp-caption-text">The tags folder inside the module directory</p></div>
<p>Then we open the module administration and add an export point to our module (<em>Administration -&gt;  	<span class="link" onclick="openPage('/system/workplace/views/admin/admin-main.jsp?path=/modules');" onmouseover="sMH('navtool7');" onmouseout="hMH('navtool7');"><span style="white-space: nowrap;">Module Management</span></span> -&gt; Edit Your module -&gt; Module exportpoints -&gt; New exportpoint</em>).</p>
<div id="attachment_228" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sebastian.himberger.de/blog/wp-content/uploads/2008/12/add-exportpoint.png"><img class="size-full wp-image-228" title="Adding the tags exportpoint" src="http://www.sebastian.himberger.de/blog/wp-content/uploads/2008/12/add-exportpoint.png" alt="Adding the tags exportpoint" width="500" height="138" /></a><p class="wp-caption-text">Adding the tags exportpoint</p></div>
<p>After pressing <em>OK</em> we are well prepared to add custom tags to our OpenCms module.</p>
<h4>Creating the tag file</h4>
<p>We now create a directory for our taglib. This will be located inside our newly created <em>tags </em>folder. Because we want to create a tag which interacts with the OpenCms VFS we will simply call the folder <em>vfs</em>. Inside this directory we create a new JSP resource called <em>directoryLoop.tag</em>. The result should look something like this:</p>
<div id="attachment_230" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sebastian.himberger.de/blog/wp-content/uploads/2008/12/the-tag-file.png"><img class="size-full wp-image-230" title="The created tag file in the VFS" src="http://www.sebastian.himberger.de/blog/wp-content/uploads/2008/12/the-tag-file.png" alt="The created tag file in the VFS" width="500" height="57" /></a><p class="wp-caption-text">The created tag file in the VFS</p></div>
<p>Now it&#8217;s time to write some code <img src='http://www.sebastian.himberger.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<h4>Writing the tag file</h4>
<p>I don&#8217;t want to go into the details of developing tag files in general. This topic has been covered by dozens of books and online tutorials. I have collected some links in this blog post which explain the development of tag files in detail. Have a look at the section <em>Further reading</em> if you want to find out.</p>
<p>I will assume you&#8217;ve already developed JSP files inside OpenCms so I won&#8217;t explain the steps in detail. If you have questions regarding the sourcecode simply post a comment.</p>
<p>Here&#8217;s the commented sourcecode for our tag file.</p>
<pre class="file">&lt;%@ tag body-content="scriptless" %&gt;
&lt;%@ tag import="org.opencms.jsp.*,
                org.opencms.file.*,
                java.util.*" %&gt;
&lt;%@ attribute name="folder" required="true" %&gt;
&lt;%@ variable name-given="resource" scope="NESTED" %&gt;
&lt;%@ variable name-given="status" scope="NESTED" %&gt;
&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;&lt;%

// First we get the pageContext variable.
// Tag files only have an explicit JspContext but in this case
// it is a PageContext which is a subclass of JspContext.
PageContext pageContext = (PageContext)jspContext;

// Instantiate the usual CmsObject to access OpenCms data
CmsJspActionElement cmsa = new CmsJspActionElement(pageContext ,request,response);
CmsObject cmso = cmsa.getCmsObject();

// Read the resources, note that we can access the tag
// parameters using the pageContext.
String folder = (String) pageContext.getAttribute("folder");
folder = cmso.getRequestContext().removeSiteRoot(folder);
List resources = cmso.readResources(folder,CmsResourceFilter.DEFAULT,false);

// We store the list of resources in the pageContext for usage with JSTL
pageContext.setAttribute("resources",resources);

%&gt;

&lt;c:forEach var="resource" items="${resources}" varStatus="status"&gt;
  &lt;jsp:doBody/&gt;
&lt;/c:forEach&gt;</pre>
<p>As you can see the tag file looks like a usual JSP file with only a few differences.</p>
<p>The tag exports two variables: The <em>current resource</em> and the <em>iteration status</em>. These can be accessed from the invoking JSP. We will make use of this in the next example.</p>
<p><strong>To use the tag you have to publish the file</strong> so it gets written to the file system. After you&#8217;re finished writing/modifying the tag: Don&#8217;t forget to publish it!</p>
<p><strong>You can&#8217;t preview tags</strong>, even though they are JSP files. You also won&#8217;t get compiler warnings. You always need a JSP file to test your tag files.</p>
<h4>Using the created tag</h4>
<p>We will use the created tag to implement a simple file browser. The file browser displays the contents of a folder and allows the user to navigate into subfolders recursively. Please note that <strong>this is definately no production ready code</strong>.</p>
<pre class="file"><strong>&lt;%@ taglib prefix="vfs" tagdir="/WEB-INF/tags/vfs" %&gt;</strong>
&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;

&lt;%-- Determine the current folder, set to "/" if no parameter given --%&gt;
&lt;c:set var="folder" value="${param.folder}"/&gt;
&lt;c:if test="${folder eq '' or folder == null}"&gt;
  &lt;c:set var="folder" value="/"/&gt;
&lt;/c:if&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;style type="text/css"&gt;

   .row-1 {
     background-color: #ECECEC;
   }

  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Resources of folder "${folder}"&lt;/h1&gt;
&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;&lt;/th&gt;
    &lt;th&gt;Name&lt;/th&gt;
    &lt;th&gt;Size&lt;/th&gt;
    &lt;th&gt;Date created&lt;/th&gt;
  &lt;/tr&gt;
<strong>  &lt;vfs:directoryLoop folder="${folder}"&gt;</strong>
  &lt;%-- We use the status for alternating row classes, useful for css --%&gt;
  &lt;tr class="row-${status.count % 2}"&gt;
    &lt;td&gt;
      &lt;%-- Display D for directory or F for file --%&gt;
      &lt;c:choose&gt;
        &lt;c:when test="${resource.folder}" &gt;D&lt;/c:when&gt;
        &lt;c:otherwise&gt;F&lt;/c:otherwise&gt;
      &lt;/c:choose&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;%-- If the current resource is a folder, display a link --%&gt;
      &lt;c:choose&gt;
        &lt;c:when test="${resource.folder}" &gt;
          &lt;a href="?folder=${resource.rootPath}"&gt;${resource.name}&lt;/a&gt;
        &lt;/c:when&gt;
        &lt;c:otherwise&gt;${resource.name}&lt;/c:otherwise&gt;
      &lt;/c:choose&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;%-- If the current resource is a file, display size --%&gt;
      &lt;c:if test="${!resource.folder}"&gt;${resource.length}&lt;/c:if&gt;
    &lt;/td&gt;
    &lt;td&gt;${resource.dateCreated}&lt;/td&gt;
  &lt;tr&gt;
<strong>  &lt;/vfs:directoryLoop&gt;</strong>
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>As you can see the tags are included with the directive.</p>
<pre class="file"><strong>&lt;%@ taglib prefix="vfs" tagdir="/WEB-INF/tags/vfs" %&gt;
</strong></pre>
<p>The usage of the tags is similar to normal tags with the exception that you can&#8217;t use scriptlets in the tag bodies. If the example is working you should see something like the following.</p>
<div id="attachment_241" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sebastian.himberger.de/blog/wp-content/uploads/2008/12/ouput.png"><img class="size-full wp-image-241" title="The output of the created JSP" src="http://www.sebastian.himberger.de/blog/wp-content/uploads/2008/12/ouput.png" alt="The output of the created tag" width="500" height="178" /></a><p class="wp-caption-text">The output of the created JSP</p></div>
<p>If you have trouble reading the above code. Here is a more condensed version of a file using the tag:</p>
<pre><strong>&lt;%@ taglib prefix="vfs" tagdir="/WEB-INF/tags/vfs" %&gt;</strong>
&lt;ul&gt;
<strong>&lt;vfs:directoryLoop folder="/system/modules"&gt;</strong>
  &lt;li&gt;${resource.name}&lt;/li&gt;
<strong>&lt;/vfs:directoryLoop&gt;</strong>
&lt;/ul&gt;</pre>
<h3>Things to keep in mind</h3>
<p>JSP tag files and OpenCms really are a nice fit, but before you start working on converting all your custom includes to tag files keep in mind some of the disadvantages of tag files in respect to using <em>&lt;cms:include&gt;</em>.</p>
<ul>
<li><strong>Tag files are not seperated by online/offline</strong>. Since the tag files only get exported during publishing there is no way of developing the tags in the offline project. You always have to publish the tag file to see your changes (It&#8217;s like a normal, Java based, tag library). This means if you have an error in your code the live system will be affected by it. In my opinion this problem is not as big as it sounds. Tags are normally developed in a staged environment or on a developer machine and then deployed on the live server. Additionally they are no replacement for templates and therefore shouldn&#8217;t be changed often.</li>
<li><strong>Tag files are not cached</strong>. The output of a <em>&lt;cms:include&gt;</em> may be cached by the OpenCms FlexCache. This can speed up the rendering enormously, tag files are always processed. In my opinion this no big problem. Tag files will mostly always be used in JSP templates which in turn will be cached by the FlexCache. I would suggtest that tag files are used as the building blocks for JSP templates and therefore are one a finer granular level. The chunks you want to cache are normally much more coarse grained.</li>
</ul>
<h3>Finishing thoughts</h3>
<p>In my opinion JSP tag files are a great thing. They can help you clean up messy JSP templates and nicely decouple your JSPs from OpenCms (although I used a pretty OpenCms heavy example in this post). I hope this post was useful and helped you adding another tool to your toolbox. If you have further questions or need help regarding a specific project, please leave a comment or <a href="/contact">contact me directly</a>.</p>
<h3>Further Reading</h3>
<p>These tutorials can help you developing your own tag files or looking up classes used in this tutorial.</p>
<ul>
<li><a title="Encapsulating Reusable Content Using Tag Files" href="http://java.sun.com/javaee/5/docs/tutorial/doc/bnama.html" target="_blank">The JEE 5 tutorial on creating tag files</a></li>
<li><a title="Creating JSP 2.0 Tag Files" href="http://www.oracle.com/technology/pub/articles/cioroianu_tagfiles.html" target="_blank">An online tutorial on JSP tag files by Oracle</a></li>
<li><a title="Easy Custom Tags with Tag Files" href="http://today.java.net/pub/a/today/2003/11/14/tagfiles.html" target="_blank">A java.net article on tag files, short and good</a></li>
<li><a title="The OpenCms JavaDoc" href="http://files.opencms.org/javadoc/core/" target="_blank">The OpenCms JavaDoc, always handy</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2008/12/12/use-the-power-of-jsp-tag-files-in-opencms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enterprise grade software is an euphemism</title>
		<link>http://www.sebastian.himberger.de/blog/2008/12/04/enterprise-grade-software-is-an-euphemism/</link>
		<comments>http://www.sebastian.himberger.de/blog/2008/12/04/enterprise-grade-software-is-an-euphemism/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 19:48:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Cal Henderson]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Enterprise]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=163</guid>
		<description><![CDATA[I recently had to restart a Java webapplication because somehow the JDBC connection to the database server was hanging completely. This reminded me of a sentence a friend of mine told me during the OpenCms Days 2008.
&#8220;Enterprise software just means that it&#8217;s targeted at customers who can afford the guy who restarts the application server [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to restart a Java webapplication because somehow the JDBC connection to the database server was hanging completely. This reminded me of a sentence a friend of mine told me during the OpenCms Days 2008.</p>
<blockquote><p><em>&#8220;Enterprise software just means that it&#8217;s targeted at customers who can afford the guy who restarts the application server every few hours.&#8221;</em></p></blockquote>
<p>I had to laugh because while the quote is clearly cynical it has a true core. Especially if you compare languages like Java and PHP it&#8217;s true that PHP doesn&#8217;t have these kind problems. This is mostly because of the <em>throw-away-the-state</em> nature of PHP. After every served request PHP forgets what it&#8217;s done before and has to completely rebuild the working environment at the next request. Java in contrast is able to remember things between requests. Which makes it more powerful but also harder to maintain (more state, more problems). I&#8217;m really not sure if I&#8217;m buying into this <em>enterprise-thing</em> anymore. Especially if you need scalability you definitely want to keep application state at a minimum and without state you don&#8217;t really need those big interconnected clusters of application servers any more.</p>
<p>Here is a nice talk about scalability and <em>serious</em> (speak enterprise) languages I found recently. It&#8217;s from Cal Henderson a software development guy at <a href="http://www.flickr.com/">Flickr</a>. It&#8217;s really worth watching. Even if you&#8217;re not into Python and Django.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/i6Fr65PFqfk&amp;hl=en&amp;fs=1" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/i6Fr65PFqfk&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>(Watch it at: <a href="http://www.youtube.com/watch?v=i6Fr65PFqfk&amp;feature=PlayList&amp;p=D415FAF806EC47A1&amp;index=10">http://www.youtube.com/watch?v=i6Fr65PFqfk&amp;feature=PlayList&amp;p=D415FAF806EC47A1&amp;index=10</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2008/12/04/enterprise-grade-software-is-an-euphemism/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript void links in OpenCms 6.2.3 WYSIWYG</title>
		<link>http://www.sebastian.himberger.de/blog/2008/11/28/javascript-void-links-in-opencms-623-wysiwyg/</link>
		<comments>http://www.sebastian.himberger.de/blog/2008/11/28/javascript-void-links-in-opencms-623-wysiwyg/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 19:49:42 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[FCKEditor]]></category>
		<category><![CDATA[OpenCms]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=207</guid>
		<description><![CDATA[Just a quick note: There was a long standing problem regarding the FCKEditor (HTML editor) in OpenCms 6.2.X using Firefox 3. Adding links always produced an URL like javascript:void(0)/*1241321*/. Since most customers are already on OpenCms 7 this is not such a big problem but recently I had to look for a fix. It turned [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick note: There was a long standing problem regarding the FCKEditor (HTML editor) in OpenCms 6.2.X using Firefox 3. Adding links always produced an URL like <em><span class="searchword0">javascript</span>:<span class="searchword1">void</span>(0)/*1241321*/</em>. Since most customers are already on OpenCms 7 this is not such a big problem but recently I had to look for a fix. It turned out the bug was quite popular and there is quite an easy workaround.</p>
<p>Open the file<em> /system/workplace/resources/editors/fckeditor/editor/js/fckeditorcode_gecko_2.js</em> in OpenCms and replace the text:</p>
<pre>FCK.ExecuteNamedCommand('CreateLink',B);var C=<strong>document</strong>.evaluate<strong>
</strong></pre>
<p>with:</p>
<pre>FCK.ExecuteNamedCommand('CreateLink',B);var C=<strong>this.EditorDocument</strong>.evaluate</pre>
<p>Publish the file and this should be it. Don&#8217;t forget to empty your browser cache afterwards (don&#8217;t just press CTRL+F5) otherwise you will still get the old file.</p>
<p>Of course this is not a real fix, but if you have to get rid of the problem fast. This can help.</p>
<p><strong>Update:</strong> In OpenCms 6.2.3 the file is called <em>fckeditorcode_gecko.js </em>not<em> </em><em>fckeditorcode_gecko_2.js.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2008/11/28/javascript-void-links-in-opencms-623-wysiwyg/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
