My mistakes

Author Archive

When other applications try to open a new browser and navigate to a url sometimes we will get an error like “an error occurred while starting the browser”. This may be due to your default browser is not set properly.

To resolve this issue you have to change the default browser.

Debian based distributions

sudo update-alternatives –config x-www-browser
sudo update-alternatives –config gnome-www-browser





username@hostname:~$ python

>>>from passlib.context import CryptContext
>>>print CryptContext(['pbkdf2_sha512']).encrypt('PASSWORD')

Replace the PASSWORD with the appropriate password.

username@hostname:~$su - postgres_username
postgres_username@hostname:~$psql -t database_name
database_name=#UPDATE res_users SET password='', password_crypt='$pbkdf2-sha512$25000$U.r9H4Ow9l5LiVHq3dt77w$q0f2q/WcDLD3I8/KzB3E4TqJ6vaKIXqWySE8HyRCzJXbh4N8wZtcJjN2zPQ5337PYep6IFFIUeoshUm1beMifg' WHERE id=1;


Posted on: April 25, 2014

MySQL distinct count if conditions unique

Build a query to find distinct women and men in a given records. 
The row is identified by the field id and it may be duplicated , but the gender for an id should only be counted once.

    COUNT(DISTINCT CASE WHEN gender ='m' THEN id END) as male_count,  
    COUNT(DISTINCT CASE WHEN gender ='f' THEN id END) as female_count
FROM table.

Try the below solution.

  1. cd .metadata/.plugins
  2. mv org.eclipse.core.resources org.eclipse.core.resources.bak
  3. Start eclipse
  4. It will start but will show errors with opened tabs. This is because we have changed the resources folder, which eclipse use for managing the resources
  5. Close all opened tabs
  6. Exit from Eclipse
  7. Delete any newly create org.eclipse.core.resources folder
  8. Rename back the ‘org.eclipse.core.resources.bak’ to ‘org.eclipse.core.resources’
  9. Start Eclipse
  10. It should start fine with all projects

It worked for me.

This information is taken from the below URL.

SEVERE: Servlet.service() for servlet EmailServlet threw exception
java.lang.SecurityException: Access to default session denied

Please try the below solutions
1) Verify there is no duplication of javamail.jar in the tomcat or in your application.

Check the tomcat_home/lib , your_app/WEB-INF/lib

2)  Verify you are using only one email configuration to call the Session.getDefaultInstance through out the site.

Because as per the documentation the replication of the configuration with getDefaultInstance will cause an error.

In such case if you want to insist with the new configuration then use Session.getInstance instead of Session.getDefaultInstance.


The Apache Tika™ toolkit detects and extracts metadata and structured text content from various documents using existing parser libraries

For more information follow the below link


Things to take care

1) Set the contentType on the jsp via

<%@ page contentType="text/html;charset=UTF-8" %>

2) Set this tag inside the jsp:
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8" />

3) Add the below filter to the web.xml

<!– Ensure UTF-8 encoded pages so that certain characters are displayed and submitted correctly –>


4) Make sure the database fields have appropriate collation like utf-8, utf-16