25/02/2013

Oracle delete purge object

In Oracle, when you delete a table with the DROP TABLE statement (or another object for that matter), it's not definitevly deleted as it goes instead into the recycle bin. This can be good as you may recover your objects with the FLASHBACK command but can also cause issues if other objects depend on or refer to the deleted one.

To permanently delete the object, you can either disable the recycle bin or use the PURGE command along with you DROP statement.

Oracle test if nested table has elements

If you're using nested tables in Oracle and need to check wether they're empty or not, you can use the IS EMPTY statement:

SELECT nt.*
FROM myTable t, TABLE(t.myNested) nt
WHERE t.myNested IS [NOT] EMPTY;

Oracle get nested table element value without column name

In Oracle, if you have a nested table with a single unnamed column (usually named simply "element"), you can access its value by using the COLUMN_VALUE keyword:

SELECT nt.COLUMN_VALUE
FROM myTable t, TABLE(t.myNested) nt;

07/02/2013

Oracle get MAX or MIN between multiple values

In order to get the MAX or MIN between multiple values (NOT just numbers!) you can respectively use GREATEST or LEAST.

NOTE: beware! If one of the parameters you pass is NULL, then the function will return NULL!

Windows 7 enable Telnet client

So, you're happily using Windows 7 when suddenly you feel the urge to Telnet but your console says: 'telnet' is not recognized as an internal or external command, operable program or batch file.

If you get this error, you must add the Telnet client to your Windows installation. Go to Control panel->Programs and features->Turn Windows features on or off then scroll down to "Telnet Client", check it and press OK.
Now wait until installation is complete and you're done!

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.