$('*:contains("00%")').each(function(){
if($(this).children().length < 1) { // alert('hi'); $(this).html($(this).text().replace("00%",'0%')) } });
Showing posts with label tricks. Show all posts
Showing posts with label tricks. Show all posts
Monday, June 10, 2013
Search whole page & replace text in JQuery
Saturday, February 9, 2013
Repair Windows Server 2008 R2 & Restart issue
Repair WINDOWS Server 2008 R2
Suppose your windows Server R2 is not starting up & restarting at start up then you can fix it .
Procedure to Repair Corrupt Windows 2008 Server OS:
1) Insert bootable CD / DVD of Windows 2008 Server in the machine.
2) Restart PC
3) Instialize the New Windows setup.
4) Click on Repair Windows
5)Execute this command in recovery console
X:\Sources\Recovery\StartRep.exe
It will ake some time & fix all errors.
Suppose your windows Server R2 is not starting up & restarting at start up then you can fix it .
Procedure to Repair Corrupt Windows 2008 Server OS:
1) Insert bootable CD / DVD of Windows 2008 Server in the machine.
2) Restart PC
3) Instialize the New Windows setup.
4) Click on Repair Windows
5)Execute this command in recovery console
X:\Sources\Recovery\StartRep.exe
It will ake some time & fix all errors.
Saturday, October 13, 2012
Cross browser : Change scroll bar color & Custom scrollbar
Add the following CSS snippet in the header section of webpage.
<STYLE>/* Let's get this party started */
::-webkit-scrollbar { width: 12px;}
/* Track */::-webkit-scrollbar-track
{ -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-webkit-border-radius: 10px; border-radius: 10px;
}
/* Handle */
::-webkit-scrollbar-thumb
{ -webkit-border-radius: 10px;
border-radius: 10px; background: rgba(255,0,0,0.8);
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); }
::-webkit-scrollbar-thumb:window-inactive
{ background: rgba(255,0,0,0.4); }
</STYLE>
Friday, August 3, 2012
Display table design ( with data types ) with SQL QUERY
Display table design with SQL QUERY
Execute folowing in SQL Query window
sp_columns <table name>
OR
sp_help <table name>
Execute folowing in SQL Query window
sp_columns <table name>
OR
sp_help <table name>
Friday, June 29, 2012
disable JavaScript Errors in IE
<script type="text/javascript">function noError(){return true;}window.onerror = noError;</script>Thursday, June 28, 2012
Insert selected records (checkboxes) from asp gridView & perform CRUD operations
Scenario :- I have to perform CRUD operation for selected records ( check boxes) in a GridView ID as described in the image.
No what we are doing is to perform a for loop on datatgrid & get selected checkbox id in a string varibale separted by ','.After that we will create a DB function that will split the checkbox ID'd string in new row for each id.
It will make CRUD operation very easy
GridView in aspx:-
<asp:DataGrid ID="grdList" DataKeyField="diagnosis_id" Runat="server" AutoGenerateColumns="False"
AllowPaging="False" PageSize="100" ShowHeader="true" >
<Columns>
<asp:BoundColumn DataField="diagnosis_name" HeaderText="DIAGNOSIS" SortExpression="diagnosis_name asc">
<HeaderStyle Width="75%" HorizontalAlign="Center" ></HeaderStyle>
<ItemStyle CssClass="greylabelsmall"></ItemStyle>
</asp:BoundColumn>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
VB function to get selected checkboxes in datagrid
Private Sub GetCheckedBox()
For Each item As DataGridItem In grdICDList.Items
If CType(item.FindControl("chkICD"), CheckBox).Checked Then
icdIds = icdIds + Convert.ToString( grdList .DataKeys.Item(item.ItemIndex)) + ","
End If
Next
If icdIds.Length > 0 Then
If icdIds.LastIndexOf(",") > 0 Then
icdIds = icdIds.Substring(0, icdIds.Length - 1)
End If
'SaveICDs()
InsertDiagnosis(icdIds)
End If
End Sub
Now create a db Function like this:-
CREATE FUNCTION [dbo].[Split]
(
@RowData varchar(8000),
@SplitOn nvarchar(5)
)
RETURNS @RtnValue table
(
Id int identity(1,1),
Data nvarchar(100)
)
AS
BEGIN
Declare @Cnt int
Set @Cnt = 1
While (Charindex(@SplitOn,@RowData)>0)
Begin
Insert Into @RtnValue (data)
Select
Data = ltrim(rtrim(Substring(@RowData,1,Charindex(@SplitOn,@RowData)-1)))
Set @RowData = Substring(@RowData,Charindex(@SplitOn,@RowData)+1,len(@RowData))
Set @Cnt = @Cnt + 1
End
Insert Into @RtnValue (data)
Select Data = ltrim(rtrim(@RowData))
Return
END
And Use it in your stored procedures like this :-
INSERT INTO INSERTABC
(CPTID,
ICDID,
CREATED_USER,
CREATED_DATE,
ISDELETED)
SELECT @CPTID,LTRIM(RTRIM(DATA)), @CREATED_USER, GETDATE(),0 FROM SPLIT(@ICDIDS,','
Example :--
SELECT DATA FROM SPLIT(@ICDIDS, ',' )
Data will give you select check boxes ID in new rows.
Friday, May 25, 2012
SQL Listing all column names alphabetically
Dynamic Query to list all column Alphabetically.
DECLARE @QUERY VARCHAR(4000)SET @QUERY = 'SELECT '
SELECT @QUERY = @QUERY + Column_name + ',' + CHAR(13) + CHAR(10) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'<TableName>' ORDER BY Column_name
SET @QUERY = @QUERY + 'FROM <TableName> '
PRINT @QUERY
Note:- Replace <TableName> with your table name .Also if you want all fields in a string ( a,b,c,d etc) then remove CHAR(13) + CHAR(10)
Update :-
Underscore (_) and quotes within SQL LIKE queries
Suppose we have a field having data 'xxxx_S' now We have to select Table Columns having '_S'
DECLARE @QUERY VARCHAR(4000)
SET @QUERY = 'SELECT '
SELECT @QUERY = @QUERY + Column_name + ','
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = N'insuredinfo' AND Column_name LIKE '%' + char(13) + '_S' escape char(13)
SET @QUERY = @QUERY + 'FROM insuredinfo'
PRINT @QUERY
Tuesday, February 28, 2012
Unchecking all checkboxes through JavaScript
Suppose we have 10 check boxes ..& checkboxes ID are chk1,chk2,chk3...
<script>
function selectOnlyThis(id) {
for (var i = 0;i <= 10; i++)
{
document.getElementById("Chk" + i).checked = false;
}
}
</script>
Call this function on a button click.
Friday, January 13, 2012
show pop up JavaScript message through C#
Add this following script in html code :
<script>
function ShowMessage() {
alert('Thank you for your submission! To complete, please continue with PayPal transaction');
window.location.href = 'BuyNow.aspx';
}
</script>
C# Code :-
ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "ShowMessage()", true);
<script>
function ShowMessage() {
alert('Thank you for your submission! To complete, please continue with PayPal transaction');
window.location.href = 'BuyNow.aspx';
}
</script>
C# Code :-
ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "ShowMessage()", true);
Monday, December 19, 2011
Checkbox Validation in ASP.NET
Validation of check box is little bit tricky but you can validate with Java Script
Add this script in the page.
<script type="text/javascript">add a Checkbox Control
function validateCheckBox(source,args)
{
var cb=document.getElementById("Privacy1");
if(!cb.checked)
args.IsValid=false;
}
</script>
Now you need to add a custom Validator:-<asp:CheckBox ID="Privacy1" runat="server"></asp:CheckBox>
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator" ValidateEmptyText="True" ClientValidationFunction="validateCheckBox"></asp:CustomValidator>
Tuesday, December 6, 2011
How to make free trials last FOREVER!!!
How to make free trials last FOREVER!!!
Difficulty : Piece of Cake
You can make any software work for life time.
I am taking example of “ADOBE FLASH CS5 PROFESSIONAL “ Trial version as an example
Here we go ->
- First download any trial software(Flash CS5)
- Type runasdate in Google
- Open 1st displayed page most probably nirsoft.
- Download the software which is free.
- Extract it & run .
- Then the first option will be application to run .Select desired(CS5) application’s exe file's path.
- Now,set a date/time Make it sure it must be in the trial period. (you can set same date when application is installed or next day’s date)
- Check both radio button, (move the time forward a/c to the real time & immediate mode)
- Create a new desktop shortcut with desired name (eg:- RippedCS5 ).
- Click RUN
- That’s it
- This procedure is required only for 1st time , make sure to make a shortcut & only use that shortcut on desktop. Configure every trial software with this utility & create short cut then u don’t need to run it again-2
Tuesday, August 9, 2011
Set Default Page in ASP.NET through web.config
Sometime you need to set a different landing,default page (other than home.aspx,index.htm) or suppose you are working on Godaddy's server.Then you can set you default page through web.config
Add this section in web.config :-
system.webServer
defaultdocument
files
clear/>
add value="CreateThing.aspx"/>
/files
/defaultDocument
/system.webServer
*Note : Keep each line in < > or < />
Add this section in web.config :-
system.webServer
defaultdocument
files
clear/>
add value="CreateThing.aspx"/>
/files
/defaultDocument
/system.webServer
*Note : Keep each line in < > or < />
Subscribe to:
Posts (Atom)
