Skip to main content

Posts

Showing posts from October, 2012

Javascript search Function in keyup event

 Script: <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#searchbox').keyup(function() { searchTable($(this).val()); }); }); function searchTable(inputVal) { var table = $('#search'); table.find('tr').each(function(index, row) { var allCells = $(row).find('td'); if(allCells.length > 0) { var found = false; allCells.each(function(index, td) { var regExp = new RegExp(inputVal, 'i'); if(regExp.test($(td).text())) { found = true; return false; } }); if(found == true)$(row).show();else $(row).hide(); } }); } </script> <label >Find By Name/Company Name</label><input type="text" id="searchbox"  /> demo: Find By Name/Company Name Name Company Name karthik aeykay technologies Gowshik Sundar CTS ...

Facebook Like Time Ago Function C#

This is a small time ago function which return a date time value in a readable way as facebook,twitter and most of the forum sites..eg(1 day ago,1 min ago etc).used c# programming language.. C# public static string TimeAgo( DateTime date)      {      TimeSpan timeSince = DateTime .Now.Subtract(date);      if (timeSince.TotalMilliseconds < 1)         return "not yet" ;      if (timeSince.TotalMinutes < 1)         return "just now" ;      if (timeSince.TotalMinutes < 2)         return "1 minute ago" ;      if (timeSince.TotalMinutes < 60)         return string .Format( "{0} minutes ago" , timeSince.Minutes);      if (timeSince.TotalMinutes < 120) ...

JavaScript Date and Time Functions

script:  <script type="text/javascript"> function startTime() { var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") var today=new Date(); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); var d=today.getDate(); var mo=today.getMonth(); var ye=today.getFullYear(); // add a zero in front of numbers<10 mo=montharray[today.getMonth()]; d=checkTime(d); ye=checkTime(ye); m=checkTime(m); s=checkTime(s); h=checkTime(h); var hour; if(h == 0) {hour = 12;var ap = " AM";} else if(h <= 11) {ap = " AM";hour = h;} else if(h == 12) {ap = " PM";hour = 12;} else if (h >= 13) {hour = (h - 12);ap = " PM";} if(h >= 13) {hour = h - 12;} document.getElementById('txt').innerHTML=d+"/"+mo+"/...

Download SQLHelper Class

Microsoft .net framework consists of ADO .NET which enables the developer to interact with the database. ADO .NET provides many rich features that can be used to retrieve and display data in a number of ways. Apart from the flexibility provided by the ADO .NET, sometimes we find ourselves repeating the same code again and again. For this reason Microsoft introduced SQL helper class which can be used to perform common task in with less code. You can Download SQLHelper Class   in this link. Download SQLHelper Class SQLHelper class is used to select/insert/update the data from database. It contains the methods which return different objects like Dataset, SqlDataReader, Integer etc at the end of the method. It also contains methods for adding parameter to SQL Command with different parameters and contains the method to set the parameter value. Download SQLHelper Class Download SQLHelper Class

Bad word Filteration –Using SQL Function

A wordfilter (sometimes referred to as just "filter" or "censor") is a script typically used on Internet forums or chat rooms that automatically scans users' posts or comments as they are submitted and automatically changes or censors particular words or phrases. The SQL replace Function is use to replace a string.to filter bad word in a sentence ,first create a table and insert a list of words to be replaced… Example: Create Query:  CREATE TABLE [dbo].[FILTERWORD](                 [string] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,                 [replacement] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL )  Result   Table: SQL Function for filtering   a particular word in a sentence: Create FUNCTION [dbo] . [filter] ( @word varchar ( max )) R...

SQL Split Function

The SQL Split Function is use to SPLIT a string based on the Delimeter such as comma,hyphen etc. Delimeter is a string character which is used to identify substring limits in the given string. SQL Function to split a string: create function   [dbo] . [split2] ( @id varchar ( 1000 ), @sym char ) returns   @result table ( id varchar ( 12 )) as begin             declare @len int             declare @lenstr varchar ( 1000 )             declare @charindex int             declare @splindex int             declare @startindex int             declare @lenstr1 int         ...