Ir ao conteúdo

Nova versão do LURL (Tiny-URL).

Boa noite,

Na primeira versão do LURL (Tiny-URL), o usuário João, sugeriu que em vez de eu gerar um identificador aleatório, que poderia causar problemas quando o banco de dados se tornasse muito grande, eu poderia utilizar o campo ID, pois o mesmo é Auto Increment, e por isso ele se auto incrementa, não permitindo que existam dois campos com o mesmo identificador.

Já pensava em acatar a idéia do João a bastante tempo mas sempre estava com preguiça, até que alguns dias atrás uma amiga pediu ajuda para fazer um script para conversão de números entre bases. Após ajudar a mesma, ficou fácil. Só passar o código para PHP, modificar algumas funções antigas e pronto.

Foi necessário criar dois novos métodos importantes:
[code lang=”php”]
function convertDecimalTo($decimal,$newBase,$str,$letters) {
if ($decimal >= $newBase) {
$x = $decimal % $newBase;
$y = $decimal / $newBase;
$str = $letters{$x} . $str;
if ($y < $newBase) { $str = $letters{$y} . $str; } return convertDecimalTo($y,$newBase,$str,$letters); } else { if (strlen($str) == 0) { $str = $letters{$decimal} . $str; } return $str; } } function convertBaseToDecimal($value,$newBase,$letters) { $sum = 0; $len = strlen($value); $end = $len-1; for ($x=$end;$x>=0;$x–) {
$sum = $sum + strpos($letters,$value{$x}) * pow($newBase,($end – $x));
}
return $sum;
}
[/code]

As demais modificações você pode ver aqui:
LURL (Tiny-URL) com Identificador apartir do ID em PHP 4

Assim que for possível vou fazer as alterações na versão para PHP5 onde é utilizado classes.
Matheus Bratfisch

PS: Vou criar uma página para o LURL na sessão Code em breve.

LURL (Tiny-URL) com gráfico e estatísticas para PHP4
LURL (Tiny-URL) com gráfico e estatísticas para PHP5

Publicado emAprendendoCodeMySQLphp

4.006 Comentários

  1. Yo car enthusiasts Been searching for a decent luxury rental in Miami for weeks Tried like 8 different companies last year The only rental spot that actually keeps their promises — luxury car rental miami with premium fleet Cruised around South Beach in a Lambo and turned heads everywhere Anyway, all the deets are right here — car rental near miami beach https://www.pinterest.com/pin/1092122978527737203 Don’t fall for those sketchy rental agencies Send this to anyone planning a Miami trip in style

  2. So — have been messing about with this thing for something like a few months now and I keep coming back, so figured I’d write something up since someone asked me a few days back. Am based in the UK, mainly stick to footie and the horses, a fiver here and there, so take it how you like.

    The reason I started using it was genuinely a bit daft — I never could get my head round what an each way return actually was with 1/5 odds a place. I used to just guess and get a shock. These days I type the odds in before I place anything, even the boring singles.

    The single bet calculator tool is the part I use most — type in stake and odds and it spits out returns with no faffing, fractions or decimals. There’s also the fiddly ones — doubles and trebles returns, a lucky 15, patents and yankees, which is where most people I know lose track. If you fancy a poke about, it’s here kelly criterion calculator sports betting and it’s free with no account nonsense.

    What genuinely made a difference were the nerdier extras. The probability converter which shows you how much the bookie’s taking, and there’s the kelly tool — I run quarter kelly as the full version is terrifying. The dutching one is decent for when I’m splitting a race.

    It’s not perfect mind. The interface feels pretty plain — zero frills, which honestly I don’t mind but some will. On my phone it works but the acca grid need a bit of scrolling. And no app, it’s browser only — fine by me but worth saying.

    So yeah. Costs nowt, barely any ads, does the job. Anyone who even now does the maths on paper, give it a go — saved me a fair few dumb bets I’d have regretted.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *