Tuesday, May 13, 2008

Password validator in flex 3

create a validator PwdValidator.as

package valueObjects

import mx.validators.ValidationResult;
import mx.validators.Validator;

public class PwdValidator extends Validator {

// Define Array for the return value of doValidation().
private var results:Array;
// this will help in getting the status
public static var VALID:Boolean = true;

// Constructor.
public function PwdValidator() {
// Call base class constructor.


// Define the doValidation() method.
override protected function doValidation(value:Object):Array {
//var pwd: Password = value as Password;
var p1: String = value.first;
var p2: String = value.second;

results = [];
results = super.doValidation(value);

if(p1 == p2)
return results;
results.push(new ValidationResult(true, null, "Mismatch",
"Password Dosen't match Retype!"));
return results;


Now the flex code should be passing the value of the password and confirm password textbox. This is done as

<mx:Model id ="pass">



// this is the way to pass the multiple controls input to the validator.
<val:PwdValidator id="custPass" source="{pass}" property="passwords" listener="{txtPassword}"/>

<mx:Form labelWidth="110">

<mx:FormItem required="true" label="Password">
<mx:TextInput id="txtPassword" displayAsPassword="true" />
<mx:FormItem required="true" label="Confirm Password">
<mx:TextInput id="txtConfirmPassword" displayAsPassword="true" change="custPass.validate()"/>


Wednesday, May 7, 2008

Five best bollywood lines

1. Border : If every soldier leaves the battlefield to serve his family, who is going to fight the enemy
2. RHTM.. never say i dont eat nonveg, say I have not eaten it since long time
3. DDLJ: Whats there in Zurich , real europe is countryside.
You can not spend the entire life with your friends, you got to have a beloved
4. Zameen: In our country its illegal to kill stray dogs
5. OSO: Every story has a happy ending, if you think the end is not happy it means the story is incomplete

Saturday, May 3, 2008

New Book on Web 2.0

A must read book. The author has explained the Web 2.0 philosophy in a very intuitive way. He talks about how to monetize the websites at the same time attract the users by giving them
some free services. He calls this as Freemium.
The book discusses the success stories of Flickr, Facebook,Linkedin, google. The basis of all the success story is the rich user base.All of them have followed the long trail concept by reaching out to the masses rather than concentrating to a niche segment " Every buck counts".
Since the book talks about the sites which we commonly use it is easy to realize the concepts since we are the part of the revolution happening around the particular site.

I would highly recommend this book to anybody who wants to find out what is this web 2.0 business all about.