Bulk file copy in unix with custom name

In Unix I have to copy bulk files from one folder to another they are in below form

FILE1_547804_550484_2013-12-19 21.15.32_913.pdf
FILE2_518868_616944_2014-01-03 21.10.49_718.pdf

but while copying to the destination want to remove time part and copy as below:

FILE1_547804_550484.pdf
FILE2_518868_616944.pdf

Continue reading

Posted in unix | Tagged , , | Leave a comment

Copy First N files from current directory to other directory

I was working today on one production issue where a requirement came to restore files from a archive directory in batch of 250, so i created this command to run in unix, have a look might be helpful for you.

Continue reading

Posted in unix | Tagged , | Leave a comment

com.jcraft.jsch.JSchException: reject HostKey: serverName

Today I was working on a Ant target to upload file to server using SCP task which using jsch-0.1.49.jar API. Below is the syntax for same in Ant build.xml. You need to add the API file in class path.

<target name=”copyFileToServer”>
        <echo>::::::::copyFileToServer Example::::::::::::</echo>
    <scp file=”Sample.txt” todir=”${svn.username}:${svn.password}@${hostname}:/tmp/” verbose=”true” port=”2222″  failonerror=”true”/>
  </target>

When I tried this I faced “reject HostKey” error. Reason of error was server was not listed in my known hosts list. So in order to fix this you have two options either add that server to known host list or

Continue reading

Posted in ant | Tagged , | 4 Comments

Download sequence of files using Curl

In day to day life we used to download useful stuff from world wide web, sometime requirement to download sequence of files, one way is to do it manually by clicking individual links or automate the download using Curl.

Showing you that next, how we can do it.

grab Curl from : http://curl.haxx.se/download.html

Curl has the ability to set sequences (including with leading zeroes, and alphanumeric sequences) as part of the download command which makes it a lot easier. This is all covered in the man page so I suggest reading it for a complete understanding of the options available.
Continue reading

Posted in unix | Tagged | Leave a comment

How to get XML from body of soap using XSLT

It happens sometime you want to extract XML body from SOAP message. In order to do that use below mentioned XSLT.

Continue reading

Posted in HowTo, xml | Tagged , | Leave a comment

jQuery: Problem with id containing a period or asterisk

Today I was writing a code to get error text from spring generated span field using jQuery. Where I noticed that name is having a period and asterisk which is not directly supported by selectors.

<div id=”test1″><span id=”*.errors“>The information you entered is invalid. Try again.</span></div>

Continue reading

Posted in jQuery | Tagged | Leave a comment

jQuery Mobile bugs, tips and tricks

jQuery mobile is a framework build upload on jQuery and jQuery UI foundation, which is a unified, HTML5-based user interface system for all popular mobile device platforms. Now days jQuery becoming popular among mobile sites. In spite of bugs (couple of explained below) this should not put you off developing with the framework as no framework is 100% complete, it get improvements/enhancements on going with users feedback. One of the major factor why jQuery Mobile becoming popular is easy to learn,  early adoption of jQuery mobile by mobile sites and a large range of online support, threads and documentation available. Almost all bugs we encountered are known to development team and they definitely will fix those in future releases.

Many of the bugs are unique to the older Android devices (like 2.2, 2.3), therefore with the recent news that Google Chrome is to become the standard browser on Android 4.0 and above means that, jQuery mobile will be more consistent and will offer gr8 performance across devices. Currently, mobile chrome is available through Android Market in Beta.

One interesting fact, was when I ran CSS3/HTML5 compatibility test on Android default browser I got approx 188 points whereas when ran on Chrome I got approx 300 points which means quite a lot improvement and support for new features introduces with CSS3/HTML5.

Link: http://www.google.com/intl/en/chrome/android/ (Supported on Android 4.0+)

Couple of Known Bugs Continue reading

Posted in jQuery Mobile | Tagged , , | Leave a comment

java.lang.UnsupportedOperationException : Please implement

Today during testing of some service I got this UnsupportedOperationException  in which message says Please Implement class#method which I am calling.

Later I digged inside the services code and found Continue reading

Posted in Axis2 | Tagged , , , | Leave a comment

UNIX: How to Automate SSH Login

Yesterday, I was working on some shell script piece for my project and I came across a situation where I have to copy some files from one server to another using ‘scp’ command and also some time have to execute some command on other server.  One requirement was we don’t need to pass the password of functional id inside the script.

User should be able to login to other server without password using command  “ssh -l username remotehost”.

For this I used SSH public key based authentication as below:-

Continue reading

Posted in HowTo, linux, unix | Tagged , | Leave a comment

java.io.NotSerializableException

I was getting this error today during writing a program

java.io.NotSerializableException: com.xxxx.xxx.xxx.thunderhead.Project
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
    at java.util.ArrayList.writeObject(ArrayList.java:570)

 

Continue reading

Posted in Java, Troubleshoot | Leave a comment