Pages

Showing posts with label a. Show all posts
Showing posts with label a. Show all posts

Thursday, October 3, 2013

Page Speed-Specify a Vary: Accept-Encoding header


 <IfModule mod_headers.c>  
  <FilesMatch "\.(js|css|xml|gz)$">  
   Header append Vary Accept-Encoding  
  </FilesMatch>  
 </IfModule>  
If you would like to add more file type to this rule, add the its extension to the statement

Sunday, August 18, 2013

MYSQL-Find a word from comma separated list(in string)

I have a table as follows

id name status
1  test1  option1,option2
2  test2  option,option1
3  test3  option2,option3
4  test4  option3,option4
5  test5  option1,option3

"SELECT * FROM TABLE WHERE FIND_IN_SET('option',status-name of column/attribute)">0

simple query to check whether a string is present in comma separated values entered as string under a column or attribute

Sunday, July 8, 2012

Javascript code to get a string sliced till last occurance of a charcter

Javascript code to get a string sliced till last occurrence of a character function
 //javascript
getStringTillLastCharcter(str,chr)
{
    var flag=0;
    var lastpos;
    //alert(str.length);
    for(i=0;i < str.length; i++ )  {
        if(str.charAt(i)==chr)
            {
                lastpos=i+1;
            }
    }
    //alert(lastpos);
    return str.slice(0,lastpos);
}


Here is a code to get the string till the last occurance of a charcter.....