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.

Entries for the ‘webmaster’ Category

[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!");
        }
    });
}

Add html element via javascript

// add an element

var fb_foot = document.createElement("div");
fb_foot.id="fb-root";
document.body.appendChild(fb_foot);

 

// import a js file

// e.g load facebook javascript
var tag = document.createElement(‘script’);
tag.type="text/javascript";
tag.src = ‘http://connect.facebook.net/en_US/all.js’;
document.body.appendChild(tag);

HTML + CSS to implement a fixed head and fixed bottom style page

<html>

<style type="text/css">

html,body {height: 100%;}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.top,.bottom {
position: absolute;
width: 100%;
left: 0px;
height: 10%;
background-color: #FFFF22;
}
.top {top: 0px;}
.bottom {bottom: 0px;}
.main {
background-color: #00FFF0;
overflow-y: scroll;
position: absolute;
top: 10%;
bottom: 10%;
height: 80%;
width: 100%;
}

</style>
</head>

<body>
<div class="top">TOP</div>
<div class="bottom">BOTTOM</div>
<div class="main">
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>
CONT<br>

</div>
</body>

</html>

Top 5 of my favorite free Windows Live Writer (WLW) plugin

I like free one, so I only list top 5 of my favorite ones.

  1. Twitter Update: (by Krishnan)
  2. Allow you to add up to 3 twitter accounts and tweet according to the blog you post.
    In the options page enter default Twitter account user name and password, which will be used when there is no matching twitter account for a blog is found.
    Add blog home page Urls in the text box (seperated by | if you have more than one) and enter the twitter account details of the corresponding twitter account

  3. Blog This for Firefox:Adds a button to Firefox which starts a new Windows Live Writer blog post prepopulated with content and title from the current web page. Blog the whole page, or just selected snippets. Interacts with other registered plugins to parse and structure web content where appropriate. Blog quickly when you find something of interest on the web.
  4. Syntax Higlighter for WLW: Add smart content editor syntax higlighter 2.0 support for Windows Live Writer.
  5. Facebook Live Writer Plugin: Prompts you to share a link on Facebook whenever you publish a new post.
  6. Tag Generator: A tool to automatically generate tags based on the content of your post. Supports Technorati, WordPress and Blogger

Online pricing models in ineternet market

In general, the online advertising market, pricing model three, marketers can use it to buy advertising and potential customers.

Cost per thousand impressions (per thousand) pricing model display ads – that is, when many people are advertising. CPM display advertising pricing model is usually sold. Problem is CPM advertising is the advertiser’s fees, even if the target audience not to click (or even view) the ad.

CPC costs (per click) advertisers receive overcome this problem, only when the consumer clicks on the ad. However, due to increased competition, keyword search has become very expensive. Double-click the Performics 2007 search trends report shows that in January 2007 cost-per-click (CPC) of less than $ 1 more than the same period last year by nearly six times the number of keywords. The cost for each keyword an increase of 33% per visit up to 55% of the costs.

CPL cost (per line) advertising costs CPM and the Communist Party leadership to resolve the only risk. Every time the leadership of the Communist Party of increased demand for the same price. Also like the Communist Party’s commitment to providors way to create a chance or mixed with another (for example – search for clues leads and joint registration) fraud led to the source to generate higher profits.

Marketers who are willing to pay the specific actions will only have two choices: CPL advertising (or online lead generation), and CPA advertising activities in the CPL (. Also known as affiliate marketing are known), interested advertisers pay Lead – Advertisers who are interested in that product or service contact information. CPL’s activities is to brand marketers and direct response marketers, see the contact point for customers – by creating a community site, Membership Rewards program or acquisition plans mailing list. Activities in the certified public accountants, advertisers usually pay the credit card transaction has been completed, involved the sale. CPA is all about ‘now’ – this is a consumer purchase, focusing on the promotion of the moment. If a site does not have the tourists to buy things, there is no simple way to remarket them.

Performance tuning tips for ASP.NET and IIS 7

1. Browser caching

In part 1, we looked at how it was possible to set an expiration header to any static file such as JavaScript and CSS files, so the browser would cache them for a long time and thereby optimize both for bandwidth and the number of requested files going from server to browser.

The problem with setting a browser cache expiration date of i.e. a JavaScript file to a year in the future becomes clear when you change the file before it expires in your visitor’s browsers. They simply won’t see the changes until they either clear their cache or hits F5 manually.

2. Bundle multiple files

Another common website performance issue is that there are many JavaScript and CSS files included on a page. This scenario results in the browser have to download a lot of extra files and that all slows down the performance of a website. The solution to this is also very simple when you’ve first completed the above steps to register the HTTP handler in web.config and called the BundleHelper.InsertFile method when inserting JavaScript and CSS files.

3. HTTP compression

You’ve always been able to perform HTTP compression in ASP.NET by using third-party libraries or own custom built ones. With IIS 7 you can now throw that away and utilize the build-in compression available from the web.config. Add the following line to enable HTTP compression:

<urlCompression doDynamicCompression=”true” doStaticCompression=”true” dynamicCompressionBeforeCache=”true”/>

By default, only text based content types are compressed.

4. Cache static files

To speed up the load time for the visitors, it is crucial that everything that can be cached by the browser IS cached by the browser. That includes static files such as images, stylesheets and script files. By letting the browser cache all these files means it doesn’t need to request them again for the duration of the cache period. That saves you and your visitors a lot of bandwidth and makes the page load faster. A well primed browser cache also triggers the load and DOMContentLoaded event sooner.

It’s worth noticing that the output caching respects file changes and therefore refreshes ever time changes are made to the JavaScript and CSS files tunnelled through this code.