Archive for February, 2009

23
Feb

delphi regexpr et susbtitute

 

simple exemple de SUBSTITUTE dans une expression régulière

 

function ParsePhone (const AInputString, ATemplate : string) : string;
const
      IntPhoneRE = ‘(\+\d *)?(\(\d+\) *)?\d+(-\d*)*’;
var
      r : TRegExpr;
begin
      r := TRegExpr.Create; // Crée l’objet
      try // s’assure de la relâche de mémoire en cas d’erreurs d’exceptions.
            r.Expression := IntPhoneRE;
            if r.Exec (AInputString)
                  then Result := r.Substitute (ATemplate)
                  else Result := ;
            finally r.Free;
      end;
end;
begin
      ParsePhone (‘Phone of AlkorSoft (project PayCash) is +7(812) 329-44-69′,
      ‘Zone code $1, city code $2. Whole phone number is $&.’);
end.

20
Feb

service d’installation de red5

des problèmes pour installer red5 ?

screenshotLe site www.red5-installation.com vous permet d’installer red5  très rapidement : en 24 heures ou même en deux heures.

Installation de red5 sur Linux ou windows.

17
Feb

Flex et inverse kinematics (Bones)

 

une fois votre flash CS4 crée incluant les bones (inverse kinematic), vous ne pouvez pas l’importer directement dans FLEX: elle apparait comme une image statique.

pour ce faire importer la Library ik.swc dans flex et ajouter le code suivant

 

http://www.mad.com.au/blog/?p=208=1

 

 

import fl.ik.*;
import flash.display.*;

//load the bones swf
var request:URLRequest = new URLRequest("bones.swf");
var loader:Loader = new Loader();
loader.load(request);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, init);

//set up the vars
var boneClip:Sprite;
var myArmature:IKArmature;

function init(e:Event):void{
      //add the clip to the stage
      boneClip = Sprite(loader.content);
      addChild(boneClip);
      //set up IK
      IKManager.setStage(stage);
      myArmature = IKManager.getArmatureAt(0);
      myArmature.registerElements(stage);
      IKManager.trackAllArmatures(true);
}

12
Feb

flex outerDocument et itemRenderer

 

Pour sortir du scope d’un composant INLINE, il faut utiliser outerdocument

exemple:

    <mx:HorizontalList height="31" left="10" right="0" top="136" dataProvider="{Application.application.joursDB_dp}" columnCount="7">
        <mx:itemRenderer>
            <mx:Component>
                <mx:LinkButton x="10" y="137" label="{data.description}" fontWeight="normal" click="{outerDocument.generer()}" />
            </mx:Component>
        </mx:itemRenderer>
    </mx:HorizontalList>

07
Feb

spry : custom value: comment l’utiliser ?

 

<body>
<p> example shows how to validate using a custom made validation function. You can define your own javascript validation function that can validate a password strength or the password to be correcly retyped.</p>
 
<form id="form8" name="form8" method="get" action="TextfieldValidationSample.html">
  <table border="0">
    <tr>
      <td>Password:</td>
      <td style="width: 600px;">
<span id="customPasswordFunction">
                        <input type="password" name="text212" id="text212" />
              <span class="textfieldRequiredMsg">You must enter a value!</span>
                        <span class="textfieldInvalidFormatMsg">2 numbers, 2 chars and a non alpha numeric, length between 8 and 10.</span>
        </span>
      </td>
    </tr>
        <tr>
            <td>Retype:</td>
            <td style="width: 600px;">
<span id="dupFunction">
                        <input type="password" name="text213" id="text213" />
              <span class="textfieldRequiredMsg">You must enter a value!</span>
                        <span class="textfieldInvalidFormatMsg">The passwords not match.</span>
              </span>
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>
          <input type="submit" name="submit713" id="submit713" value="Submit" />
      </td>
    </tr>
  </table>
</form>
 
<script type="text/javascript">
<!--
var passwordStrength = function(value, options){
 
    if (value.length < 8 || value.length > 10)
        return false;
 
    if (value.replace(/[^0-9]*/ig, ).length < 2)
        return false;
    
 
    if (value.replace(/[^a-z]/ig, ).length < 2)
        return false;
 
    if (value.replace(/[0-9a-z]/ig, ).length == 0)
        return false;
 
    return true;
}
 
var passwordTheSame = function(value, options){
    var other_value = document.getElementById(‘text212′).value;
    if (value != other_value){
        return false;
    }
    return true;
}
 
var customFunction = new Spry.Widget.ValidationTextField("customPasswordFunction", "custom", {validation: passwordStrength, validateOn:["blur", "change"]});
var passwordDuplication = new Spry.Widget.ValidationTextField("dupFunction", "custom", {validation: passwordTheSame, validateOn:["change", "blur"]});
//–>
</script>
</body>