Crystal Language
Using modules in crystal
As your application grows, you would like to move from one big .cr file to separating your code into smaller files. You can use require from your main .cr file to add code from other files: require “./tools/*” This statement will add code from the tools directory, relative to your main .cr file. This will…
WeiterlesenThe scope of ecr within crystal: or how do I pass in variables and Objects into ECR templates?
As a beginner in the Crystal language I still struggle to get my head around some of the concepts in it, and develop a feel for coding in Crystal. When I come across difficult problems, which I solve or start to understand, I blog about them, so others can benefit – as lack of documentation…
WeiterlesenException: Unexpected quote at 1:2 (CSV::MalformedCSVError) Crystal
While trying to parse an Amazon pay file, I stumbled across this particular problem: Exception: Unexpected quote at 1:2 (CSV::MalformedCSVError) The reason: Amazon Pay encodes it’s files in UTF-8 with BOM. The BOM is an optional (in UTF-8 files) marker. You can see it with the tool xxd for instance xxd apolish_amazon_2018DecMonthlyTransaction.csv | less The…
WeiterlesenInstall Crystal on Docker: how to add the Crystal repository to Docker in the Dockerfile
Dockerfile (excerpt) ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn RUN apt-get update && apt-get install -y \ software-properties-common \ build-essential \ libevent-dev \ libssl-dev \ libxml2-dev \ libyaml-dev \ libgmp-dev \ libreadline-dev \ apt-transport-https \ iputils-ping \ git \ aptitude \ nano \ openssh-server \ && apt-key adv –keyserver keys.gnupg.net –recv-keys 09617FD37CC06B54 \ && add-apt-repository ‘deb https://dist.crystal-lang.org/apt crystal…
WeiterlesenCrystal libevent-2.0.so.5: cannot open shared object file
Today I upgraded my Ubuntu to 18.04. Compiling a file with Crystal gives me the following error: stderr: /root/.cache/crystal/usr-share-crystal-src-ecr-process.cr/macro_run: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory The library in question, libevent-2.0.so.5 has been superseded by libevent-2.1.so.6 => /usr/lib/x86_64-linux-gnu/libevent-2.1.so.6 Crystal is of course aware of this…
WeiterlesenCrystal & Alpine on the Raspberry Pi
Bringing together two interesting technologies: Alpine Linux – a small-size and security oriented Linux distribution Crystal – a compiled language with a nice syntax (similar to Ruby) on the Raspberry Pi (armhf / ARMv6, which would also support the Pi Zero W) is not possible currently, as of 21.12.2018. There is no (at least no…
WeiterlesenCrystal: crystal language Duplicate trail found
max@morpheus:~/crystal/taxgod$ crystal run src/taxgod.cr Unhandled exception: Duplicate trail found ‘vat-correction’ (Radix::Tree::DuplicateError) from lib/radix/src/radix/tree.cr:0:11 in ‘add’ from lib/radix/src/radix/tree.cr:149:11 in ‘add’ from lib/radix/src/radix/tree.cr:149:11 in ‘add’ from lib/radix/src/radix/tree.cr:108:9 in ‘add’ from lib/kemal/src/kemal/route_handler.cr:49:7 in ‘add_to_radix_tree’ from lib/kemal/src/kemal/route_handler.cr:21:7 in ‘add_route’ from lib/kemal/src/kemal/dsl.cr:12:1 in ‘post’ from src/vatcorrection.cr:26:2 in ‘__crystal_main’ from /usr/share/crystal/src/crystal/main.cr:97:5 in ‘main_user_code’ from /usr/share/crystal/src/crystal/main.cr:86:7 in ‘main’ from /usr/share/crystal/src/crystal/main.cr:106:3 in ‘main’…
Weiterlesen