Sunday, June 20, 2010
Friday, April 2, 2010
Change the Color & Backgraound of slected text in Browser.
I was wondering how to define color
and background
for text the user selects.
Try it in this in your CSS. If you select something and it will change its background to red and text to white, your browser supports selection styles.
::-moz-selection{
background:#cc0000;
color:#fff;
}
::selection {
background:#cc0000;
color:#fff;
}
code::-moz-selection {
background: #333333;
}
code::selection {
background: #333333;
}
Of course Mozilla needs a special ::-moz-selection
selector, while Safari keeps it simple. The selector only seems to accept color
and background
. I defined a grey background for code
elements with the code::[-moz-]selection
syntax.
Monday, March 8, 2010
Logic to get Email From a Paragraph
My plan was to get email ids from the page posted data in PHP, it was the requirement of my module at that time to do so I write some code like this
Output
Now I have given enough tips try some experimenting lust of yours and utilize it according to your need.
<?php
function get_emails ($str)
{
$emails = array();
preg_match_all("/\b\w+\@\w+[\.\w+]+\b/", $str, $output);
foreach($output[0] as $email) array_push ($emails, strtolower($email));
if (count ($emails) >= 1) return $emails;
else return false;
}
# Here is how to use it.
# Sample string containing email addresses;
$str = "happy happy@gmail.com bingo happy@test.com jojo jojo@badjojo.com";
# Get the emails on arrays;
$emails = get_emails ($str);
# Print that arrays;
print_r ($emails);
?>
Output
Array ( [0] => happy@gmail.com [1] => happy@test.com [2] => jojo@badjojo.com )
Now I have given enough tips try some experimenting lust of yours and utilize it according to your need.
Thursday, March 4, 2010
JQuery Tooltip in easy Move...
The Tooltip is a common graphical user interface element. It is used in conjunction with a cursor, usually a mouse pointer. The user hovers the cursor over an item, without clicking it, and a tooltip may appear — a small "hover box" with information about the item being hovered over.

This type of tooltip can be generated in different ways.We will see all of them later.
To create Tooltip you have to download Jquery tooltip Plugin from:
Download ToolTip Plugin
Select Development and Jquery check boxes. Thats enough to keep tooltip working. Thats what I prefer but you can download all :).

Now you will be able to see "jquery.qtip-1.0.0-rc3.custom.zip" compressed file in your download folder. Extract it -> Open it. Here you will find following files.
Now Create a html file with following code and save it in the same folder where other six downloaded files exists....
Now you can see it is Displaying tool tip in new format when you move your cursor on LINK.
Now, Some Good thing to know you can alter the way tooltip appears. By default it is "dark" but u can change it to other styles too... like "green", "blue", "red", "dark" and "cream". what you need to do is just change the value of "style: 'dark'" to "style: 'blue'" or any color from this list and see the magic.
Now you only need to do is keep experimenting and see you alter it. Also this tooltip can be applied to all html tags that supports "title" parameter. ;) Do experiment and know how?
Waiting for your comments....

This type of tooltip can be generated in different ways.We will see all of them later.
To create Tooltip you have to download Jquery tooltip Plugin from:
Download ToolTip Plugin
Select Development and Jquery check boxes. Thats enough to keep tooltip working. Thats what I prefer but you can download all :).

Now you will be able to see "jquery.qtip-1.0.0-rc3.custom.zip" compressed file in your download folder. Extract it -> Open it. Here you will find following files.
- jquery-1.3.2.min.js -> Compressed Jquery File
- jquery.qtip-1.0.0-rc3.min.js -> Compressed Plugin File.
- jquery.qtip-1.0.0-rc3.js -> Main Tooltip Plugin file.
- INSTALL -> File for install instructions
- REQUIREMENTS ->File to tell you abut the requirement of the tooltip to run.
- LICENSE-> Licence Agreement file.
Now Create a html file with following code and save it in the same folder where other six downloaded files exists....
<html>
<head>
<title>
jQuery Tooltip Plugin
</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery.qtip-1.0.0-rc3.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#computercurry a[href][title]').qtip({
content: {
text: false
},
style: 'dark'
});
});
</script>
</head>
<body>
<h1 style="{ padding: 15px; background-color: #96b; color: white; font-size: large; border-bottom: 1px solid #ccc; text-align: center }"><a href="http://computercurry.blogspot.com/" style="color:white">jQuery Tooltip Plugin</a></h1>
<fieldset id="computercurry">
<legend>Using bodyHandler to display footnotes in the tooltip</legend>
<a href="http://computercurry.blogspot.com/" title="This is the link to 'Computer Curry' Blog">Move your mouse to this link</a>
</fieldset>
</body>
Now you can see it is Displaying tool tip in new format when you move your cursor on LINK.
Now, Some Good thing to know you can alter the way tooltip appears. By default it is "dark" but u can change it to other styles too... like "green", "blue", "red", "dark" and "cream". what you need to do is just change the value of "style: 'dark'" to "style: 'blue'" or any color from this list and see the magic.
Now you only need to do is keep experimenting and see you alter it. Also this tooltip can be applied to all html tags that supports "title" parameter. ;) Do experiment and know how?
Waiting for your comments....
Tuesday, February 16, 2010
Date Convertion in PHP... Easy Move..
In this code we are capable to give Source date format and Destination date format as parameters our function of date conversion.
As in this example:
Source Format: 'd/m/Y';
Destination Format: 'Y-m-d';
Input Date: "25/12/2005";
Output Date: "2005-12-25".
As in this example:
Source Format: 'd/m/Y';
Destination Format: 'Y-m-d';
Input Date: "25/12/2005";
Output Date: "2005-12-25".
[?php //Php start tag...
/**
* Converts a date string from one format to another (e.g. d/m/Y => Y-m-d, d.m.Y => Y/d/m, ...)
*
* @param string $date_format1
* @param string $date_format2
* @param string $date_str
* @return string
*/
function dates_interconv( $date_format1, $date_format2, $date_str )
{
$base_struc = split('[/.-]', $date_format1);
$date_str_parts = split('[/.-]', $date_str );
$date_elements = array();
$p_keys = array_keys( $base_struc );
foreach ( $p_keys as $p_key )
{
if ( !empty( $date_str_parts[$p_key] ))
{
$date_elements[$base_struc[$p_key]] = $date_str_parts[$p_key];
}
else
return false;
}
$dummy_ts = mktime( 0,0,0, $date_elements['m'],$date_elements['d'],$date_elements['Y']);
return date( $date_format2, $dummy_ts );
}
$df_src = 'd/m/Y';
$df_des = 'Y-m-d';
$iso_date = dates_interconv( $df_src, $df_des, '25/12/2005');
?>
output:
2005-12-25
Sunday, February 7, 2010
Blank admin page in Drupal 6
I installed Drupal 6 today on my windows machine in office. After creating the first user I tried to access the Administration Page, but a blank page was returned. I searched google to fix this problem.. What I found was totally helpful... as it solve my problem.
If you too facing such problem then just what you need to do is:-
Go to "system" table of you Drupal Database and change the value of 'status', 'bootstrap' and 'throttle' to 0. By using PHPMyAdmin or MySql Command line:
This help me to access my Drupal's admin panel hope this will help you too.
:)
If you too facing such problem then just what you need to do is:-
Go to "system" table of you Drupal Database and change the value of 'status', 'bootstrap' and 'throttle' to 0. By using PHPMyAdmin or MySql Command line:
update system s
set s.status=0, s.throttle=0, s.bootstrap=0
where filename = 'modules/update/update.module'
This help me to access my Drupal's admin panel hope this will help you too.
:)
Subscribe to:
Posts (Atom)