Monday, September 29, 2014

Git rollback latest changeset

In git to rollback the latest changeset, you do a git reset hard and specify the commit ID of the changeset before that.

For example suppose your latest commit id is fd1793a0a8366bdd48a85f7afe4fe26339f1149c. And the commit id of the previous commit is a6755301e8b283a0c7191028bb7611feff003cdd. To roll back fd1793a0a8366bdd48a85f7afe4fe26339f1149c this is what you do

git reset --hard a6755301e8b283a0c7191028bb7611feff003cdd

This points your Head to a6755301e8b283a0c7191028bb7611feff003cdd, effectively rolling back fd1793a0a8366bdd48a85f7afe4fe26339f1149c.

Monday, September 15, 2014

Debug tomcat web apps using intellij (IntelliJ attach to process)

1>Go to Run>Edit Configurations

Create a configuration under remote

In "Search sources using Module's classpath", select the project that you want to debug

(In your catalina.bat you will have something like this set JPDA_ADDRESS=localhost:8000)

2>Start tomcat server using the command (the switch jpda is what enables debugging)
catalina.bat jpda  start

You can also use the below command, if you want to make a copy of tomcat console into a file
catalina.bat   jpda   run > catalina.out 

3>Click the bug symbol on the upper right corner of intelliJ

4> If everything goes well, you should this in your console.

Sunday, September 14, 2014

Enabling SQL trace on PostgreSQL 9.3 (on 64 bit Windows 7)

Edit C:\Program Files\PostgreSQL\9.3\data\postgresql.conf  and update the following values

#log_statement = 'all'
#log_min_error_statement = error

Restart the service postgresql-x64-9.3

Now you can see all the SQL queries against postgreSQL DB in