Thursday, August 13, 2015

Resolve missing .classpath and .project on Grails project

Problem
You have an existing Grails project. It cannot be imported by eclipse / STS IDE because the files .classpath and .project are both missing.

Solution
Open the terminal on the grails project folder.
Then, run the following command on your terminal:
grails integrate-with --eclipse

Friday, April 24, 2015

How to Execute a bin File on Linux

Problem
How do I execute a .bin file on Linux?

Solution
1. Open your terminal

2. Run the following command to make the file executable:
chmod u+x <file name>

3. Execute the bin file using the following command:
./<file name>

If the installer needs administrator rights, try this command instead:
sudo ./<file name>

Friday, April 17, 2015

How to Run Integration Tests on Grails

Problem
How do I run integration tests on Grails?

Solution
Run the following command on the console:
grails test-app integration:integration

Friday, April 10, 2015

How to Drop All User Tables in Oracle

Problem
You want to remove/drop all user tables from on Oracle Database.

Solution
1. Run the following SQL query
select 'drop table '||table_name||' cascade constraints;' from user_tables;

2. Run the SQL query generated after the 1st step above.

Sunday, February 1, 2015

How to Show Hibernate SQL Statements in Grails

Problem
You want to see all Hibernate SQL statements when using grails.

Solution
You must have these line of codes inside your conf/Config.groovy configuration file.

log4j = { debug 'org.hibernate.SQL' trace 'org.hibernate.type' }
The SQL statements will appear on the standard output console.

Monday, January 19, 2015

Update MySQL User Password

SET PASSWORD FOR 'root'@'localhost' = '';

The SQL script above sets the password for the user root to blank.
The script will run successfully if the current user has UPDATE privilege on the MySQL database.

Friday, October 31, 2014

How to Import Existing GIT Project to BitBucket

Here are the steps to import your existing GIT project to BitBucket. This tutorial focuses on local GIT project. If you plan to import project from your hosting site, checkout this Atlassian article instead.

1. Login to to your BitBucket account.

2. Create a new repo.
Click Create button.
Click Create repository button to save the new repo.

3. Open your Terminal application to the project's path.
cd /path/to/my/repo

3.1. Remove any existing remote (in this case the remote name is origin). Skip this if your project has no remote yet.
git remote rm origin

4. Point your project to the new BitBucket repo.
git remote add origin https://mybitbucketusername@bitbucket.org/mybitbucketusername/myexistingproject.git

5. Push the project and all its refs.
git push -u origin --all

6. Push tags in the project.
git push -u origin --tags

Done. :)