Skip to main content

Posts

Showing posts from February, 2014

Java remove redundant values in a list of String and sort it

            List<String>idees=new ArrayList<String>();             idees.add("0009232329329323923");             idees.add("9009232329329323923");             idees.add("5009232329329323923");             idees.add("1009232329329323923");             idees.add("4009232329329323923");             idees.add("3009232329329323923");             idees.add("6009232329329323923");             idees.add("2009232329329323923");             idees.add("7009232329329323923");             idees.add("0009232329329323924");             idees.add("0000000000000000000");             idees.add("0000000000000000000");             idees.add("0000000000000000000");             idees.add("0000000000000000000");             idees.add("0000000000000000000");             idees.add("0000000000000000000");                  

enable/disable element in html

<!DOCTYPE html> <html> <head> <script> function disable_enable(){ if (document.all || document.getElementById){ if (document.test1.test2.disabled==true) document.test1.test2.disabled=false else document.test1.test2.disabled=true } } </script> </head> <body>  <form name="test1">       <p><input type="test" value="A Button" name="test2" disabled> <a       href="javascript:disable_enable()">Click here</a></p>     </form> </body> </html>

SQL group by comon mistakes

problem:   we have millions of patient visits and we want to get all last patients visits in the hospital solution: 1-we have to separate them by patient id wise  to avoid engine crushing               2- we will use group by in our query BUT we should group by only patient id ***trick***  to bring more details in your query and avoid redundancy  , then you may add more columns but in the form of calculations  then you don't have to put them after group by the below example brings max visit of each patient ..and i have added VISIT_DATE as well in my details without adding it after group by ....just by using max (v.VISIT_DATE) select  max(v.VISIT_NO) , v.PATIENT_ID ,max(v.VISIT_DATE) as last_visit from OPS_PATIENT_VISITS v   where  v.PATIENT_ID  between 1 and 10 group by v.PATIENT_ID