find . | xargs grep -s stringToFind
Cron jobs are located in /var/spool/cron/crontabs
crontab -l
Search for files
find . -name "filename.ext" -print 2> /dev/null
My log of technical experiments, installations and updates
It is very easy to generate Axis web service stubs (artifacts) using soapUI tool. NOTE: This can also be done using the commands
Put file in C:\Projects\Jars\axis-1_4\lib
cd C:\Projects\Jars\axis-1_4\lib
java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java -p<packageName> <WSDLFileName/ URL>
soapUI is a web service, SOA, SOAP testing tool which provides a GUI for generating these stubs for those who do not like the command line. soapUI is a free open source desktop application for inspecting contract, invoking, developing, testing (functional, load, compliance, simulation) web services.
First in File-> Preferences->Tools tab set the Axis 1.x directory where you have downloaded the library files. Axis libraries can be downloaded out here : http://www.apache.org/dyn/closer.cgi/ws/axis/1_4
Tools->Axis 1.0 Artifacts
Put in the WSDL and the directory where you want the stubs to be located
In the Advanced tab you can specify the package where stubs should be placed
Generate button will start the task of generating stubs
In the following articles I will demonstrate how I called the web service using these stubs.
dwr 3.0 is still in development stages but after checking out dwr 2.0 which requires XML configuration I was willing to take the risk of diving into a release candidate library under heavy development.
web.xml
1: <context-param>2: <param-name>contextConfigLocation</param-name>3: <param-value>/WEB-INF/applicationContext.xml</param-value>4: </context-param>5: <listener>6: <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>7: </listener>8: <servlet>9: <servlet-name>dispatcher</servlet-name>10: <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>11: <load-on-startup>2</load-on-startup>12: </servlet>13: <servlet-mapping>14: <servlet-name>dispatcher</servlet-name>15: <url-pattern>*.do</url-pattern>16: </servlet-mapping>17: <servlet-mapping>18: <servlet-name>dispatcher</servlet-name>19: <url-pattern>*.html</url-pattern>20: </servlet-mapping>21: <servlet-mapping>22: <servlet-name>dispatcher</servlet-name>23: <url-pattern>/dwr/*</url-pattern>24: </servlet-mapping>
Notice there is no DwrServlet. Everything goes to Spring’s DispatcherServlet
dispatcher-servlet.xml
1: <?xml version="1.0" encoding="UTF-8"?>2: <beans xmlns="http://www.springframework.org/schema/beans"3: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"4: xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"5: xmlns:context="http://www.springframework.org/schema/context"6: xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"7: xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd8: http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd9: http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd10: http://www.springframework.org/schema/context11: http://www.springframework.org/schema/context/spring-context-2.5.xsd12: http://www.directwebremoting.org/schema/spring-dwr13: http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd">14:15: <!-- Annotation-based configuration-->16: <context:annotation-config />17:18: <!--
19: To remove the explicit bean definitions: Spring can scan package names20: to find beans to manage as follows21: -->22: <context:component-scan base-package="*" />23:24: <!-- Enable DWR AJAX functionality-->25: <dwr:configuration />26: <dwr:annotation-config />27: <dwr:annotation-scan />28: <dwr:url-mapping />29: <dwr:controller id="dwrController" debug="true" />30:31: <!--AnnotationMethodHandler-->32: <bean33: class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />34: <!-- bean
35: class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /-->
DwrService
1: package service.impl;2:3: import java.util.ArrayList;4:5: import org.directwebremoting.annotations.RemoteMethod;6: import org.directwebremoting.annotations.RemoteProxy;7: import org.springframework.beans.factory.annotation.Autowired;8: import org.springframework.stereotype.Service;9:10: import beans.Printer;11: import dao.jdbc.VmecsDaoJdbc;12:13: @Service14: @RemoteProxy15: public class DwrService {16:17: @Autowired18: private DaoJdbc db;19:20:21: @RemoteMethod22: public ArrayList<Printer> getPrinters() {23: return this.db.getPrinters();24: }25: }
Bean converter
1: package beans;2:3: import org.directwebremoting.annotations.DataTransferObject;4: import org.directwebremoting.annotations.RemoteProperty;5: import org.directwebremoting.convert.BeanConverter;6:7: @DataTransferObject(converter = BeanConverter.class)8: public class Printer {9: @RemoteProperty10: private String printerName;11: @RemoteProperty12: private String queueName;13:14: /**
15: * @return the printerName16: */17: @RemoteProperty18: public String getPrinterName() {19: return this.printerName;20: }21:22: /**
23: * @param printerName24: * the printerName to set25: */26: public void setPrinterName(String printerName) {27: this.printerName = printerName;28: }29:30: /**
31: * @return the queueName32: */33: @RemoteProperty34: public String getQueueName() {35: return this.queueName;36: }37:38: /**
39: * @param queueName40: * the queueName to set41: */42: public void setQueueName(String queueName) {43: this.queueName = queueName;44: }45:46: }
Browse to the test page:-
Enter input (if required) and hit Execute. The output is JSON
I have not explained the annotations since they seem to be self-explanatory. If you have any questions leave a comment.
eg. osgi.instance.area.default=c:/Projects
Look what I received in my email today. Last time I used Offlice Live Workspace beta – My editing rights were removed without informing me that the beta period had expired. I found out the hard way. When I click on a word doc it used to prompt me to download!
At present, I use Ms Office Live Workspace as a backup for my Google docs account. Should I try Ms again? That depends on whether it is beta and the “soon” factor
Your Office Live Workspace account will be upgraded for free.
Good news!
Your Microsoft Office Live Workspace beta account is about to become even better. You already know it’s a great way to store and share documents, and soon it will come together with Windows Live SkyDrive to become a great way to view, create, and edit documents from virtually anywhere.
In the coming months, you’ll receive notification when your Office Live Workspace account will be upgraded, along with further details. Until then, there’s no need for you to do anything.
With your SkyDrive account, you’ll get 25 GB of online storage for sharing both documents and photos. Your SkyDrive account is designed to work smoothly with other Windows Live services like Hotmail and Messenger. And you’ll be able to view and edit documents from virtually anywhere* using new Microsoft Office Web Apps.
Questions? Visit the Office Live Workspace upgrade center.
* An appropriate device, Internet connection, and Internet Explorer, Mozilla Firefox, or Safari browser are required.
©Microsoft Corporation. One Microsoft Way, Redmond, WA 98052-6399, USA
All rights reserved. Legal | Trademarks | Privacy
Replace all orange items with Project specific, version specific and system specific settings
You might have to uninstall and reinstall some plugins depending on the plugins that are complaining when you run clean, upgrade or run-app command.
grails –clean
“Resolve plugins” if you are using Netbeans
grails –upgrade
NOTE: This is not a foolproof way to downgrade grails version. These are just some notes I remember from my ordeal.
If you want to go to the last page or referer application history.go(-1) works for IE but it does not work in FireFox.
<a href="javascript:void(0);" onClick="JavaScript:history.go(-1);">Back</a>
The fix is to use history.back(); return false; as shows below:-
<a href="javascript:void(0);" onclick="history.back(); return false;">Back</a>
Reference: https://developer.mozilla.org/En/DOM/Window.history
To upgrade grails on a project I download the latest distribution binary zip from http://grails.org/Download and unzip it over my old installation on c:\grails to override my older installation.
On starting Netbeans it automatically downloads the updated dependencies:-
Welcome to Grails 1.3.0 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: c:\grails
Base Directory: C:\Projects\ProjectEditor
Resolving dependencies...
Downloading: c:\grails\lib\gpars-0.9.jar ...
Download complete.
Downloading: c:\grails\dist\grails-docs-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-bootstrap-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-scripts-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-core-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-resources-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-web-1.3.0.jar ...
Download complete.
Downloading: c:\grails\lib\groovy-all-1.7.2.jar ...
Download complete.
Downloading: c:\grails\dist\grails-crud-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-gorm-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-spring-1.3.0.jar ...
Download complete.
Downloading: c:\grails\lib\junit-4.8.1.jar ...
Download complete.
Downloading: c:\grails\dist\grails-test-1.3.0.jar ...
Download complete.
Dependencies resolved in 63984ms.
I then run the upgrade command on individual projects:-
grails upgrade
Running script c:\grails\scripts\Upgrade.groovy
Environment set to development
WARNING: This target will upgrade an older Grails application to 1.3.0.
Are you sure you want to continue?
(y, n)
NOTE: Your application currently expects grails version [1.2.2], this target will upgrade it to Grails 1.3.0 ...
y
[delete] Deleting directory C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\resources
[copy] Copying 1 file to C:\Projects\ProjectEditor\web-app\WEB-INF
[copy] Copying 1 file to C:\Projects\ProjectEditor\web-app\WEB-INF
[copy] Copying 4 files to C:\Projects\ProjectEditor\web-app\WEB-INF\tld
Installing zip c:\grails\plugins\grails-hibernate-1.3.0.zip... ...
[mkdir] Created dir: C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins\hibernate-1.3.0
[unzip] Expanding: c:\grails\plugins\grails-hibernate-1.3.0.zip into C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins\hibernate-1.3.0
Installed plugin hibernate-1.3.0 to location C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins/hibernate-1.3.0. ...
Resolving plugin JAR dependencies ...
Executing hibernate-1.3.0 plugin post-install script ...
Plugin hibernate-1.3.0 installed
Installing zip c:\grails\plugins\grails-tomcat-1.3.0.zip... ...
[mkdir] Created dir: C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins\tomcat-1.3.0
[unzip] Expanding: c:\grails\plugins\grails-tomcat-1.3.0.zip into C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins\tomcat-1.3.0
Installed plugin tomcat-1.3.0 to location C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins/tomcat-1.3.0. ...
Executing tomcat-1.3.0 plugin post-install script ...
Plugin tomcat-1.3.0 installed
Plugin provides the following new scripts:
------------------------------------------
grails tomcat
Please make sure you view the README for important information about changes to your source code. ...
Project upgraded
The reCAPTCHA PHP Library provides a simple way to place a CAPTCHA image verification on your PHP website, helping you stop bots from abusing it. The library wraps the reCAPTCHA API.
require_once('recaptchalib.php');
$publickey = "..."; // you got this from the signup page
echo recaptcha_get_html($publickey);
require_once('recaptchalib.php');
$privatekey = "...";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
This tip is when you use ssl (https). reCAPTCHA code by default is not for ssl and hence IE8 would show the following popup:-
Now if you click Yes – you will not get the reCAPTCHA code since it is http code and if you click No – you will see reCAPTCHA.
Code for reCAPTCHA looks like this :-
require_once('recaptchalib.php');
$publickey = "..."; // you got this from the signup page
echo recaptcha_get_html($publickey);
The reCAPTCHA website does not have any code to explain this. But if you go through the library you will see that you have to change the last line of the above code to say:-
echo recaptcha_get_html($publickey,null,true);
First parameter is your public key, second is your error string and third is whether ssl is enabled. We have used reCAPTCHA for our Asha for Education donation page
If you have used any version of Spring upto 3.0 you would be surprised when using form:label tag:-
<form:label path="foo.bar"/>
does not render anything in HTML. You would not see the data in foo.bar in the resultant HTML. In fact the html equivalent would be <label for="foo.bar"></label>
For the text to show in your view use <form:label path="foo.bar">The actual label</form:label>
eg. <form:label path="foo.bar">${command.foo.bar}</form:label>
There is already a Spring JIRA issue for the MessageSource support: http://jira.springframework.org/browse/SPR-2566
Toad for Oracle 10.5 released in mid-April 2010 and I decided to give the (not so easy) update a shot.
Help->Check for Updates on 10.1 said there was no upgrade available
Based on my prior experience you need to manually download the latest executable from their website https://support.quest.com/MySupportLink/MySupportLink.aspx This requires a Site ID which validates your license and your profile.
After logging in search for ‘Toad for Oracle’
Click on the Downloads tab
You would need to know your licensed products. Quest allows you to download all executables if you are not licensed it will only show up as a trial version. I used the Toad for Oravle 10.5 Commercial Installer
Toad does not upgrade the previous version. After installing you will have to import settings from the older version and then uninstall the older version
I had to change the folder to make it work
The Quest SQL Optimizer for Oracle requires you to have .Net Framework. What’s weird about this is there is no version of .Net Framework named 2.1. I received this error message even after I installed 4.0
I love Toad and I am going to give its Toad for MySQL freeware a try : http://www.quest.com/toad-for-mysql/
Ever get the SEVERE: Error listenerStart and can't find the error? Logs don't seem to help since this is a container start up problem.
May 3, 2010 3:01:09 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.5.0_07\bin;C:\Program Files\Tomcat\5.5\bin;C:\oracle\ora10_2\BIN
May 3, 2010 3:01:10 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
May 3, 2010 3:01:10 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 984 ms
May 3, 2010 3:01:10 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 3, 2010 3:01:10 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.26
May 3, 2010 3:01:10 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.
May 3, 2010 3:01:15 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 3, 2010 3:01:15 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/CameraProject] startup failed due to previous errors
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
May 3, 2010 3:01:15 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
May 3, 2010 3:01:16 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
May 3, 2010 3:01:16 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/63 config=null
May 3, 2010 3:01:16 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
May 3, 2010 3:01:16 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6391 ms
Start Tomcat
=========
I'm using tomcat - and whilst I understand Jetty is meant to be good for development, it doesn't seem to yet support eclipse 3.2. You probably have a script to start and restart tomcat or using a plugin to restart it. I'm using sysdeo (http://www.eclipseplugincentral.com/...k-cid-120.html) which seemed to me to be the most common. With the sysdeo plug in I can start my tomcat in eclipse which can link in to the debugger. In this case I have used MyEclipse to reproduce the error.
Attach the source
==============
in your build path (project properties, java build path) select the libraries tab and the spring jar. Expand the + and click on source attachment, and edit the path to be the spring source 'src' directory. I manually downloaded spring 3.0 release with the sources and pointed to that jar file : http://www.springsource.com/download/community
Set Breakpoint in ContextLoaderListener
=========================
In the spring jar on the build path, find org.springframework.web.context and the ContextLoaderListener class. Set a breakpoint at line which will read this.contextLoader.initWebApplicationContext(event .getServletContext()); This will be around line 47 (Spring 3.0)
find the error!
==========
Now when you start tomcat from within an eclipe plugin it will stop at the above. Choose to 'step return' once and then wait for the container to load everything up and find an error. If there is an error you will now be at standardcontext.listenerstart and you can now look at the error in the variable window under 't'. There are 'cause' error, make sure you take a look at them all since some can be wrapped/hidden. If you're using hibernate, I find that this does show the hbm mapping file problems, but the actual bean which causes the error can be wrong - it seems to just take the first bean in its list!
In my case the error was :-
java.io.FileNotFoundException: class path resource [application.properties] cannot be opened because it does not exist