December 20, 2011

apply tinyMCE to specific textarea instead of all textareas

apply tinyMCE to specific textarea instead of all textareas This problem occurs when we don’t bother to specify the textarea for tinyMCE. Situation justifies because mostly we deal with such content pages where only one textarea will be used and that either rich texteditor or simple textarea. Few developers will not agree with me if […]

December 12, 2011

Caching with .htaccess

Caching with .htaccess # Set the cache-control max-age # For 1 year <FilesMatch “\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$”> Header set Cache-Control “max-age=31449600, public” </FilesMatch> # For 2 DAYS <FilesMatch “\.(xml|txt)$”> Header set Cache-Control “max-age=172800, public, must-revalidate” </FilesMatch> # For 4 HOURS <FilesMatch “\.(html|htm|php)$”> Header set Cache-Control “max-age=14400, must-revalidate” </FilesMatch> Followings things should be considered as well: https://developers.google.com/speed/docs/insights/EnableCompression

December 8, 2011

PHP Explode, PHP End, File Name, File Extension

PHP Explode, PHP End, File Name, File Extension if ( ! function_exists(‘file_parts’)) { function file_parts($url,$params=’ext’) { if($params==’ext’) { $parts = explode(‘.’,$url); return end($parts); } elseif($params==’name’) { $parts = explode(‘/’,$url); return end($parts); } else { $parts = explode(‘/’,$url); $file_name_ext = explode(‘.’,end($parts)); $file_name = array_pop($file_name_ext); return implode(‘.’,$file_name); } } }

Cufon MouseOver Effect Works!!! With CodeIgniter Helper & JS Function

Cufon MouseOver Effect With CodeIgniter Helper Function This helper function can help in mouseover and mouseout effect when you are using cufon for fonts on web pages. if ( ! function_exists(‘link_hover’)) { function link_hover($title, $class=’anchor’, $tag = ‘span’, $url) { $CI =& get_instance(); $time = time(); $active_url = ‘link_’.$time; $inactive_url = ‘link_’.$time.’_over’; if($tag != ”) […]

Mysql Max Import Size Phpmyadmin

Mysql Max Import Size Phpmyadmin Sometimes this simple solution gets a different turn when we go to modify the mysql related phpmyadmin max import size from 2M to more. And it is mostly because that wampserver has different menus for PHP, MySql and Apache configuration. But a rule of thumb can resolve this issue here […]

December 5, 2011

Java Serialization

We can read a file with FileReader function available in Java as FileReader fr = new FileReader(fileName); BufferedReader br = new BufferedReader(fr); Once data loaded into memory from file, now read it line by line String line = br.readLine(); while(line!=null) { pieces = line.split(separator); //for meta keywords we use mostly comma //now the string is […]

Ideal Weight Calculator

Ideal Weight Calculator Code Highlights: import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; JTextField txtWeight; static JSlider heightScale; ButtonGroup btnGroup; JRadioButtonMenuItem btnMale; JRadioButtonMenuItem btnFemale; public void calculate_weight() { String genderValue; if(btnMale.isSelected()==true) { genderValue = btnMale.getActionCommand(); } else { genderValue = btnFemale.getActionCommand(); } Integer userHeight = heightScale.getValue(); Integer heightSqr = (userHeight*userHeight); String idealWeight = […]

December 2, 2011

codeigniter recursive function return problem

codeigniter recursive function return problem If you are stuck too in recursive call of a function and not getting the value as return as expected so be sure about your instances. Because whenever a function being called either independently or recursively so it should be linked to the parent function to which it should report […]