Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

text

get the value of hyperlink filed in asp.net
Monday, 30 January 2012 07:48
// get the value of hyperlink filed in asp.net


DataNavigateUrlFields="TestId" DataNavigateUrlFormatString="~/Test.aspx?TestId={0}" />

HyperLink hypTestLink = (HyperLink)Gv.Rows[gvRow.RowIndex].Cells[testLinkcolumnindex].Controls[0];
ViewStateLinkData = string.IsNullOrWhiteSpace(hypTestLink .Text) ? 0 : Convert.ToInt32(hypTestLink .Text);

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/kE508u3uWHY/14547

 
How to display Alert
Monday, 26 December 2011 00:23
A JavaScript alert is a simple window containing a message.

Here is what the code looks like — it's just one line (inside the JavaScript tag):



The text inside the parentheses is what is shown in the alert message. If you want to show a string of literal text, enclose the text in quotes. To display variable values, enter the variable name without quotes. You can also combine variable values and text strings by using the + sign. For example:

function showAlert() {
var country = "Fiji";
var city = "Suva";
alert('The city of ' + city + ' is located in ' + country + '.');
}


Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/idvC5IHjlQ4/14337

 
Search particular word or text from the entire stored procedure in the Database
Monday, 19 December 2011 00:32
following code will find text "GetUsers" from the entire stored procedure in the database.

SELECT distinct(OBJECT_NAME(id)) FROM syscomments WHERE text like '%GetUsers%'

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/oce8hWa5obQ/14225

 
jQuery Hover Swap Text
Monday, 12 December 2011 15:19

Things have been busy! I’m working on a new book and site and having a blast. I’ll share more on that later, but for now I just want to get back into posting at Perishable Press. To kick it into gear, here is one of the jQuery snippets I’m using at the new book site.

jQuery Hover Swap Text

There is probably a better way to do this, but I needed a way to swap link text with the title attribute on hover. Nothing fancy, and I thought for sure there would be an easier/existing way of doing this with jQuery, but didn’t see anything so came up with this lil’ snippet:

// jQuery hover swap text @ http://perishablepress.com/jquery-hover-swap-text/ 
function xycss_swap_text(){
	$('a').hover(function(){
		var title = $(this).attr('title');
		var text  = $(this).text();
		$(this).text(title).attr('rel', text).removeAttr('title').wrapInner('<span />');

	},function(){
		var title = $(this).text();
		var text  = $(this).attr('rel');
		$(this).text(text).attr('title', title);
	});
}
$(document).ready(function(){
	xycss_swap_text();
});

Just drop into your JavaScript file and edit the $('a') selector with your choice. Going thru, this is just a jQuery hover function that swaps the contents of the title attribute with the anchor text. I also wrap the hover text with a <span> (for styling purposes), but you can yank that out of there if it’s not needed.

Update:

Bryan Watson extends this snippet into more of a plugin format:

(function($){

    // Swap text with title attribute
    $.fn.swapTitleAttr = function() {
    
        var title = this.attr('title');
        var text  = this.text(); 
        
        $(this).wrapInner('<span />');
        
        $(this).hover(function(){
            $(this).text(title).attr('rel', text).removeAttr('title');
        },function(){
            $(this).text(text).attr('title', title).removeAttr('rel');
        });
    };
    
})(jQuery);

$(document).ready(function(){
    $('a').swapTitleAttr();
});

As Bryan explains, with this version “the vars are outside of the hover function (and don’t need to be redefined). Plus, it makes the function reusable for any selector with a title attribute.”

Better way?

Drop some hints if you know an easier way of doing this — I’m sure there’s a better way :)

© 2011 Perishable Press

Read more: http://perishablepress.com/jquery-hover-swap-text/

 
Normalize table
Saturday, 22 October 2011 01:46
// Normalize table by creating a child table with the unique field and each value of the comma separated column.


DROP TABLE IF EXISTS SplitValues;
DROP PROCEDURE IF EXISTS split_string;
DROP PROCEDURE IF EXISTS normalize_table;

CREATE TABLE `SplitValues` (
`cid` varchar(40),
`value` varchar(500)
) ENGINE=MyISAM;

DELIMITER //

CREATE PROCEDURE split_string (pcd TEXT, pinput TEXT, pdmtr VARCHAR(10))
DETERMINISTIC
BEGIN
DECLARE cur_position INT DEFAULT 1;
DECLARE remainder TEXT;
DECLARE cur_string VARCHAR(1000);
DECLARE delimiter_length TINYINT UNSIGNED;

SET remainder = pinput;
SET delimiter_length = CHAR_LENGTH(pdmtr);

WHILE CHAR_LENGTH(remainder) > 0 AND cur_position > 0 DO
SET cur_position = INSTR(remainder, pdmtr);
IF cur_position = 0 THEN
SET cur_string = remainder;
ELSE
SET cur_string = LEFT(remainder, cur_position - 1);
END IF;
IF TRIM(cur_string) != '' THEN
INSERT INTO SplitValues (cid, value) VALUES (pcd, cur_string);
END IF;
SET remainder = SUBSTRING(remainder, cur_position + delimiter_length);
END WHILE;
END
//

CREATE PROCEDURE normalize_table (ptable VARCHAR(64), pkey TEXT, pvalue TEXT, pdel VARCHAR(10))
DETERMINISTIC
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE vkey,vvalue TEXT;
SET @vquery = CONCAT("CREATE VIEW tmpnormview AS SELECT ", pkey,",",pvalue," FROM ",ptable);

DROP VIEW IF EXISTS tmpnormview;
PREPARE stmt FROM @vquery;
EXECUTE stmt;

BEGIN
DECLARE cur CURSOR FOR SELECT * FROM tmpnormview;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN cur;
REPEAT
FETCH cur INTO vkey,vvalue;
IF NOT done THEN
CALL split_string(vkey,vvalue,pdel);
END IF;
UNTIL done END REPEAT;
CLOSE cur;
END;
DROP VIEW tmpnormview;
DEALLOCATE PREPARE stmt;
END
//

DELIMITER ;

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/6V6bJL8QWm0/13779

 
Start
Prev
1


Page 1 of 6
Taxonomy by Zaragoza Online