Monday, June 8, 2009

AdSense for domains

What is AdSense for domains?

AdSense for domains allows publishers with unused domains to help users reach relevant information by presenting content on the domains.

Users often type domains into their address bar or follow expired links leading to sites with no content. Instead of an "under construction" page or 404 error, AdSense for domains provides links, search results, advertisements and other content. To do this, we use semantic technology targeted to the domain name. You earn revenue when users interact with the ads on your site.

If you have a site that has content on it (e.g., articles, reviews, forums, blog postings or other text), then your site should be used with AdSense for content. If you have a page with no content on it, then AdSense for domains can help your users. To get started with AdSense for domains, check out our set-up instructions, or search or browse our AdSense Help Forum for more information.

AdSense for domains

Use the Google Chart API to create charts for your web applications

With the Google Chart API you can build a URL that will dynamically create a chart for you. This service is used internally for Google Finance, Google Video, and beyond. Now, anyone can use it!

Although it is simple to use (just a darn URL after all) you will see that there are many options.

Here is just a few charts to show how broad this is:

Line Chart×125&chd=t:0,30,60,70,90,95,100|20,30,40,50,60,70,80|10,30,40,45,52|100,90,40,20,10|-1|5,33,50,55,7&chco=3072F3,ff0000,00aaaa&chls=2,4,1&chm=s,FF0000,0,-1,5|s,0000ff,1,-1,5|s,00aa00,2,-1,5

Bar Charts×125&chd=s:hello,world&chco=cc0000,00aa00

Pie Charts×100&chl=Rails|PHP|Java|.NET

Venn Diagrams×100&chd=t:100,80,60,30,30,30,10


Solid Fill,3.0,0.0&chs=200×125&chxt=x,y&chxl=0:|Jun|July|Aug|1:||20|30|40|50&chf=bg,s,efefef

Wednesday, May 13, 2009

Turn the submit button off when it press in ASP.Net

Sometime, we need to turn the button off after user clicking to prevent the double actions. Let's say, when I developed 2C2P payment processor,  I have to disable the "Confirm" button to avoid the double payment transactions when user click the button once. Otherwise, we will have the complaint from user about duplicated transactions when user might click the button double times since page loading is slow (behind scene, it's processing). The following example show you that it turn the submit button off and show message when it press using server-side script.

Disable button after clicking

Here is button control to add <form> tag.
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" Width="97px" />

Put the following code to code-behind as below.
protected void Page_Load(object sender, EventArgs e)
            this.Button1.Attributes.Add("onclick", "this.value='Please wait...';this.disabled = true;"
                + Page.ClientScript.GetPostBackEventReference(this.Button1, ""));
protected void Button1_Click(object sender, EventArgs e)
            //Here go on for click event

Now, click the button every times, it disable itself and user don't have a chance to press the button double.

How to limit the text length as maximum with Javascript (Text Counter)

Here is the javascript text counter. When you write down the character in Textarea box, it show the available text count immediately and remove the extra text as well. Put the following javascript between <head> and </head> tag.
<script type="text/javascript">
function textCounter(field, countfield, maxlimit)
    if (field.value.length > maxlimit)
        field.value = field.value.substring(0, maxlimit);
        countfield.value = maxlimit - field.value.length;
Here is form tag.
<span>Only 200 char allowed</span>
<textarea id="comment" onblur="'#ffffff'" onfocus="'#FFFCF9'" onkeyup="textCounter(comment,textCount,200);" onkeydown="textCounter(comment,textCount,200);" rows="7" cols="60" name="comment" style="background-color: rgb(255, 255, 255);">
<input type="text" value="200" maxlength="3" size="3" id="textCount" name="textCount"/>
<span>Char count</span>

That's it. Enjoy the JScript!

Friday, April 17, 2009

ASP.NET Overview

ASP.NET provides services to allow the creation, deployment, and execution of Web Applications and Web Services

Like ASP, ASP.NET is a server-side technology

Web Applications are built using Web Forms. ASP.NET comes with built-in Web Forms controls, which are responsible for generating the user interface. They mirror typical HTML widgets like text boxes or buttons. If these controls do not fit your needs, you are free to create your own user controls.

Web Forms are designed to make building web-based applications as easy as building Visual Basic applications

Introducing ASP.NET

ASP.NET was developed in direct response to the problems that developers had with classic ASP. Since ASP is in such wide use, however, Microsoft ensured that ASP scripts execute without modification on a machine with the .NET Framework (the ASP engine, ASP.DLL, is not modified when installing the .NET Framework). Thus, IIS can house both ASP and ASP.NET scripts on the same machine.

Advantages of ASP.NET

Separation of Code from HTML
To make a clean sweep, with ASP.NET you have the ability to completely separate layout and business logic. This makes it much easier for teams of programmers and designers to collaborate efficiently. This makes it much easier for teams of programmers and designers to collaborate efficiently.

Support for compiled languages
developer can use VB.NET and access features such as strong typing and object-oriented programming. Using compiled languages also means that ASP.NET pages do not suffer the performance penalties associated with interpreted code. ASP.NET pages are precompiled to byte-code and Just In Time (JIT) compiled when first requested. Subsequent requests are directed to the fully compiled code, which is cached until the source changes.

Use services provided by the .NET Framework
The .NET Framework provides class libraries that can be used by your application. Some of the key classes help you with input/output, access to operating system services, data access, or even debugging. We will go into more detail on some of them in this module.

Graphical Development Environment
Visual Studio .NET provides a very rich development environment for Web
developers. You can drag and drop controls and set properties the way you do in Visual Basic 6. And you have full IntelliSense support, not only for your code, but also for HTML and XML.

State management
To refer to the problems mentioned before, ASP.NET provides solutions for session and application state management. State information can, for example, be kept in memory or stored in a database. It can be shared across Web farms, and state information can be recovered, even if the server fails or the connection breaks down.

Update files while the server is running!
Components of your application can be updated while the server is online and clients are connected. The Framework will use the new files as soon as they are copied to the application. Removed or old files that are still in use are kept in memory until the clients have finished.

XML-Based Configuration Files
Configuration settings in ASP.NET are stored in XML files that you can easily read and edit. You can also easily copy these to another server, along with the other files that comprise your application.

Looking Back : Active Server Pages (ASP)

Microsoft Active Server Pages (ASP) is a server-side scripting technology. ASP is a technology that Microsoft created to ease the development of interactive Web applications. With ASP you can use client-side scripts as well as server-side scripts. Maybe you want to validate user input or access a database. ASP provides solutions for transaction processing and managing session state. Asp is one of the most successful language used in web development.

Problems with Traditional ASP

There are many problems with ASP if you think of needs for Today's powerful Web applications.

Interpreted and Loosely-Typed Code
ASP scripting code is usually written in languages such as JScript or VBScript. The script-execution engine that Active Server Pages relies on interprets code line by line, every time the page is called. In addition, although variables are supported, they are all loosely typed as variants and bound to particular types only when the code is run. Both these factors impede performance, and late binding of types makes it harder to catch errors when you are writing code.

Mixes layout (HTML) and logic (scripting code)
ASP files frequently combine script code with HTML. This results in ASP scripts that are lengthy, difficult to read, and switch frequently between code and HTML. The interspersion of HTML with ASP code is particularly problematic for larger web applications, where content must be kept separate from business logic.

Limited Development and Debugging Tools
Microsoft Visual InterDev, Macromedia Visual UltraDev, and other tools have attempted to increase the productivity of ASP programmers by providing graphical development environments. However, these tools never achieved the ease of use or the level of acceptance achieved by Microsoft Windows application development tools, such as Visual Basic or Microsoft Access. ASP developers still rely heavily or exclusively on Notepad.

Debugging is an unavoidable part of any software development process, and the debugging tools for ASP have been minimal. Most ASP programmers
resort to embedding temporary Response. Write statements in their code to trace the progress of its execution.

No real state management
Session state is only maintained if the client browser supports cookies. Session state information can only be held by using the ASP Session object. And you have to implement additional code if you, for example, want to identify a user.

Update files only when server is down
If your Web application makes use of components, copying new files to your application should only be done when the Web server is stopped. Otherwise it is like pulling the rug from under your application's feet, because the components may be in use (and locked) and must be registered.

Obscure Configuration Settings
The configuration information for an ASP web application (such as session state and server timeouts) is stored in the IIS metabase. Because the metabase is stored in a proprietary format, it can only be modified on the server machine with utilities such as the Internet Service Manager. With limited support for programmatically manipulating or extracting these settings, it is often an arduous task to port an ASP application from one server to another.