Posts

defining functions clojure

(defn saysomething      " i dont want to talk to you"      [name]      (str "why is it so?" name)) #'my-clojureproject1.core/saysomething => (println (saysomething "anjana") => (defn saymorethings "what do you want to hear" [name] (str "life is a box of chocolates" name)) #'my-clojureproject1.core/saymorethings => (println (saymorethings "nirosha")             ) life is a box of chocolatesnirosha nil

Learning clojure day-1

;; Clojure 1.6.0 => (count a[eee ttt tt]) CompilerException clojure.lang.ArityException: Wrong number of args (2) passed to: core/count--inliner, compiling:(C:\Users\\AppData\Local\Temp\form-init7824848865457405872.clj:1:1) => (count [eee tt 565 dfsxf 889 dfgd]) CompilerException java.lang.RuntimeException: Unable to resolve symbol: eee in this context, compiling:(C:\Users\\AppData\Local\Temp\form-init7824848865457405872.clj:1:1) => (count ["aaa" "ddd" 56 45 ""]) 5 => (def storages["ssss" "sddsdsd" "333dsfsd"]) #'my-clojureproject1.core/storages => (first storages) ssss => (second storages) sddsdsd => (last storages) 333dsfsd => (nthext storages 2) CompilerException java.lang.RuntimeException: Unable to resolve symbol: nthext in this context, compiling:(C:\Users\am055849\AppData\Local\Temp\form-init7824848865457405872.clj:1:1) => (nthnext storages 2) ("333dsfsd") =&g

Deploy 2 spring .war with different context on JBOSS 7 AS

Image
Assume you have 2 applications SpringApp1.war SpringApp2.war when you try to deploy both on JBOSS 7 AS,  you will may see some error like this: Exception sending context initialized event to listener  instance of class org.springframework.web.util.Log4jConfigListener  java.lang.IllegalStateException: Web app root system property already set to  a different value: 'webapp.root' = [E:\jboss-as-7.1.1.Final\standalone\deployments\SpringApp1.war] instead of [E:\jboss-as-7.1.1.Final\standalone\deployments\SpringApp2.war]  - Choose unique values for the 'webAppRootKey'  context-param in your web.xml  ensure you add the below context param in web.xml of both the .war files:

How to get count of distinct column in ORACLE

select   DISTINCT COL_NAME_1,count( DISTINCT COL_NAME_2) as COUNT from TABLE_NAME   group by COL_NAME_1 ;

Compare Text in 2 files and write the difference in a new file

Here I am reading 2 files, first file data is added to list.second file data is added to another list.Then converting 2 list to 2 Hashset. Then i am removing 1st hashset from the 2nd one.In this process all the common string will get removed and the new Hashset will have the difference data. /**  * Getting 2 text files with single column data in each, need to find out the difference and write the difference between the 2 files to a new file.  */ public class CompareTwoFiles { public static List readcsv(String filename) { List l=new ArrayList(); String tempstr = ""; String dataStr = ""; int rownum = 0; try { BufferedReader br = new BufferedReader(new FileReader(filename)); try { String line = ""; while ((line = br.readLine()) != null) { l.add(line); // System.out.println(dataStr); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace();

Capture AJAX response and assign to a variable using JQUERY

function checkforduplicateempname(){  var message=true;  /*Assigning AJAX response to a javascript variable*/  var empId = $.ajax({    url: 'checkforduplicateempname.relay',    data: oMyForms,    cache: false,    contentType: false,    processData: false,    global: false,    async:false,    type: 'POST',    success: function(data){     return data;        },error:function(){     $("#empname").notify("Unable to check for duplicate title.","error");        } }).responseText; //end of ajax capturing the response     if(empId!='0'){     $("#empaname").notify("Duplicate Title.","error");     message=false;     } return message; }//end of function

How to retain the space of the td after hidding it in Jquery

Image
If you use the following code snippet to hide and show tds- the UI will get disturbed. The next corresponding td will get shifted to the hidden td space.    var tablevar="#"+myTable;  $(tablevar+' tr:eq('+i+')').find('td:eq(3)').show();    $(tablevar+' tr:eq('+i+')').find('td:eq(2)').show(); So how to retain the td space and still achieve the functionality. use the this code snippet.    var tablevar="#"+myTable; $(tablevar+' tr:eq('+i+')').find('td:eq(3)').css("visibility", "hidden");  $(tablevar+' tr:eq('+i+')').find('td:eq(2)').css("visibility", "hidden");  $(tablevar+' tr:eq('+i+')').find('td:eq(4)').css("visibility", "visible");