Jack @ ASP.NET

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Developing JavaScript Web Applications

Building rich JavaScript applications that bring the desktop experience to the Web is now possible, thanks to powerful JavaScript engines and the CSS3 and HTML5 specifications. The key is moving state from the server to the client side; but that’s no simple task. This book takes you through all the steps necessary to create state-of-the-art JavaScript applications, including structure, templating, frameworks, communicating with the server, and many other issues.

Through practical, tutorial-based explanations, you learn how to create JavaScript applications that offer a much more responsive and improved experience. You’ll work hands-on with an example application throughout the book to learn the concepts involved.

  • Explore MVC and how to best structure and manage dependencies inside your application
  • Get an introduction to templating and data binding
  • Learn about loading remote data, Ajax Level 2 and cross-domain requests
  • Use WebSockets and Node to create realtime applications
  • Accept dropped files and upload data with progress indicators
  • Learn about major frameworks and libraries, including jQuery, JavaScriptMVC and Backbone
  • Write tests and use the console to debug your applications
  • Get deployment best practices, such as caching and minification

(O’Reilly: Developing JavaScript Web Applications)

Break up a Code Line in javascript

You can break up a code line within a text string with a backslash. The example below will be displayed properly:

document.write("Hello \
World!");

However, you cannot break up a code line like this:

document.write \
("Hello World!");

get the selected item text from a ‘select’ html control

it is quite simple via jquery,

$("#yourSelectCtrlId option:selected").text();

[Google Map API] Find a place, and mark it on google map

In google map API, there is a class google.maps.Geocoder, it  is a service for converting between an address and a LatLng.

Demo of using this api:

function showAddress(address){
    var geocoder = new google.maps.Geocoder();
    geocoder.geocode( {‘address’: ‘your address’}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            var searchLoc = results[0].geometry.location;
            var latlng = new google.maps.LatLng(searchLoc.lat(), searchLoc.lng());
            map.setCenter(latlng);// assert we already have a ‘map’ instance
            marker.setPosition(latlng); // assert we already have a ‘marker’ instance
        }
        else{
            alert("There is no such place!");
        }
    });
}

Check a checkbox via jQuery

jQuery 1.6+

Use the new .prop() function:

$(".myCheckbox").prop("checked", true);$(".myCheckbox").prop("checked", false);

jQuery 1.5 and below

The .prop() function is not available, so you need to use .attr().

To check the checkbox (by setting the value of the checked attribute) do

$('.myCheckbox').attr('checked','checked')

and for un-checking (by removing the attribute entirely) do

$('.myCheckbox').removeAttr('checked')

Godaddy promo code for renew .Info domain

GDBBREN8 $7.99