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, 23 de fevereiro de 2015

How to install Oracle SQL Developer on Ubuntu 14.04

If you need to connect to an Oracle database, you can use Oracle SQL Developer.

To do so, you need to download the installer from Oracle's website here http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html

Before you are able to download it, you will have to login or create an Oracle account here https://login.oracle.com/mysso/signon.jsp

The version I'm going to use is 4.0.3 (4.0.3.16.84), from September 15, 2014.

Download the rpm one.

Once the download is finished, using terminal, go to the folder where you saved the installer and execute:

Install the required dependencies:

sudo apt-get install alien lsb

You will also need a JDK (Java Development Kit) installed. If you don't have it, follow this tutorial http://douglascrp.blogspot.com/2014/08/how-to-install-oracle-java-on-ubuntu.html

With dependencies in place, execute:

sudo alien --scripts sqldeveloper*rpm

and then

sudo dpkg -i sqldeveloper*deb

If everything is ok, you are ready to start Oracle SQL Developer.

Using terminal, execute:

sqldeveloper

On the first time you run it, it wil ask you to provide a valid JDK installation path.

Type the full pathname of a JDK installation (or Ctrl-C to quit), the path will be stored in /home/user/.sqldeveloper/4.0.0/product.conf
 
If you followed the tutorial above, type:
/usr/lib/jvm/java-7-oracle

Hit enter and it's done.





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.