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 -  

2. use the cd() command -

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

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 

Wednesday, February 29, 2012

Display all "display:none" elements

$("*").filter(function() { return $(this).css("display") == "none" }).css("display","")

Sunday, February 19, 2012

HTTP Caching 101, Sebastien Lambla

HTTP Caching 101, Sebastien Lambla (@serialseb) of CodeBetter.com


http://vimeo.com/36409207


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.


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 )

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

Sunday, October 16, 2011

External Tables example

Using FIXED -

Using DELIMITED BY NEWLINE -

SQL Data Loader example




A simpler example - data contained within the .ctl file (for testing purposes)

Tuesday, September 20, 2011

Trello.com - technologies used


  • Nodejs for Webserver 
  • Express for MVC
  • JQuery
  • Backbone
  • SocketIO
  • JQueryUI
 It's all written in Coffee Script as well. Mongo stores our permanent data, and we're using Redis as a transient data store.


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

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



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();
}

WCF CallBacks related - Assign ClientBaseAddress in code

Update ClientBaseAddress via code

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

Friday, July 1, 2011

Small Basic - for beginners and kids

http://msdn.microsoft.com/en-us/ff384126.aspx
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.

101 Examples in Linq - MSDN

C# - http://msdn.microsoft.com/en-us/vcsharp/aa336746

VB - http://msdn.microsoft.com/en-us/vbasic/bb688088.aspx

Thursday, June 16, 2011

Adding Text to Days in DatePicker jqueryui




Steps Required Steps:
(1) All days displayed are actually <a> tags. So, replace html of the required <a> tag with required html
Repeat 1 for as many days as required.
(2) At this point , since the html for some <a> tags has been modified, the height and width of the cells containing these modified <a> tags might be different than others in the same row. So, for each row, find out maximum height among <a> tags, and make it the height for all <a> tags in that row.

Optional steps:
(3)
Left-align text that has been added
(4) Center all <a> tags using text-align:center



Example - jquery code for the above steps To add text to June 26, 2011 in DatePicker in jqueryui -

$('table a:eq(25)').html('<table><tr><td valign="top">26</td></tr><tr><td><span style="font-size:10px"><b>Sai-On Vacation</span></td></tr></table>');

$('table a:eq(25)').find('span').css('text-align', 'left');

$('a').css('text-align', 'center');

$('table a:eq(25)').parent().parent().find('a').height($('table a:eq(25)').height());




Function to make heights of cells same in each row The below function could be used for Step 2 in "Required Steps" above (i.e. to make the heights of all <a> tags same in a row) -


function findAnchorWithMaxHtInEachRowAndAssignItsHtToAllAnchors() {
  for (i = 0; i < 5; i++) { // There are only 5 rows in each calendar
    max_ht = 0;
    $('table.ui-datepicker-calendar > tbody > tr:eq(' + i.toString() + ') >td > a').each(function () { // find max ht in each row
      if ($(this).height() > max_ht)
          max_ht = $(this).height();
    });
    $('table.ui-datepicker-calendar > tbody > tr:eq(' + i.toString() + ') >td > a').each(function () { // assign this max ht to all <a> tags in that row
      $(this).height(max_ht);
    });
  }
}




When showing multiple calendar controls on the page When showing multiple months, like for eg. in 2rows,3cols (i.e. 6 months), we have to prefix the following to reach the correct month's calendar instance - <span style="font-weight:bold;">$('span.ui-datepicker-month:eq(2)').parent().parent().parent().find(</span>      as in
$('span.ui-datepicker-month:eq(2)').parent().parent().parent().find('table a:eq(16)').html('17 <br> <span style="font-size:5px"><b>Sai-Approved-By Anil</b><br><i>Sai-Not Approved-By Anil</i></span>' )



Tuesday, June 14, 2011

ASHX JSON - to fill a dropdownlist using AJAX



HTML page with dropdownlist that makes ajax call to a .net http handler -


(CLICK ON IMAGES TO SEE CODE MORE CLEARLY)

http handler .ashx code -

Saturday, March 26, 2011

14 Rules to make websites faster



http://www.youtube.com/watch?v=52gL93S3usU&feature=relmfu

Saturday, March 5, 2011

Thursday, March 3, 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; }

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

Wednesday, November 10, 2010

AJAX Toolkit examples here

http://www.asp.net/ajaxlibrary/act_tutorials.ashx

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>

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.

http://www.onlinetools.org/

Free Javascript scripts -
http://www.onlinetools.org/

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.

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>

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

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

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.

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.

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.)

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.

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

Stored procedures can be written in C#

http://www.sqlteam.com/article/writing-clr-stored-procedures-in-charp-introduction-to-charp-part-1

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)

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

  • 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.

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

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)

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.

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?

Friday, May 28, 2010

Customize VS.Net Look&Feel

http://studiostyles.info

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

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

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

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."

Saturday, February 13, 2010

http://www.questpond.com/

http://www.questpond.com/

Has e-books and videos on .net interview questions, projects etc

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

Followers

Blog Archive