All BASIC

BASIC User Group => Code Challenges => Topic started by: jalih on March 17, 2019, 02:58:18 AM

Title: Generate QR code
Post by: jalih on March 17, 2019, 02:58:18 AM
Your challenge is to generate a QR code for All BASIC forum website using your favorite programming language and library.

Below is a simple 8th version using built-in capability.

Code: [Select]
needs utils/qrcode

: fname "qr.png" ;
: qr-str "https://www.allbasic.info/forum/index.php" ;

: app:main
  qr-str img:ECC-LOW img:qr-gen img:qr>img
  fname f:rm drop
  fname img:>file
  bye ;
Title: Re: Generate QR code
Post by: John on March 17, 2019, 08:47:27 AM
(http://api.qrserver.com/v1/create-qr-code/?data=https%3A%2F%2Fwww.allbasic.info%2Fforum%2Findex.php&size=125x125)


Code: [Select]
http://api.qrserver.com/v1/create-qr-code/?data=https%3A%2F%2Fwww.allbasic.info%2Fforum%2Findex.php&size=125x125


Title: Re: Generate QR code
Post by: AIR on March 17, 2019, 08:29:07 PM
GO:

Code: Go
  1. package main
  2.  
  3. import (
  4.         "os"
  5.  
  6.         qrcode "github.com/skip2/go-qrcode"
  7. )
  8.  
  9. func main() {
  10.         err := qrcode.WriteFile("https://www.allbasic.info/forum/index.php", qrcode.Medium, 256, "qr.png")
  11.         if err != nil {
  12.                 println("Error generating QR image...")
  13.                 os.Exit(-1)
  14.         }
  15. }
  16.  
Title: Re: Generate QR code
Post by: John on March 17, 2019, 09:12:14 PM
I like the GO feature of being able to include code from the web.

I'm going to try using SB's pre-processor to acomplishish the same effect.