Categories
Linux Software

WordPress: Solution for “Image could not be processed. Please go back and try again.”

This is a rather cryptical error message WordPress gives when trying to upload a header image and it fails.

The solution is to make sure your server has php(5)-gd installed.

Ubuntu:

apt-get install php5-gd

Red Hat:

yum install php-gd
Categories
Development Java Linux Red Hat Software

jpackages error: Missing Dependency: /usr/bin/rebuild-security-providers

Jpackages on Red Hat has a nifty bug that causes dependency errors.

Luckily, somebody has created a fix as a rpm package 🙂

wget http://plone.lucidsolutions.co.nz/linux/centos/images/jpackage-utils-compat-el5-0.0.1-1.noarch.rpm
rpm -ivh jpackage-utils-compat-el5-0.0.1-1.noarch.rpm

And then jpackages works.

Categories
Linux Software

ImportError: No module named trac

When working with a new Trac installation you can bump into the error message “ImportError: No module named trac”. This is usually caused by Trac installation not unzipping all the needed files.

The following one liner should fix the issue:

cd /usr/lib/python2.4/site-packages;unzip Trac-0.12.2-py2.4.egg
Categories
Linux Red Hat

package subversion-1.6.12-0.1.el5.rf.x86_64 (which is newer than subversion-1.4.2-4.el5_3.1.i386) is already installed

Package conflict that can appear some times, a simple fix then is to downgrade first, then upgrade:

 

yum --downgrade update subversion
yum update subversion
Categories
Java

Tips for implementing a custom JAAS login module for Jetty

1) jetty-web.xml

You can gather all specific settings for Jetty in the file WEB-INF/jetty-web.xml, remember to also specify paths for the role principals if you use your own classes for that.

Example jetty-web.xml file:

<!-- Jetty specific config file -->
<Configure>

<!-- Tell jetty where to find login config -->
<Call name="setProperty">
	<Arg>java.security.auth.login.config</Arg>
	<Arg>WEB-INF/login.config</Arg>
</Call>

<!-- Bug fix for Jetty to properly handle login config in a per-project setup -->
<Set name="serverClasses">
	<Array type="java.lang.String">
		<Item>-org.mortbay.jetty.plus.jaas.</Item>
		<Item>org.mortbay.jetty</Item>
		<Item>org.slf4j.</Item>
	</Array>
</Set>

<!-- Create login realm -->
<Get name="securityHandler">
	<Set name="userRealm">
		<New>
			<Set name="name">*NAME OF YOUR REALM*</Set>
			<Set name="LoginModuleName">*NAME OF YOUR LOGIN CLASS*</Set>
			<Set name="roleClassNames">
				<Array type="java.lang.String">
					<Item>*PATH TO YOUR ROLE PRINCIPAL CLASS*</Item>
				</Array>
			</Set>
		</New>
	</Set>
</Get>
</Configure>

2) Adding roles to a user in commit

When you want to give a user roles(like admin, moderator etc), you can add those to the user when he or she is authenticated and commit is called upon:

	public boolean commit() throws LoginException {
		MyUserPrincipal user = new MyUserPrincipal("username");

		//Add logged in user as first principal
		subject.getPrincipals().add(user);

		//Add roles for the logged in user
		subject.getPrincipals().add( new MyGroupPrincipal("admin") );
		subject.getPrincipals().add( new MyGroupPrincipal("moderator") );
	}