How to setup django on a cpanel server

May 15th, 2010

This is a very good documentation on how to get django up and running on a cpanel server

http://blog.perplexedlabs.com/2008/11/10/setup-python-25-mod_wsgi-and-django-10-on-centos-5-cpanel/

Appfuse: error when doing mvn install eclipse:eclipse

March 3rd, 2010

When creating a new appfuse project following the quick start guide you might see this error:

[INFO] Request to merge when ‘filtering’ is not identical. Original=resource src/main/resources: output=target/classes, include=[], exclude=[ApplicationResources_de.properties|ApplicationResources_fr.properties|ApplicationResources_ko.properties|ApplicationResources_nl.properties|ApplicationResources_no.properties|ApplicationResources_pt*.properties|ApplicationResources_tr.properties|ApplicationResources_zh*.properties|applicationContext-resources.xml|struts.xml|**/*.java], test=false, filtering=true, merging with=resource src/main/resources: output=target/classes, include=[applicationContext-resources.xml|struts.xml], exclude=[**/*.java], test=false, filtering=false

after the command:
mvn install eclipse:eclipse
This is due to an incompatibility with the eclipse maven plugin, you can solve this by running the command like:
mvn org.apache.maven.plugins:maven-eclipse-plugin:2.5.1:eclipse
I saw this solution here:
http://www.mail-archive.com/users@appfuse.dev.java.net/msg17295.html

Appfuse - The Struts dispatcher cannot be found.

December 2nd, 2009

I was getting the following error in my appfuse project, the reason was the security.xml filtered out the page that I was requesting

The Struts dispatcher cannot be found.  This is usually caused by using
Struts tags without the associated filter. Struts tags are only usable when
the request has passed through its servlet filter, which initializes the
Struts dispatcher needed for this tag. - [unknown location]
        at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
        at
org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:52)
        at
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49)

Installing flash debugger on ubuntu

September 15th, 2009

I had a problem installing the flash debugger v10, as a plugin to firefox, on my ubuntu system. The install script always keept asking me for the path to my mozilla browser and no matter what I put in there nothing worked.

I ended up searching for where the libflashplayer.so file is located on my machine and found that it was here

/usr/lib/flashplugin-nonfree/libflashplayer.so

So just copy the debugger to there

Here it is possible to verify what version of the player you have installed and whether its the debugger or not

http://kb2.adobe.com/cps/155/tn_15507.html

EMF complex types missing setters

April 30th, 2009

When EMF generates Java classes for complex types from XSD it only generates getters but not setters for attributes of the class.

This can be fixed by defining the setter method as an annotated operation.

Make sure your complex type has the following structure:

<xsd:complexType name=”ComplexTypeName”>
<xsd:annotation>
<xsd:appinfo ecore:key=”operations”
source=”http://www.eclipse.org/emf/2002/Ecore”>
<operation name=”setNameOfAttribute”>
<parameter name=”value” type=”ecore:EEList{?}” />
<body />
</operation>
<operation name=”setNameOfSecondAttribute”>
<parameter name=”value” type=”ecore:EEList{?}” />
<body />
</operation>

</xsd:appinfo>
<xsd:documentation>
Documentation on the purpose of your class
</xsd:documentation>
</xsd:annotation>
….
</xsd:complexType>

Appfuse don’t create database every time

April 27th, 2009

Every time appfuse is started with

mvn jetty:run-war

the database is re-created. If you want to preserve the previous database turn of tests

mvn jetty:run-war -Dmaven.test.skip=true

Using two Eager fetch in Appfuse + Struts 2 + Hibernate

January 28th, 2009

Apparently Hibernate does not support fetching two Bags Eagerly at the same time.

See problem here http://forum.hibernate.org/viewtopic.php?p=2310316&

I found a solution to the problem, described here in two blog entries

http://jroller.com/eyallupu/entry/hibernate_exception_simultaneously_fetch_multiple

http://jroller.com/eyallupu/entry/solving_simultaneously_fetch_multiple_bags

Appfuse create a custom page to edit users

January 27th, 2009

I am working on a site based on Appfuse + Struts 2 and I needed to create a custom page allowing the logged in user to change add information to his profile.

I decided to base my extension on the already existent User model object in Appfuse, copy pasted the default editProfile.jsp under a new name. Then I added few new fields there and also to the standard user object.

However I noticed a problem that my new jsp page was not getting the logged in user from the UserAction.edit method which I specified in the struts.xml, as it was also for the editProfile.jsp page. Instead I always got a new empty User object.

Looking into the code for the UserAction.edit method I saw that there is a boolean variable at the top of the method that checks wheter the query string included the editProfile string.

Thus there are two solutions to this problem. Let the name of the new .jsp include the string editProfile or simply copy the method into a new action method and hardcode the boolean value to true there. Also the new copied method can ofcourse been simplified.

The easiest way ofcourse is to have the page include the string editProfile.

 

Editing an index created by nutch

November 20th, 2008

I have started to work with the Lucene java search engine and its Nutch Web crawler. My needs are a little bit special so after having nutch crawl Web sites I wan’t to run my own program that cleans up unrelevant documents from the index.

Using the Lucene API jar that is pritty straight forward but you have to be carefull of using the right version of Lucene. I couldn’t find anything info about the supported version of Lucene on the Nutch site but after trying several 2.1.0, http://archive.apache.org/dist/lucene/java/lucene-2.1.0-src.zip, seems to be the correct one for Nutch 0.9

Installing Joomla! on your Nokia phone

April 15th, 2008

With its PAMP (Personal AMP - Apache, MySQL and PHP) for S60 project Nokia has made it possible to install nearly all web based systems created for the popular trio Apache, MySQL and PHP. Here I will show how you can use it to install the content management system Joomla!, http://www.joomla.org, to your phone. (Note that currently only Nokia N95 8GB and E90 phones are supported)

1. Point your phone to http://download.mymobilesite.net, download and install the client, then create an account to the MWS using the software.

2. Next go to http://sourceforge.net/projects/pamp and download the PAMP install (using your PC). Follow the guidelines here for installing, http://wiki.opensource.nokia.com/projects/PAMP:Installation.

3. When everything is installed the next step is to get your phone available  through the public internet. In order  to do that simply start MWS and then PAMP (http://wiki.opensource.nokia.com/projects/PAMP:Connectivity, under the title MWS Gateway)

4. Now you should be able to access https://youraccount.mymobilesite.net/ and see

It works!

Next you can try phpinfo.php.

If that works, then you are all set for installing your favourite CMS!

These ones have been tried:

5. Next step is to create a database for joomla on your phone, there are two ways to do that

You need the MySQL command line tool installed on your PC if you don’t have it download it from http://www.mysql.com, then open your cmd promt and type

mysql -h address
Where address is the IP address of your phone on your WLAN, then create teh database with
mysql> create database joomla;

Query OK, 1 row affected (0.09 sec)

6. Next go to http://www.joomla.org and download the latest release, unzip the archive and copy it to your phones htdocs folder
Nokia Phone Browser\Nokia N95 8GB\Memory Card\Data\apache\htdocs
using Nokia PC suite

7. Next delete index.html from your phones htdocs folder

8. Next open http://YOURPHONESIPADDRESS/ and start the Joomla installation

9. When you reach the database configuration enter

Host Name: 127.0.0.1 (not localhost)

MySQL User Name: dummy

MySQL Password: dummy

MySQL Database Name: joomla

10. Proceed until you reach step 3, then change URL to https://YOURACCOUNT.mymobilesite.net, provide a email address and choose a password.

11. Now delete the installation folder from htdocs

12. Go to https://YOURACCOUNT.mymobilesite.net, you should see the joomla front end :)