Monday, June 18, 2012
Sunday, June 17, 2012
Sunday, June 10, 2012
'Account at a Glance' app
http://weblogs.asp.net/dwahlin/archive/2012/03/31/code-and-slides-building-the-account-at-a-glance-asp-net-mvc-ef-code-first-html5-and-jquery-application.aspx
Code is available for download on this page
To migrate above project to MVC4:
http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253806
Code is available for download on this page
To migrate above project to MVC4:
http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253806
Monday, May 28, 2012
javascript console - To get value of an element from an iframe
var d = ($$('iframe')[0]).contentDocument; d.getElementsByName('ID')[0]
Saturday, May 26, 2012
Title: Become a Javascript Console Power-User
To be able to access, from Console, elements in an iframe:
1. get id of iframe -
document.getElementsByTagName('iframe')
2. use the cd() command -
cd(document.getElementById('id_of_iframe').contentWindow)
3. now we can access elements in the iframe as usual using document.getElementById() etc
Wednesday, May 23, 2012
Wednesday, May 16, 2012
DateTime.Now.CompareTo() method
var dt1 = DateTime.Now;
while (DateTime.Now.CompareTo(dt1.AddSeconds(10)) <= 0)
{
}
Tuesday, May 15, 2012
Store Form Values bookmarklet
Drag & Drop the following bookmarklets to 'store' and 'load' a form's values.
Form Values - Store
Form Values - Load
Form Values - Store
Form Values - Load
Monday, May 7, 2012
Monday, March 19, 2012
Search stored procedure's text
http://blog.sqlauthority.com/2007/09/03/sql-server-2005-search-stored-procedure-code-search-stored-procedure-text/
USE AdventureWorks
GO
--Searching for Empoloyee table
SELECT Name FROM sys.procedures WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%Employee%'
GO
--Searching for Empoloyee table and RateChangeDate column together
SELECT Name FROM sys.procedures WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%Employee%'AND OBJECT_DEFINITION(OBJECT_ID) LIKE '%RateChangeDate%'
GO
USE AdventureWorks
GO
--Searching for Empoloyee table
SELECT Name FROM sys.procedures WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%Employee%'
GO
--Searching for Empoloyee table and RateChangeDate column together
SELECT Name FROM sys.procedures WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%Employee%'AND OBJECT_DEFINITION(OBJECT_ID) LIKE '%RateChangeDate%'
GO
Wednesday, February 29, 2012
Display all "display:none" elements
$("*").filter(function() { return $(this).css("display") == "none" }).css("display","")
Sunday, February 26, 2012
Mobile UI Frameworks (popular ones as of today..Feb 2012)
JQuery Mobile
http://jquerymobile.com
Sencha Touch
http://www.sencha.com/products/touch
JqTouch
http://jqtouch.com
Kendo UI
http://www.kendoui.com/mobile.aspx
http://jquerymobile.com
Sencha Touch
http://www.sencha.com/products/touch
JqTouch
http://jqtouch.com
Kendo UI
http://www.kendoui.com/mobile.aspx
Tuesday, February 21, 2012
Sunday, February 19, 2012
Sunday, February 12, 2012
More examples using Correlated Subquery
More examples using Correlated Subquery-
In my opinion, although Method 1 has the extra select statement at the top, it conveys the logic of the query better than Method 2.
In Method 2, we basically have pushed the 'join' statement inside the outer query.
SELECT
A.*, Challenge.*
FROM
(SELECT CE1.Challenge_ID,Question1,Question2,Question3,Question4,Question5,Question6
FROM Challenge_Enter as CE1
WHERE CE1.ID =
(SELECT max(CE2.ID)
From Challenge_Enter as CE2
WHERE CE2.CustomerID = 1123607 AND CE2.Challenge_ID = CE1.Challenge_ID AND Challenge_ID > 0)
) A
INNER JOIN
Challenge
on A.Challenge_ID = Challenge.ID
SELECT Challenge.*,CE1.Challenge_ID,Question1,Question2,Question3,Question4,Question5, Question6
FROM Challenge_Enter as CE1
INNER JOIN Challenge on CE1.Challenge_ID = Challenge.ID
WHERE CE1.ID =
(SELECT max(CE2.ID)
From Challenge_Enter as CE2
WHERE CE2.CustomerID = 1123607 AND CE2.Challenge_ID = CE1.Challenge_ID AND Challenge_ID > 0)
In my opinion, although Method 1 has the extra select statement at the top, it conveys the logic of the query better than Method 2.
In Method 2, we basically have pushed the 'join' statement inside the outer query.
Method 1:
SELECT
A.*, Challenge.*
FROM
(SELECT CE1.Challenge_ID,Question1,Question2,Question3,Question4,Question5,Question6
FROM Challenge_Enter as CE1
WHERE CE1.ID =
(SELECT max(CE2.ID)
From Challenge_Enter as CE2
WHERE CE2.CustomerID = 1123607 AND CE2.Challenge_ID = CE1.Challenge_ID AND Challenge_ID > 0)
) A
INNER JOIN
Challenge
on A.Challenge_ID = Challenge.ID
Method 2:
SELECT Challenge.*,CE1.Challenge_ID,Question1,Question2,Question3,Question4,Question5, Question6
FROM Challenge_Enter as CE1
INNER JOIN Challenge on CE1.Challenge_ID = Challenge.ID
WHERE CE1.ID =
(SELECT max(CE2.ID)
From Challenge_Enter as CE2
WHERE CE2.CustomerID = 1123607 AND CE2.Challenge_ID = CE1.Challenge_ID AND Challenge_ID > 0)
Correlated Subquery, Common Table Expression example
Here are 3 different ways to write the same query.
The difference between using Self-Join method, CTE method, and Correlated Subquery method --> in Correlated Subquery method, I could use the ID column (which is the primary key column); but we cannot use ID in Group By (since it will be unique for each row), so we cannot use it in the Self-Join & CTE methods
Hence, while writing Correlated Subqueries, we 'probably' have to focus on this --> returning the Primary Key of the outer query's table from the subquery
(This has to be verified by looking at examples)
From the table Challenge_Enter,
find out all the details of the latest Challenge to which the Customer 1123607 has entered into.
Self-Join
---------
SELECT
xx.*, Question1, Question2, Question3, Question4, Question5, Question6
FROM
Challenge_Enter yy
INNER JOIN
(SELECT
CustomerID, Challenge_Id, max(EnterDate) AS EnterDate
FROM
Challenge_Enter
WHERE
customerid = 1123607 AND Challenge_ID > 0
GROUP BY
Challenge_Id, CustomerID
) xx
ON yy.Challenge_ID = xx.Challenge_ID
WHERE
yy.EnterDate = xx.EnterDate
Common Table Expression
-----------------------
WITH
max_entries (Challenge_ID, maxEnterDate) As
(
SELECT
Challenge_id, max(EnterDate) maxEnterDate
from
Challenge_Enter
where CustomerID = 1123607 AND Challenge_ID > 0
group BY
Challenge_ID
)
SELECT
*
FROM
max_entries
INNER JOIN
Challenge_Enter
ON
max_entries.Challenge_ID = Challenge_Enter.Challenge_ID AND
max_entries.maxEnterDate = Challenge_Enter.EnterDate
Correlated Subquery
-------------------
SELECT
Challenge_ID,Question1,Question2,Question3,Question4,Question5,Question6
FROM
Challenge_Enter as CE1
WHERE
ID = (SELECT max(CE2.ID) From Challenge_Enter as CE2 WHERE CE2.CustomerID = 1123607 AND CE2.Challenge_ID = CE1.Challenge_ID AND Challenge_ID > 0 )
Thursday, January 26, 2012
Monday, January 2, 2012
Sunday, December 18, 2011
Sunday, December 4, 2011
Friday, November 18, 2011
TableSorter, Flexigrid examples
TableSorter
This does everything on the Client (i.e. data is downloaded and then Paging, Sorting, Filtering (Search) is done on the data).(I modified the jquery.tablesorter.filter.js file because there was a bug - search was being conducted on a row after combining all its column values without a space in between; this results in extra rows being displayed in the Search)
TableSorter with Paging & Search
Flexigrid
This does everything on the Server (i.e. paging, sorting, searching)Unzip the file, open as Website in Visual Studio, right-click on "HTMLPage_UsingJquery1.7.htm" or "HTMLPage.htm" , and select View in Browser
Flexigrid.zip
BUGS -
1) If on Page 2,3,.. (>1), and then Search string is modified, page number does not go to 1 automatically. This is a problem if Search results do not exceed 1 page. (I could not rectify this by passing 'page':1 to flexOptions like I did for Search parameters.)
2) Displaying 10 of 23 results - this message at the bottom-right does not update properly with Search & Paging updates
Monday, November 7, 2011
Comparison_of_JavaScript_frameworks
http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks
This is a Wikipedia link, so it will probably be up-to-date always.
This is a Wikipedia link, so it will probably be up-to-date always.
Monday, October 31, 2011
Performance Tips ASP.Net
http://optimizeasp.net/
http://madskristensen.net/post/Performance-tuning-tricks-for-ASPNET-and-IIS-7-part-1.aspx
http://madskristensen.net/post/Performance-tuning-tricks-for-ASPNET-and-IIS-7-e28093-part-2.aspx
http://msdn.microsoft.com/en-us/library/ms973839.aspx#dotnetperftips_topic4
http://msdn.microsoft.com/en-us/library/ms973838.aspx
http://madskristensen.net/post/Performance-tuning-tricks-for-ASPNET-and-IIS-7-part-1.aspx
http://madskristensen.net/post/Performance-tuning-tricks-for-ASPNET-and-IIS-7-e28093-part-2.aspx
http://msdn.microsoft.com/en-us/library/ms973839.aspx#dotnetperftips_topic4
http://msdn.microsoft.com/en-us/library/ms973838.aspx
Saturday, October 22, 2011
Friday, October 21, 2011
Sunday, October 16, 2011
Tuesday, September 20, 2011
Trello.com - technologies used
- Nodejs for Webserver
- Express for MVC
- JQuery
- Backbone
- SocketIO
- JQueryUI
From http://stackoverflow.com/questions/5053167/backbone-js-versus-express-versus-ext-js-and-jspp -
backbone.js is a client-side MVC framework.
JSPP is a means you can write inline server-side code (like PHP or ASP) for nodejs
Express is a node.js specific server-side framework for web development.
Ext JS is a framework for making web applications and widgets.
There all very different. There isn't any point in a direct comparison without you telling us what you want to use them for.
To vaguely answer your question. IMHO I would say using backbone.js on the client and on nodejs is great for MVC centric design.
Express is a great layer of abstraction on nodejs because it beats writing the code yourself. Use it to serve content to your clients.
Ext JS is not free.
JSPP looks like ASP/PHP!
Wednesday, September 14, 2011
Finding out which apps are using which ports on your machine
http://blogs.msdn.com/b/bgroth/archive/2004/11/11/256190.aspx
Above link suggests using "netstat" along with "tasklist"
Another way is to use "netstat" along with Task Manager
Step 1: Open Task Manager -- select "View" -- select "Select Columns" -- check PID
Find out PID of the process whose port info you are after.
Step 2: (From above link)
C:\>NetStat -o
Above link suggests using "netstat" along with "tasklist"
Another way is to use "netstat" along with Task Manager
Step 1: Open Task Manager -- select "View" -- select "Select Columns" -- check PID
Find out PID of the process whose port info you are after.
Step 2: (From above link)
C:\>NetStat -o
PID will displayed in the last column. Use PID from Step 1
Example: To find the port that "sqlservr.exe" is using, we first find out the PID from Task Manager ,which is 1660
If we now type "netstat -o" in a command prompt window, we will be able to see which port is being used by that PID ie 1660
Example: To find the port that "sqlservr.exe" is using, we first find out the PID from Task Manager ,which is 1660
If we now type "netstat -o" in a command prompt window, we will be able to see which port is being used by that PID ie 1660
Thursday, September 8, 2011
WCF Callbacks related - Steps to do on client-side when using wsDualHttpBinding
Client = WPF app (chat application)
WCF Service = uses wsDualHttpBinding (to make callbacks to the clients)
OS= Windows XP
(The whole project is an implementation of - http://www.eggheadcafe.com/tutorials/aspnet/b5ada8df-58c5-492f-b368-457b3a4f137c/notify-client-applications-using-wcf-callbacks.aspx )
After initially developing the client (a WPF app) and the WCF Service on the same machine, we moved the WCF Service to a test server.
I received the error message - The caller was not authenticated by the service..
Upon googling, it turned out that this is the common error message that is received when developers typically move their WCF Service to another machine.
1. In client's app.config file :
<security mode="None">
<message clientCredentialType="None" negotiateServiceCredential="false" />
</security>
2. Specified "clientBaseAddress" attribute for "binding" element in client's app.config:
clientBaseAddress="http://system2:8001/TempUri/"
(I used machine-name or IP address instead of "localhost" in clientBaseAddress)
3. Add 8001 port to Firewall's Exception list
Did the following to make the WPF app, running as a non-admin , to receive the callback properly from the WCF service. This will take care of the following error -
HTTP could not register URL http://*:8001/TempUri/. Your process does not have access rights to this namespace
4. Download HttpNamespaceManager tool from http://blogs.msdn.com/b/paulwh/archive/2007/05/04/addressaccessdeniedexception-http-could-not-register-url-http-8080.aspx
HttpNamespaceManager.zip
5. Add SDDL using HttpNamespaceManager tool - Add Users group AND give rights to Users group
6. (OPTIONAL step) Specifying clientBaseAddress via code instead of from app.config - If we do this, we do not have to change app.config when we install the app on the user's machine
// modify ClientBaseAddress to have this machine's IP address in the Url
// The ClientBaseAddress is needed for the Service to contact the client
WSDualHttpBinding w = (WSDualHttpBinding)this.chatServiceClient.Endpoint.Binding;
w.ClientBaseAddress = new Uri("http://" + getIPAddress() + ":8001/TempUri");
chatServiceClient.Endpoint.Binding = w;
........
........
........
private string getIPAddress()
{
string myClientMachineName = System.Net.Dns.GetHostName();
IPHostEntry myClientMachineAddressList = System.Net.Dns.GetHostEntry(myClientMachineName);
return myClientMachineAddressList.AddressList[0].ToString();
}
Monday, September 5, 2011
WCF Callbacks
The below is a good example of using WCF Callbacks -
http://www.eggheadcafe.com/tutorials/aspnet/b5ada8df-58c5-492f-b368-457b3a4f137c/notify-client-applications-using-wcf-callbacks.aspx
But I have stripped down the code for the 'client' to the below, to understand the main steps more easily.
By 'stripping down', I mean, I removed error checking code and made the MainWindow class implement the callback function
http://www.eggheadcafe.com/tutorials/aspnet/b5ada8df-58c5-492f-b368-457b3a4f137c/notify-client-applications-using-wcf-callbacks.aspx
But I have stripped down the code for the 'client' to the below, to understand the main steps more easily.
By 'stripping down', I mean, I removed error checking code and made the MainWindow class implement the callback function
Friday, July 1, 2011
Small Basic - for beginners and kids
http://msdn.microsoft.com/en-us/ff384126.aspx
http://smallbasic.com/
http://smallbasic.com/
Microsoft Small Basic puts the fun back into computer programming. With a friendly development environment that is very easy to master, it eases both kids and adults into the world of programming.
Thursday, June 16, 2011
Tuesday, June 14, 2011
Saturday, March 26, 2011
Saturday, March 5, 2011
CSS - Using background-image to replace text
http://stopdesign.com/archive/2003/03/07/replace-text.html
Good sites to learn/study CSS -
www.bluerobot.com
www.csszengarden.com
Good sites to learn/study CSS -
www.bluerobot.com
www.csszengarden.com
Thursday, March 3, 2011
Tuesday, March 1, 2011
Thursday, January 13, 2011
Difference between 'Web Site' and 'Project' in Visual Studio
Monday, January 10, 2011
Thursday, January 6, 2011
!important rule in CSS
Cascading Style Sheets cascade. This means that the styles are applied in order as they are read by the browser. The first style is applied and then the second and so on. What this means is that if a style appears at the top of a style sheet and then is changed lower down in the document, the second instance of that style will be the one applied, not the first. For example, in the following style sheet, the paragraph text will be black, even though the first style property applied is red:
p { color: #ff0000; }
p { color: #000000; }
The !important rule is a way to make your CSS cascade but also have the rules you feel are most crucial always be applied. A rule that has the !important property will always be applied no matter where that rule appears in the CSS document. So if you wanted to make sure that a property always applied, you would add the !important property to the tag. So, to make the paragraph text always red, in the above example, you would write:
p { color: #ff0000 !important; }
p { color: #000000; }
p { color: #ff0000; }
p { color: #000000; }
The !important rule is a way to make your CSS cascade but also have the rules you feel are most crucial always be applied. A rule that has the !important property will always be applied no matter where that rule appears in the CSS document. So if you wanted to make sure that a property always applied, you would add the !important property to the tag. So, to make the paragraph text always red, in the above example, you would write:
p { color: #ff0000 !important; }
p { color: #000000; }
Thursday, December 9, 2010
Monday, November 29, 2010
Good topics related to AJAX
When to use GET and POST in AJAX -
http://javascript.about.com/od/ajax/a/ajaxgp.htm
See the links listed at the end of the page also
http://javascript.about.com/od/ajax/a/ajaxgp.htm
See the links listed at the end of the page also
Wednesday, November 10, 2010
Good color combination for a Heading
Below heading is created using a Panel. It looks good on a normal white background (page's background I mean)

<asp:Panel ID="pReferralMethodHeader" runat="server" BackColor="#e7e7e7" Height="30px" ScrollBars="None">
<div style="padding: 5px; cursor: pointer; vertical-align: middle;">
<div style="float: left;" class="">
<font face="verdana" color="#993333" size="3"><b>Referral Method</b></font>
</div>
<div style="float: right; vertical-align: middle;">
<asp:ImageButton ID="imgReferralMethod" runat="server" ImageUrl="~/images/expand_blue.jpg"
AlternateText="(Show Claim Information Details...)" />
</div>
</div>
</asp:Panel>
<asp:Panel ID="pReferralMethodHeader" runat="server" BackColor="#e7e7e7" Height="30px" ScrollBars="None">
<div style="padding: 5px; cursor: pointer; vertical-align: middle;">
<div style="float: left;" class="">
<font face="verdana" color="#993333" size="3"><b>Referral Method</b></font>
</div>
<div style="float: right; vertical-align: middle;">
<asp:ImageButton ID="imgReferralMethod" runat="server" ImageUrl="~/images/expand_blue.jpg"
AlternateText="(Show Claim Information Details...)" />
</div>
</div>
</asp:Panel>
Monday, November 8, 2010
CSS Inheritance
From http://dorward.me.uk/www/css/inheritance/
(Another good link is - http://www.webdesignfromscratch.com/html-css/css-inheritance-cascade/)
Multiple Classes
Making good use of classes will solve most problems. Take the example of having boxes of data floating on alternating sides of the canvas.
.oddBoxOut {
width: 12em;
float: left;
padding: 0.5em;
margin: 0.5em;
border: solid 1px black;
}
.evenBoxOut {
width: 12em;
float: right;
padding: 0.5em;
margin: 0.5em;
border: solid 1px black;
}
As you can see, many properties are duplicated in each definition, so it is obvious why somebody might want OO-style inheritance.
There is another solution though. Lets take a quick look back at the HTML specification:
class = cdata-list[CS]
This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters.
So we can assign multiple class names to a single element? That means we can change the style sheet so it looks like this:
.boxOut {
width: 12em;
padding: 0.5em;
margin: 0.5em;
border: solid 1px black;
}
.oddBoxOut {
float: left;
}
.evenBoxOut {
float: right;
}
And then the HTML will look like:
<div class="boxOut oddBoxOut">
Grouping Selectors
A single style may have multiple selectors assigned to it through the use of grouping.
To revisit the previous example, we first simplify the HTML so we only mention the one class:
<div class="oddBoxOut">
Then we assign the CSS we want to it, but we group the common property/value pairs.
.oddBoxOut,
.evenBoxOut {
width: 12em;
padding: 0.5em;
margin: 0.5em;
border: solid 1px black;
}
.oddBoxOut {
float: left;
}
.evenBoxOut {
float: right;
}
These two techniques should solve most problems which people think can be solved with OO-style inheritance, but we still have the option of using a preprocessor.
(Another good link is - http://www.webdesignfromscratch.com/html-css/css-inheritance-cascade/)
Multiple Classes
Making good use of classes will solve most problems. Take the example of having boxes of data floating on alternating sides of the canvas.
.oddBoxOut {
width: 12em;
float: left;
padding: 0.5em;
margin: 0.5em;
border: solid 1px black;
}
.evenBoxOut {
width: 12em;
float: right;
padding: 0.5em;
margin: 0.5em;
border: solid 1px black;
}
As you can see, many properties are duplicated in each definition, so it is obvious why somebody might want OO-style inheritance.
There is another solution though. Lets take a quick look back at the HTML specification:
class = cdata-list[CS]
This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters.
So we can assign multiple class names to a single element? That means we can change the style sheet so it looks like this:
.boxOut {
width: 12em;
padding: 0.5em;
margin: 0.5em;
border: solid 1px black;
}
.oddBoxOut {
float: left;
}
.evenBoxOut {
float: right;
}
And then the HTML will look like:
<div class="boxOut oddBoxOut">
Grouping Selectors
A single style may have multiple selectors assigned to it through the use of grouping.
To revisit the previous example, we first simplify the HTML so we only mention the one class:
<div class="oddBoxOut">
Then we assign the CSS we want to it, but we group the common property/value pairs.
.oddBoxOut,
.evenBoxOut {
width: 12em;
padding: 0.5em;
margin: 0.5em;
border: solid 1px black;
}
.oddBoxOut {
float: left;
}
.evenBoxOut {
float: right;
}
These two techniques should solve most problems which people think can be solved with OO-style inheritance, but we still have the option of using a preprocessor.
Javascript examples: style.display & style.visibility & .disabled
document.getElementById("pnlSearch").style.display = "block";
document.getElementById("pnlSearch").style.display = "none";
document.getElementById("pnlSearch").style.visibility = "visible";
document.getElementById("pnlSearch").style.visibility = "hidden";
document.getElementById('btnSearch').disabled =false;
document.getElementById('btnSearch').disabled =true;
From http://stackoverflow.com/questions/133051/what-is-the-difference-between-visibilityhidden-and-displaynone : (See link for a short-but-great example) :
display:none means that the the tag in question will not appear on the page at all (although you can still interact with it through the dom). There will be no space allocated for it between the other tags. Visibility:hidden means that unlike display:none, the tag is not visible, but space is allocated for it on the page.
document.getElementById("pnlSearch").style.display = "none";
document.getElementById("pnlSearch").style.visibility = "visible";
document.getElementById("pnlSearch").style.visibility = "hidden";
document.getElementById('btnSearch').disabled =false;
document.getElementById('btnSearch').disabled =true;
From http://stackoverflow.com/questions/133051/what-is-the-difference-between-visibilityhidden-and-displaynone : (See link for a short-but-great example) :
display:none means that the the tag in question will not appear on the page at all (although you can still interact with it through the dom). There will be no space allocated for it between the other tags. Visibility:hidden means that unlike display:none, the tag is not visible, but space is allocated for it on the page.
Saturday, November 6, 2010
Difference between DIV and SPAN tags
http://webdesign.about.com/od/htmltags/a/aa011000a.htm
The primary difference between the <span> and <div> tags is that <span> doesn't do any formatting of it's own. The <div> tag acts includes a paragraph break, because it is defining a logical division in the document. The <span> tag simply tells the browser to apply the style rules to whatever is within the <span>
The primary difference between the <span> and <div> tags is that <span> doesn't do any formatting of it's own. The <div> tag acts includes a paragraph break, because it is defining a logical division in the document. The <span> tag simply tells the browser to apply the style rules to whatever is within the <span>
Monday, November 1, 2010
Validate your CSS, XHTML; CSS Quirks
Excerpt from http://www.uwplatt.edu/web/wtc/div/boxmodel.html :
If you run into problems, go back and make sure you are accounting for all elements and all the properties. If you still are still having problems, validate your CSS, validate your XHTML, be sure to check the CSS Quirks Section, and if you are still having problems, consult an online resource
If you run into problems, go back and make sure you are accounting for all elements and all the properties. If you still are still having problems, validate your CSS, validate your XHTML, be sure to check the CSS Quirks Section, and if you are still having problems, consult an online resource
Good tutorial to learn about DIV, CSS (real HTML stuff)
http://www.uwplatt.edu/web/wtc/div/clear.html
One nice way to remember the components of CSS Box Model - MBIPC (like MPC, BIPC, etc in XII std in school)..
M - Margin (always transparent), B - Border, P - Padding, C - Content
http://www.uwplatt.edu/web/wtc/div/boxmodel.html
One nice way to remember the components of CSS Box Model - MBIPC (like MPC, BIPC, etc in XII std in school)..
M - Margin (always transparent), B - Border, P - Padding, C - Content
http://www.uwplatt.edu/web/wtc/div/boxmodel.html
Monday, October 25, 2010
Sunday, October 24, 2010
Wednesday, October 20, 2010
Asymmetric Encryption
Excerpt from http://www.4guysfromrolla.com/articles/021407-1.aspx
In asymmetric encryption two keys are generated per entity, one which is kept private and the other which is publicly known. The interesting and most important attribute of each of the two keys is that: each key undoes the other's operations, and it is computationally infeasible to generate the opposite key given one of the keys. As Figure 2 illustrates, if Bob wants to send a message to Alice, he uses Alice's public key to encrypt the message with. Later, when Alice wants to decrypt the message, she only needs to use her private key to do so. This method ensures that only Alice is able to read the messages encrypted with her public key.
In asymmetric encryption two keys are generated per entity, one which is kept private and the other which is publicly known. The interesting and most important attribute of each of the two keys is that: each key undoes the other's operations, and it is computationally infeasible to generate the opposite key given one of the keys. As Figure 2 illustrates, if Bob wants to send a message to Alice, he uses Alice's public key to encrypt the message with. Later, when Alice wants to decrypt the message, she only needs to use her private key to do so. This method ensures that only Alice is able to read the messages encrypted with her public key.
The Art & Science of Storing Passwords (2006 article)
Good article about Storing Passwords
http://www.codeproject.com/KB/recipes/StoringPasswords.aspx
Excerpt from conclusion -
The simple guidelines are:
* If you need to retrieve passwords, use encryption.
* If you do not need to retrieve passwords, use hashes (more secure).
* Whatever you do, salt the passwords.
http://www.codeproject.com/KB/recipes/StoringPasswords.aspx
Excerpt from conclusion -
The simple guidelines are:
* If you need to retrieve passwords, use encryption.
* If you do not need to retrieve passwords, use hashes (more secure).
* Whatever you do, salt the passwords.
Tuesday, October 19, 2010
MultiTouch Vista
http://multitouchvista.codeplex.com/
Excerpt from http://www.drdobbs.com/windows/227701092
The great drawback is that you cannot emulate multitouch gestures with a mouse or a touchpad in your developer workstation. However, if you don't have a multitouch monitor, you still have a chance to test some multitouch gestures without having to deploy the project to the phone. There is an interesting project on CodePlex, Multi-Touch Vista that allows you to work with multiple mice to emulate two fingers on the screen and their multitouch gestures. In fact, the latest version of Multi-How to build a UI from scratch.
Multi-Touch Vista provides a Windows 7 compatible driver that enables multiple mice and is compatible with the Windows Phone 7 emulator. For example, you can use a laptop's touchpad as one of the pointers and a USB mouse connected to the same laptop as the second pointer. (If you're interested in working with Multi-Touch Vista, you can read an excellent step-by-step tutorial written by Michael Sync This tutorial explains how to install and configure the driver to work with the Windows Phone 7 emulator.)
Excerpt from http://www.drdobbs.com/windows/227701092
The great drawback is that you cannot emulate multitouch gestures with a mouse or a touchpad in your developer workstation. However, if you don't have a multitouch monitor, you still have a chance to test some multitouch gestures without having to deploy the project to the phone. There is an interesting project on CodePlex, Multi-Touch Vista that allows you to work with multiple mice to emulate two fingers on the screen and their multitouch gestures. In fact, the latest version of Multi-How to build a UI from scratch.
Multi-Touch Vista provides a Windows 7 compatible driver that enables multiple mice and is compatible with the Windows Phone 7 emulator. For example, you can use a laptop's touchpad as one of the pointers and a USB mouse connected to the same laptop as the second pointer. (If you're interested in working with Multi-Touch Vista, you can read an excellent step-by-step tutorial written by Michael Sync This tutorial explains how to install and configure the driver to work with the Windows Phone 7 emulator.)
When using post-cache substitution
From ASP.Net 3.5 Unleashed (pg 1318)
When you use post-cache substitution (declaratively or programmatically) then caching no longer happens beyond the web server. Using post-cache substitution causes a Cache-Control:no-cache HTTP header to be included in the HTTP response, which disables caching on proxy servers and browsers. This limitation is understandable because the substitution content must be generated dynamically with each page request.
When you use post-cache substitution (declaratively or programmatically) then caching no longer happens beyond the web server. Using post-cache substitution causes a Cache-Control:no-cache HTTP header to be included in the HTTP response, which disables caching on proxy servers and browsers. This limitation is understandable because the substitution content must be generated dynamically with each page request.
Friday, October 15, 2010
Stored Procedures and PreCompilation
Whether they're precompiled depends on the database. In SQL Server, for instance, they're not. Stored procedures and parameterized SQL are both compiled before being run. A stored procedure can sometimes reuse an execution plan if a corresponding one exists...but so can parameterized SQL.
http://stackoverflow.com/questions/226859/disadvantage-of-stored-procedures
http://stackoverflow.com/questions/226859/disadvantage-of-stored-procedures
implementing-a-dynamic-where-clause
http://www.sqlteam.com/article/implementing-a-dynamic-where-clause
SELECT Cus_Name,
Cus_City,
Cus_Country
FROM Customers
WHERE Cus_Name = COALESCE(@Cus_Name,Cus_Name) AND
Cus_City = COALESCE(@Cus_City,Cus_City) AND
Cus_Country = COALESCE(@Cus_Country,Cus_Country)
SELECT Cus_Name,
Cus_City,
Cus_Country
FROM Customers
WHERE Cus_Name = COALESCE(@Cus_Name,Cus_Name) AND
Cus_City = COALESCE(@Cus_City,Cus_City) AND
Cus_Country = COALESCE(@Cus_Country,Cus_Country)
Monday, October 11, 2010
Difference between <%= and <%#
The ASP.NET syntax <%# %> is a shorthand convention that instructs the runtime to execute whatever is contained within and output the results “in Line”.
Difference between <%= and <%# -
From http://blogs.msdn.com/b/dancre/archive/2007/02/13/the-difference-between-lt-and-lt-in-asp-net.aspx
Difference between <%= and <%# -
From http://blogs.msdn.com/b/dancre/archive/2007/02/13/the-difference-between-lt-and-lt-in-asp-net.aspx
- The <%= expressions are evaluated at render time
- The <%# expressions are evaluated at DataBind() time and are not evaluated at all if DataBind() is not called.
- <%# expressions can be used as properties in server-side controls. <%= expressions cannot.
Monday, September 20, 2010
SET NOCOUNT ON
http://msdn.microsoft.com/en-us/library/ms189837.aspx
When SET NOCOUNT is ON, the count is not returned. When SET NOCOUNT is OFF, the count is returned.
The @@ROWCOUNT function is updated even when SET NOCOUNT is ON.
SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. For stored procedures that contain several statements that do not return much actual data, or for procedures that contain Transact-SQL loops, setting SET NOCOUNT to ON can provide a significant performance boost, because network traffic is greatly reduced.
When SET NOCOUNT is ON, the count is not returned. When SET NOCOUNT is OFF, the count is returned.
The @@ROWCOUNT function is updated even when SET NOCOUNT is ON.
SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. For stored procedures that contain several statements that do not return much actual data, or for procedures that contain Transact-SQL loops, setting SET NOCOUNT to ON can provide a significant performance boost, because network traffic is greatly reduced.
Tuesday, September 14, 2010
Tailspin Spyworks
1. Beginner Developer Learning Center
http://msdn.microsoft.com/en-us/beginner/default.aspx
2. Tailspin Spyworks Step-by-Step Tutorial - demonstrates how extraordinarily simple it is to create powerful, scalable applications for the .NET platform. It shows off how to use the great new features in ASP.NET 4 to build an online store, including shopping, checkout, and administration.
This tutorial series details all of the steps taken to build the Tailspin Spyworks sample application.
http://www.asp.net/web-forms/tutorials/tailspin-spyworks-part-1
http://msdn.microsoft.com/en-us/beginner/default.aspx
2. Tailspin Spyworks Step-by-Step Tutorial - demonstrates how extraordinarily simple it is to create powerful, scalable applications for the .NET platform. It shows off how to use the great new features in ASP.NET 4 to build an online store, including shopping, checkout, and administration.
This tutorial series details all of the steps taken to build the Tailspin Spyworks sample application.
http://www.asp.net/web-forms/tutorials/tailspin-spyworks-part-1
Friday, September 3, 2010
AJAX
From http://www.telerik.com/help/aspnet-ajax/ajxajax.html -
AJAX-enabled applications, on the other hand, rely on a new asynchronous method of client-server communication. It is implemented as a JavaScript engine that is loaded on the client during the initial page load. From there on, this engine serves as a mediator that sends only relevant XML-formatted data to the server and subsequently processes the server response to update the relevant page elements.
Below is a diagram of the complete lifecycle of an AJAX-enabled web form.

Click to enlargeClick to enlarge
1. Initial request by the browser – the user requests a particular URL.
2. The complete page is rendered by the server (along with the JavaScript AJAX engine) and sent to the client (HTML, CSS, JavaScript AJAX engine).
3. All subsequent requests to the server are initiated as function calls to the JavaScript engine.
4. The JavaScript engine then makes an XmlHttpRequest to the server.
5. The server processes the request and sends a response in XML format to the client (XML document). It contains the data only of the page elements that need to be changed. In most cases this data comprises just a fraction of the total page markup.
6. The AJAX engine processes the server response, updates the relevant page content or performs another operation with the new data received from the server. (HTML + CSS)
AJAX-enabled applications, on the other hand, rely on a new asynchronous method of client-server communication. It is implemented as a JavaScript engine that is loaded on the client during the initial page load. From there on, this engine serves as a mediator that sends only relevant XML-formatted data to the server and subsequently processes the server response to update the relevant page elements.
Below is a diagram of the complete lifecycle of an AJAX-enabled web form.

Click to enlargeClick to enlarge
1. Initial request by the browser – the user requests a particular URL.
2. The complete page is rendered by the server (along with the JavaScript AJAX engine) and sent to the client (HTML, CSS, JavaScript AJAX engine).
3. All subsequent requests to the server are initiated as function calls to the JavaScript engine.
4. The JavaScript engine then makes an XmlHttpRequest to the server.
5. The server processes the request and sends a response in XML format to the client (XML document). It contains the data only of the page elements that need to be changed. In most cases this data comprises just a fraction of the total page markup.
6. The AJAX engine processes the server response, updates the relevant page content or performs another operation with the new data received from the server. (HTML + CSS)
Thursday, September 2, 2010
Monday, August 30, 2010
ProXPN
http://www.youtube.com/watch?v=ONpttV7o9Oc&feature=player_embedded
ProXPN is a new VPN service which creates a highly secure environment between your computer and the internet.
ProXPN is a new VPN service which creates a highly secure environment between your computer and the internet.
Friday, July 9, 2010
Thursday, July 8, 2010
Understand the Attraction of Small Functions
From http://petesbloggerama.blogspot.com/ -
Bill Wagner, in his excellent book, “Effective C#” Second Edition (which I reviewed here), gives a good example in his “Item 11 – Understand the Attraction of Small Functions”:
Bill says that one of the most common examples of premature optimization is when you create longer, more complicated methods in the hope of avoiding method calls.
The .NET Runtime performs JIT compilation on a method – by – method basis at runtime, as the methods are used. Methods that do not ever get called don’t get JITed. Bill gives a short example:
public string BuildMsg( bool takeFirstPath )
{
StringBuilder msg = new StringBuilder( );
if ( takeFirstPath )
{
msg.Append( "A problem occurred." );
msg.Append( "\nThis is a problem." );
msg.Append( "imagine much more text" );
} else
{
msg.Append( "This path is not so bad." );
msg.Append( "\nIt is only a minor inconvenience." );
msg.Append( "Add more detailed diagnostics here." );
}
return msg.ToString( );
}
The first time BuildMsg gets called, both paths are JITed, but only one is needed. But if you rewrote the method this way:
public string BuildMsg( bool takeFirstPath )
{
if ( takeFirstPath )
{
return FirstPath( );
} else
{
return SecondPath( );
}
}
-- the body of each clause has been factored into its own method, and that method can be JITed on demand rather than the first time BuildMsg is called. The example is deliberately short and contrived, but think about how you code: Do you write code with 20 or more statements in each branch? How about switch statements where the body of each case block is defined inline instead of in separate methods?
Bill Wagner, in his excellent book, “Effective C#” Second Edition (which I reviewed here), gives a good example in his “Item 11 – Understand the Attraction of Small Functions”:
Bill says that one of the most common examples of premature optimization is when you create longer, more complicated methods in the hope of avoiding method calls.
The .NET Runtime performs JIT compilation on a method – by – method basis at runtime, as the methods are used. Methods that do not ever get called don’t get JITed. Bill gives a short example:
public string BuildMsg( bool takeFirstPath )
{
StringBuilder msg = new StringBuilder( );
if ( takeFirstPath )
{
msg.Append( "A problem occurred." );
msg.Append( "\nThis is a problem." );
msg.Append( "imagine much more text" );
} else
{
msg.Append( "This path is not so bad." );
msg.Append( "\nIt is only a minor inconvenience." );
msg.Append( "Add more detailed diagnostics here." );
}
return msg.ToString( );
}
The first time BuildMsg gets called, both paths are JITed, but only one is needed. But if you rewrote the method this way:
public string BuildMsg( bool takeFirstPath )
{
if ( takeFirstPath )
{
return FirstPath( );
} else
{
return SecondPath( );
}
}
-- the body of each clause has been factored into its own method, and that method can be JITed on demand rather than the first time BuildMsg is called. The example is deliberately short and contrived, but think about how you code: Do you write code with 20 or more statements in each branch? How about switch statements where the body of each case block is defined inline instead of in separate methods?
Wednesday, June 9, 2010
Performance - Patterns and Practices
Big list of links related to Performace -
http://blogs.msdn.com/b/jmeier/archive/2010/06/08/patterns-amp-practices-performance-guidance-roundup.aspx
http://blogs.msdn.com/b/jmeier/archive/2010/06/08/patterns-amp-practices-performance-guidance-roundup.aspx
Friday, May 28, 2010
regex to strip non-numeric characters from a phone-number-string
javascript - function(value) {return value.replace(/[^0-9]/g,"") }
This convertor function strips any non-numeric characters from the INPUT element. Now, if you enter the phone number (206) 555-9999 into the phone input field then the value 2065559999 is assigned to the phone property of the contact object
http://weblogs.asp.net/scottgu/archive/2010/05/07/jquery-templates-and-data-linking-and-microsoft-contributing-to-jquery.aspx
This convertor function strips any non-numeric characters from the INPUT element. Now, if you enter the phone number (206) 555-9999 into the phone input field then the value 2065559999 is assigned to the phone property of the contact object
http://weblogs.asp.net/scottgu/archive/2010/05/07/jquery-templates-and-data-linking-and-microsoft-contributing-to-jquery.aspx
Thursday, May 20, 2010
Sunday, March 28, 2010
Deep Zoom related
Deep Zoom - automating the generation of collection -
1. http://www.codeproject.com/KB/silverlight/DecosDeepZoom.aspx
2. http://blogs.msdn.com/giorgio/archive/2008/05/05/deep-zoom-batch-export-programmaticly-using-c.aspx
1. http://www.codeproject.com/KB/silverlight/DecosDeepZoom.aspx
2. http://blogs.msdn.com/giorgio/archive/2008/05/05/deep-zoom-batch-export-programmaticly-using-c.aspx
Saturday, March 27, 2010
Script.aculo.us - useful effects
Here we insered to extra parameters. In this example, the picture will start fading after 10 seconds, not frames, and will only fade to 50 percent of it's original color.
>
Here are all the 16 standard effects that you can use with script.aculo.us:
Fade: Decreases opacity
Appear: Increases opacity
BlindUp, BlindDown: Changes height of the element
SlideUp, SlideDown: Slides the element up or down.
Shrink: Resizes the element( Shrinks)
Grow: Resizes the element( Expands)
Highlight: CHanges background color of element.
Shake: Causes an element to slide left to right a few times.
Pulsate: Rapidly fades in and out several times.
DropOut: Simultaneously fades an element and moves it downward, so it appears to drop off the page
SwitchOff: SImulates an old television bieng turned off; a quick flicker, and then the element collapses into a horizontal line.
Puff: Makes an element incease in size while decreasing opacity.
Squish: Similiar to shrink, but the element's top-left corner remains fixed.
Fold: First redurces the element's height to a thin line and then reduces its width until it disappears
>
Here are all the 16 standard effects that you can use with script.aculo.us:
Fade: Decreases opacity
Appear: Increases opacity
BlindUp, BlindDown: Changes height of the element
SlideUp, SlideDown: Slides the element up or down.
Shrink: Resizes the element( Shrinks)
Grow: Resizes the element( Expands)
Highlight: CHanges background color of element.
Shake: Causes an element to slide left to right a few times.
Pulsate: Rapidly fades in and out several times.
DropOut: Simultaneously fades an element and moves it downward, so it appears to drop off the page
SwitchOff: SImulates an old television bieng turned off; a quick flicker, and then the element collapses into a horizontal line.
Puff: Makes an element incease in size while decreasing opacity.
Squish: Similiar to shrink, but the element's top-left corner remains fixed.
Fold: First redurces the element's height to a thin line and then reduces its width until it disappears
Thursday, March 25, 2010
JavaScript Tutorial: Regular Expressions
Very Good Javascript Tutorial
JavaScript Tutorial: Regular Expressions
JavaScript Tutorial: Regular Expressions
Sunday, March 14, 2010
Saturday, March 13, 2010
QuirksMode - for all your browser quirks
QuirksMode - for all your browser quirks: "QuirksMode.org is the prime source for browser compatibility information on the Internet. It is maintained by Peter-Paul Koch, mobile platform strategist in Amsterdam, the Netherlands.
QuirksMode.org is the home of the Browser Compatibility Tables, where you’ll find hype-free assessments of the major browsers’ CSS and JavaScript capabilities, as well as their adherence to the W3C standards."
QuirksMode.org is the home of the Browser Compatibility Tables, where you’ll find hype-free assessments of the major browsers’ CSS and JavaScript capabilities, as well as their adherence to the W3C standards."
Thursday, March 11, 2010
Wednesday, March 10, 2010
Saturday, February 13, 2010
Wednesday, February 10, 2010
ASP.Net stuff to learn
6 Things Every ASP.NET Developer Should Know by 2010 -
http://blog.saviantllc.com/archive/2009/03/09/4.aspx
(read comments for other suggestions)
patterns & practices: App Arch Guide 2.0 Knowledge Base
http://www.codeplex.com/wikipage?ProjectName=AppArch&title=App%20Pattern%20-%20Three-Tier%20RIA%20Application%20Scenario
http://blog.saviantllc.com/archive/2009/03/09/4.aspx
(read comments for other suggestions)
patterns & practices: App Arch Guide 2.0 Knowledge Base
http://www.codeplex.com/wikipage?ProjectName=AppArch&title=App%20Pattern%20-%20Three-Tier%20RIA%20Application%20Scenario
Subscribe to:
Posts (Atom)