Smile and Love

যখন অনেক ছোটো ছিলাম তখন বাবাকে কিছু কিনে দিতে বললে কিনে দিত আর বলতো তোদের কিছু দিয়েই তো আমি সুখী | তখন বুঝতামনা, ভাবতাম আমাদের কিনে দিয়ে সে কি করে সুখী হয় ! এখন অনেকটাই বুঝি | কারণ আমি যে এখন ভালবাসতে শিখে গেছি | না, আমি এখনো বাবা হইনি | কিন্তু ভালো তো বাসি | বাবা, মা, ভাই, বোন, বন্ধু-বান্ধব সবাইকেই ভালবাসি | ভালবাসার মানুষদের মুখে এক চিলতে হাসি দেখলে নিজের মন যে কত খুশিতে ভরে যায় তা বোঝানোর ভাষা এখনো আবিষ্কার হয়নি | সেই হাসি দেখে অনায়াসে ভুলে যাওয়া যায় নিজের দু:খ, না পাওয়ার বেদনা, হারানোর কষ্ট — সব | হৃদয় – সে যত ক্ষতবিক্ষতই হোক না কেন সে এক টুকরো হাসি যেন সেই ক্ষততেই প্রলেপ দেয় | পেটের দায়ে সারা দিন দৌড়ে এসে বাবা যখন তার ছোটো শিশু টিকে কোলে নেয়, শিশু টি যখন দৌড়ে এসে মায়ের বুকে ঝাপিয়ে পরে, ভাইয়ের কাছে যখন তার ছোটো বোনটি চকলেট এর আবদার ধরে, প্রেমিক যখন এসে প্রেমিকার পাশে বসে, স্বামী যখন তার স্ত্রীর আচলে আবদ্ধ হয় (and vice-versa) তখন মনে হয় সার্থক এ বেচে থাকা | একটা মানুষের জীবনে খুব বেশি কিছুর দরকার হয়না যদি তার অসীম ভালবাসার ভান্ডার থাকে | ভালবাসার মানুষদের মুখের এই এক চিলতে হাসি – তা লক্ষ কোটি টাকার বিনিময়েও কেনা যায় না – যেই হাসি ফুটাতে আমাদের অবিরাম ছুটে চলা |

Easiest way to create tooltip using jQuery

This is a very easy way to create tooltip using jQuery. This tooltip is shown on “mouseover” event, but you can customize it.

First, add latest jQuery into head tag in your html.

[html]

[/html]

Then insert the following code:
[html]

$(document).ready(function() {

$(‘.baloon’).mouseover(function() {
text = $(this).children(‘span’).html();
html = ‘

‘+text+’

‘;
$(this).append(html);
})
.mouseout(function() {
$(‘.tooltip’).remove();
}) ;

});

[/html]

Insert these css lines into your stylesheet:
[css]
div.tooltip{
width:226px;
position:absolute;
top:33px;
left:10px;
z-index:100;
line-height:120%;
text-align:left;
font-weight:bold;
}

div.tooltip_top{
width:100%;
height:14px;
background:url(../images/tooltip_top.png) no-repeat;
}

div.tooltip_bottom{
width:100%;
height:7px;
background:url(../images/tooltip_bottom.png) no-repeat;
}

div.tooltip_body{
padding:0 5px;
background:url(../images/tooltip_body.png) repeat-y;
}

#your_id{

width:100px;

height:35px;

position:relative;

}

#your_id span{display:none;}
[/css]

Now the html:
[html]

Total Communications Awareness
A VBS campaign to help you understand the benefits of adopting a Fixed Mobile Convergence approach in your local market and explain the requirements needed to adopt this approach.

[/html]

So, just put the class “baloon” in your tag in which you want to use tooltip. And within this tag set a span tag and write the tooltip text within that span tag.

That’s it. Mouseover on the tag and get your tooltip !

Thanks.

PHP: Convert number into Text (Amount into words)

This is a php function which converts number into text. This function is developed in respect of Bangladeshi Currency (Bangladeshi Taka), but if you know a little php, you can convert it into your currency. Just call the function as

[php]

[/php]

You will get the result.

Code:
[php]
<?php
function convert_number($number)
{
if (($number 999999999))
{
throw new Exception(“Number is out of range”);
}

$Gn = floor($number / 100000); /* Millions (giga) */
$number -= $Gn * 100000;
$kn = floor($number / 1000); /* Thousands (kilo) */
$number -= $kn * 1000;
$Hn = floor($number / 100); /* Hundreds (hecto) */
$number -= $Hn * 100;
$Dn = floor($number / 10); /* Tens (deca) */
$n = $number % 10; /* Ones */

$res = “”;

if ($Gn)
{
$res .= convert_number($Gn) . ” Lacs”;
}

if ($kn)
{
$res .= (empty($res) ? “” : ” “) .
convert_number($kn) . ” Thousand”;
}

if ($Hn)
{
$res .= (empty($res) ? “” : ” “) .
convert_number($Hn) . ” Hundred”;
}

$ones = array(“”, “One”, “Two”, “Three”, “Four”, “Five”, “Six”,
“Seven”, “Eight”, “Nine”, “Ten”, “Eleven”, “Twelve”, “Thirteen”,
“Fourteen”, “Fifteen”, “Sixteen”, “Seventeen”, “Eightteen”,
“Nineteen”);
$tens = array(“”, “”, “Twenty”, “Thirty”, “Fourty”, “Fifty”, “Sixty”,
“Seventy”, “Eigthy”, “Ninety”);

if ($Dn || $n)
{
if (!empty($res))
{
$res .= ” and “;
}

if ($Dn
[/php]

PHP: Find maximum odd number of sequence in an array

This is php program that finds the maximum odd number of sequence in an array. By editing, in case of even number also be found out.

Code:
[php]
<?php
$x = array(1,7,4,5,7,5,6,3,4,6,87,53,45,567,45,43,66,56,57,5);
$tot = count($x);
$y = $res = array();
$y[0] = array();
$k = $j = 0;
for($i = 0; $i $val)
if($max == count($val))
$k = $key;

echo “The number of maximum odd sequesnce: $max
The numbers are:”;
var_dump($y[$k]);

?>
[/php]

Waiting for any better solutions. :)

A little trick to store data into mysql database from a large form

Sometimes we feel boring to write mysql insertion query to store data into database from a large form where are too many input fields (such as about 50 fields). We face problem to handle all the fields, sometimes we miss the field name. Here is a small trick to store data from such a large form.

In this trick, we have to do same naming of table fields and input fields. For example –

[html][/html]

Then the field name of the database will be “first_name”

Then the php code will be:

Suppose, name of the submit button is submit [html][/html]

[php]
safe_entry($_POST); // here obj is the object; safe_entry is a custom function which confirms the input validation of XSS and mysql injection; otherwise you can use $data = safe_entry($_POST); or simply use $data = $_POST;

$field = $value = array(); //two blank array in which field names and field values will be stored

foreach($data as $key=>$val)

if($key != ‘submit’)

{

array_push($field, $key);

array_push($value, $val);

}

$fields = implode(‘,’, $field);

$values = implode(“‘, ‘”, $value);

$sql = “insert into tablename($fields) values(‘$values’)”;

$query = $obj->insertQuery($sql); //use direct function mysql_query() in stead of custom function and object

?>
[/php]

That’s it! This code will store data from a large form. Thanks.

jSlider Plugin for jQuery (for 3 horizontal div)

This is my first jQuery plugin. Not so perfect, but it can be used I think :)

This plugin is very easy to use.

Doc:
This is a small slider content plugin for three horizontal floated div. By clicking on top menu, the divs switch.

1. Just pass the master div id which is wrapping the three floating div in the parameter field named master.
2. Pass id of the three floated divs’ in label parameter under jid index
3. Pass id of the three links’ in label parameter under links index

That’s It!
You don’t have to mention floated div in css.

Javascript Code:
[html]

$(document).ready(function(){
$.fn.jSlider({
//”width”:null,
//”height”:null,
“master”:”content”,
“labels”:[
{“jid”:”one_content”, “links”:”one”},
{“jid”:”two_content”, “links”:”two”},
{“jid”:”three_content”, “links”:”three”},
]
});
});

[/html]

HTML Code:
[html]

This is DIV 1

This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1. This is DIV 1.

This is DIV 2

This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2. This is DIV 2.

This is DIV 3

This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3. This is DIV 3.

[/html]

CSS Code:
[css]

#wrapper{
width:100%;
overflow:hidden;
color:#990000
}

#header{
width:100%;
height:30px;
background:#0033FF;
color:#FFFFFF;
}

#content{
overflow:hidden;
}

#header a{
padding:5px 15px;
color:#FFFFFF;
}

#one_content{
background:url(images/one.jpg) repeat;
}

#two_content{
background:url(images/two.jpg) repeat;
}

#three_content{
background:url(images/three.jpg) repeat;
}

[/css]

That’s it !

A Very Simple jQuery Drop Down Menu Plugin

This is a very simple jquery Drop Down Menu Plugin, vertically no doubt. Add latest jQuery in your html like:

[html]

[/html]

[if u don’t have jQuery in your server]

HTML Code:
[html]

[/html]
Just declare a class named “parent” in the li tag in which you have a submenu. Then its is done.

CSS Code:
[css]
div#menu ul li{
float:left;
}

div#menu ul li a{
display:block;
line-height:27px;
text-align:center;
color:#FFFFFF;
font-size:12px;
padding:0 13px;
border-right:1px solid #017302;
}

div#menu ul li a:hover, div#menu ul li a.active{
text-decoration:none;
}

.parent{
position:relative;
}

.parent ul{
position:absolute;
top:100%;
overflow:hidden;
left:0;
display:none;
background:#4CA82E;
}

div#menu ul li ul li a{
background:none;
width:auto !important;
white-space:nowrap;
text-align:left;
}

div#menu ul li ul li a:hover{
text-decoration:underline;
}

div#menu ul li ul li{
width:auto !important;
float:none;
}
[/css]

Now put the following code in your tag just below of the declaration of jQuery:
[html]

$(document).ready(function(){
$(“.parent”).hover(function(){
$(this).find(“ul”).show(“slow”);
}, function () {
$(this).find(“ul”).hide(“slow”);
});
});

[/html]
That’s it! Boom!! If you have this plugin just declare a class named “parent” in your

  • tag in which you have submenu.

    Thanks.

  • Setup a web server in Linux Ubuntu

    Try the following code in terminal:

    That’s It! In the installation you may be asked for mysql password for root. Set as you wish but remember it as you will need it.

    Thanks: Ronju vai

    Some Security Issue (php)

    Never, Ever, Trust Your Users

    It can never be said enough times, you should never, ever, ever trust your users to send you the data you expect. I have heard many people respond to that with something like “Oh, nobody malicious would be interested in my site”. Leaving aside that that could not be more wrong, it is not always a malicious user who can exploit a security hole – problems can just as easily arise because of a user unintentionally doing something wrong.

    So the cardinal rule of all web development, and I can’t stress it enough, is: Never, Ever, Trust Your Users. Assume every single piece of data your site collects from a user contains malicious code. Always. That includes data you think you have checked with client-side validation, for example using JavaScript. If you can manage that, you’ll be off to a good start. If PHP security is important to you, this single point is the most important to learn. Personally, I have a “PHP Security” sheet next to my desk with major points on, and this is in large bold text, right at the top.

    Global Variables

    In many languages you must explicitly create a variable in order to use it. In PHP, there is an option, “register_globals”, that you can set in php.ini that allows you to use global variables, ones you do not need to explicitly create.

    Consider the following code:
    [php]
    if ($password == “my_password”) {

    $authorized = 1;

    }

    if ($authorized == 1) {

    echo “Lots of important stuff.”;

    }
    [/php]

    To many that may look fine, and in fact this exact type of code is in use all over the web. However, if a server has “register_globals” set to on, then simply adding “?authorized=1″ to the URL will give anyone free access to exactly what you do not want everyone to see. This is one of the most common PHP security problems.

    Fortunately, this has a couple of possible simple solutions. The first, and perhaps the best, is to set “register_globals” to off. The second is to ensure that you only use variables that you have explicitly set yourself. In the above example, that would mean adding “$authorized = 0;” at the beginning of the script:

    [php]
    $authorized = 0;

    if ($password == “my_password”) {

    $authorized = 1;

    }

    if ($authorized == 1) {

    echo “Lots of important stuff.”;

    }
    [/php]

    Source: http://www.addedbytes.com/writing-secure-php/writing-secure-php-1/

    Comments are appriciated.

    Face Ditector Jquery Plugin

    Face detection is a common feature in most digital cameras today; the white or red square that pops around someones face when we are focusing the camera on that person. Face detection algorithms enables the software to pinpoint the locations and sizes of human faces in digital images, whatever the surrounding objects may be.

    Face-Detection is a jQuery plugin that enables you to detect human faces in images. Besides the crucial algorithm that does the main work it uses HTML5 Canvas element to grab the image data. This means that the plugin only works on browsers that support the HTML5 Canvas element. A immediate application I thought of was to use it to automatically crop faces from pictures to be used as profile photos.

    I tried it on various types of images – groups of people, individuals, portraits – and it got a detection success of around 85%. As you can see from the demo given, it fails to detect the face on the extreme right. Still, quite nice for such a small piece of Javascript; with some more tweaks to the detection code by the author, the accuracy will get better over time and we can think of more browser applications of these concepts.

    Source:

    http://www.codediesel.com/javascript/face-detection-using-jquery/