<?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>sebthom.de</title>
	<atom:link href="http://sebthom.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://sebthom.de</link>
	<description>IT Freelancer - Java, J2EE, IBM WebSphere Portal, Lotus Notes/Domino</description>
	<lastBuildDate>Sat, 03 Sep 2011 18:02:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Bash: Capturing stderr in a variable while still printing to the console.</title>
		<link>http://sebthom.de/158-bash-capturing-stderr-variable/</link>
		<comments>http://sebthom.de/158-bash-capturing-stderr-variable/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 22:56:53 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[stderr]]></category>
		<category><![CDATA[stdout]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=158</guid>
		<description><![CDATA[     <link rel="alternate" type="application/atom+xml" title="sebthom.de Category: IT" href="http://sebthom.de/category/it/feed/" />
     <link rel="alternate" type="application/atom+xml" title="sebthom.de Category: Linux" href="http://sebthom.de/category/it/linux/feed/" />
Storing the stdout output of a command in a variable and displaying it is simple: OUTPUT=$(command) echo $OUTPUT If you have longer running commands where you want to display stdout in realtime and also store it in a variable you can tee the output to stderr: OUTPUT=$(command &#124; tee /dev/stderr) OUTPUT=$(command &#124; tee /proc/self/fd/2) OUTPUT=$(command [...]]]></description>
			<content:encoded><![CDATA[<p>Storing the stdout output of a command in a variable and displaying it is simple:</p>
<pre class="perl" name="code">
OUTPUT=$(command)
echo $OUTPUT
</pre>
<p>If you have longer running commands where you want to display stdout in realtime and also store it in a variable you can tee the output to stderr:</p>
<pre class="perl" name="code">
OUTPUT=$(command | tee /dev/stderr)
</pre>
<pre class="perl" name="code">
OUTPUT=$(command | tee /proc/self/fd/2)
</pre>
<pre class="perl" name="code">
OUTPUT=$(command | tee >(cat - >&#038;2))
</pre>
<p>If you have longer running commands where you want to display stdout/stderr in realtime and also store stderr in a variable it gets a bit complicated.<br />
However, this can be achieved by switching stdout and stderr and then teeing the new stdout (which is stderr now) back to stderr for console output.</p>
<pre class="perl" name="code">
ERROR=$(command 3>&#038;1 1>&#038;2 2>&#038;3 | tee /dev/stderr)
</pre>
<pre class="perl" name="code">
ERROR=$(command 3>&#038;1 1>&#038;2 2>&#038;3 | tee /proc/self/fd/2)
</pre>
<pre name="code" class="bash">
ERROR=$(command 3>&#038;1 1>&#038;2 2>&#038;3 | tee >(cat - >&#038;2))
</pre>
<p>Good reading:<br />
<a href="http://mywiki.wooledge.org/BashFAQ/002">Bash FAQ: How can I store the return value/output of a command in a variable?</a></p>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=158" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2011. |
<a href="http://sebthom.de/158-bash-capturing-stderr-variable/">Permalink</a> |
<a href="http://sebthom.de/158-bash-capturing-stderr-variable/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/158-bash-capturing-stderr-variable/&amp;title=Bash: Capturing stderr in a variable while still printing to the console.">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/bash/" rel="nofollow tag">bash</a>, <a href="http://sebthom.de/tag/stderr/" rel="nofollow tag">stderr</a>, <a href="http://sebthom.de/tag/stdout/" rel="nofollow tag">stdout</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/158-bash-capturing-stderr-variable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring EMF Teneo with Hibernate, Commons DBCP, Spring Hibernate Transaction Manager, and the OpenSessionInViewFilter</title>
		<link>http://sebthom.de/152-configuring-emf-teneo-hibernate-dbcp-spring-transactions-opensessioninviewfilter/</link>
		<comments>http://sebthom.de/152-configuring-emf-teneo-hibernate-dbcp-spring-transactions-opensessioninviewfilter/#comments</comments>
		<pubDate>Sat, 02 Oct 2010 16:26:40 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[dbcp]]></category>
		<category><![CDATA[emf]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[persistence]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[teneo]]></category>
		<category><![CDATA[transaction]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=152</guid>
		<description><![CDATA[While trying to get an application working with]]></description>
			<content:encoded><![CDATA[<p>While trying to get an application working with <a href="http://wiki.eclipse.org/Teneo/Hibernate/Download_and_Install"EMF Teneo</a>, <a href="http://www.hibernate.org/">Hibernate</a>, <a href="http://commons.apache.org/dbcp/">Commons DBCP</a>, <a href="http://static.springsource.org/spring/docs/current/spring-framework-reference/html/orm.html#orm-hibernate-tx-declarative/">Spring Hibernate Transaction Manager</a> and the <a href="http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.html">OpenSessionInViewFilter</a> I encountered several unexpected issues. Here is an example of a working configuration for this software stack. Read the comments below the XML file for some explanations.</p>
<p><b>HbDataStoreWithDataSource.java:</b></p>
<pre class="java" name="code">
package de.sebthom.util;

import java.sql.*;
import java.util.Properties;
import javax.sql.DataSource;
import org.eclipse.emf.teneo.PersistenceOptions;
import org.eclipse.emf.teneo.hibernate.HbSessionDataStore;
import org.hibernate.HibernateException;
import org.hibernate.cfg.*;
import org.hibernate.connection.ConnectionProvider;

/**
 * @author Sebastian Thomschke
 */
public class HbDataStoreWithDataSource extends HbSessionDataStore {
  public final static class CustomConnectionProvider implements ConnectionProvider {
    private DataSource ds;

    public void close() throws HibernateException { }

    public void closeConnection(final Connection conn) throws SQLException {
      conn.close();
    }

    public void configure(final Properties props) throws HibernateException {
      ds = _CONFIG_TIME_DS_HOLDER.get();
    }

    public Connection getConnection() throws SQLException {
      return ds.getConnection();
    }

   public boolean supportsAggressiveRelease() {
     return false;
   }
  }

  private static final long serialVersionUID = 1L;
  private static HbDataStoreWithDataSource INSTANCE;

  /**
   * the data source holder acts as a thread safe bridge between the DSConnectionProvider which is instantiated by Hibernate internally
   * and the data source injected into the session factory during spring configuration time.
   */
  private static final ThreadLocal<DataSource> _CONFIG_TIME_DS_HOLDER = new ThreadLocal<DataSource>();

  public static HbDataStoreWithDataSource getInstance() {
		return INSTANCE;
  }

  private final Properties props = new Properties();

  public HbDataStoreWithDataSource() {
    INSTANCE = this;

    props.setProperty(PersistenceOptions.ADD_INDEX_FOR_FOREIGN_KEY, "true");
    props.setProperty(PersistenceOptions.FETCH_CONTAINMENT_EAGERLY, "false");
    props.setProperty(PersistenceOptions.FETCH_ASSOCIATION_EXTRA_LAZY, "false");

    // tell Teneo to not change the table names, we do this using Hibernate's ImprovedNamingStrategy
    props.setProperty(PersistenceOptions.SQL_CASE_STRATEGY, "none");
    props.setProperty(PersistenceOptions.MAXIMUM_SQL_NAME_LENGTH, "-1");
  }

  protected Configuration createConfiguration() {
    Configuration cfg = super.createConfiguration();
    cfg.setNamingStrategy(ImprovedNamingStrategy.INSTANCE);

    // only if a DS is injected we register our connection provider
    if (_CONFIG_TIME_DS_HOLDER.get() != null)
      cfg.setProperty(Environment.CONNECTION_PROVIDER, CustomConnectionProvider.class.getName());
    return cfg;
  }

  public void setDataSource(final DataSource ds) {
    _CONFIG_TIME_DS_HOLDER.set(ds);
  }

  public final void setHibernateProperties(final Properties hibernateProperties) {
    throw new UnsupportedOperationException();
  }

  public final void setPersistenceProperties(final Properties persistenceOptions) {
    throw new UnsupportedOperationException();
  }

  public void setProperties(final Properties props) {
    this.props.putAll(props);
    super.setProperties(this.props);
  }
}
</pre>
<p><b>web.xml:</b></p>
<pre class="xml" name="code">
<filter>
  <filter-name>openSessionInViewFilter</filter-name>
  <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
    <init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
    </init-param>
    <init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>realSessionFactory</param-value>
    </init-param>
</filter>
<filter-mapping>
  <filter-name>openSessionInViewFilter</filter-name>
  <url-pattern>/*</url-pattern>
  <dispatcher>REQUEST</dispatcher>
  <dispatcher>ERROR</dispatcher>
</filter-mapping>
</pre>
<p><b>applicationContext.xml:</b></p>
<pre class="xml" name="code">
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd" default-lazy-init="false">

  <context:property-placeholder location="WEB-INF/application.spring.properties"></context:property-placeholder>

  <bean id="dataSource" class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
<property name="targetDataSource">
      <bean class="org.apache.commons.dbcp.BasicDataSource" init-method="createDataSource" destroy-method="close">
<property name="driverClassName">${jdbc.driverClassName}</property>
<property name="url">${jdbc.url}</property>
<property name="username">${jdbc.username}</property>
<property name="password">${jdbc.password}</property>
<property name="defaultAutoCommit">false</property>
<property name="maxActive">${jdbc.maxConnections}</property>
<property name="maxIdle">${jdbc.minConnections}</property>
<property name="maxWait">10000</property>
<property name="initialSize">${jdbc.minConnections}</property>
<property name="validationQuery">${jdbc.validationQuery}</property>
<property name="testOnBorrow">false</property>
<property name="testWhileIdle">true</property>
<property name="timeBetweenEvictionRunsMillis">1200000</property>
<property name="minEvictableIdleTimeMillis">1800000</property>
<property name="numTestsPerEvictionRun">5</property>
      </bean>
    </property>
  </bean>

  <bean id="teneoSessionFactory" class="de.sebthom.util.HbSessionDataStoreWithDataSource" init-method="initialize" p:name="myDataStore" p:dataSource-ref="dataSource">
<property name="properties"><value>
      hibernate.dialect=${hibernate.dialect}
      hibernate.hbm2ddl.auto=${hibernate.hbm2ddl.auto}
      hibernate.jdbc.batch_size=2000
      hibernate.show_sql=${hibernate.show_sql}
      hibernate.transaction.auto_close_session=false
      hibernate.current_session_context_class=org.springframework.orm.hibernate3.SpringSessionContext
      hibernate.transaction.factory_class=org.springframework.orm.hibernate3.SpringTransactionFactory
    </value></property>
<property name="EPackageClasses">
<list><value>com.acme.ShopPackageImpl</value></list></property>
  </bean>

  <bean id="realSessionFactory" factory-bean="teneoSessionFactory" factory-method="getSessionFactory"></bean>

  <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" p:sessionFactory-ref="realSessionFactory" p:nestedTransactionAllowed="true" p:earlyFlushBeforeCommit="true"></bean>

  <tx:annotation-driven transaction-manager="transactionManager"></tx:annotation-driven>

</beans>
</pre>
<p><b>Comments:</b></p>
<ol>
<li><b>VERY IMPORTANT:</b>The <b>HibernateTransactionManager</b> does NOT get the teneoSessionFactory(HbSessionDataStore) object passed in as sessionFactory, but the underlying Hibernate SessionFactory that can be retrieved from the HbSessionDataStore via the getSessionFactory() method. Not doing so will result in duplicate Hibernate Sessions completely breaking the transaction managment. This happens because in that case the TransactionSynchronizationManager will sometimes internally bind the hibernate session to the current thread based on different keys and thus does not find it again. Here are some stacktraces showing the problem:
<pre>
TransactionSynchronizationManager.bindResource(Object, Object) line: 170
at OpenSessionInViewFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain) line: 183
=> results in TransactionSynchronizationManager.bindResource(<b>HbSessionDataStore</b>, SessionHolder) => as key the <b>Teneo SessionFactory</b> is used

TransactionSynchronizationManager.bindResource(Object, Object) line: 170
at SessionFactoryUtils.doGetSession(SessionFactory, Interceptor, SQLExceptionTranslator, boolean) line: 339
at SessionFactoryUtils.doGetSession(SessionFactory, boolean) line: 256
at SpringSessionContext.currentSession() line: 60
at SessionFactoryImpl.getCurrentSession() line: 700
at HbSessionDataStore(HbBaseSessionDataStore).getCurrentSession() line: 161
=> results in TransactionSynchronizationManager.bindResource(<b>SessionFactoryImpl</b>, SessionHolder) => as key the <b>Hibernate SessionFactory</b> is used

TransactionSynchronizationManager.bindResource(Object, Object) line: 170
at HibernateTransactionManager.doBegin(Object, TransactionDefinition) line: 577
at HibernateTransactionManager(AbstractPlatformTransactionManager).getTransaction(TransactionDefinition) line: 371
at TransactionInterceptor(TransactionAspectSupport).createTransactionIfNecessary(PlatformTransactionManager, TransactionAttribute, String) line: 316
at TransactionInterceptor.invoke(MethodInvocation) line: 105
at ReflectiveMethodInvocation.proceed() line: 172
=> results in TransactionSynchronizationManager.bindResource(<b>HbSessionDataStore</b>, SessionHolder) => as key the <b>Teneo SessionFactory</b> is used
</pre>
<li><b>defaultAutoCommit</b> is set to <b>false</b> to ensure that Spring has full control over the transaction and that the connection pool is not committing statements automatically based on it&#8217;s own strategies.
<li>The example uses an extended version of the <b>org.eclipse.emf.teneo.hibernate.HbSessionDataStore</b> class that allows the usage of a DataSource object and that configures Teneo to not alter the table, column names but let&#8217;s Hibernate handle this via its ImprovedNamingStrategy.
<li><b>hibernate.transaction.auto_close_session</b> is set to <b>false</b> to avoid &#8220;SessionException: Session is closed!&#8221; in conjunction with the OpenSessionInViewListener.
<li><b>hibernate.current_session_context_class</b> and <b>hibernate.transaction.factory_class</b> are set to special Spring implementations to avoid &#8220;org.hibernate.HibernateException: No CurrentSessionContext configured!&#8221; when not using Spring Hibernate Template via HibernateDAOSupport. It is not recommended to use the Hibernate Template anymore, see <a href="http://blog.springsource.com/2007/06/26/so-should-you-still-use-springs-hibernatetemplate-andor-jpatemplate/">http://blog.springsource.com/2007/06/26/so-should-you-still-use-springs-hibernatetemplate-andor-jpatemplate/</a>
</ol>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=152" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2010. |
<a href="http://sebthom.de/152-configuring-emf-teneo-hibernate-dbcp-spring-transactions-opensessioninviewfilter/">Permalink</a> |
<a href="http://sebthom.de/152-configuring-emf-teneo-hibernate-dbcp-spring-transactions-opensessioninviewfilter/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/152-configuring-emf-teneo-hibernate-dbcp-spring-transactions-opensessioninviewfilter/&amp;title=Configuring EMF Teneo with Hibernate, Commons DBCP, Spring Hibernate Transaction Manager, and the OpenSessionInViewFilter">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/dbcp/" rel="nofollow tag">dbcp</a>, <a href="http://sebthom.de/tag/emf/" rel="nofollow tag">emf</a>, <a href="http://sebthom.de/tag/hibernate/" rel="nofollow tag">hibernate</a>, <a href="http://sebthom.de/tag/java/" rel="nofollow tag">Java</a>, <a href="http://sebthom.de/tag/persistence/" rel="nofollow tag">persistence</a>, <a href="http://sebthom.de/tag/spring/" rel="nofollow tag">spring</a>, <a href="http://sebthom.de/tag/teneo/" rel="nofollow tag">teneo</a>, <a href="http://sebthom.de/tag/transaction/" rel="nofollow tag">transaction</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/152-configuring-emf-teneo-hibernate-dbcp-spring-transactions-opensessioninviewfilter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using EMF ECore model objects with Wicket components</title>
		<link>http://sebthom.de/146-using-emf-ecore-model-objects-with-wicket-components/</link>
		<comments>http://sebthom.de/146-using-emf-ecore-model-objects-with-wicket-components/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 19:56:26 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[ecore]]></category>
		<category><![CDATA[emf]]></category>
		<category><![CDATA[reflection]]></category>
		<category><![CDATA[wicket]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=146&amp;langswitch_lang=de</guid>
		<description><![CDATA[Apache Wicket uses so called model objects to bind data objects to Wicket components. The framework provides a number of model implementations to access data objects and their properties in various ways. The PropertyModel implementation for example is used to access and set the value of a Java object using reflection. EPropertyModel If you are [...]]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://wicket.apache.org">Apache Wicket</a> uses so called <a href="https://cwiki.apache.org/WICKET/working-with-wicket-models.html" target="_blank">model objects</a> to bind data objects to Wicket components. The framework provides a number of model implementations to access data objects and their properties in various ways. The <a href="https://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-PropertyModels" target="_blank">PropertyModel</a> implementation for example is used to access and set the value of a Java object using reflection.</p>
<h3>EPropertyModel</h3>
<p>If you are working with <a target="_blank" href="http://www.eclipse.org/modeling/emf/">EMF (Eclipse Modeling Framework)</a> generated model classes you can also use PropertyModels to bind structural features (properties in EMF terminology) of an EObject to a Wicket component. E.g. if your EObject has an attribute called &#8220;comment&#8221; you could instantiate a model like this</p>
<pre class="java" name="code">IModel model = new PropertyModel(myEObject, "comment");
</pre>
<p>This approach has several disadvantages. First, the name of the attribute is declared as a String and not as a compile-time reference to the actual attribute. This means the application could break during runtime if you have renamed the attribute at one point and forgot to also change the String value. Second, this property model uses runtime reflection which is a slow alternative to compile time based access.<br />
Java classes generated from EMF Models by default extend the <a href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.4.3/org/eclipse/emf/ecore/EObject.html" target="_blank">EObject</a> class which provides a compile-time reflection API. Using the generic eGet and eSet methods any public property of the EObject can be accessed. The EMF Generator also generates a Package class for each EMF package that holds a Literals interface listing all available attributes and references of all generated EClasses of the given package. If you lets say have an EClass &#8220;Ticket&#8221; with the attribute &#8220;comment&#8221; in the package &#8220;com.acme.service&#8221; you could utilize the compile time reflection API as follows:</p>
<pre class="java" name="code">EAttribute commentAttribute = com.acme.service.ServicePackage.Literals.TICKET__COMMENT;
Ticket newTicket = com.acme.service.ServiceFactory.eINSTANCE.create(Ticket.class);
newTicket.eSet(commentAttribute, "my comment");
</pre>
<p>Using the EMF compile-time reflection API I created a generic EMF ECore Feature Model implementation that leverages the compile-time references to structural features. Most of the code is actually related to working around the fact that EAttributes and EReferences are not serializable but which they should to be part safely referenced in a model that potentially is serialized by Wicket between requests.</p>
<pre class="java" name="code">import org.apache.wicket.model.IDetachable;
import org.apache.wicket.model.IObjectClassAwareModel;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;

/**
 * A property model to bind an attribute of an EMF ECore object
 *
 * @author Sebastian Thomschke
 */
@SuppressWarnings("unchecked")
public class EFeatureModel&lt;T&gt; implements IObjectClassAwareModel&lt;T&gt;
{
	private static final long serialVersionUID = 1L;

	private transient EStructuralFeature feat;
	private String featContainerClassName;
	private String featName;
	private String featPackageNsURI;

	private EObject target;

	public EFeatureModel(EObject target, EStructuralFeature efeature)
	{
		this.target = target;
		this.feat = efeature;
		this.featName = efeature.getName();
		this.featContainerClassName = efeature.getContainerClass().getName();
		this.featPackageNsURI = ((EPackage) efeature.eContainer().eContainer()).getNsURI();
	}

	public void detach()
	{
		if (target instanceof IDetachable) ((IDetachable) target).detach();
	}

	public EStructuralFeature getFeature()
	{
		if (feat == null)
		{
			EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(featPackageNsURI);
			for (Object eClassifierItem : ePackage.getEClassifiers())
			{
				EClassifier eClassifier = (EClassifier) eClassifierItem;
				if (eClassifier.getInstanceClass().getName().equals(featContainerClassName))
					feat = ((EClass) eClassifier).getEStructuralFeature(featName);
			}
		}
		return feat;
	}

	public T getObject()
	{
		return (T) target.eGet(getFeature());
	}

	public Class&lt;T&gt; getObjectClass()
	{
		return getFeature().getEType().getInstanceClass();
	}

	public void setObject(T object)
	{
		// do nothing if the object is the same instance that is returned by the getter
		// this is esp. important for collection properties
		if (target.eGet(getFeature()) == object) return;

		target.eSet(getFeature(), object);
	}

	@Override
	public String toString()
	{
		return new StringBuilder("Model:classname=[").append(getClass().getName()).append("]").append(":target=[")
				.append(target).append("]").toString();
	}
}</pre>
<p>Using this new model implementation is as simple as using the PropertyModel provided by Wicket:</p>
<pre class="java" name="code">IModel model = new EFeatureModel(myTicket, com.acme.service.ServicePackage.Literals.TICKET__COMMENT);
</pre>
<p>You can now fully enjoy the compile-time safeness of your EMF model.</p>
<h3>Making EObjects serializable</h3>
<p>Wicket usually serializes components and their associated models between HTTP requests. If you are using the provided EPropertyModel your EObject classes must implement the Serializable interface. To achieve this, simply extend the EObject interface with the Serializables interface and set &#8220;Root Extends Interface&#8221; property in your genmodel configuration to this interface.</p>
<pre class="java" name="code">
/**
 * @author Sebastian Thomschke
 */
public interface SerializableEObject extends EObject, Serializable {
}
</pre>
<p>When you now regenerate the model classes they will extend the SerializableEObject interface and Wicket will stop complaining about objects in the model being not serializable.</p>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=146" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2010. |
<a href="http://sebthom.de/146-using-emf-ecore-model-objects-with-wicket-components/">Permalink</a> |
<a href="http://sebthom.de/146-using-emf-ecore-model-objects-with-wicket-components/#comments">One comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/146-using-emf-ecore-model-objects-with-wicket-components/&amp;title=Using EMF ECore model objects with Wicket components">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/eclipse/" rel="nofollow tag">eclipse</a>, <a href="http://sebthom.de/tag/ecore/" rel="nofollow tag">ecore</a>, <a href="http://sebthom.de/tag/emf/" rel="nofollow tag">emf</a>, <a href="http://sebthom.de/tag/java/" rel="nofollow tag">Java</a>, <a href="http://sebthom.de/tag/reflection/" rel="nofollow tag">reflection</a>, <a href="http://sebthom.de/tag/wicket/" rel="nofollow tag">wicket</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/146-using-emf-ecore-model-objects-with-wicket-components/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing Tomcat 6 on Debian Squeeze</title>
		<link>http://sebthom.de/142-installing-tomcat-6-debian-squeeze/</link>
		<comments>http://sebthom.de/142-installing-tomcat-6-debian-squeeze/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 16:07:35 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[port 80]]></category>
		<category><![CDATA[port forwarding]]></category>
		<category><![CDATA[quercus]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[vhost]]></category>
		<category><![CDATA[virtual servers]]></category>
		<category><![CDATA[VPS]]></category>
		<category><![CDATA[xinetd]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=142</guid>
		<description><![CDATA[This post describes how to setup Tomcat 6 on Debian Squeeze. The configured Tomcat serves requests on port 80 without the need of an additional web server. This is especially good for virtual servers (VPS) providing limit memory. It also has multiple virtual hosts configured, each with it&#8217;s own webapp with context root / and [...]]]></description>
			<content:encoded><![CDATA[<p>This post describes how to setup Tomcat 6 on Debian Squeeze. The configured Tomcat serves requests on port 80 without the need of an additional web server. This is especially good for virtual servers (VPS) providing limit memory. It also has multiple virtual hosts configured, each with it&#8217;s own webapp with context root / and optional support for PHP via the Quercus PHP implementation.</p>
<h3>Installing Sun Java 6</h3>
<p>Ensure the non-free section is enabled for the APT repository configuration in /etc/apt/sources.list, e.g. &#8220;deb http://ftp.de.debian.org/debian testing main contrib non-free&#8221;</p>
<pre name="code" class="php">
apt-get update
apt-get install sun-java6-jdk
echo 'JAVA_HOME="/usr/lib/jvm/java-6-sun"' >> /etc/environment
echo 'JRE_HOME="/usr/lib/jvm/java-6-sun/jre"' >> /etc/environment
</pre>
<h3>Installing Tomcat 6</h3>
<pre  name="code" class="php">
apt-get install tomcat6 tomcat6-admin
/etc/init.d/tomcat6 stop
</pre>
<h3>Creating standard Tomcat directory layout</h3>
<pre name="code" class="php">
mkdir /opt/tomcat
cd /opt/tomcat
ln -s /etc/tomcat6/ conf
ln -s /usr/share/tomcat6/bin/ bin
ln -s /usr/share/tomcat6/lib/ lib
ln -s /var/lib/tomcat6/webapps webapps
ln -s /var/log/tomcat6/ logs
</pre>
<h3>Creating a Tomcat admin user</h3>
<p>In /opt/tomcat/conf/tomcat-users.xml add an entry like:</p>
<pre name="code" class="xml">
&lt;user name="ADMIN_USERNAME" password="ADMIN_PASSWORD" roles="admin,manager" /&gt;
</pre>
<h3>Setting up virtual hosts</h3>
<p>For each virtual host execute the following command. Replace &#8220;mydomain.com&#8221; with the desired virtual host name, but omit the &#8220;www.&#8221; part.</p>
<pre name="code" class="php">
mkdir -p /opt/tomcat/webapps.mydomain.com/ROOT
</pre>
<p>In the &lt;Engine&gt; tag of &#8220;/opt/tomcat/conf/server.xml&#8221; add one host entry for each virtual host.</p>
<pre name="code" class="xml">
&lt;Host name="mydomain.com" appBase="/opt/tomcat/webapps.mydomain.com"&gt;
    &lt;Alias&gt;www.mydomain.com&gt;/Alias&gt;
    &lt;Valve className="org.apache.catalina.valves.AccessLogValve" prefix="mydomain_access_log." suffix=".txt" pattern="common"/&gt;
&lt;/Host&gt;
</pre>
<p>The &lt;Alias&gt; tag tells Tomcat to redirect from www.mydomain.com to mydomain.com.<br />
The &lt;Valve&gt; tag enables access logging in the standard logging format.</p>
<h3>Using xinetd to configure port 80 for Tomcat</h3>
<p>Binding a service on port 80 requires root permissions. Thus we use port forwarding to &#8220;bind&#8221; Tomcat to port 80. My VPS does not support the use of &#8220;iptables -j REDIRECT&#8221; therefore I am using xinetd as a web proxy.<br />
Ensure that no other service is listening on port 80/443:</p>
<pre name="code" class="php">
netstat -pan | grep ":80\|:443"
</pre>
<p>Register the required xinetd services:</p>
<pre name="code" class="php">
echo echo "
service www
{
        socket_type     = stream
        protocol        = tcp
        user            = root
        wait            = no
        bind            = 88.80.198.181
        port            = 80
        redirect        = localhost 8080
        disable         = no
        flags           = REUSE
        log_type        = FILE /var/log/wwwaccess.log
        log_on_success  -= PID HOST DURATION EXIT

        per_source      = UNLIMITED
        instances       = UNLIMITED
}

service https
{
        socket_type     = stream
        protocol        = tcp
        user            = root
        wait            = no
        bind            = 88.80.198.181
        port            = 443
        redirect        = localhost 8443
        disable         = no
        flags           = REUSE
        log_type        = FILE /var/log/httpsaccess.log
        log_on_success  -= PID HOST DURATION EXIT

        per_source      = UNLIMITED
        instances       = UNLIMITED
}
" > /etc/init.d/tomcat
/etc/init.d/xinetd restart
</pre>
<p>If you want to use a different service name, e.g. &#8220;tomcat&#8221; instead of &#8220;www&#8221; you must add this service to /var/services, e.g. &#8220;tomcat 80/tcp&#8221;<br />
In /opt/tomcat/conf/server.xml modify the &lt;Connector&gt; as follows:</p>
<pre name="code" class="xml">
&lt;Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" proxyPort="80" address="127.0.0.1" /&gt;
</pre>
<p>This binds Tomcat to localhost. It also tells Tomcat that port 80 is the proxy port which is necessary for correct URL generation.<br />
From now on the Tomcat admin applications are only accessible via localhost. You can use SSH port forwarding to still access the applications from your workstation&#8217;s web browser. E.g. if you are using <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">PuTTY</a> you can use this command line option &#8220;-L 8080:localhost:8080&#8243; to forward the server&#8217;s local 8080 port to your workstation&#8217;s local 8080 port. On your workstation&#8217;s browser you then simply enter <a href="http://localhost:8080/manager/html">http://localhost:8080/manager/html</a> and are connected to the server&#8217;s Tomcat admin application.</p>
<h3>Enabling PHP support (optional)</h3>
<p>Download <a href="http://quercus.caucho.com/">Quercus</a>.</p>
<pre name="code" class="php">
mkdir -p /opt/downloads
wget -o /opt/downloads/quercus-4.0.3.war http://caucho.com/download/quercus-4.0.3.war
</pre>
<p>Install Quercus as a shared library.</p>
<pre name="code" class="php">
unzip -j /opt/downloads/quercus-4.0.3.war \*.jar -d /opt/tomcat/lib
</pre>
<p>Enable PHP support for the virtual hosts by installing the quercus web.xml. For each virtual host execute:</p>
<pre name="code" class="php">
unzip /opt/downloads/quercus-4.0.3.war *web.xml -d /opt/tomcat/webapps.mydomain.com/ROOT
</pre>
<h3>Starting Tomcat</h3>
<pre name="code" class="php">
/etc/init.d/tomcat start
</pre>
<h3>References</h3>
<ul>
<li><a href="http://www.ibm.com/developerworks/java/library/l-secjav.html#h5">Securing Linux for Java services: The port dilemma</a>
<li><a href="http://ruleoftech.com/journal/redirecting-http-and-https-traffic-to-tomcats-ports">Redirect HTTP and HTTPS traffic to Tomcat&#8217;s ports</a>
<li><a href="http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html">Tomcat 6: Virtual Hosting How To</a>
<li><a href="http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html">Tomcat 6: Classloader How To</a>
<li><a href="http://www.ex-parrot.com/pete/tomcat-vhost.html">Virtual Hosting with Tomcat</a>
<li><a href="http://wiki.caucho.com/Quercus:_Tomcat">Quercus: Tomcat</a>
<li><a href="http://www.ubuntugeek.com/how-to-install-tomcat-6-on-ubuntu-9-04-jaunty.html">How to install Tomcat 6 on Ubuntu 9.04 (Jaunty)</a>
</ul>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=142" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2010. |
<a href="http://sebthom.de/142-installing-tomcat-6-debian-squeeze/">Permalink</a> |
<a href="http://sebthom.de/142-installing-tomcat-6-debian-squeeze/#comments">7 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/142-installing-tomcat-6-debian-squeeze/&amp;title=Installing Tomcat 6 on Debian Squeeze">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/java/" rel="nofollow tag">Java</a>, <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/port-80/" rel="nofollow tag">port 80</a>, <a href="http://sebthom.de/tag/port-forwarding/" rel="nofollow tag">port forwarding</a>, <a href="http://sebthom.de/tag/quercus/" rel="nofollow tag">quercus</a>, <a href="http://sebthom.de/tag/tomcat/" rel="nofollow tag">tomcat</a>, <a href="http://sebthom.de/tag/vhost/" rel="nofollow tag">vhost</a>, <a href="http://sebthom.de/tag/virtual-servers/" rel="nofollow tag">virtual servers</a>, <a href="http://sebthom.de/tag/vps/" rel="nofollow tag">VPS</a>, <a href="http://sebthom.de/tag/xinetd/" rel="nofollow tag">xinetd</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/142-installing-tomcat-6-debian-squeeze/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Leveraging PyDev&#8217;s auto completion for indirectly created objects</title>
		<link>http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/</link>
		<comments>http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 23:29:00 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Jython]]></category>
		<category><![CDATA[pydev]]></category>
		<category><![CDATA[pydoc]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[rtype]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=140</guid>
		<description><![CDATA[This is just a quick tip how to enable auto completion in PyDev for indirectly created objects. By default, PyDev has no problems in presenting you the possible object attributes and methods on a variable if that variable gets a new object instance assigned directly in the code. For example, when you first type &#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick tip how to enable auto completion in <a href="http://pydev.org">PyDev</a> for indirectly created objects. </p>
<p>By default, PyDev has no problems in presenting you the possible object attributes and methods on a variable if that variable gets a new object instance assigned directly in the code. </p>
<p>For example, when you first type &#8230;</p>
<pre name="code" class="python">mybook = Book()</pre>
<p>&#8230; and in the next line you enter &#8230;</p>
<pre name="code" class="python">mybook.</pre>
<p>&#8230; PyDev will dutifully present you the statically declared features for the Book class in a popup.</p>
<p>If you however get that Book instance as the result of another method, e.g. &#8230;</p>
<pre name="code" class="python">mybook = bookstore.findBook("foobar")</pre>
<p>&#8230; PyDev currently seems to be helpless. </p>
<p>Because of Python&#8217;s dynamic nature it is of course a bit harder for an IDE to figure out what kind of objects may a method. But PyDev could for example honor the @return / @rtype <a href="http://epydoc.sourceforge.net/manual-epytext.html">PyDoc</a> annotations (which you can add to the findBook&#8217;s method declaration) but currently it just does not.</p>
<p>To still have autocompletion you have two options:</p>
<ol>
<li> Temporarily instantiate a Book object in the code.
<pre name="code" class="python">
mybook = Book()
mybook = bookstore.findBook("foobar")
mybook. #--> now you have auto completion
</pre>
<p>This has the drawback, that if you forget to remove the first line before you finish coding an unneccessary Book instance will be created on every execution during runtime.</p>
<li> Use an assertion to ensure that the mybook variable contains an object of type Book
<pre name="code" class="python">
mybook = bookstore.findBook("foobar")
assert isinstance(mybook, Book)
mybook. #--> now you have auto completion
</pre>
</ol>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=140" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2010. |
<a href="http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/">Permalink</a> |
<a href="http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/#comments">2 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/&amp;title=Leveraging PyDev&#8217;s auto completion for indirectly created objects">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/jython/" rel="nofollow tag">Jython</a>, <a href="http://sebthom.de/tag/pydev/" rel="nofollow tag">pydev</a>, <a href="http://sebthom.de/tag/pydoc/" rel="nofollow tag">pydoc</a>, <a href="http://sebthom.de/tag/python/" rel="nofollow tag">python</a>, <a href="http://sebthom.de/tag/rtype/" rel="nofollow tag">rtype</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OVal 1.40 released</title>
		<link>http://sebthom.de/139-oval-140-released/</link>
		<comments>http://sebthom.de/139-oval-140-released/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 20:42:38 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=139</guid>
		<description><![CDATA[I am happy to announce the immediate availability of Version 1.40 OVal the Object Validation Framework for Java. This release fixes some minor issues and provides the following two new features: 1. Enabling/disabling constraints based on the object state: Using the newly introduced when attribute for constraints it is possible to specify under which circumstances [...]]]></description>
			<content:encoded><![CDATA[<p>I am happy to announce the immediate availability of Version 1.40 OVal the Object Validation Framework for Java. This release fixes some minor issues and provides the following two new features:</p>
<p><b>1. Enabling/disabling constraints based on the object state:</b><br />
Using the newly introduced <i>when</i> attribute for constraints it is possible to specify under which circumstances the constraint will be considered during object validation. The <i>when</i> attribute holds a formula in one of the supported scripting languages. If the formula returns true, the constraint will be activated for the current validation cycle otherwise it is ignored. In the following example the alias attribute must have a value only when the name attribute is not set.</p>
<pre name="code" class="java">
public class User {
   private String name;

   @NotNull(when = "groovy:_this.name == null")
   private String alias;

   // . . .
}
</pre>
<p><b>2. Fine grain control over how constraints are applied on arrays, maps, collections and their elements</b><br />
The newly introduced attribute <i>appliesTo</i> allows you to specify if and how a constraint declared for a map, a collection or an array is applied to their elements as well or exclusively. See the following example how this works:</p>
<pre name="code" class="java">
public class BusinessObject {

   // the ids field may be null, but if it is not null
   // none of it's items must be null
   @NotNull(appliesTo = { ConstraintTarget.VALUES })
   private String[] ids;

   // only the field itself must not be null,
   // the list can contain null values
   @NotNull(appliesTo = { ConstraintTarget.CONTAINER })
   private List items;

   // the field must not be null as well as all keys
   // and values of the map
   @NotNull(appliesTo = { ConstraintTarget.CONTAINER, ConstraintTarget.KEYS, ConstraintTarget.VALUES })
   private Map itemsByGroup;

   // . . .
}
</pre>
<p><b>Download</b><br />
You can get the lates binaries and source files of OVal from here: http://sourceforge.net/projects/oval/files/</p>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=139" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2009. |
<a href="http://sebthom.de/139-oval-140-released/">Permalink</a> |
<a href="http://sebthom.de/139-oval-140-released/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/139-oval-140-released/&amp;title=OVal 1.40 released">del.icio.us</a>
<br/>
Post tags: <br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/139-oval-140-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing WebSphere Portal in a local network</title>
		<link>http://sebthom.de/138-installing-websphere-portal-local-network/</link>
		<comments>http://sebthom.de/138-installing-websphere-portal-local-network/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 21:32:05 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[WebSphere Portal]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[websphere portal]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=138</guid>
		<description><![CDATA[Recently I had to setup some WebSphere Portal 6.1 installations in VMWares within a private network. Unfortunately the portal installer aborted with the following message &#8220;EJPIC0067E: Portal requires a fully qualified host name that is recoganized by the DNS Server.&#8221; Even when adding the fully qualified hostname to the hosts file the installer may still [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to setup some WebSphere Portal 6.1 installations in VMWares within a private network. Unfortunately the portal installer aborted with the following message &#8220;EJPIC0067E: Portal requires a fully qualified host name that is recoganized by the DNS Server.&#8221; Even when adding the fully qualified hostname to the hosts file the installer may still fail with the same message.<br />
The workaround is to disable the hostname check by invoking the portal installer with the following parameter specified: <strong>-W nodeHost.active=&#8221;False&#8221;</strong>. You should however only do this for test or development installations.</p>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=138" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2009. |
<a href="http://sebthom.de/138-installing-websphere-portal-local-network/">Permalink</a> |
<a href="http://sebthom.de/138-installing-websphere-portal-local-network/#comments">3 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/138-installing-websphere-portal-local-network/&amp;title=Installing WebSphere Portal in a local network">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/deployment/" rel="nofollow tag">deployment</a>, <a href="http://sebthom.de/tag/websphere-portal/" rel="nofollow tag">websphere portal</a>, <a href="http://sebthom.de/tag/workaround/" rel="nofollow tag">workaround</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/138-installing-websphere-portal-local-network/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Comparing version numbers in Jython / Python</title>
		<link>http://sebthom.de/136-comparing-version-numbers-in-jython-pytho/</link>
		<comments>http://sebthom.de/136-comparing-version-numbers-in-jython-pytho/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 23:03:57 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Jython]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=136</guid>
		<description><![CDATA[Here comes a function to compare version numbers of e.g. Maven artifacts in Jython / Python. import re def cmpver(vA, vB): """ Compares two version number strings @param vA: first version string to compare @param vB: second version string to compare @author Sebastian Thomschke @return negative if vA < vB, zero if vA == vB, [...]]]></description>
			<content:encoded><![CDATA[<p>Here comes a function to compare version numbers of e.g. Maven artifacts in Jython / Python.</p>
<pre name="code" class="python">
import re

def cmpver(vA, vB):
    """
    Compares two version number strings
    @param vA: first version string to compare
    @param vB: second version string to compare
    @author <a href="http://sebthom.de/">Sebastian Thomschke</a>
    @return negative if vA < vB, zero if vA == vB, positive if vA > vB.

    Examples:
    >>> cmpver("0", "1")
    -1
    >>> cmpver("1", "0")
    1
    >>> cmpver("1", "1")
    0
    >>> cmpver("1.0", "1.0")
    0
    >>> cmpver("1.0", "1")
    0
    >>> cmpver("1", "1.0")
    0
    >>> cmpver("1.1.0", "1.0.1")
    1
    >>> cmpver("1.0.1", "1.1.1")
    -1
    >>> cmpver("0.3-SNAPSHOT", "0.3")
    -1
    >>> cmpver("0.3", "0.3-SNAPSHOT")
    1
    >>> cmpver("1.3b", "1.3c")
    -1
    >>> cmpver("1.14b", "1.3c")
    1
    """
    if vA == vB: return 0

    def num(s):
        if s.isdigit(): return int(s)
        return s

    seqA = map(num, re.findall('\d+|\w+', vA.replace('-SNAPSHOT', '')))
    seqB = map(num, re.findall('\d+|\w+', vB.replace('-SNAPSHOT', '')))

    # this is to ensure that 1.0 == 1.0.0 in cmp(..)
    lenA, lenB = len(seqA), len(seqB)
    for i in range(lenA, lenB): seqA += (0,)
    for i in range(lenB, lenA): seqB += (0,)

    rc = cmp(seqA, seqB)

    if rc == 0:
        if vA.endswith('-SNAPSHOT'): return -1
        if vB.endswith('-SNAPSHOT'): return 1
    return rc
</pre>
<p>Theoretically lines 43 &#8211; 49 could be written in a more compact way but using the short circuit evaluations (as below) lead to wrong results &#8211; at least in Jython 2.1:</p>
<pre name="code" class="python">
    seqa = map(lambda s: s.isdigit() and int(s) or s, re.findall('\d+|\w+', vA.replace('-SNAPSHOT', '')))
    seqb = map(lambda s: s.isdigit() and int(s) or s, re.findall('\d+|\w+', vB.replace('-SNAPSHOT', '')))
</pre>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=136" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2009. |
<a href="http://sebthom.de/136-comparing-version-numbers-in-jython-pytho/">Permalink</a> |
<a href="http://sebthom.de/136-comparing-version-numbers-in-jython-pytho/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/136-comparing-version-numbers-in-jython-pytho/&amp;title=Comparing version numbers in Jython / Python">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/jython/" rel="nofollow tag">Jython</a>, <a href="http://sebthom.de/tag/python/" rel="nofollow tag">python</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/136-comparing-version-numbers-in-jython-pytho/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running TomCat 6 in Debug Mode under Windows</title>
		<link>http://sebthom.de/135-running-tomcat-6-debug-mode-windows/</link>
		<comments>http://sebthom.de/135-running-tomcat-6-debug-mode-windows/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 21:55:02 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=135</guid>
		<description><![CDATA[While tracing some problems in one of my grails applications I had the need to do step debugging on a remote Tomcat server. Eventually I came up with the following lines to launch TomCat in debug mode: @echo off set JPDA_TRANSPORT="dt_socket" set JPDA_ADDRESS="8000" set JPDA_SUSPEND="y" catalina.bat jpda start Simply create a debug.bat file in TomCat&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>While tracing some problems in one of my grails applications I had the need to do step debugging on a remote Tomcat server. Eventually I came up with the following lines to launch TomCat in debug mode:</p>
<pre>
@echo off
set JPDA_TRANSPORT="dt_socket"
set JPDA_ADDRESS="8000"
set JPDA_SUSPEND="y"
catalina.bat jpda start
</pre>
<p>Simply create a <b>debug.bat</b> file in TomCat&#8217;s <b>bin</b> directory and add these lines.</p>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=135" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2009. |
<a href="http://sebthom.de/135-running-tomcat-6-debug-mode-windows/">Permalink</a> |
<a href="http://sebthom.de/135-running-tomcat-6-debug-mode-windows/#comments">One comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/135-running-tomcat-6-debug-mode-windows/&amp;title=Running TomCat 6 in Debug Mode under Windows">del.icio.us</a>
<br/>
Post tags: <br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/135-running-tomcat-6-debug-mode-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Determine the user who logged on via SSH</title>
		<link>http://sebthom.de/134-determine-the-user-who-logged-on-via-ssh/</link>
		<comments>http://sebthom.de/134-determine-the-user-who-logged-on-via-ssh/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 16:16:23 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[username]]></category>

		<guid isPermaLink="false">http://sebthom.de/134-determine-the-user-who-logged-on-via-ssh/</guid>
		<description><![CDATA[Today we had the need to determine the initial id of a user who logged onto a Linux box via SSH and executed the su command. When the su command is issued the effective user is changed and whoami or id commands will report that new user id instead. For anyone who is interested, that [...]]]></description>
			<content:encoded><![CDATA[<p>Today we had the need to determine the initial id of a user who logged onto a Linux box via SSH and executed the <b>su</b> command. When the <b>su</b> command is issued the effective user is changed and <b>whoami</b> or <b>id</b> commands will report that new user id instead.</p>
<p>For anyone who is interested, that is what we came up to put the initial user id into a variable named ${LOGIN_USER}</p>
<pre>LOGIN_USER=`who -m`; LOGIN_USER=${LOGIN_USER%% *}</pre>
<p>or alternatively</p>
<pre>LOGIN_USER=`who -m | cut -d' ' -f1`</pre>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=134" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2009. |
<a href="http://sebthom.de/134-determine-the-user-who-logged-on-via-ssh/">Permalink</a> |
<a href="http://sebthom.de/134-determine-the-user-who-logged-on-via-ssh/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/134-determine-the-user-who-logged-on-via-ssh/&amp;title=Determine the user who logged on via SSH">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/bash/" rel="nofollow tag">bash</a>, <a href="http://sebthom.de/tag/linux/" rel="nofollow tag">Linux</a>, <a href="http://sebthom.de/tag/username/" rel="nofollow tag">username</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/134-determine-the-user-who-logged-on-via-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lotus Notes&#8217; [Send only] and [Send and File] buttons for Outlook 2003</title>
		<link>http://sebthom.de/119-lotus-notes-send-only-send-and-file-buttons-for-outlook-2003/</link>
		<comments>http://sebthom.de/119-lotus-notes-send-only-send-and-file-buttons-for-outlook-2003/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 18:13:08 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[Outlook]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=119</guid>
		<description><![CDATA[You can say what you want about Lotus Notes, if you have used it for a while and switched e.g. to Outlook, you&#8217;ll find yourself missing one or the other nifty Notes function. Already two of my customers &#8220;forced&#8221; me to use MS Outlook 2003 and since this isn&#8217;t likely to change in the near [...]]]></description>
			<content:encoded><![CDATA[<p>You can say what you want about Lotus Notes, if you have used it for a while and switched e.g. to Outlook, you&#8217;ll find yourself missing one or the other nifty Notes function.</p>
<p>Already two of my customers &#8220;forced&#8221; me to use MS Outlook 2003 and since this isn&#8217;t likely to change in the near future, I implemented two of these handy Notes functions for Outlook 2003:</p>
<ol>
<li>The button <b>[Send only]</b> sends e-mails without storing a copy of it in the local mailbox.</li>
<li>The button <b>[Send and File...]</b> prompts you for the folder where to store the e-mail being send.</li>
</ol>
<p>Installation:</p>
<ol>
<li>Download the Visual Basic module in the favored language.<br />
Note: There is a file embedded within this post, please visit this post to download the file.</p>
<p>Note: There is a file embedded within this post, please visit this post to download the file.<br />

</li>
<li>In Outlook open the Visual Basic editor.<br />
<a href="http://sebthom.de/wp-content/uploads/2009/02/01_outlook_open_vbe.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/01_outlook_open_vbe-150x150.png" alt="open VBE from within outlook" title="open VBE from within outlook" class="alignnone size-thumbnail wp-image-121" height="150" width="150" /></a></li>
<li>Import the Visual Basic module.<br />
<a href="http://sebthom.de/wp-content/uploads/2009/02/02_vbe_import.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/02_vbe_import-150x150.png" alt="Import the VBE module" title="Import the VBE module" class="alignnone size-thumbnail wp-image-122" height="150" width="150" /></a> <a href="http://sebthom.de/wp-content/uploads/2009/02/03_vbe_select_file.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/03_vbe_select_file-150x150.png" alt="Select the VBE module" title="Select the VBE module" class="alignnone size-thumbnail wp-image-123" height="150" width="150" /></a> <a href="http://sebthom.de/wp-content/uploads/2009/02/04_vbe_module_imported.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/04_vbe_module_imported-150x150.png" alt="The VBE module was imported." title="The VBE module was imported." class="alignnone size-thumbnail wp-image-124" height="150" width="150" /></a>
</li>
<li>Save the project.<br />
<a href="http://sebthom.de/wp-content/uploads/2009/02/05_vbe_save_module.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/05_vbe_save_module-150x150.png" alt="Save the VBE project" title="Save the VBE project" class="alignnone size-thumbnail wp-image-125" height="150" width="150" /></a>
</li>
<li>Install the buttons in the toolbar.<br />
<a href="http://sebthom.de/wp-content/uploads/2009/02/06_outlook_open_markos.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/06_outlook_open_markos-150x150.png" alt="Open the Macros dialog" title="Open the Macros dialog" class="alignnone size-thumbnail wp-image-126" height="150" width="150" /></a> <a href="http://sebthom.de/wp-content/uploads/2009/02/07_marco_select_install_sendandfile.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/07_marco_select_install_sendandfile-150x150.png" alt="Installing the button [Send and File...]" title="Installing the button [Send and File...]" class="alignnone size-thumbnail wp-image-127" height="150" width="150" /></a> <a href="http://sebthom.de/wp-content/uploads/2009/02/08_msg_sendandfile_installed.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/08_msg_sendandfile_installed-150x120.png" alt="Button [Send and File...] installed" title="Button [Send and File...] installed" class="alignnone size-thumbnail wp-image-128" height="120" width="150" /></a> <a href="http://sebthom.de/wp-content/uploads/2009/02/09_marco_select_install_sendonly.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/09_marco_select_install_sendonly-150x150.png" alt="Installing the button [Send only]" title="Installing the button [Send only]" class="alignnone size-thumbnail wp-image-129" height="150" width="150" /></a> <a href="http://sebthom.de/wp-content/uploads/2009/02/10_msg_sendonly_installed.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/10_msg_sendonly_installed-150x120.png" alt="Button [Send only] installed" title="Button [Send only] installed" class="alignnone size-thumbnail wp-image-130" height="120" width="150" /></a>
</li>
<li>When composing a new e-mail the additional buttons should appear in the toolbar.<br />
<a href="http://sebthom.de/wp-content/uploads/2009/02/11_new_buttons_in_toolbar.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/11_new_buttons_in_toolbar-150x150.png" alt="New buttons in the toolbar" title="New buttons in the toolbar" class="alignnone size-thumbnail wp-image-131" height="150" width="150" /></a>
</li>
<li>When clicking &#8220;Send and File&#8230;&#8221; the folder dialog is displayed before the e-mail is send.<br />
<a href="http://sebthom.de/wp-content/uploads/2009/02/12_sendandfile_select_folder.png" rel="lightbox[119]"><img src="http://sebthom.de/wp-content/uploads/2009/02/12_sendandfile_select_folder-150x150.png" alt="Selecting the target folder" title="Selecting the target folder" class="alignnone size-thumbnail wp-image-120" height="150" width="150" /></a></li>
</ol>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=119" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2009. |
<a href="http://sebthom.de/119-lotus-notes-send-only-send-and-file-buttons-for-outlook-2003/">Permalink</a> |
<a href="http://sebthom.de/119-lotus-notes-send-only-send-and-file-buttons-for-outlook-2003/#comments">19 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/119-lotus-notes-send-only-send-and-file-buttons-for-outlook-2003/&amp;title=Lotus Notes&#8217; [Send only] and [Send and File] buttons for Outlook 2003">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/outlook/" rel="nofollow tag">Outlook</a>, <a href="http://sebthom.de/tag/productivity/" rel="nofollow tag">Productivity</a>, <a href="http://sebthom.de/tag/vba/" rel="nofollow tag">VBA</a>, <a href="http://sebthom.de/tag/visual-basic/" rel="nofollow tag">Visual Basic</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/119-lotus-notes-send-only-send-and-file-buttons-for-outlook-2003/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>getpass for Jython</title>
		<link>http://sebthom.de/70-getpass-jython/</link>
		<comments>http://sebthom.de/70-getpass-jython/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 00:02:15 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Jython]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=70</guid>
		<description><![CDATA[In my current project I am developing some Jython based command line tools and had the need for masking passwords entered in the command shell. Python provides the getpass module for this purpose. Unfortunately this module has not been made available for Jython. Here comes a module I wrote to provide this kind of functionality. [...]]]></description>
			<content:encoded><![CDATA[<p>In my current project I am developing some Jython based command line tools and had the need for masking passwords entered in the command shell. Python provides the <a href="http://www.python.org/doc/lib/module-getpass.html">getpass </a>module for this purpose. Unfortunately this module has not been made available for Jython.</p>
<p>Here comes a module I wrote to provide this kind of functionality. It uses the mechanism described here <a href="http://java.sun.com/developer/technicalArticles/Security/pwordmask/">http://java.sun.com/developer/technicalArticles/Security/pwordmask/</a> to mask characters entered at the command prompt. Additionally if Java 6 or higher is running Jython the module will instead use the new <a href="http://java.sun.com/javase/6/docs/api/java/io/Console.html#readPassword%28%29">Console.readPassword()</a> method. In case the module is running in an environment where the getpass module is available it will delegate to the corresponding methods of this module instead of using its own implementations.</p>
<pre class="python" name="code"># ext_getpass.py
# @author Sebastian Thomschke, http://sebthom.de/
import thread, sys, time, os

# exposed methods:
__all__ = ["getpass","getuser"]

def __doMasking(stream):
    __doMasking.stop = 0
    while not __doMasking.stop:
        stream.write("b*")
        stream.flush()
        time.sleep(0.01)

def generic_getpass(prompt="Password: ", stream=None):
    if not stream:
        stream = sys.stderr
    prompt = str(prompt)
    if prompt:
        stream.write(prompt)
        stream.flush()
    thread.start_new_thread(__doMasking, (stream,))
    password = raw_input()
    __doMasking.stop = 1
    return password

def generic_getuser():
    for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'):
        usr = os.environ.get(name)
        if usr: return usr

def java6_getpass(prompt="Password: ", stream=None):
    if not stream:
        stream = sys.stderr
    prompt = str(prompt)
    if prompt:
        stream.write(prompt)
        stream.flush()

    from java.lang import System
    console = System.console()
    if console == None:
	    return generic_getpass(prompt, stream)
    else:
        return "".join(console.readPassword())

try:
    # trying to use Python's getpass implementation
    import getpass
    getpass = getpass.getpass
    getuser = getpass.getuser
except ImportError, e:
    getuser = generic_getuser

    # trying to use Java 6's Console.readPassword() implementation
    try:
        from java.io import Console
        getpass = java6_getpass
    except ImportError, e:
        # use the generic getpass implementation
        getpass = generic_getpass
</pre>
<p>Here is an usage example:</p>
<pre class="python" name="code">
import ext_getpass as getpass

pw = getpass.getpass("Please enter your password:")
print "The entered password was: " + pw
</pre>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=70" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/70-getpass-jython/">Permalink</a> |
<a href="http://sebthom.de/70-getpass-jython/#comments">One comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/70-getpass-jython/&amp;title=getpass for Jython">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/java/" rel="nofollow tag">Java</a>, <a href="http://sebthom.de/tag/jython/" rel="nofollow tag">Jython</a>, <a href="http://sebthom.de/tag/password/" rel="nofollow tag">password</a>, <a href="http://sebthom.de/tag/python/" rel="nofollow tag">python</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/70-getpass-jython/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WebSphere Portal 6.1.0.0 does not support installation on a managed node</title>
		<link>http://sebthom.de/67-websphere-portal-6100-does-not-support-installation-on-a-managed-node/</link>
		<comments>http://sebthom.de/67-websphere-portal-6100-does-not-support-installation-on-a-managed-node/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 19:42:41 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[WebSphere Portal]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[limitation]]></category>
		<category><![CDATA[websphere portal]]></category>

		<guid isPermaLink="false">http://sebthom.de/67-websphere-portal-6100-does-not-support-installation-on-a-managed-node/</guid>
		<description><![CDATA[With WebSphere Portal 5.1 a new deployment option was introduced that allowed the installation of WP onto an existing node managed by a deployment manager. AFAIK the main reason for this new option was to simplify the cluster setup procedure. Both options, installing WP standalone and federating it into a cell afterwards as well as [...]]]></description>
			<content:encoded><![CDATA[<p>With WebSphere Portal 5.1 a new deployment option was introduced that allowed the installation of WP onto an existing node managed by a deployment manager. AFAIK the main reason for this new option was to simplify the cluster setup procedure.</p>
<p>Both options, installing WP standalone and federating it into a cell afterwards as well as installing it on an already managed node have different pros and cons each. In WP 6.0 the installation onto a managed node was even mandatory to enable WebSphere Process Server integration.</p>
<p>Surprisingly WP6.1.0.0 does not support the installation on a managed node anymore. All nodes of a cluster need to be installed as standalone systems first and then be federated into a WebSphere cell.</p>
<p>For WP 6.0 the installation procedure is described <a href="http://publib.boulder.ibm.com/infocenter/wpdoc/v6r0/topic/com.ibm.wp.ent.doc/wpf/clus_install_primary_fed.html" target="_blank">here</a>. The 6.1 info center does not mention this procedure anymore and it no, it was not dropped accidentally.</p>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=67" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/67-websphere-portal-6100-does-not-support-installation-on-a-managed-node/">Permalink</a> |
<a href="http://sebthom.de/67-websphere-portal-6100-does-not-support-installation-on-a-managed-node/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/67-websphere-portal-6100-does-not-support-installation-on-a-managed-node/&amp;title=WebSphere Portal 6.1.0.0 does not support installation on a managed node">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/deployment/" rel="nofollow tag">deployment</a>, <a href="http://sebthom.de/tag/limitation/" rel="nofollow tag">limitation</a>, <a href="http://sebthom.de/tag/websphere-portal/" rel="nofollow tag">websphere portal</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/67-websphere-portal-6100-does-not-support-installation-on-a-managed-node/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Solved] Blank Pages with WordPress 2.6.x</title>
		<link>http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/</link>
		<comments>http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 18:57:59 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=63&amp;langswitch_lang=de</guid>
		<description><![CDATA[After upgrading to WordPress 2.6 it occasionally happend that an empty page was displayed in the browser when navigating through the blog or working in the admin area. Refreshing the browser using CTRL+F5 usually helped in that case. Today I upgraded to WordPress 2.6.2 and I was not able to access the plug-ins page of [...]]]></description>
			<content:encoded><![CDATA[<p>After upgrading to WordPress 2.6 it occasionally happend that an empty page was displayed in the browser when navigating through the blog or working in the admin area. Refreshing the browser using CTRL+F5 usually helped in that case. Today I upgraded to WordPress 2.6.2 and I was not able to access the plug-ins page of the admin area anymore. No matter how often I refreshed the page in the browser it stayed blank.<br />
First I searched the web for possible solutions. I found quite a number of discussions giving tips about this widely known problem but unfortunately none of these solutions helped in my case.<br />
So I again started debugging the WordPress code and finally found the lines of code causing the trouble. The problem are <b>(object)</b> casts in the <strong>wp-includes/taxonomy.php</strong> file that transform an array into an object:</p>
<pre class="php" name="code">$wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count');
$wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count');
$wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false);
</pre>
<p>Since I don&#8217;t get any error messages neither on the screen nor in the log files I have no idea why these casts fail. The PHP version used to serve the site is the latest stable 5.x release from php.net.<br />
As a workaround I introduced a function that does also transforms an array into an object but does not rely on the casting mechanism.</p>
<pre class="php" name="code">function arr2obj($arr) {
	foreach ($arr as $k => $v) $obj -> {$k} = $v;
	return $obj;
}

$wp_taxonomies['category'] = arr2obj(array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count'));
$wp_taxonomies['post_tag'] = arr2obj(array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count'));
$wp_taxonomies['link_category'] = arr2obj(array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false));
</pre>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=63" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/">Permalink</a> |
<a href="http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/#comments">2 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/&amp;title=[Solved] Blank Pages with WordPress 2.6.x">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/bug/" rel="nofollow tag">bug</a>, <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/wordpress/" rel="nofollow tag">Wordpress</a>, <a href="http://sebthom.de/tag/workaround/" rel="nofollow tag">workaround</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Peter Nalitch &#8211; Guitar</title>
		<link>http://sebthom.de/62-peter_nalitch_guitar/</link>
		<comments>http://sebthom.de/62-peter_nalitch_guitar/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 20:00:06 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[My Music]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://sebthom.de/62-peter_nalitch_guitar/</guid>
		<description><![CDATA[Some weeks ago we had two IT consultants from Russia on-site. Unfortunately one of them introduced me to a &#8211; to me so far &#8211; hidden part Russian culture: the song Guitar from Peter Nalitch. The consultant said that the song eats his brain &#8230; Well, I could not have said it better. I too [...]]]></description>
			<content:encoded><![CDATA[<p>Some weeks ago we had two IT consultants from Russia on-site. Unfortunately one of them introduced me to a &#8211; to me so far &#8211; hidden part Russian culture: the song Guitar from Peter Nalitch. The consultant said that the song eats his brain &#8230; Well, I could not have said it better. I too can&#8217;t get it out of my mind anymore.</p>
<p>If you have not heard it before, you can enjoy it now:</p>
<p>
<div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:73255b9b-4d92-4cc9-b5b2-be45fb896763" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">
<div id="276f4771-80ed-4d4c-8b48-4e005e310b22" style="margin: 0px; padding: 0px; display: inline;">
<div><a href="http://www.youtube.com/watch?v=AOzkN8dHnjk&amp;hl=en&amp;fs=1" target="_new"><img src="http://sebthom.de/wp-content/uploads/2008/07/video4d83482a46db.jpg" galleryimg="no" onload="var downlevelDiv = document.getElementById('276f4771-80ed-4d4c-8b48-4e005e310b22'); downlevelDiv.innerHTML = &quot;&lt;div&gt;&lt;object width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/AOzkN8dHnjk&amp;hl=en&amp;fs=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/AOzkN8dHnjk&amp;hl=en&amp;fs=1&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&quot;;" alt=""></a></div>
</div>
</div>
<p>The original version</p>
<p> (...)<br/>Read the rest of <a href="http://sebthom.de/62-peter_nalitch_guitar/">Peter Nalitch &#8211; Guitar</a> (34 words)</p>
<hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/62-peter_nalitch_guitar/">Permalink</a> |
<a href="http://sebthom.de/62-peter_nalitch_guitar/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/62-peter_nalitch_guitar/&amp;title=Peter Nalitch &#8211; Guitar">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/fun/" rel="nofollow tag">fun</a>, <a href="http://sebthom.de/tag/music/" rel="nofollow tag">My Music</a>, <a href="http://sebthom.de/tag/video/" rel="nofollow tag">video</a>, <a href="http://sebthom.de/tag/youtube/" rel="nofollow tag">youtube</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/62-peter_nalitch_guitar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sun JDK5/6 compilers broken when linking overloaded methods with variable arguments</title>
		<link>http://sebthom.de/56-sun_jdk5_6_compilers_broken_when_linking_overloaded_methods_with_variable_arguments/</link>
		<comments>http://sebthom.de/56-sun_jdk5_6_compilers_broken_when_linking_overloaded_methods_with_variable_arguments/#comments</comments>
		<pubDate>Thu, 15 May 2008 23:23:44 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[jdk]]></category>

		<guid isPermaLink="false">http://sebthom.de/56-sun_jdk5_6_compilers_broken_when_linking_overloaded_methods_with_variable_arguments/</guid>
		<description><![CDATA[We are currently switching the build system of OVal from custom Ant scripts to Maven 2. During that process we accidentally compiled the project using the Java compiler of the Sun JDK 5 instead of the AspectJ compiler. Surprisingly javac did not complain about the missing aspect class files. Instead it already aborted while compiling [...]]]></description>
			<content:encoded><![CDATA[<p>We are currently switching the build system of <a title="OVal - the object validation framework for Java 5 or later" href="http://oval.sourceforge.net/" target="_blank">OVal</a> from custom Ant scripts to Maven 2. During that process we accidentally compiled the project using the Java compiler of the Sun JDK 5 instead of the AspectJ compiler. Surprisingly javac did not complain about the missing aspect class files. Instead it already aborted while compiling an ordinary Java class which only referenced other non-AspectJ related classes. This is the original error message:</p>
<pre>[INFO] [compiler:compile]
[INFO] Compiling 180 source files to C:\projects\oval\src\trunk\target\classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
C:\projects\oval\src\trunk\src\main\java\net\sf\oval\Validator.java:[373,58]
addMethodParameterChecks(java.lang.reflect.Method,int,java.lang.Object)
has private access in net.sf.oval.internal.ClassChecks </pre>
<p>There exist multiple methods named <strong>addMethodParameterChecks</strong> in the class <strong>ClassChecks</strong> with different signatures. The problem is that javac tries to link against the wrong method when compiling the class calling one of the methods. </p>
<p>(...)<br/>Read the rest of <a href="http://sebthom.de/56-sun_jdk5_6_compilers_broken_when_linking_overloaded_methods_with_variable_arguments/">Sun JDK5/6 compilers broken when linking overloaded methods with variable arguments</a> (284 words)</p>
<hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/56-sun_jdk5_6_compilers_broken_when_linking_overloaded_methods_with_variable_arguments/">Permalink</a> |
<a href="http://sebthom.de/56-sun_jdk5_6_compilers_broken_when_linking_overloaded_methods_with_variable_arguments/#comments">One comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/56-sun_jdk5_6_compilers_broken_when_linking_overloaded_methods_with_variable_arguments/&amp;title=Sun JDK5/6 compilers broken when linking overloaded methods with variable arguments">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/bug/" rel="nofollow tag">bug</a>, <a href="http://sebthom.de/tag/compiler/" rel="nofollow tag">compiler</a>, <a href="http://sebthom.de/tag/java/" rel="nofollow tag">Java</a>, <a href="http://sebthom.de/tag/jdk/" rel="nofollow tag">jdk</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/56-sun_jdk5_6_compilers_broken_when_linking_overloaded_methods_with_variable_arguments/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making the DD Sitemap Generator Plug-in work with multilingual blogs</title>
		<link>http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/</link>
		<comments>http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/#comments</comments>
		<pubDate>Thu, 01 May 2008 21:47:38 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/</guid>
		<description><![CDATA[To create a bilingual blog with WordPress I am using the Language Switcher Plug-in. This plug-in allows you to put content in more than one language into the post title and content fields by surrounding the localized texts with special tags indicating their language (e.g. &#8220;[ lang_en]Hello World[ /lang_en][ lang_de]Hallo Welt[ /lang_de]&#8220;). When the posts [...]]]></description>
			<content:encoded><![CDATA[<p>To create a bilingual blog with <a href="http://wordpress.org/" target="_blank">WordPress</a> I am using the <a href="http://www.poplarware.com/languageplugin.html" target="_blank">Language Switcher Plug-in</a>. This plug-in allows you to put content in more than one language into the post title and content fields by surrounding the localized texts with special tags indicating their language (e.g. <strong>&#8220;[ lang_en]Hello World[ /lang_en][ lang_de]Hallo Welt[ /lang_de]&#8220;</strong>). When the posts are viewed in the browser the plug-in will determine the active language and strip off the texts specified in all other languages on the fly.</p>
<p>I am using the great <a href="http://www.dagondesign.com/articles/sitemap-generator-plugin-for-wordpress/" target="_blank">DD Sitemap Generator Plug-in for WordPress</a>&nbsp; to automatically render a site map based on the posts, pages and categories created in my blog. The problem however is that the generated site map is not language aware and displays the page/post titles and category names including the tags and the texts of all languages at once. </p>
<p>To solve this I started digging a bit into the code of WordPress and the Language Switcher Plug-in. The Language Switcher Plug-in achieves the on-the-fly processing of multilingual texts by hooking itself into the so called <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference" target="_blank">Filters API</a> which is something like an event-based callback mechanism. Plug-ins can signal their interest in a certain text filter event by calling the <a href="http://codex.wordpress.org/Function_Reference/add_filter" target="_blank">add_filter(the_event_id, the_name_of_a_function_to_callback)</a> function provided by the WordPress API to register one if it&#8217;s functions that will be invoked by WordPress when the filter event occurs. Besides registering for filter events, plug-ins can also fire such events by calling the <a href="http://codex.wordpress.org/Function_Reference/apply_filters" target="_blank">apply_filters(the_event_id, the_text_to_be_filtered)</a>. WordPress will then apply all registered filters to the text passed over and the apply_filters will return a &#8220;filtered&#8221; version of the passed text. When rendering the title of a post or page WordPress fires the filter event &#8220;the_title&#8221; allowing plug-ins to process/modify the title before it is actually displayed. Therefore the Language Switcher Plug-in registers itself to this event and a lot of others to be able to strip off the language tags and the texts in languages other than the currently active one.</p>
<p>Unfortunately the DD Sitemap Generator Plug-in is currently not applying the respective filters when rendering the site map. Therefore the Language Switcher Plug-in is not aware of it and as a result the site map shows all translations of a category name or page/post title at the same time no matter which language is currently active.</p>
<p>To solve this problem I analyzed the source code of the DD Sitemap Generator Plug-in and added the missing <strong>apply_filters</strong> calls where appropriate. You can follow these steps in case you are having the same issue:</p>
<ol>
<li>Open the file <strong>&lt;wordpress_root&gt;/wp-content/plugins/sitemap-generator/sitemap-generator.php</strong> (or <strong>&lt;wordpress_root&gt;/wp-content/plugins/dd-sitemap-gen/dd-sitemap-gen.php</strong>) in an editor
<li>Locate the text<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = $pages[$k]-&gt;post_title;</font><br />and replace it with<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = <strong>apply_filters(&#8216;the_title&#8217;, </strong>$pages[$k]-&gt;post_title<strong>)</strong>;</font>
<li>Locate the text<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = $cat_data[$c]['cat_name'];</font><br />and replace it with<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = <strong>apply_filters(&#8216;the_category&#8217;, </strong>$cat_data[$c]['cat_name']<strong>)</strong>;</font>
<li>Locate the text<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = $posts[$k]-&gt;post_title;</font><br />and replace it with<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = <strong>apply_filters(&#8216;the_title&#8217;, </strong>$posts[$k]-&gt;post_title<strong>)</strong>;</font>
<li>Save the file and you are done.</li>
</ol>
<p>If you are encountering similar problems with other plug-in you can use the same approach to make them play nicely with the Language Switcher Plug-in.</p></p>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=55" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/">Permalink</a> |
<a href="http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/#comments">3 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/&amp;title=Making the DD Sitemap Generator Plug-in work with multilingual blogs">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/wordpress/" rel="nofollow tag">Wordpress</a>, <a href="http://sebthom.de/tag/workaround/" rel="nofollow tag">workaround</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>[Solved] WordPress 2.5 One-Click Plug-in Upgrades &#8211; Could not create directory</title>
		<link>http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/</link>
		<comments>http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 23:44:06 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/</guid>
		<description><![CDATA[Some days ago I upgraded my WordPress installation to the new 2.5 release. Being a lazy guy I of course wanted to use the new on-click plug-in upgrades feature to update several plug-ins. Trying to one-click update some of the out-dated plug-ins only resulted in the rather meaningless error message &#8220;Could not create directory&#8221;. So [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago I upgraded my WordPress installation to the new <a href="http://wordpress.org/development/2008/03/wordpress-25-brecker/" target="_blank">2.5 release</a>. Being a lazy guy I of course wanted to use the new <a href="http://wordpress.org/development/2008/03/wordpress-25-brecker/" target="_blank">on-click plug-in upgrades</a> feature to update several plug-ins. Trying to one-click update some of the out-dated plug-ins only resulted in the rather meaningless error message &#8220;Could not create directory&#8221;. So I started searching the web for possible solutions. I quickly found <a href="http://wordpress.org/support/topic/164174" target="_blank">some</a> <a href="http://blog.fabrice-pascal.de/item/1132/2008/04/06/" target="_blank">posts</a> explaining this issue to be a directory permission problem. Manually creating the /wp-content/upgrade directory and chmoding it as well as the plug-in directories to 777 should solve the problem. Unfortunately not for me. Therefore I rolled up my sleeves and started to debug WordPress&#8230;</p>
<p>To cut a long story short, eventually I came across this PHP bug report <a href="http://bugs.php.net/bug.php?id=42739" target="_blank">#42739 mkdir doesn&#8217;t like a trailing slash when safe_mode is enabled</a> and it turned out that this was the issue I was facing with on my hosting account too. The safe_mode option is enabled and WordPress tries to create directories that end with a slash (e.g. /htdocs/wp-content/upgrade/the-plugin<strong>/</strong>).</p>
<p>After knowing the reason I could develop a workaround and finally got the one-click updater running. If you are facing the same issue you can try to use my patch too.</p>
<ol>
<li>Locate and open the file <strong>&lt;wp_root&gt;/wp_admin/includes/class-wp-filesystem-direct.php</strong> in an editor <br /> 
<li>Search for &#8220;<strong>function mkdir</strong>&#8221; <br /> 
<li>Add the following statements to this method
<pre class="php" name="code">function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
	if( ! $chmod)
		$chmod = $this-&gt;permission;

	// workaround for http://bugs.php.net/bug.php?id=42739 starts here
	if(ini_get('safe_mode') &amp;&amp; substr($path, -1) == '/')
	{
		$path = substr($path, 0, -1);
	}
	// workaround for http://bugs.php.net/bug.php?id=42739 ends here

	if( !@mkdir($path,$chmod) )
		return false;
	if( $chown )
		$this-&gt;chown($path,$chown);
	if( $chgrp )
		$this-&gt;chgrp($path,$chgrp);
	return true;
}</pre>
<li>Start one-click updating! </li>
</ol>
<p><b>Addendum:</b>
<ol>
<li>The patch also works for WordPress 2.5.1</li>
<li>If applying this patch does not lead to success the problem may have a second cause. Therefore also check the permissions on the /wp-content/upgrade/ folder and it&#8217;s sub folders, e.g. chmod them to 777. If the upgrade directory does not exist at all it may be sufficient to create it manually.</li>
</ol>
<p>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=54" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/">Permalink</a> |
<a href="http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/#comments">36 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/&amp;title=[Solved] WordPress 2.5 One-Click Plug-in Upgrades &#8211; Could not create directory">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/bug/" rel="nofollow tag">bug</a>, <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/wordpress/" rel="nofollow tag">Wordpress</a>, <a href="http://sebthom.de/tag/workaround/" rel="nofollow tag">workaround</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Which Superhero am I?</title>
		<link>http://sebthom.de/52-which_superhero_am_i/</link>
		<comments>http://sebthom.de/52-which_superhero_am_i/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 18:39:35 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://sebthom.de/52-which_superhero_am_i/</guid>
		<description><![CDATA[Recently, I came across the Superhero Quiz at http://www.thesuperheroquiz.com/. Doing the quiz revealed my true personality: You are Superman Superman 70% Robin 60% Green Lantern 50% Spider-Man 50% Supergirl 50% Iron Man 35% The Flash 30% Wonder Woman 20% Catwoman 20% Hulk 20% Batman 20% You are mild-mannered, good, strong and you love to help [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I came across the Superhero Quiz at <a href="http://www.thesuperheroquiz.com/">http://www.thesuperheroquiz.com/</a>. Doing the quiz revealed my true personality:
<p><b>You are <font size="6">Superman</font></b><br />
<table>
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td>Superman</td>
<td>
<hr align="left" width="70" noshade="noshade" size="4" /></td>
<td>70%</td>
</tr>
<tr>
<td>Robin</td>
<td>
<hr align="left" width="60" noshade="noshade" size="4" /></td>
<td>60%</td>
</tr>
<tr>
<td>Green Lantern</td>
<td>
<hr align="left" width="50" noshade="noshade" size="4" /></td>
<td>50%</td>
</tr>
<tr>
<td>Spider-Man</td>
<td>
<hr align="left" width="50" noshade="noshade" size="4" /></td>
<td>50%</td>
</tr>
<tr>
<td>Supergirl</td>
<td>
<hr align="left" width="50" noshade="noshade" size="4" /></td>
<td>50%</td>
</tr>
<tr>
<td>Iron Man</td>
<td>
<hr align="left" width="35" noshade="noshade" size="4" /></td>
<td>35%</td>
</tr>
<tr>
<td>The Flash</td>
<td>
<hr align="left" width="30" noshade="noshade" size="4" /></td>
<td>30%</td>
</tr>
<tr>
<td>Wonder Woman</td>
<td>
<hr align="left" width="20" noshade="noshade" size="4" /></td>
<td>20%</td>
</tr>
<tr>
<td>Catwoman</td>
<td>
<hr align="left" width="20" noshade="noshade" size="4" /></td>
<td>20%</td>
</tr>
<tr>
<td>Hulk</td>
<td>
<hr align="left" width="20" noshade="noshade" size="4" /></td>
<td>20%</td>
</tr>
<tr>
<td>Batman</td>
<td>
<hr align="left" width="20" noshade="noshade" size="4" /></td>
<td>20%</td>
</tr>
</tbody>
</table>
</td>
<td>You are mild-mannered, good,            <br />strong and you love to help others.             <br /><img src="http://www.thesuperheroquiz.com/pics/superman.jpg" /></td>
</tr>
</tbody>
</table>
<p>   <a href="http://www.thesuperheroquiz.com/">Click here to take the Superhero Personality Test</a>     </p>
<p>Which Superhero are you? </p>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=52" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/52-which_superhero_am_i/">Permalink</a> |
<a href="http://sebthom.de/52-which_superhero_am_i/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/52-which_superhero_am_i/&amp;title=Which Superhero am I?">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/fun/" rel="nofollow tag">fun</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/52-which_superhero_am_i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Balls of Steel &#8211; Neg&#8217;s Urban Sports</title>
		<link>http://sebthom.de/51-balls_of_steel_negs_urban_sports/</link>
		<comments>http://sebthom.de/51-balls_of_steel_negs_urban_sports/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 16:42:54 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://sebthom.de/51-balls_of_steel_negs_urban_sports/</guid>
		<description><![CDATA[I just came across a British reality comedy TV series called Balls of Steel I&#8217;d like to share with you. I am probably three years behind but I still think it is worth mentioning. Especially the series segment &#34;Neg&#8217;s Urban Sports&#34; caught my attention. Here is one of my favorite videos where Neg is performing [...]]]></description>
			<content:encoded><![CDATA[<p>I just came across a British reality comedy TV series called Balls of Steel I&#8217;d like to share with you. I am probably three years behind but I still think it is worth mentioning. Especially the series segment &quot;Neg&#8217;s Urban Sports&quot; caught my attention. Here is one of my favorite videos where Neg is performing a &quot;sport game&quot; he calls &quot;Knock and Don&#8217;t Run&quot; which is a rather dangerous version of doorbell pranks.</p>
<p> <embed src="http://www.youtube.com/v/uoxcZiWK79c&amp;hl=en&amp;rel=0" width="425" height="355" type="application/x-shockwave-flash" wmode="transparent" />
<p>You can watch more urban sports videos <a href="http://www.youtube.com/results?search_query=%22Neg%27s+urban" target="_blank">here</a> at YouTube.</p>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=51" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/51-balls_of_steel_negs_urban_sports/">Permalink</a> |
<a href="http://sebthom.de/51-balls_of_steel_negs_urban_sports/#comments">One comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/51-balls_of_steel_negs_urban_sports/&amp;title=Balls of Steel &#8211; Neg&#8217;s Urban Sports">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/fun/" rel="nofollow tag">fun</a>, <a href="http://sebthom.de/tag/video/" rel="nofollow tag">video</a>, <a href="http://sebthom.de/tag/youtube/" rel="nofollow tag">youtube</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/51-balls_of_steel_negs_urban_sports/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

