April 14, 2013 Vignesh Sathiyanantham

We can submit the html form page by pressing submit button and the shortcut way is pressing enter ( return ) button on keyboard after filling up the form Here is the post to explain how to submit a form by pressing enter button using jQuery Generally, a form is submitted when the user presses a submit button. However, sometimes, you may need to submit the form when the user press return key ( enter key) Here is the code to submit the form by pressing the enter key <html> <head> https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js <script> function formSubmit() { document.getElementById(“frm1”).submit(); } $(‘#submit_form’).keypress(function…

April 14, 2013 Vignesh Sathiyanantham

Here is the solution to fetch the data from another Database instance in word press How To Use WPDB Class to connect and fetch data from another database host Let’s say you’ve installed wordpress into the database wp_wordpress and you want to fetch some data from another independent database which has nothing to do with wordpress (ex. mydb). Here’s how you can do it. Querying for Data Using WPDB Now, here’s the trick. You have to instantiate a new WPDB instance $mydb= new wpdb(‘username’,’password’,’db_name’,’db_host’); $rows = $mydb->get_results(“select columnName from tableName”); foreach ($rows as $obj) { echo $obj->columnName; } That saves…

April 14, 2013 Vignesh Sathiyanantham

Lots of web servers are running in LAMP stack, as ubuntu is easy to install and configure and many advantages people prefer ubuntu server,  Ubuntu server is completely command based , you need to do all the operation using the ubuntu Terminal… For the Ubuntu Desktop users who are not very good in ubuntu commands Here is the solution to use server like desktop in amazon EC2 instance. Create a new ubuntu server instance in amazon EC2 Make sure the AWS security group has port 22 open for your Instance IP address you are using. ( for SSH access )…

April 14, 2013 Vignesh Sathiyanantham

Highlight your php code in your website or in your blog post Instead of using external tools or third party code to highlight the syntax of php code in your website you can use the inbuilt function of php highlight_string or highlight_file Highlight_string is the function to highlight the php syntax of the block of code Here is the example for the highlight_string <?php $code = ‘ <?php //array with files to allow $allowed = array(“index.php”, “menu.php”, “about.php”); // get the filename $file = $_GET[file]; if(file_Exists($file)){ if(in_array($file, $allowed)){ // check if it is part of the allowed list highlight_file($file); //highlight…

April 7, 2013 Vignesh Sathiyanantham

Session often breaks in codeigniter ??? Here is the fix ! I developed e-commerce website using php codeigniter and it is using database to store session values. But the session is lost if it has more data in it I have spent some days checking about it and changed the third party session library , it has lots of limitations again i switched back to codeigniter default session library and trying to fix the issue finally i found out the issue in it. It was failing to unserialize the session data stored in the user_data field in ci_session table So…

April 7, 2013 Vignesh Sathiyanantham

Best practises in checking codeigniter sessions There are many practices in checking the session conditions for whether the user is logged in or not Usually we check in the codeigniter controllers function my_function() { $user = $this->session->userdata(‘user_id’); if (!isset($user)) { $logged_in = false; } else { $logged_in = true; } } This 4-8 lines of code you need to check in every controller , So you can create a codeigniter library and call the library function in every controller , It is easy to code and also in modifying the code  Create a my_library.php file in application/libraries Copy the following…

March 25, 2013 Vignesh Sathiyanantham

Javascript is often used on the browser client side to perform simple tasks that would otherwise require a full postback to the server. Many of those simple tasks involve processing text or characters entered into a form element on a web page, and it is often necessary to know the javascript keycode associated with a character. Here is a reference. Key Code Key Code Key Code backspace 8 e 69 numpad 8 104 tab 9 f 70 numpad 9 105 enter 13 g 71 multiply 106 shift 16 h 72 add 107 ctrl 17 i 73 subtract 109 alt 18…

March 23, 2013 Vignesh Sathiyanantham

There are two ways to install Zabbix. You can compile and install Zabbix from source, or you can install Zabbix packages, if your distribution supports it. Installing the packages is faster and makes things easier to maintain, but the installed version might be older than what’s available on the Zabbix website. Compiling and installing from source is a longer process, but it works on every distribution If you’re running Ubuntu or Other Debian and would like to install the Zabbix packages, follow these instructions: First we will enter into root sudo -i ( enter your password ) Install Zabbix server…

March 21, 2013 Vignesh Sathiyanantham

Still many people using query string / get method for their URL to getting the value from the user , but these query strings are not Search engine friendly , To create a searchengine friendly url you can make use of URI segments asvignesh.in/blog_post?title=post_name Instead we can use like asvignesh.in/blog_post/post_name I explain you how to fetch the URI segments Here is a set of two php functions that I use regularly to quickly get a specific URI segment or return all segments available. These are very helpful if you have written or are writing your own custom SEF urls <?phpfunction…

March 3, 2013 Vignesh Sathiyanantham

JasperReports provides the necessary features to generate dynamic reports, including data retrieval using JDBC (Java Database Connectivity), as well as support for parameters, expressions, variables, and groups. JasperReports also includes advanced features, such as custom data sources, scriptlets, and subreports. Overview of Jasper Reports Jasperreport is open source Business intelligence reporting tool. Jasper Reports is written in 100% Java. And can be embedded in any Java application. JasperReports is an engine that takes an XML file and forms a report out of that file using the data source specified in the XML file. Various output options PDF, HTML, XLS, CSV,…