Jump to content
Fivewin Brasil

emotta

Membros
  • Posts

    1,609
  • Joined

  • Last visited

  • Days Won

    88

Everything posted by emotta

  1. Use a DirectoryRecurse, essa função tem a mesma assinatura da função directory
  2. Eu resolveria da seguinte maneira: - crie um bucket no aws S3 - na matriz tenha uma opção para enviar o cadastro para web. Essa opção gera um arquivo texto no formato json com todos os campos do seu cadastro de produtos. - nas filiais basta vc ler o arquivo que estará disponível na web no bucket S3 Aqui nesse vídeo tem tudo que vc precisa pra aprender a subir arquivo no seu bucket S3. Obs: se este seu cliente, que é uma rede de lanchonetes, precisar de uma solução de ponto eletrônico me procure. Abraços e boa sorte
  3. Pelo que entendi o a desconfiança do Andre é que estão alterando direto no DBF, aí não tem jeito. Minha recomendação é usar um banco de dados (sql server express, mysql, etc) pois aí o cara tem que saber a senha pra alterar algo direto na fonte. Se isso for possivel é o que recomendo.
  4. Kapiaba, o pai da criança é o Wagner, acredito que ele seja o melhor para lhe dizer (caso a documentação que está no github não seja suficiente)
  5. show de bola hein Wagner, parabens
  6. que loucura... muito bem Joao
  7. e o qrDLL tem algum valor? se sim qual?
  8. eu fiz esse exemplo e funciona normal. Veja que o arquivo criado neste exemplo direciona para a pasta C:\TESTE Minha pergunta é: vc tem essa pasta TESTE criada no seu crive C: ? Acredito que o ideal é vc direcionar para a pasta da sua aplicação, deixando só: cFile := "arq.bmp" Outra coisa, a dll QRCODELIB.DLL tem que estar na mesma pasta do seu executavel
  9. Veja se o link abaixo te ajuda https://www.mail-archive.com/xharbour-developers@lists.sourceforge.net/msg02079.html
  10. essas mensagens são de warning e não é erro. Certamente não é isso que está dando erro. Faça o teste de maneira isolada, sem colocar no seu projeto. Após tudo funcionando aí sim coloque.
  11. printa a tela com o erro (ou warning)
  12. Realmente nesse caso a estratégia de barrar pela razão social não te ajuda
  13. É um warning ou é um erro? Você pode postar um print da tela? Você fez alguma mudança no test_pix.prg ? Estranho ter erro de compilação pois compilo normalmente. Meu xHarbour é o comercial e compilo pelo xBuild Se o seu xharbour não é o comercial possivelmente é algo que você precisa setar na hora da compilação deste código que é em C.
  14. Quando eu comercializava a solução em desktop, minha solução para proteger contra pirataria foi gerar uma KEY para o cliente com base na razão social do cadastro de empresa e a data de validade da key. Então o cara até conseguia copiar o sistema porem todos os relatórios sairiam com a razão social liberada e se ele alterasse a razão social, a key se tornaria inválida e ele teria que pedir a nova key ou usar o sistema com a razão social de outro. Se quiser adotar esse modelo me avisa que preparo um exemplo simples e vc mesmo poderá alterar o algoritmo de geração da KEY a seu gosto.
  15. Se vc usa sqlrdd não vai adiantar pq harbour não tem.
  16. Eu refatorei o código e tirei tudo que não era necessário, nele tinha várias funções de CRC e eu deixei apenas a que é usada para gerar o PIX. Então clone novamente o repositório pra pegar as ultimas modificações que eu fiz, compile o código e executa. Veja se continua o problema. Lembrando que é necessário colocar as libs do fivewin.
  17. Eu fiz uma limpeza nós fontes antes de conmitar no github e pode ser isso Amanhã vou voltar o fonte na versão antes dessa limpeza e commito novamente e te aviso e vc baixa.
  18. Exemplo funcional gerando QRCODE para PIX. Usei o fonte que o João postou neste mesmo tópico, um exemplo antigo que postei para gerar qrcode e uma função para gerar o CRC exigido no PIX que não existe em xHarbour façam os devidos testes e a responsabilidade de uso é de cada um (MIT License) Segue tudo no GITHUB em um repositório publico https://github.com/eduardomotta-emottasistemas/pix_qrcode.git
  19. http://fivewin.com.br/index.php?/topic/27811-gerar-qrcode-fivewin/&tab=comments#comment-284381
  20. Apanhei muito nessa questão de CRC no xHarbour, então busquei as funcoes em C de diversos algoritmos e adaptei a minha necessidade. Segue ai 4 algoritmos de CRC, sendo que o Kermit tem uma variante para inverter os bytes. Veja qual algoritmo é o que você precisa e bom trabalho. Function u_Teste() Local cTexto := "teste crc" ? "EMTCRC_CCITT_FFFF", cTexto, EMTCRC_CCITT_FFFF(cTexto) ? "EMTCRC_CRC_16", cTexto, EMTCRC_CRC_16(cTexto) ? "EMTCRC_CRC_MODBUS", cTexto, EMTCRC_CRC_MODBUS(cTexto) ? "EMTCRC_CRC_KERMIT (invert=.t.)", cTexto, EMTCRC_CRC_KERMIT(cTexto) ? "EMTCRC_CRC_KERMIT (invert=.f.)", cTexto, EMTCRC_CRC_KERMIT(cTexto, .f.) Return Function EMTCRC_CCITT_FFFF(cTexto) Local cCrc,nCrc nCrc := C_EMTCRC_CCITT_FFFF(cTexto) cCrc := NumToHex(nCrc) cCrc := PadL(NumToHex(nCrc), 4, "0") Return cCrc Function EMTCRC_CRC_16(cTexto) Local cCrc,nCrc nCrc := C_EMTCRC_CRC_16(cTexto) cCrc := NumToHex(nCrc) cCrc := PadL(NumToHex(nCrc), 4, "0") Return cCrc Function EMTCRC_CRC_MODBUS(cTexto) Local cCrc,nCrc nCrc := C_EMTCRC_CRC_MODBUS(cTexto) cCrc := NumToHex(nCrc) cCrc := PadL(NumToHex(nCrc), 4, "0") Return cCrc Function EMTCRC_CRC_KERMIT(cTexto, lInvert) Local cCrc, nCrc, nI If lInvert == nil lInvert := .t. EndIf nCrc := C_EMTCRC_CRC_KERMIT(cTexto) cCrc := PadL(NumToHex(nCrc), 4, "0") If lInvert cCrc_Str := HexTostr(cCrc) cCrc := "" For nI := Len(cCrc_Str) to 1 Step -1 cCrc+=cCrc_Str[nI] Next cCrc := StrToHex(cCrc) EndIf Return cCrc #pragma BEGINDUMP #include "windows.h" #include "hbapi.h" #include <stdio.h> #include <stdint.h> #include <stdbool.h> #ifndef DEF_LIBCRC_CHECKSUM_H #define DEF_LIBCRC_CHECKSUM_H #define CRC_POLY_16 0xA001 #define CRC_POLY_32 0xEDB88320L #define CRC_POLY_CCITT 0x1021 #define CRC_POLY_DNP 0xA6BC #define CRC_POLY_KERMIT 0x8408 #define CRC_POLY_SICK 0x8005 #define CRC_START_8 0x00 #define CRC_START_16 0x0000 #define CRC_START_MODBUS 0xFFFF #define CRC_START_XMODEM 0x0000 #define CRC_START_CCITT_1D0F 0x1D0F #define CRC_START_CCITT_FFFF 0xFFFF #define CRC_START_KERMIT 0x0000 #define CRC_START_SICK 0x0000 #define CRC_START_DNP 0x0000 #define CRC_START_32 0xFFFFFFFFL unsigned char * checksum_NMEA( const unsigned char *input_str, unsigned char *result ); uint8_t crc_8( const unsigned char *input_str, size_t num_bytes ); uint16_t crc_16( const unsigned char *input_str, size_t num_bytes ); uint32_t crc_32( const unsigned char *input_str, size_t num_bytes ); uint16_t crc_ccitt_1d0f( const unsigned char *input_str, size_t num_bytes ); uint16_t crc_ccitt_ffff( const unsigned char *input_str, size_t num_bytes ); uint16_t crc_dnp( const unsigned char *input_str, size_t num_bytes ); uint16_t crc_kermit( const unsigned char *input_str, size_t num_bytes ); uint16_t crc_modbus( const unsigned char *input_str, size_t num_bytes ); uint16_t crc_sick( const unsigned char *input_str, size_t num_bytes ); uint16_t crc_xmodem( const unsigned char *input_str, size_t num_bytes ); uint8_t update_crc_8( uint8_t crc, unsigned char c ); uint16_t update_crc_16( uint16_t crc, unsigned char c ); uint32_t update_crc_32( uint32_t crc, unsigned char c ); uint16_t update_crc_ccitt( uint16_t crc, unsigned char c ); uint16_t update_crc_dnp( uint16_t crc, unsigned char c ); uint16_t update_crc_kermit( uint16_t crc, unsigned char c ); uint16_t update_crc_sick( uint16_t crc, unsigned char c, unsigned char prev_byte ); #endif // DEF_LIBCRC_CHECKSUM_H static uint16_t crc_ccitt_generic( const unsigned char *input_str, size_t num_bytes, uint16_t start_value ); static void init_crcccitt_tab( void ); static bool crc_tabccitt_init = false; static uint16_t crc_tabccitt[256]; static void init_crc_tab( void ); static bool crc_tab_init = false; static uint16_t crc_tab[256]; /* * uint16_t crc_xmodem( const unsigned char *input_str, size_t num_bytes ); * * The function crc_xmodem() performs a one-pass calculation of an X-Modem CRC * for a byte string that has been passed as a parameter. */ uint16_t crc_xmodem( const unsigned char *input_str, size_t num_bytes ) { return crc_ccitt_generic( input_str, num_bytes, CRC_START_XMODEM ); } /* crc_xmodem */ /* * uint16_t crc_ccitt_1d0f( const unsigned char *input_str, size_t num_bytes ); * * The function crc_ccitt_1d0f() performs a one-pass calculation of the CCITT * CRC for a byte string that has been passed as a parameter. The initial value * 0x1d0f is used for the CRC. */ uint16_t crc_ccitt_1d0f( const unsigned char *input_str, size_t num_bytes ) { return crc_ccitt_generic( input_str, num_bytes, CRC_START_CCITT_1D0F ); } /* crc_ccitt_1d0f */ /* * uint16_t crc_ccitt_ffff( const unsigned char *input_str, size_t num_bytes ); * * The function crc_ccitt_ffff() performs a one-pass calculation of the CCITT * CRC for a byte string that has been passed as a parameter. The initial value * 0xffff is used for the CRC. */ uint16_t crc_ccitt_ffff( const unsigned char *input_str, size_t num_bytes ) { return crc_ccitt_generic( input_str, num_bytes, CRC_START_CCITT_FFFF ); } /* crc_ccitt_ffff */ /* * static uint16_t crc_ccitt_generic( const unsigned char *input_str, size_t num_bytes, uint16_t start_value ); * * The function crc_ccitt_generic() is a generic implementation of the CCITT * algorithm for a one-pass calculation of the CRC for a byte string. The * function accepts an initial start value for the crc. */ static uint16_t crc_ccitt_generic( const unsigned char *input_str, size_t num_bytes, uint16_t start_value ) { uint16_t crc; uint16_t tmp; uint16_t short_c; const unsigned char *ptr; size_t a; if ( ! crc_tabccitt_init ) init_crcccitt_tab(); crc = start_value; ptr = input_str; if ( ptr != NULL ) for (a=0; a<num_bytes; a++) { short_c = 0x00ff & (unsigned short) *ptr; tmp = (crc >> 8) ^ short_c; crc = (crc << 8) ^ crc_tabccitt[tmp]; ptr++; } return crc; } /* crc_ccitt_generic */ /* * uint16_t update_crc_ccitt( uint16_t crc, unsigned char c ); * * The function update_crc_ccitt() calculates a new CRC-CCITT value based on * the previous value of the CRC and the next byte of the data to be checked. */ uint16_t update_crc_ccitt( uint16_t crc, unsigned char c ) { int16_t tmp; int16_t short_c; short_c = 0x00ff & (uint16_t) c; if ( ! crc_tabccitt_init ) init_crcccitt_tab(); tmp = (crc >> 8) ^ short_c; crc = (crc << 8) ^ crc_tabccitt[tmp]; return crc; } /* update_crc_ccitt */ /* * static void init_crcccitt_tab( void ); * * For optimal performance, the routine to calculate the CRC-CCITT uses a * lookup table with pre-compiled values that can be directly applied in the * XOR action. This table is created at the first call of the function by the * init_crcccitt_tab() routine. */ static void init_crcccitt_tab( void ) { uint16_t i; uint16_t j; uint16_t crc; uint16_t c; for (i=0; i<256; i++) { crc = 0; c = i << 8; for (j=0; j<8; j++) { if ( (crc ^ c) & 0x8000 ) crc = ( crc << 1 ) ^ CRC_POLY_CCITT; else crc = crc << 1; c = c << 1; } crc_tabccitt[i] = crc; } crc_tabccitt_init = true; } // ======================================================================== static void init_crc16_tab( void ); static bool crc_tab16_init = false; static uint16_t crc_tab16[256]; /* * uint16_t crc_16( const unsigned char *input_str, size_t num_bytes ); * * The function crc_16() calculates the 16 bits CRC16 in one pass for a byte * string of which the beginning has been passed to the function. The number of * bytes to check is also a parameter. The number of the bytes in the string is * limited by the constant SIZE_MAX. */ uint16_t crc_16( const unsigned char *input_str, size_t num_bytes ) { uint16_t crc; uint16_t tmp; uint16_t short_c; const unsigned char *ptr; size_t a; if ( ! crc_tab16_init ) init_crc16_tab(); crc = CRC_START_16; ptr = input_str; if ( ptr != NULL ) for (a=0; a<num_bytes; a++) { short_c = 0x00ff & (uint16_t) *ptr; tmp = crc ^ short_c; crc = (crc >> 8) ^ crc_tab16[ tmp & 0xff ]; ptr++; } return crc; } /* crc_16 */ /* * uint16_t crc_modbus( const unsigned char *input_str, size_t num_bytes ); * * The function crc_modbus() calculates the 16 bits Modbus CRC in one pass for * a byte string of which the beginning has been passed to the function. The * number of bytes to check is also a parameter. */ uint16_t crc_modbus( const unsigned char *input_str, size_t num_bytes ) { uint16_t crc; uint16_t tmp; uint16_t short_c; const unsigned char *ptr; size_t a; if ( ! crc_tab16_init ) init_crc16_tab(); crc = CRC_START_MODBUS; ptr = input_str; if ( ptr != NULL ) for (a=0; a<num_bytes; a++) { short_c = 0x00ff & (uint16_t) *ptr; tmp = crc ^ short_c; crc = (crc >> 8) ^ crc_tab16[ tmp & 0xff ]; ptr++; } return crc; } /* crc_modbus */ /* * uint16_t crc_kermit( const unsigned char *input_str, size_t num_bytes ); * * The function crc_kermit() calculates the 16 bits Kermit CRC in one pass for * a byte string of which the beginning has been passed to the function. The * number of bytes to check is also a parameter. */ uint16_t crc_kermit( const unsigned char *input_str, size_t num_bytes ) { uint16_t crc; uint16_t low_byte; uint16_t high_byte; const unsigned char *ptr; size_t a; if ( ! crc_tab_init ) init_crc_tab(); crc = CRC_START_KERMIT; ptr = input_str; if ( ptr != NULL ) for (a=0; a<num_bytes; a++) { crc = (crc >> 8) ^ crc_tab[ (crc ^ (uint16_t) *ptr++) & 0x00FF ]; } low_byte = (crc & 0xff00) >> 8; high_byte = (crc & 0x00ff) << 8; crc = low_byte | high_byte; return crc; } /* crc_kermit */ /* * static void init_crc_tab( void ); * * For optimal performance, the CRC Kermit routine uses a lookup table with * values that can be used directly in the XOR arithmetic in the algorithm. * This lookup table is calculated by the init_crc_tab() routine, the first * time the CRC function is called. */ static void init_crc_tab( void ) { uint16_t i; uint16_t j; uint16_t crc; uint16_t c; for (i=0; i<256; i++) { crc = 0; c = i; for (j=0; j<8; j++) { if ( (crc ^ c) & 0x0001 ) crc = ( crc >> 1 ) ^ CRC_POLY_KERMIT; else crc = crc >> 1; c = c >> 1; } crc_tab[i] = crc; } crc_tab_init = true; } /* init_crc_tab */ /* * uint16_t update_crc_16( uint16_t crc, unsigned char c ); * * The function update_crc_16() calculates a new CRC-16 value based on the * previous value of the CRC and the next byte of data to be checked. */ uint16_t update_crc_16( uint16_t crc, unsigned char c ) { uint16_t tmp; uint16_t short_c; short_c = 0x00ff & (uint16_t) c; if ( ! crc_tab16_init ) init_crc16_tab(); tmp = crc ^ short_c; crc = (crc >> 8) ^ crc_tab16[ tmp & 0xff ]; return crc; } /* update_crc_16 */ /* * static void init_crc16_tab( void ); * * For optimal performance uses the CRC16 routine a lookup table with values * that can be used directly in the XOR arithmetic in the algorithm. This * lookup table is calculated by the init_crc16_tab() routine, the first time * the CRC function is called. */ static void init_crc16_tab( void ) { uint16_t i; uint16_t j; uint16_t crc; uint16_t c; for (i=0; i<256; i++) { crc = 0; c = i; for (j=0; j<8; j++) { if ( (crc ^ c) & 0x0001 ) crc = ( crc >> 1 ) ^ CRC_POLY_16; else crc = crc >> 1; c = c >> 1; } crc_tab16[i] = crc; } crc_tab16_init = true; } /* init_crc16_tab */ // ======================================================================== HB_FUNC( C_EMTCRC_CCITT_FFFF ) // cText --> nTextCRC { hb_retnl( crc_ccitt_ffff( ( unsigned char * ) hb_parc( 1 ), hb_parclen( 1 ) ) ); } HB_FUNC( C_EMTCRC_CRC_16 ) // cText --> nTextCRC { hb_retnl( crc_16( ( unsigned char * ) hb_parc( 1 ), hb_parclen( 1 ) ) ); } HB_FUNC( C_EMTCRC_CRC_MODBUS ) // cText --> nTextCRC { hb_retnl( crc_modbus( ( unsigned char * ) hb_parc( 1 ), hb_parclen( 1 ) ) ); } HB_FUNC( C_EMTCRC_CRC_KERMIT ) // cText --> nTextCRC - codigo fonte obtido em https://github.com/lammertb/libcrc/tree/master/src { hb_retnl( crc_kermit( ( unsigned char * ) hb_parc( 1 ), hb_parclen( 1 ) ) ); } #pragma ENDDUMP
  21. eu peguei esse, funciona muito bem, não falha nenhum email por motivo de spam
  22. user = apikey *pwd = [key send grid] server = smtp.sendgrid.net port = 465 SSL = true *from = [seu email configurado no sendgrid] a unica diferença é o pwd e o from que você deve pegar das suas configurações no sendgrid
  23. No script de compilação vc precisa setar que o executável gerado será multithread. Precisa pesquisar como faz essa setagem pq eu não me lembro o de tem que mudar.
×
×
  • Create New...