Switch to English
( Blog «java»)

Calculateur de versements hypothécaires canadien

Écrit par David Grégoire | 16 novembre 2010 | 0

Voilà:

function paiements(AnnualIntRate, Period, Amount, PPay){
PrValue = Amount;
IntRate = (Math.pow((1+AnnualIntRate/2),(2/PPay)) - 1)

Pa = (PrValue * IntRate) / (1 - Math.pow (1 + IntRate, - (Period * PPay)))
return Pa;
}

aux deux semaines
console.log(paiements(0.045, 25, 325000, 24));

au mois
console.log(paiements(0.045, 25, 325000, 12));

accéléré deux semaines
console.log(paiements(0.045, 25, 325000, 26));

par semaine
console.log(paiements(0.045, 25, 325000, 52));

Tags: calculatrice hypothécaire, hypothèque, java, versements hypothécaires,

Catégorie: Gratuit

Partager:

Typeface sépare inutilement lorsqu'il rencontre un caractère spécial (Unicode) - IE

Écrit par David Grégoire | 23 mars 2010 | 3

Nous utilisons régulièrement Typeface pour appliquer une police particulière à du texte sur le web.

Nous avons rencontré un bug: l'engin de regex séparait le mot "français" à "franç" et "ais". La séparation se faisait lorsque l'engin rencontre un caractère accentué ou UTF8 - Unicode.

L'apparence était parfaite dans plusieurs navigateurs, mais dans Internet Explorer, un espace était inséré car le script créait deux balises distinctes et consécutives.

Il y a une solution !  Il suffit de changer la ligne #289 du fichier typeface.js à ceci:

var words = text.split(/\b(?=\X)/);

Et l'affaire est ketchup !

Credits: http://twitter.com/tousdan

Tags: accents, caracteres spéciaux, java, regex, typeface, unicode,

Catégorie: Gratuit

Partager: