FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Number licence xxxx-xxxx-xxxx-xxxx
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Thu Feb 01, 2007 09:57 AM

Have you and Idea or a function to create number licence as Office Microsoft Licence ?

Best Regards, Saludos



Falconi Silvio
Posts: 42
Joined: Sat Sep 30, 2006 09:43 AM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Thu Feb 01, 2007 11:05 AM

u can use 123456789 and abcdefghijklmnopqrstuvwxyz to create Office Style

Serial numbers

Using Nissan 350 Z with last Firmware



compiled with Super Plus
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Thu Feb 01, 2007 11:40 AM

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
what ????????????

Best Regards, Saludos



Falconi Silvio
Posts: 310
Joined: Sun Jan 08, 2006 10:09 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Thu Feb 01, 2007 01:53 PM

Amiguinho

See this

REGIDA := nSerialHD()
REGIDB := nSerialHD()

REGIDC := ""
REGIDC := REGIDC+SUBS(REGIDA,1,1)+SUBS(REGIDB,8,1)
REGIDC := REGIDC+SUBS(REGIDA,2,1)+SUBS(REGIDB,7,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,3,1)+SUBS(REGIDB,6,1)
REGIDC := REGIDC+SUBS(REGIDA,4,1)+SUBS(REGIDB,5,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,5,1)+SUBS(REGIDB,4,1)
REGIDC := REGIDC+SUBS(REGIDA,6,1)+SUBS(REGIDB,3,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,7,1)+SUBS(REGIDB,2,1)
REGIDC := REGIDC+SUBS(REGIDA,8,1)+SUBS(REGIDB,1,1)

This returns a number with "XXXX-XXXX-XXXX-XXXX" format.

Or use this:

REGIDA := GerarSenha(16,2)

REGIDC := ""
REGIDC := REGIDC+SUBS(REGIDA,1,1)+SUBS(REGIDA,2,1)
REGIDC := REGIDC+SUBS(REGIDA,3,1)+SUBS(REGIDA,4,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,5,1)+SUBS(REGIDA,6,1)
REGIDC := REGIDC+SUBS(REGIDA,7,1)+SUBS(REGIDA,8,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,9,1)+SUBS(REGIDA,10,1)
REGIDC := REGIDC+SUBS(REGIDA,11,1)+SUBS(REGIDA,12,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,13,1)+SUBS(REGIDA,14,1)
REGIDC := REGIDC+SUBS(REGIDA,15,1)+SUBS(REGIDA,16,1)

Function GerarSenha(MaxNum,Tipo)
* 1 = Somente Numeros
* 2 = Numero e Letras
* 3 = Somente Letras
local chave := ""
var_valores := { "0123456789",;
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",;
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" }[Tipo]
for i = 1 to MaxNum
num := random(len(var_valores))
chave := chave + substr(var_valores,num,1)
next
return lTrim(chave)

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Thu Feb 01, 2007 02:40 PM

Good Mr Rochinha

BUT NOT FOUND RANDOM FUNCTION

Best Regards, Saludos



Falconi Silvio
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Thu Feb 01, 2007 05:20 PM

Silvio,

Here is a random() function that I found somewhere.

James

/*

Here is a simple but good working random number generator for with a
period of 2^31-2. It generates uniformly distributed numbers in the
range from 0 to 1, limits included.

Clipper code donated to the Public Domain by Phil Barnett November 29, 1996

Random numbers donated to the Universe by God.

*/

static seed := 0

/*
procedure test()

local d := date()
local x

SET DECIMAL TO 16

// call it once with the seed
random( seconds() * day( d ) * month( d ) * year( d ) )

do while !lastkey() == 27

// then, call it with no parameter repeatedly
x := random()
? x

// produces random numbers in the range of 0 - 100 inclusive
?? int( x * ( 100 + 1 ) )

// produces random numbers in the range of 1 - 100 inclusive
?? int( x * 100 ) + 1

// produces random numbers in the range of 0 - 99 inclusive
?? int( x * 100 )

// inkey(.01)

enddo

return
*/


function random( s )

local a := 16807 // This is just a lucky prime number

// you can hardcode these as constants for better speed
local m := ( 2 ^ 31 ) - 1
local q := int( m / a )
local r := int( m % a )

if valtype( s ) == 'N'
seed := s
endif

seed := a * ( seed % q ) - r * ( seed / q )

IF seed <= 0
seed += m
endif

return ( seed - 1 ) / ( m - 2 )

/*
Other Prime Numbers are:

38833
37171
11903
18233
31337
23339
27481
31063
34543 // an anagram prime!
36299
13691
17659
29411

If you need more, get the SIEVE.ZIP program and modify it.

*/

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Thu Feb 01, 2007 05:31 PM

Silvio,

FW provides nRandom( [nRange] )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Thu Feb 01, 2007 05:34 PM

thanks to all

Best Regards, Saludos



Falconi Silvio
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Fri Feb 02, 2007 12:23 AM
Hi Silvio,

I don't know if this will help you but you can look at this post....

http://fivetechsoft.com/forums/viewtopi ... ght=#19497
" rel="noopener">
http://fivetechsoft.com/forums/viewtopi ... ght=#19497




Jeff
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 252
Joined: Tue Oct 25, 2005 02:48 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Fri Feb 02, 2007 11:26 AM

Rochinha and All,

In my routine I avoid use 0 (zero) number and O (upper "o") character to avoid confuse the user...

Regards
Maurilio

Posts: 310
Joined: Sun Jan 08, 2006 10:09 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Fri Feb 02, 2007 01:12 PM

Yes

One question, a lot of solution, it's good.

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Fri Feb 02, 2007 05:36 PM

JEFF
WHERE ARE THE KEYGEN SOURCES

Best Regards, Saludos



Falconi Silvio
Posts: 16
Joined: Mon Feb 18, 2008 06:27 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Mon Oct 20, 2008 09:32 AM

Como puedo crear un numero aleatorio de 6 dígitos

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Mon Oct 20, 2008 11:19 AM
Hb_RandomInt( 111111, 999999 )


EMG
Posts: 82
Joined: Fri Mar 03, 2006 06:26 PM
KeyGen32
Posted: Mon Oct 20, 2008 09:36 PM

Hi Jeff

Can you supply the download link to KeyGen32 again as it has expired?

Many thanks
David