Posts

Showing posts from 2017

find a jar file by the name of class

A utility to find the text from archives. This strain is specifically useful for finding the particular jar file if it contains the given class. Use it freely on any Unix and Linux platform. for f in `find $1 -name "*.jar"` do if [ `jar tf $f | grep "class" | sed 's|/|.|g' | grep $2 | wc -l` -gt 0 ] ; then echo $f fi done Example usage: $ ./jarFinder . com.ibm.ws.webservices.engine.description.OperationDesc Output ./libs/Lib/com.ibm.ws.runtime.jar ./libs/Lib/com.ibm.ws.runtime.jar

find a file by content with line number on unix linux platform

Find a file on linux/ unix/ cygwin platform by the content. This inline script will give the name of the file, line number of searched text in nested directories. Find command adds the selection of file and can be used to accommodate others variations like since date modified, file type etc. find . -name "*.java" -exec grep -H -n "express" '{}' \; Example Output ./com/abc/HttpRequestInterceptor.java:120:           if (StringUtils.isEmpty(request.getHeader("express"))) { ./com/abc/HttpRequestInterceptor.java:123:           if (!request.getHeader("xxxxx").equalsIgnoreCase("true")) { ./com/abc/xyz.java:10: *  either expressed or implied. ./com/xxxx/abc.java:282:          String expression = "^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$"; ./com/xxxxx/AddressChangeUtil.java:284:           Pattern pattern = Pattern.compile(expression); ./com/xxxxx/changecontact/ChangeContactSaveHelper.java:64:            

Unix/Linux Inline command for extracting file and filetype

filetype=`echo $f | awk '{n=split($0, a, ".")} END{print a[n] }'` filename=`echo $f | awk '{n=split($0, a, "/")} END{print a[n] }'` where $f is the full path of the file. It can be used directly too as.. filetype=`echo "/home/myuser/a.b.c.d.txt" | awk '{n=split($0, a, ".")} END{print a[n] }'` output : txt filename=`echo "/home/myuser/a.b.c.d.txt" | awk '{n=split($0, a, "/")} END{print a[n] }'` output: a.b.c.d

VitualBox Host Only Adapter & NAT configuration.

Image
Oracle Virtualbox is great virtualisation  solution for developers. The best feature of VirtualBox is, "it's free" and its runs on Linux, Mac & Windows. Many time when people want to set up Virtualbox they have two common requirements. 1. To connect to internet from guest i.e. the virtual machine. 2. To be able to connect to virtual machine from host computer. Now let's talk on solution. Requirement '1' can be met with configuration of 'NAT', like in screenshot below. This will enable the virtual machine to connect to internet. Now we want to enable LAN sort of connectivity between host and guest machines. For this we have to follow following steps. 1. Create a host only adapter by going to Virtualbox > Preferences 2. Add a host only adapter as shown. 3. Setup up DHCP if you want. I personally don't like DHCP, so my example will have manual setup in it. If you are following this example, be sure to uncheck DHCP confi

The object identified by: 31 could not be found

The Problem Abstract  I encountered a strange exception while restarting my admin WebLogic server. Everything was working fine a day ago. But a day later its was giving me strange issue of "object 31" error. After struggling for a while I realized that some startup option was creating the issue. The startup options was containing JVM arguments "-Dweblogic.management.server=t3://10.188.103.55:7002" . The admin server should not contain this, as it makes the server to run in managed server mode. So the issue was, admin server was starting as managed server and trying to contact itself, creating a deadlock kind scenario. Usually ${ADMIN_URL} sets up the variable "weblogic.management.server". I tried to find out that who set this variable for admin mode startup, as setDomain.sh script enforces this variable is null for admin server startup sequence. On little debugging on environment variables at operating system level, it was clear ${JAVA_OPTS} was export

JQuery/ Javascript text box text slides to label and mandatory field validation

I was thinking about an effect where on click or on focus the indicative text of text box become a label and slides animatedly to left. If one leaves the text box blank then the label again slides into text box and validation check is done. Attached is the code. View the example at  http://jsfiddle.net/rfL96u6c/ HTML < head > < meta http-equiv = "Content-Type" content = "text/html; charset=US-ASCII" > < title > Insert title here </ title > < script src = "http://code.jquery.com/jquery-1.9.1.min.js" ></ script > < script   type = "text/javascript" src = "../js/textboxanim.js" ></ script > < link href = "../css/registration_page.css" rel = "stylesheet" type = "text/css" > < style type = "text/css" > </ style > </ head > < body > < form action = "doRegistration" method =

Google Charts/ Google Table, put tooltip on header row.

A strange problem was seen while trying to enhance google table to add tooltip like function on the header of the table. This problem has few steps, as I am putting down below.   How to add tooltip like function on the column of the google table Google data structures for charting work well for the tooltip for all other charts but when you try to put the tooltip in the header of a google table, no inbuilt mechanism works. To solve this we can use following method on either jquery 'hover' or 'mouseover' functions.This will Javascript function drawTable (jsondata){ var d = JSON. parse (jsondata); var tooltip = d[ 0 ]; var table = new google.visualization .Table( document . getElementById ( 'table_div' )); table.draw(tableData, {showRowNumber: false }); var mouseover = function () { var index = jQuery(this) .index (); $ (" #tooltip ") .html (tooltip[index]); }; var mouseout = function () { $ (" #tooltip &quo