Monthly Archives: November 2011

monitor your logs in linux

tail -f

Posted in Uncategorized | Comments Off on monitor your logs in linux

How To get Number Of Lines In A File In Linux Shell Command

wc -l filename

Posted in Uncategorized | Comments Off on How To get Number Of Lines In A File In Linux Shell Command

how to access DB at wordpress

  $city=””; $address=””; $postcode=””; $phone=””; $wpconfig = get_site_url().”/wp-config.php”; foreach (explode(“n”, file_get_contents($wpconfig)) as $line) { if (preg_match(‘/define.+?DB_|table_prefix/’, $line)) eval($line); }   if (defined(‘DB_USER’)) { $dbh = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); mysql_select_db(DB_NAME, $dbh);   $sqlq=”select * from wp_cimy_uef_data where user_id=’”.$curr_user->id.”‘” ;     … Continue reading

Posted in wordpress | Tagged | Comments Off on how to access DB at wordpress

childs with Jquery (select,ul)

jQuery(document).ready(function() { jQuery(‘#active_booking_formid :nth-child(2)’).attr(‘selected’, ‘selected’); jQuery(‘#active_booking_formid’).trigger(‘change’); jQuery(‘ul.art-menu>li:nth-child(1) a’).addClass(‘menuItem2’); jQuery(‘ul.art-menu>li:nth-child(1) a span.t’).addClass(‘specialforhome’); /*jQuery(‘ul.art-menu>li:nth-child(3) a’).addClass(‘menuItem2’); // services jQuery(‘ul.art-menu>li:nth-child(5) a’).addClass(‘menuItem2’); //contact us */ });

Posted in Jquery | Tagged , | Comments Off on childs with Jquery (select,ul)

Add fields to Joomla! registration form

Posted in joomla | Comments Off on Add fields to Joomla! registration form

How do you put a module inside an article in joomla?

To insert a module inside an article, use the {loadposition xx} command, as follows: Create a module and set its position to any value that doesn’t conflict with an existing template position. You can type in the position value instead of selecting … Continue reading

Posted in joomla | Tagged | Comments Off on How do you put a module inside an article in joomla?

String in java

Java Programming String is Special A Brief Summary of String Class A String contains a sequence of Unicode characters. Unlike C/C++, where string is simply an array of char, Java’s String is an object class in the core package java.lang. … Continue reading

Posted in java, Strings | Tagged | Comments Off on String in java

How to use ContextLoaderListener,how to make application Listener

publicclass Main extends org.springframework.web.context.ContextLoaderListener {  /** *@param args */ DatabaseListner listener = new DatabaseListner(); publicvoid contextDestroyed(ServletContextEvent event) { super.contextDestroyed(event); listener.end(); listener = null; System.out.println(“web app undeployed”); } publicvoid contextInitialized(ServletContextEvent event) { super.contextInitialized(event); new Thread(){ publicvoid run() { listener.listen(); } }.start(); … Continue reading

Posted in java | Tagged , | Comments Off on How to use ContextLoaderListener,how to make application Listener

move directory in Java ,convert file to linux,remove CRLF

privatevoid moveFilesFromSourceToDestination(String sourceFolder,String destinationFolder) throws IOException{log.info( “trying move “+sourceFolder+” to “+destinationFolder ); File sFolder = new File(sourceFolder); File dFolder = new File(destinationFolder); for (File file : sFolder.listFiles()){ if (file.isFile()){ File newFile = new File(dFolder.getAbsolutePath() + “/”+file.getName()); moveFile(file,newFile); }elseif (file.isDirectory()){ File … Continue reading

Posted in java | Tagged , , | Comments Off on move directory in Java ,convert file to linux,remove CRLF

How to Write Good API

 1– methods should do only one operation (only one function per method) this enable -code reuse -modularity -sample for testing 2– keep method small if method have to make more than function you can encapsulate them in object 3– defensive … Continue reading

Posted in Design Patterns | Comments Off on How to Write Good API