Bannars Have Standards…Cool :)

Standard

This morning, I was checking my old emails then I found a useful email from a Web Designer colleague about so interesting topic Bannar Standards .Here is the Email

Dears,

Most of us may not imagine that a thing as little as banners has standards when it comes to width and height and their place in content, i admit, i myself never imagined, not until I became a web designer :). what make this fact more interesting, is that these standards are based on studies in marketing, visual communication and usability, which make it an art and practice more than . Let me not talk so much, first link for the standard sizes,
http://www.bannercreator.nu/banner-size.html

The second about banner advertising history

http://en.wikipedia.org/wiki/Web_banner

Third, for an e-business specialized only in banners, try to change options of order, especially frames to see how much does it cost πŸ˜‰

http://www.rightbanners.com/services.html

Thanks a lot my colleague, it is very nice article

Advertisements

Eliminate Captcha Boring

Standard

Here is a better idea to eliminate Captcha boring which used in Twitter, it is as following
You can hide the Captcha control for first time and second time then if the user try to post again it will disappear to disallow the automation πŸ™‚

Validate a DropDown List Using Custom Validator

Standard

To do this Add a custom validator to your drop down like that


<asp:DropDownList ID="_districtDropDownList" runat="server" ></asp:DropDownList>
<asp:CustomValidator ID="_districtCustomValidator" runat="server"  
ErrorMessage="error message" ControlToValidate="_districtDropDownList"  
ClientValidationFunction="SelectTypeValidator">
</asp:CustomValidator> 
<script>

function SelectTypeValidator(sender, args)
{
   if (args.Value == "-1")  
         args.IsValid = false;   
  else args.IsValid = true;
} 
</script>

Custom validation method doesn’t fired if it used with textbox control and its value is empty

Standard

​To avoid using of the ValidatorEnable method to disable required field validator at some cases on textbox control I decided to use custom validator as a required field just like the following:

<asp:CustomValidator ID="_examDateCustomValidator" runat="server" Text="*"
 ClientValidationFunction="CustomValidateDDL" ControlToValidate="_textbox">

And here is the javascript validation method

function CustomValidateDDL(sender, args)
{
  if (args.Value == "")
      args.IsValid = false;
  else
       args.IsValid = true;
}

unfortunatily I found that this method is working well if I compare the value with any other value except empty text

Execute $(Document).Ready After UpdatePanel PostBack

Standard

Add the following code following code to your page and replace the commented line with your code

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args)
{
  if (args.get_error() == undefined)
  {
    //Add the method which must run after postback here
  }
}

Be Careful When Using (IN) Keyword

Standard

In a some tasks you have to write a SQL statment has a condition like x must be one of the following values {1,2,3, …..}. you can do this by using (in) keyword, and it will give you a good results, However if this values is calculated dynamically your statment may fail in unexpect case.

There is a limitation on this list of values and if these values exceed this limit of values, your statment will fails and may cause a disaster at the production level

This is exactly happened with me in a service which get a data from the database and sends an SMSs according to this data, because we were execute the database operation as a bulk update statement to get a better performance than update each record individually. Under high load this statements fails because of its long length. This cause a SMS which represented by a record in a database still has a status (not sent) and sends again and again