Create a function to save a page in Favorites and Bookmarks with javascript

Javascript Function: <script type="text/javascript"> function bookmark(title,url){ if(window.sidebar){ // for firefox window.sidebar.addPanel(title, url, ""); }else if(window.opera && window.print){ // for opera var elem = document.createElement(’a’); elem.setAttribute(’href’,url); elem.setAttribute(’title’,title); elem.setAttribute(’rel’,’sidebar’); elem.click(); }else if(document.all){// for ie window.external.AddFavorite(url, title); } } </script> Using the bookmark function: <a href="javascript:bookmark(document.title,window.location);">Bookmark this page</a> <a href="javascript:bookmark(‘javascript bookmark’,’http://www.w3mentor.com’);">Bookmark this page</a>
Continue reading…

Enjoyed this post? Share it!

 
 

Actionscript addEventListener() function

The addEventListener() method is used to identify the event, and assign the function to be executed to the object that is supposed to be doing the listening. rotate_right_btn.addEventListener(MouseEvent.MOUSE_UP,onRotateRight); function onRotateRight(evt:MouseEvent):void { box.rotation += 20; }
Continue reading…

Enjoyed this post? Share it!

 
 

SQL string function REPLACE()

SQL string function REPLACE() Syntax: REPLACE(column_name, Find, Replace) Description: Used to replace an occurence of string/character in column data Parameters: Column_name – specifies the column to be manipulated Find – string to be matched Replace – string to replace the matched string Example: SELECT name, REPLACE (name, ‘m’, ‘M’) FROM product;
Continue reading…

Enjoyed this post? Share it!

 
 

SQL string function SUBSTRING()

SQL string function SUBSTRING() Syntax: SUBSTRING(column_name, Start, Length). Description: Find the SUBSTRING from column data Parameters: Column_name – specifies the column to be manipulated Start – Offset on the column Length – Number of characters to be extracted Example: SELECT SUBSTRING(name,3,5) FROM product;
Continue reading…

Enjoyed this post? Share it!

 
 

Codeigniter URL helper anchor()

Codeigniter URL helper anchor() Syntax: Anchor(href, text, attribute) Parameters: href – The path you want to link to. text – The message you want use as the title to the link variable attribute – Specifies attributes in the key/value pair and is applied as attributes to the created tag. Return type: string. Description: Used to […]
Continue reading…

Enjoyed this post? Share it!

 
 

MySQL String Functions

BINARY string1=BINARY(string2) Returns the binary representation of a string. This function can be used to force case-sensitive comparisons when they would otherwise not occur. BIT_LENGTH bits=BIT_LENGTH(string) Returns the number of bits in a string. CHAR_LENGTH length=CHAR_LENGTH(string) Returns the number of characters in a string. Like LENGTH, except that it returns the number of characters, rather […]
Continue reading…

Enjoyed this post? Share it!

 
 

MySQL ASCII Function

The ASCII function in MySQL returns the ASCII character code corresponding to the first character in the provided input string. Example for using the ASCII function CREATE FUNCTION ascii_string (in_string VARCHAR(80) ) RETURNS VARCHAR(256) DETERMINISTIC BEGIN DECLARE i INT DEFAULT 1; DECLARE string_len INT; DECLARE out_string VARCHAR(256) DEFAULT ”;   SET string_len=LENGTH(in_string); WHILE (i<string_len) DO […]
Continue reading…

Enjoyed this post? Share it!

 
 

Determine how much time a function takes to execute in PHP

To determine how much time a single function takes to execute, we can compare time in milliseconds before running the function against the time in milliseconds after running the function to see the elapsed time spent in the function. <?php $long_str = "this is a test to see how much time md5 function takes to […]
Continue reading…

Enjoyed this post? Share it!

 
 

getsockopt function in PERL

PERL getsockopt FunctionPERL getsockopt Function Syntax getsockopt SOCKET, LEVEL, OPTNAME PERL getsockopt Function Definition and Usage Gets the socket options set on SOCKET at the socket implementation level LEVEL for the option OPTNAME. Some sample values for OPTNAME at a socket level are given in Table belowOPTNAME Result SO_DEBUG Get status of recording of debugging […]
Continue reading…

Enjoyed this post? Share it!