28/01/2013

Opera quick proxy toggle button

If you use Opera and need to easily and quickly toggle on or off your proxy setting, much like Firefox's QuickProxy add-on, you may try this. Point your browser to this URL:

 opera:/button/Enable%20proxy%20servers,,,%22Disable%20Proxy%22,Expand%20Enabled%20%3E%20Disable%20proxy%20servers,,,%22Enable%20Proxy%22,Expand%20Disabled%20+%20Show%20preferences,22,Proxy%20servers  

Then accept the installation and drag the button where you want. Clicking on it will toggle the proxy on and off and a long-click will bring you to the proxy configuration menu.

25/01/2013

Liferay cannot access login page

If you tinker with Liferay's page permissions, you may accidentally edit those associated with the "Welcome" page, effectively preventing ANYONE from ever logging in again.

To regain access you may try this (replace VERSION with your own):
  • stop Liferay (stop Tomcat), on Linux you need to run: /liferay/apache-tomcat-VERSION/bin/shutdown.sh - you may need to be a superuser to do this. On Windows it's the same path but you should use shutdown.bat instead
  • edit the portal-ext.properties file. You can find it under /liferay/apache-tomcat-VERSION/webapps/ROOT/WEB-INF/classes - and add this line:
 auto.login.hooks=com.liferay.portal.security.auth.CASAutoLogin,com.liferay.portal.security.auth.FacebookAutoLogin,com.liferay.portal.security.auth.NtlmAutoLogin,com.liferay.portal.security.auth.OpenIdAutoLogin,com.liferay.portal.security.auth.OpenSSOAutoLogin,com.liferay.portal.security.auth.RememberMeAutoLogin,com.liferay.portal.security.auth.SiteMinderAutoLogin,com.liferay.portal.security.auth.ParameterAutoLogin  


NOTE: With this, you are enabling the auto-login feature by ANY means on the portal, so remember to remove that line after you've successfully restored your situation.
  • restart Liferay. It's the same as stopping but you should use startup instead of shutdown
  • open any browser and point to:
http://LIFERAY_IP:LIFERAY_PORT?parameterAutoLoginLogin=ADMIN_USERNAME&parameterAutoLoginPassword=ADMIN_PASSWORD

Replacing LIFERAY_IP with your portal's IP (could be localhost), LIFERAY_PORT with your portal's port (could be 8080), ADMIN_USERNAME with the portal's admin username (could be test@liferay.com or simply test) and ADMIN_PASSWORD with the portal's admin password (could be test). EG:

http://localhost:8080?parameterAutoLoginLogin=test&parameterAutoLoginPassword=test

NOTE: You may input ANY user/password there, not necessarily the admin's ones, but that user must have the ability to edit the "Welcome" page's permissions, else he'll now be able to login albeit without the means to solve the issue.

23/01/2013

MySQL database import and export

Here's a run-down of some useful command line commands to manage the import/export operations of your MySQL database using mysqldump and mysql.

Note that the export operations will lock the database down, preventing any non-read operations to be executed on it along with slowing it down significantly.

16/01/2013

[MySQL] Access denied for user ''@localhost

I had a MySQL database on CentOS 5 with user root and no password. I still don't know why, but he no longer had ALL rights on ANY schema, effectively rendering him powerless; plus after logging in:

mysql -h localhost -u root;

a simple

SELECT current_user()

would show '@localhost' and

show databases;

would show only show the information_schema and test schema.

There was no way I could get back my rights, even starting mysql with the --skip-grant-tables option held no positive results and the FAQ on MySQL's site did not cover my case. I kept getting the error: ERROR 1044 (42000): Access denied for user ''@'localhost' to database XXX

Additionally I could not select any database:

use XYZ;

Since I was told I did not have the rights on it. I couldn't even set or change the password neither from shell with:

mysqladmin -u root password 'NEW_PASSWORD'

to set or

mysqladmin -u root -p'OLD_PASSWORD' password 'NEW_PASSWORD'

to change, nor from the mysql prompt:

mysql -u root -p mysql



then:

UPDATE user SET password=PASSWORD('NEW_PASSWORD') where User='root';
FLUSH PRIVILEGES;


07/01/2013

Oracle create database link and error ORA-12514

Creating a database link in Oracle is pretty straightforward and both the official documentation and Toad's Knowledge Xpert well detail the steps.

What might happen afterwards however, is that you successfully test your DB link with a client like Toad or SQLPlus, but get the ORA-12514 "TNS: listener does not currently know of service" error when using it from other clients.
This lengthy post goes well deep into how to troubleshoot errors like it, but the most basic thing you should always check first is "Are my TNSNAMES.ORA files correctly configured on both the local and remote DB?"

You may find that the reason why the client you tested the DB link with worked but the link does not work from another source instead, is that your client uses its own copy of the TNSNAMES file while the one read by your DB server is not correctly updated.