Sql Query for getting total number of empty fields in a row…

We can get total number of empty fields in a row in a table…


select SUM((`field1` = '') + (`field2` IS NULL) + ( `field3` = 0) + ...... (`fieldnth` = '')) from tablename where conditions;

Here we use
= ‘ ‘ for fields having field type string like varchar ,chars,text etc..
IS NULL is for field having default value NULL
= 0 is for field define integer type

Facebook Share URL

Hello  guys,

Normally we use

<a href="http://www.facebook.com/sharer.php?u=http://yoururl.com&t=your title here target="_blank">Facebook Share</a>

but sometime it not take title from the variable t . For solve this issue you can use

<a href = "http://www.facebook.com/sharer.php?s=100&p[title]=titlehere&p[url]=http://www.yoururlhere.com&p[summary]=your
sumary&p[images][0]=http://www.urltoyourimage.com"  target="_blank">FacebookShare</a>
Here
p[title] => title want to share
p[url] => url want to share
p[summary] = summmary want to share
p[images][n] = images want to share. images may be multiple (n number).

CakePHP Session Issues

CakePHP’s handling of session variables appears very complex .It create confusion when $_SESSION variables are added within code not working. In Core.php we found default

Configure::write(‘Session.cookie’, ‘CAKEPHP’);

and session varriable set by cakePHP app will not be accessed by using $_SESSION. For make it work we have to made change in cakePHP core.php file. We have to add line

Configure::write(‘Session.cookie’, ‘PHPSESSID’);

 Now  $_SESSION vars will be accessed  across both areas.


Note: the session cookie name just needs to correspond to the session name in your php.ini file – the default is PHPSESSID.

Full size background image/slider to website flexible using Supersized.js

We can add full size image/slide show of image using supersized.js. For implement we have to follow following steps:

1 . include jquery and supersized js files

<script type=”text/javascript” src=”jquery.js”></script
<script type=”text/javascript” src=”supersized.js”></script>

2. Now add supersized script

<script type=”text/javascript”>


jQuery(function($){
$.supersized({


//Functionality
slideshow               :   1,        //Slideshow on/off
autoplay                :    1,        //Slideshow starts playing automatically
start_slide             :   1,        //Start slide (0 is random)
random                    :     0,        //Randomize slide order (Ignores start slide)
slide_interval          :   3000,    //Length between transitions
transition              :   1,         //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed        :    500,    //Speed of transition
new_window                :    1,        //Image links open in new window/tab
pause_hover             :   0,        //Pause slideshow on hover
keyboard_nav            :   1,        //Keyboard navigation on/off
performance                :    1,        //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
image_protect            :    1,        //Disables image dragging and right click with Javascript
image_path                :    ‘img/’, //Default image path


//Size & Position
min_width                :   0,        //Min width allowed (in pixels)
min_height                :   0,        //Min height allowed (in pixels)
vertical_center         :   1,        //Vertically center background
horizontal_center       :   1,        //Horizontally center background
fit_portrait             :   1,        //Portrait img will not exceed browser height
fit_landscape            :   0,        //Landscape img will not exceed browser width

//Components
navigation              :   1,        //Slideshow controls on/off
thumbnail_navigation    :   1,        //Thumbnail navigation
slide_counter           :   1,        //Display slide numbers
slide_captions          :   1,        //Slide caption (Pull from “title” in slides array)
slides                     :      [        //Slideshow img
{image : ‘/static/css/i/bg1.jpg’, title : ‘img’, url : ‘http://www.myviewtours.wiltit.com/&#8217;},

]


});
});

</script>

3. Add supersized css now

<link rel=”stylesheet” href=”/css/supersized.css” type=”text/css” media=”screen”>

All above code must be comes within head tags.