Monday, March 24, 2014

Scheduling windows task from batch file - Converting a batchfile into exe

I was looking for an automated solution to do a repetitive search on the internet daily for a certain keyword to increase the hit count.

So, I created a java program which will connect to google and do search for me. And return some JSON data. Which one can format if wish to.

// Insert here : java - google search code - from home workspace.

 Next step was to create a batch file which will create a scheduled task and will run this jar everyday at a certain time.

So found a link on how to schedule a task using batch file... http://support.microsoft.com/kb/814596

So I created my task using this one as,

schtasks /create /tn "TASKNAME" /tr "java -jar C:\YOURJARNAME.jar" /sc DAILY /st 17:00:00


But for end user to give batch file and asking them to execute was too much. They are happy to do double click and done thing ! So, I searched to convert a batch file into executable. And found good link.

http://www.computerhope.com/dutil.htm - This has a utility bat_to_exe which I used.

And that's it.

Then I distributed the jar and the exe to the end users and asked them to copy both files under C:\ and then click on .exe file. Which will create a scheduled task to execute this jar everyday at 5 pm.

Hope this helps someone !

//Hardik

Thursday, February 20, 2014

X11 Application - XServer

To run X-window/X11 application from remote machine
**********************************************
Install http://mobaxterm.mobatek.net/
This is XServer and X11Enabeled.

Now if on remote machine user is not enabeled to use X11 application you will notice something like this...

X11 connection rejected because of wrong authentication.
X connection to localhost:11.0 broken (explicit kill or server shutdown).

To solve this problem follow steps below
http://joelinoff.com/blog/?p=729

This one worked for me !

Thursday, January 30, 2014

Guice !

http://code.imagej.net/gbh/arch/Guice.html

http://musingsofaprogrammingaddict.blogspot.co.uk/2008/12/from-0-to-guice-in-15-minutes.html

https://groups.google.com/forum/#!topic/google-guice/J2M64gM6Yao

http://www.factorypattern.com/google-guice-tutorial/

http://www.journaldev.com/2403/google-guice-dependency-injection-example-tutorial


http://www.javabeat.net/introduction-to-google-guice/
Check the "Making use of Binding Annotation".
And "Writing a simple provider".

 http://blog.crazybob.org/2006/01/i-dont-get-spring.html

Tuesday, November 26, 2013

Liferay

Liferay Hook development
http://learntolead-liferay.blogspot.co.uk/2012/07/liferay-hook-4-custom-action-prelogin.html

IBM TAM SSO with Liferay
http://www.khau-tech.com/2012/11/19/ibm-tivoli-access-manager-sso-with-liferay/


Which Action class to use to extend the action behaviour
*************************************************
https://www.liferay.com/community/wiki/-/wiki/Main/Struts+Action+Hook+Tips?_36_pageResourcePrimKey=21386817

SPRING MVC Liferay Portlet
--------------------------------------------
http://www.opensource-techblog.com/2012/09/spring-mvc-portlet-in-liferay.html

Thursday, November 14, 2013

Some handy Unix/Linux commands

To find a process with specific string and then kill a series of such processes.
-------------------------------------
kill -9 `ps -ef | grep <string> | grep -v grep | awk '{print $2}'`


Make a file void / empty
------------------------------------
cat /dev/null > abc.txt


Super duper command to remove cache/page cache from Linux
---------------------------------------------------------------------------------------
free && sync && echo 3 > /proc/sys/vm/drop_caches && free

More on this refer...
http://unix.stackexchange.com/questions/87908/how-do-you-empty-the-buffers-and-cache-on-a-linux-system


 

Tuesday, November 05, 2013

Liferay 6.2 - Installations - LDAP integration

Liferay 6.2 - LDAP Integration
*****************************

Liferay 6.2 has no properties files ! Which were there until previous version. I guess now these are part of database tables.

So, while I was trying to integrate my server with LDAP server (TDS) I could configure the LDAP using the Control panel of liferay. And server was able to connect to LDAP.

But due to some issue I was not able to login using any of my ldap users or the default portal user. I was not able to login to the portal.

In earlier version there was a property file named, portal-ext.properties which used to hold those ldap specific values. But this doesnt exist in Liferay 6.2.

While looking at database ( portal database ), I found a table named portalpreferences, which has those ldap properties.

SELECT preferences FROM lportal.portalpreferences where portalPreferencesId = 10160


So, I changed the values of the parameters,
ldap.auth.enabled and ldap.auth.enabled ( which are two check boxes on the LDAP configuration page needs to be checked to enable LDAP login ) to false.

And that's it.

It worked for me, hope it helps you. This is still work under progress and I am looking to complete this LDAP connectivity with Liferay 6.2. So will keep updating this post.

https://www.liferay.com/documentation/liferay-portal/6.2/user-guide/-/ai/integrating-existing-users-into-liferay-liferay-portal-6-2-user-guide-17-en



Thursday, October 10, 2013

WebSphere Portal - Authoring Template - Ephox error IWKAP0009E: Servlet not enabled.

We upgraded our portal server to use the latest Ephox editor because the old version was giving logs of Java Security errors.

We applied the fix pack (? - will add exact number later ! ).

And restarted the server but was getting strange error while clicking on "New" button in WCM. On click it will show "IWKAP0009E: Servlet not enabled."

After googling came across this article which is exactly the problem we had and it we resolved following it...

http://www-01.ibm.com/support/docview.wss?uid=swg21445801

Another tech note which also suggests to do the same thing...

https://www.ibm.com/developerworks/mydeveloperworks/blogs/WCML2Thoughts/?lang=en