Monday, October 17, 2011

Start Ubuntu in text mode


Running the desktop/X11 is very resource intensive, you probably don't want to do it all the time or on production server. Follow the instructions here to start your ubuntu in text mode only.

Install X11 on Ubuntu 10.04 LTS

By default, Ubuntu server 10.04 LTS is text mode only. Follow the stesp below to install X11 (or full desktop).
  1. sudo apt-get update
  2. sudo apt-get install ubuntu-desktop
  3. sudo reboot
After restart, the login screen should show up.

Friday, October 14, 2011

Enable Alfresco JavaScript Debugger

Reference http://aboutalfresco.blogspot.com/2009/11/enable-javascript-debugger.html
The debugger will open in a Java swing window. So it won't work if the server doesn't have GUI, for example, ubuntu without X-windows.

Thursday, October 13, 2011

Alfresco JavaScript Web Script Logging

Add logging in web script JS file
logger.log("whatever");

Change log4j setting in custom-log4j.properties
log4j.logger.org.alfresco.repo.jscript=debug
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug

Restart tomcat.

Friday, October 7, 2011

Where are the tags saved in Alfresco

You can use Node Browser to navigate to where the tags are saved.

  1. Login alfresco
  2. Open node browser
  3. workspace://SpaceStore > children categoryRoot > children taggable
You may not see taggable if no tag exists. Credits goes to
https://forums.alfresco.com/en/viewtopic.php?f=12&t=18091

Alfresco Tomcat JVM Tuning

I have an Alfresco installation with Tomcat server. Which file shall I use to setup JAVA_OPTS for tomcat?

The JAVA_OPTS is not set in alfresco.sh or catalina.sh. Instead, it is in tomcat/scripts/ctl.sh. Stop tomcat, make necessary changes and restart tomcat. You can verify it by

sudo ps -ef | grep java

Wednesday, October 5, 2011

Start CentOS without GUI

I have a VM with CentOS 6.0. It runs quite slow. To speed it up, I decide to turn off X11 GUI. Following the instructions here, this can be done by editing /etc/inittab. Just change from 
id:5:initdefault:
to
id:3:initdefault:
and restart.

Install VirtualBox Guest Additions on CentOS

Follow these steps to install VirtualBox Guest Additions for a CentOS VM.

1. Download guest addition.
This is done by by VirtualBox menu Devices > Install Guest Additions. This will download the file to /media folder.

2. Install dkms
According to this, you need to install dkms before installing guest addition. On CentOS, this is done by "yum install dkms". However, new installation does not have RPMForge repository configured. Follow the instructions here to add RPMForge then go back to install dkms.

3. Install guest additions
Open terminal, change to /media/CentOS-6.0-x86_64-LiveDVD, then run "sh ./VBoxLinuxAdditions.run".

4. Restart

Note run the commands as root by su -c 'your command'.



Alfresco Mimetype & Transformer

Alfresco has a web script that lists the registered mimetypes. http://localhost:8080/alfresco/service/mimetypes. Clicking one of the mimetype also shows the transformer and to/from formats it supports.




Create a CentOS 6 VM with VirtualBox

The steps to create a CentOS 6 VM using VirualBox.
  1. Download CentOS 6 Live DVD X86_64
  2. Start VirtualBox and create a new virtual machine. Select  RedHat (64 bit) as OS. Make sure to allocate > 512M RAM to the VM.
  3. Power on VM. In First Run Wiard, browse to the downloaded Live DVD iso file.
  4. After the system starts, hit "Install to Hard Drive" on the desktop to start installation.
  5. Follow the instructions to install CentOS
  6. The hard drive for the VM will need partition. Select "Re-initialize" when prompted
  7. Restart after installation is complete (in VirtualBox VM settings, make sure it boots from hard disk instead of CD/DVD. Or it will still use the Live DVD)
It is important for the VM to have more than 512M RAM. Otherwise, the "Install to Hard Drive" won't run in GUI mode.

Tuesday, September 27, 2011

How to install Alfreso Bulk Import tool?

Alfresco Bulk Filesystem Import Tool just had 1.0 release. The following steps describe how to install it.

  1. Download the latest AMP file containing the tool from here
  2. Shutdown your Alfresco instance
  3. Make a backup of the original alfresco.war file. On Tomcat, this is located in ${ALFRESCO_HOME}/tomcat/webapps
  4. Use the Alfresco Module Management Tool to install the AMP file obtained in step 1
    1. Delete the tomcat work and temp directories - run "sudo /opt/alfresco-3.4.1/bin/clean_tomcat.sh"
    2. Remove the ~/tomcat/webapps/alfresco directory (make sure to backup any file you have modified in this directory)
    3. Preview - "/opt/alfresco-3.4.1/java/bin/java -jar /opt/alfresco-3.4.1/bin/alfresco-mmt.jar install /home/alfresco/alfresco-bulk-filesystem-import-1.0.amp /opt/alfresco-3.4.1/tomcat/webapps/alfresco.war -preview"
    4. Install - "/opt/alfresco-3.4.1/java/bin/java -jar /opt/alfresco-3.4.1/bin/alfresco-mmt.jar install /home/alfresco/alfresco-bulk-filesystem-import-1.0.amp /opt/alfresco-3.4.1/tomcat/webapps/alfresco.war"
  5. Restart Alfresco, watching the log carefully for errors
References
  1. http://code.google.com/p/alfresco-bulk-filesystem-import/
  2. http://code.google.com/p/alfresco-bulk-filesystem-import/wiki/Install
  3. http://wiki.alfresco.com/wiki/Module_Management_Tool

Friday, September 23, 2011

Where can I find Alfresco content model definition?

Alfresco content model definition can be found here http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/repository/config/alfresco/model/contentModel.xml

Thursday, August 25, 2011

Alfresco Workflow Console

You must login as "admin". http://:/alfresco/faces/jsp/admin/workflow-console.jsp

Tuesday, August 2, 2011

GWT webAppCreator

GWT has a handy utility called webAppCreator. It can be used to create a GWT project with the necessary artifacts, including Eclipse project file and ant build file. It can even create a maven build file - I need to check this out. Details can be found here. The best way to start a GWT project is to run webAppCreator and import it into Eclipse.

Create a clickable GWT ImageCell

Here is my use case. A search returns a list of Document objects. A GWT CellTable displays the list. One of the table columns shows an icon based on document type, i.e., pdf, word etc. When a user double clicks the icon, it retrieves the content of the document.

GWT ImageCell does the icon part nicely. However, there is no built-in behavior to support clicking. To do that, I had to create a subclass of ImageCell and override a couple of methods. The credit goes to a post on stackoverflow.

The code below is the solution. One thing to note is that the Context object provides access to the actual object (Document, in my case) associated with the column. Here I am merely creating an alert with the document name. There are certainly a lot more exciting stuff you can do with it.




Column<Document, String> iconColumn = new Column<Document, String>(
new ClickableIconCell()) {
@Override
public String getValue(Document object) {
return "images/pdf-16.png";
}
};




private class ClickableIconCell extends ImageCell {

@Override
public Set<String> getConsumedEvents() {
Set<String> consumedEvents = new HashSet<String>();
consumedEvents.add("dblclick");
return consumedEvents;
}

@Override
public void onBrowserEvent(Context context, Element parent,
String value, NativeEvent event,
ValueUpdater<String> valueUpdater) {

switch (DOM.eventGetType((Event) event)) {
case Event.ONDBLCLICK:
Document doc = (Document) context.getKey();
Window.alert(doc.name);
break;

default:
break;
}
}
}



Friday, July 22, 2011

Create an Alfresco JMX Dump

I am working with Alfresco support on an issue and they asked me to provide a JMX dump of my Alfresco system. How in the world can I do that!? Remember that Google is your best friend. It turns out Alfresco has a nice, easy way - just a simple JSP page.
http://localhost:8080/alfresco/faces/jsp/admin/jmx-dumper.jsp

Alfresco WCM 500page Error

I installed Alfresco WCM on an existing 3.4.1 server a couple of days back. Everything worked fine. However, it threw me an "500page" error today. I finally figured out what was going on.

My Alfresco installation is on a VirutalBox VM with dynamic IP assigned every time the VM is started. When it was running last time, I went to the site in Share, Web Quick Start > Document Library > Alfresco Web Quick Start, and changed the hostname in metadata for Quick Start Editorial. I used the IP address at that time. Since the IP has changed, it could not find the hostname+port+page anymore and thus the 500 page error. It is back working after I updated the hostname with the current IP.

I think the assumption is that you should run Alfresco WCM on a fixed IP. Oh well, this is just my sandbox and I can live that inconvenience.

Thursday, July 21, 2011

Revisit my own blog

I am not an avid blogger. I did it occasionally in the past, mostly to keep notes of what I have done. When I revisited my blog today, boy, I already forgot some of the stuff and couldn't believe I wrote it.

Surprisingly, I also found quite a few comments. I am thrilled that some of the readers/followers found it helpful. On the other hand, I think I need to do a better job answering questions. So I turned on the email notification of comments.

Happy blogging...

Thursday, April 28, 2011

Get solaris version

uname doesn't give the OS release number. look at /etc/release.
Published with Blogger-droid v1.6.7

Wednesday, April 20, 2011

hibernate class loading problem in oas

oas will try to load its own antlr.jar from toplink. make sure to uncheck oracle.toplink from class loading during deployment. it will then use the antlr jar bundled from hibernate.
Published with Blogger-droid v1.6.7