Monthly Archives: October 2011

how To sort a hashmap using its keys and/or values

To sort a hashmap using its keys :- Dump the HashMap into a TreeMap: Map yourMap= new HashMap(); // put some tuples in yourMap … Map sortedMap = new TreeMap(yourMap); To sort a hashmap using its values :- public HashMap getSortedMap(HashMap hmap) … Continue reading

Posted in collections

[Java] Reverse ordering a TreeMap

TreeMap is a Map that keep the element in the natural order of the key. The order can be changed providing to the contructor of the TreeMap a Comparable. So you can implement your custom one for more specific tasks. However if you only … Continue reading

Posted in collections

get post by title

function get_post_by_title($page_title) { global $wpdb; $post = $wpdb->get_var( $wpdb->prepare( “SELECT ID FROM $wpdb->posts WHERE post_title = %s “, $page_title )); if ( $post ) { $post= get_post($post, $output); //print_r($post); $language=get_bloginfo(‘language’); if($post->post_type==”research”){ $research_language= get_post_meta($post->ID, ‘language’, true); // print $research_language. ” “.$language;print … Continue reading

Posted in wordpress

junit music box on eclipse

Posted in junit

Introduction to jUnit

Posted in junit

copy over network at linux

scp admin@ amazon_price_checker_uk-25.csv with different port scp -P 15000 /u001/sso_software/Single_sign_on/oam_11.1.1.5.tar.gz  oracle@

Posted in linux | Tagged , ,

SqlExecuter vs JDBC

public class CmdExec { public static void main(String argv[]) { executeSql(); } private static void executeSql() { final class SqlExecuter extends SQLExec { public SqlExecuter() { Project project = new Project(); project.init(); setProject(project); // setTaskType(“sql”); setTaskName(“sql”); } } SqlExecuter executer … Continue reading

Posted in java, jdbc, mysql