Seja bem-vindo

Espero que as dicas apresentadas aqui sejam úteis para você.
Se gostar de alguma coisa, não esqueça de comentar e recomendar, caso ache importante.

Currículo

segunda-feira, 26 de janeiro de 2015

Some quick Alfresco Activiti workflow tips

If you are working with Activiti workflows on Alfresco, here are some quick tips I found and I hope can save you some time.


Delete workflow instances

When you are in the development phase, usually you will have lots of workflows started, but not always finished.
If you want to remove all the running workflow instances, you can use a simple command in the workflow console (http://server:8080/alfresco/faces/jsp/admin/workflow-console.jsp)

delete all workflows imeanit

But there is a problem with this command.
It won't remove the workflow historical registers on database, and you can find some problems accessing your completed tasks after you undeploy your old workflow definitions.
This is a bug, and it wasn't fixed until 4.2.f, as described here https://issues.alfresco.com/jira/browse/ALF-20522

All you need to do is to run a delete on the database to delete all historic data for no existing workflow definitions:

delete from ACT_HI_TASKINST where not exists (select pd.ID_ from ACT_RE_PROCDEF pd where pd.ID_ = PROC_DEF_ID_);


Avoid having users starting your custom workflows

If you created custom workflows, but you are starting then using code, so maybe it's a good idea to hide those workflows in the Start Workflow form.
This can be done including the following section into your share-config-custom.xml file:

<config condition="Workflow" evaluator="string-compare">
    <hidden-workflows> 
        <workflow name="activiti$workflowId"></workflow>
    </hidden-workflows>
</config>

quinta-feira, 18 de setembro de 2014

A better approach to install Liferay on Tomcat using Ubuntu's provided package

When you install Tomcat using apt-get on Ubuntu, its root folder will be in /var/lib/tomcat7

Inside of it, there will be some folders and symbolic links

work -> ../../cache/tomcat7
logs -> ../../log/tomcat7
conf -> /etc/tomcat7
shared
server
common
temp
webapps

Folders bin and lib will be in /usr/share/tomcat7

Following the install process described in Installing Liferay on Tomcat 7 you will see, in the first sentence:

Liferay Home is one folder above Tomcat’s install location.
If you start Liferay without changing anything, just like the tutorial says, Liferay will create its folders in the Liferay Home, which is, by default, /var/lib/.

Having application data folders inside /var/lib is not a good idea, just like Dave Kliczbor commented on the comments section on that page.

In order to "fix" that behaviour, create the file /var/lib/tomcat7/webapps/ROOT/WEB-INF/classes/portal-ext.properties and add the line

liferay.home=/var/lib/tomcat7
Create the folders /var/lib/tomcat7/data and /var/lib/tomcat7/deploy and make them writeable for the user tomcat7 running

sudo chown -R tomcat7:tomcat7 /var/lib/tomcat7/data
sudo chown -R tomcat7:tomcat7 /var/lib/tomcat7/deploy


That's enough to have your Liferay server ready to run.

sexta-feira, 29 de agosto de 2014

How to fix "Setting locale failed" message on Ubuntu

Sometimes, when you try perform some activities on Ubuntu like manage packages using apt-get, you can see messages like:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_TIME = "pt_BR.UTF-8",
LC_MONETARY = "pt_BR.UTF-8",
LC_ADDRESS = "pt_BR.UTF-8",
LC_TELEPHONE = "pt_BR.UTF-8",
LC_NAME = "pt_BR.UTF-8",
LC_MEASUREMENT = "pt_BR.UTF-8",
LC_IDENTIFICATION = "pt_BR.UTF-8",
LC_NUMERIC = "pt_BR.UTF-8",
LC_PAPER = "pt_BR.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

and
locale: Cannot set LC_ALL to default locale: No such file or directory

You can see what the problem is by typing:
locale

You will see something like:
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=pt_BR.UTF-8
LC_TIME=pt_BR.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=pt_BR.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=pt_BR.UTF-8
LC_NAME=pt_BR.UTF-8
LC_ADDRESS=pt_BR.UTF-8
LC_TELEPHONE=pt_BR.UTF-8
LC_MEASUREMENT=pt_BR.UTF-8
LC_IDENTIFICATION=pt_BR.UTF-8
LC_ALL=

As you can see, LC_ALL has no value.

Type:
sudo update-locale LC_ALL="en_US.UTF-8"

This adds LC_ALL=en_US.UTF-8 to /etc/default/locale.

Reboot your server and check again by typing:
locale
If you get something like the output bellow, then you are ok:
LANG=en_US.UTF-8LANGUAGE=en_US:enLC_CTYPE="en_US.UTF-8"LC_NUMERIC="en_US.UTF-8"LC_TIME="en_US.UTF-8"LC_COLLATE="en_US.UTF-8"LC_MONETARY="en_US.UTF-8"LC_MESSAGES="en_US.UTF-8"LC_PAPER="en_US.UTF-8"LC_NAME="en_US.UTF-8"LC_ADDRESS="en_US.UTF-8"LC_TELEPHONE="en_US.UTF-8"LC_MEASUREMENT="en_US.UTF-8"LC_IDENTIFICATION="en_US.UTF-8"LC_ALL=en_US.UTF-8
See ya.

How to install Oracle Java on Ubuntu 14.04

Ubuntu usually comes with OpenJDK, but if you need, or simply prefer to use Oracle's Java proprietary package, then you can follow the steps bellow and have it installed on Ubuntu.

On terminal, type:

sudo add-apt-repository ppa:webupd8team/java (adds the repository to the sources list)
You will see some info, and you can safely type ENTER to continue.
sudo apt-get update (updates the available packages list)
sudo apt-get install oracle-java7-installer (download and install Oracle Java package)

In order to check if Java was intalled, type:

java -version

If everything is right, you should see something like this:

java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

Even though Oracle Java is installed, it's still not the default Java.

To configure it correctly, you have to type:

sudo update-alternatives --config java

I hope this post can be useful for someone else.

domingo, 1 de junho de 2014

How to install ImageMagick from sources on Ubuntu 14.04

I was running an Alfresco Community 4.2.f instance on Ubuntu 14.04, but thumbnails and avatar were not working.
When the server started, I got the following error message about ImageMagick:

no decode delegate for this image format

The solution I've found was to remove the ImageMagick installed using apt-get, which at the time of writing was, 6.7.7.10, and install the latest version available at the ImageMagick site from source.

Below are the steps I've followed:

Removing ImageMagick package:
$ sudo apt-get remove imagemagick

Installing the build dependencies:
$ sudo apt-get update
$ sudo apt-get install build-essential checkinstall libx11-dev libxext-dev zlib1g-dev libpng12-dev libjpeg-dev libfreetype6-dev libxml2-dev
$ sudo apt-get build-dep imagemagick

Downloading ImageMagick sources:
$ wget http://mirrors-au.go-parts.com/mirrors/ImageMagick/ImageMagick-6.8.9-2.tar.gz

Preparing and building:
$ tar -xzvf ImageMagick-6.8.9-2.tar.gz
$ cd ImageMagick-6.8.9-2
$ ./configure
$ sudo checkinstall
$ sudo ldconfig /usr/local/lib 

Following the above steps ImageMagick was installed and ready to use.
By default, it will be installed in /usr/local/bin

In order to allow Alfresco to generate thumbnails, it's required to setup the
alfresco-global.properties

Configure properties bellow and it's done:
img.exe=convert
img.root=/usr/local/bin

References:
http://namhuy.net/1730/install-imagemagick-6-8-linux-mint-ubuntu.html
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=17059#p63413