Wednesday 14 July, 2010

Magic of CSS3 - Part 2

Super Awesome Buttons with CSS3 and RGBA :




CSS3 is finally starting to see the light at the end of the tunnel as new browsers like Firefox and Safari continue to push its implementation.

One of our favorite things about CSS3 is the addition of RGBA, a color mode that adds alpha-blending to your favorite CSS properties. We've kicked the tires on it a bit with our own projects and have found that it helps streamline our CSS and makes scaling things like buttons very easy. To show you how, we've cooked up an example with some super awesome, scalable buttons.

View Tutorial : CSS3 Button

Magic of CSS3 Part I


Border-radius: create rounded corners with CSS! :


W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example
These different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has

Mozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.
Mozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.
Mozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.
Mozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.

These are handled by / should be handled by:

-moz-border-radius-topleft / -webkit-border-top-left-radius
-moz-border-radius-topright / -webkit-border-top-right-radius
-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius
-moz-border-radius-bottomright / -webkit-border-bottom-right-radius

Thursday 8 July, 2010

How to debug your jquery code essential tools & tricks

Not only are the JavaScript alert methods annoying, but until recently developers haven't had any really good tools to help them debug client-side code when they’re trying to re-create or resolve errors. Alert methods can also result in certain false assumptions about your code. For example, an alert dialog box waits to be closed before execution proceeds, so the timing of events can be off if you use this tool as a debugging mechanism.
In this article, I’ll describe some techniques to assist  you in the debugging process when you are using jQuery in client-side Web development. Thankfully, we have much better tools and technologies than developers had even five years ago.


Ping this to get full article  : How to debug your jquery code essential tools & tricks

Excellent Tips to improve UI using CSS3 and jquery

CSS3 is getting a lot of attentions recently.  I'm absolutely in love with CSS3. Rounded corner, drop shadow and rotation couldn't be easier! The only drawback is, CSS3 standard is not fully implemented by most browsers and also, I believe you will get a lot of CSS validation errors as well. However, there are quite a lot of websites start using it already, for example, Twitter, it uses rounded border, and replace the rounded border with images if you viewed it with IE 7 or 8, and totally ignore IE6 users (*salute*, well done twitter).

And another great example with CSS3 and CSS3 animation: Neutron Creation
This post is all about CSS3 and Javascript. With all the new features that come with CSS3, there are whole lot of animation possibilites that can't be achieve before. So, Check this out and get inspired!
Excellent Tips to improve UI using CSS3 and jquery

Sunday 4 July, 2010

Exception handling in AJAX (ASP.NET)

Exception handling plays an important role in any application development. The way we present our exceptions to the user decides the quality of our software. The way we design a pattern for exception handling in C#, ASP.NET we should also design a similar pattern for implementing Ajax exceptions. If an Ajax exception is not caught, then it should as a pop-up directly on the screen showing the exact technical error message with a code. A layman/user will never know what went wrong behind the scene.








Different ways of handling exception in Ajax
1. Using the AsyncPostBackErrorMessage property of the Script Manager class
You can set the exception message that needs to be shown to the user to the AsyncPostBackErrorMessage property of the ScriptManager object. This can be achieved in the following way:







scriptManager.AsyncPostBackErrorMessage = "Oops..\nAn error occurred while processing";

Set the above exception message in the catch block of the method. When an exception occurs, this message will be shown to the user in a pop-up window.
2. Using the above method will show the exception message to the user as a pop-up window. It is not a good practice to show a pop-up on error. Better way to do is to add a Label field to the web page and set the text of that label field with the exception message. For more clarity to the user, the exception message can be shown in Red color. Ajax inherently exposes an event OnAsyncPostBackErrorHandler. This event is invoked when an exception occurs in your web page. It is better to set the exception message in this event as shown below:






protected void OnAsyncPostBackErrorHandler(object sender, AsyncPostBackErrorEventArgs e)
{
  scriptManager.AsyncPostBackErrorMessage = "Oops..\nAn error occurred while processing";
}

Is this going to suffice?
The answer it NO. Here we have just handled an event and set the required exception message to the AsyncPostBackErrorMessage property of the scriptManager class. We have to handle another event at client side to set this message to the Label control OR to some DIV as ModalPopupExtender of AjaxControlToolKit and inform the Ajax manager to not show the ugly pop-up:
The key to custom error handling in ASP.NET AJAX is the EndRequestEventArgs class, available when handling the endRequest event. It provides information on any error conditions that have resulted and exposes a method to let the framework know that we’ve handled the errors on our own.
I’m going to add a div, to serve as our replacement error message:
Next, some CSS to style the div and close button:
#Error {
  top: 0px;
  right: 0px;
  width: 125px;
  background-color: yellow;
  border: solid 1px Black;
  padding: 10px;
  font-family: Sans-Serif;
  font-size: 10pt;
  position: absolute;
  margin: 5px;
}
#CloseButton {
  float: right;
  cursor: pointer; 
}
Finally, we need to add some JavaScript to tie it all together:
Sys.Application.add_load(AppLoad);

function AppLoad()
{  
 Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
    Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequest);
}

function BeginRequest(sender, args) 
{
  // Clear the error if it's visible from a previous request.
  if ($get('Error').style.visibility == "visible")
    CloseError();
}

function EndRequest(sender, args) 
{
  // Check to see if there's an error on this request.
  if (args.get_error() != undefined)
  {
    // If there is, show the custom error.
    $get('Error').style.visibility = "visible";
    // Let the framework know that the error is handled,
    //  so it doesn't throw the JavaScript alert.
    args.set_errorHandled(true);
  }
}

function CloseError() {
  // Hide the error div.
  $get('Error').style.visibility = "hidden";
}

The crux of this method is EndRequestEventArgs.set_errorHandled(). This tells the AJAX framework to call off the dogs and prevents the JavaScript alert from being displayed. Now, clicking Button1 results in this:





We have complete control over the error display. No JavaScript alert!
source: encosia.
Happy Coding :)

Saturday 3 July, 2010

Simulate Slow Internet Connection while Testing your Apps

So you have your Next-gen cool Web 2.0 application ready! You have tested it on your LAN environment and on your high speed internet connection – all seems ok and you are ready to deploy it in the ‘real world’. A few hours later, you get feedback that your application does not perform well on slower connections. That hurts!
Well the truth is that real world internet connections are much slower than you think. Your application end users may not always be broadband users but also people accessing your app through a dial-up connection, mobile sets, 3G or USB dongles. Most designers and developers forget to test their application on slower internet connections, resulting in a poor performing application.
Now there are many tools that let you simulate slow network connections. Out of them, what caught my attention is a nice Firefox browser plug-in that ‘effortlessly’ lets you simulate different speeds of Internet connection and lets you view the effects of slow speeds on your application. The plug-in is called Firefox Throttle.
Firefox Throttle is an extension that allows you to control download/upload rates and monitor current bandwidth utilization. Amongst other features, what I liked the most was that it lets you throttle localhost connections as well. Cool! Here’s a screenshot of the plugin in action.


The plug-in shows the current bandwidth utilization indicators in its Status panel as shown below and lets you quickly turn on/off throttling.

PingBack From this : DevCurry Atricle