<FromGitter>
<akzhan> Reason: Security, Vulnerability, Bots, Mailware using play.crystal...
<FromGitter>
<akzhan> So there is sandbox
muhlisbc has quit [Quit: AtomicIRC: The nuclear option.]
<TheGillies>
not sure if you mean malware or if mailware is actually a thing
<TheGillies>
i mean it sounds legit
bjz has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 246 seconds]
Ven has joined #crystal-lang
Ven has quit [Client Quit]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
_whitelogger has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter>
<bigDaddyS1oth> hey peeps, did radix get deprecated? Or something funky happening to it? I can't do a complete `shards install` because it tosses up this error once it tries to install radix: `git command failed: git ls-tree -r --full-tree --name-only -- shard.yml (). Maybe a commit, branch or file doesn't exist? ⏎ `
<FromGitter>
<dummied> Evening. This is my second time playing around with crystal, and I'm running into a bit of trouble I can't seem to square on my own. I'm attempting to connect to a sqlite database using an absolute path. I've confirmed that the path to the file (as the string I'm passing into `DB.open`) works when thrown into the command line `sqlite3`, but crystal gives me a consistent "Connection Refused". Any tips/pointers?
<FromGitter>
<drujensen> Hi Chris. What URL are u using? sqlite3://absolute-path
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
_whitelogger has joined #crystal-lang
whomp has quit [Ping timeout: 260 seconds]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 272 seconds]
<crystal-gh>
[crystal] akzhan opened pull request #4434: Documentation for OpenSSL::HMAC class. (master...doc-openssl/hmac.cr) https://git.io/vHJ6K
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
<crystal-gh>
[crystal] akzhan opened pull request #4435: Extract OpenSSL::Error to separate source file, document it (master...extract-openssl-error-and-reorder-openssl-requires) https://git.io/vHJPV
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 255 seconds]
bjz has quit [Ping timeout: 272 seconds]
bjz has joined #crystal-lang
TheLemonMan has joined #crystal-lang
<TheGillies>
Is there a way to do foo = "bar" and then somehow pass foo to a macro but in "bar" form?
<Papierkorb>
TheGillies: Write a program which reads it and writes the code to stdout, then use `{{ exec "foo.cr" }}` or the like
<RX14>
TheGillies, what exactly do you want to generate from the yaml
<TheGillies>
So compile time constructs are different than runtime? I thought compile time stuff ran just like runtime stuff, obviously I have no idea what I'm talking about heh
<oprypin>
yes
<TheGillies>
RX14: It's a mapping of routes to handlers
<RX14>
they're entirely seperate languages
<RX14>
unfortunately
<TheGillies>
Im used to elixir macros where you can do this sort of thing :(
<TheGillies>
but I guess they have a VM so they're cheating
<FromGitter>
<akzhan> It’s statically typed language with code compiled before execution.
<FromGitter>
<akzhan> Of course we can - load dinamically created/compiled code
<TheGillies>
>NOTE the compiler is allowed to cache the executable generated for filename and only recompile it if any of the files it depends on changes (their modified time). This is why it's strongly discouraged to use a program for #run that changes in subsequent compilations
<TheGillies>
So not a good idea for something that reads config file
<RX14>
uhh
<Papierkorb>
Use macros instead to describe routes
<RX14>
no i think it's just the executable that's cached
<RX14>
not running it
<RX14>
i'm not sure
<RX14>
otherwise how would ecr work
<RX14>
that depends on a template file which is passed as an arg to run
<oprypin>
yeah it's fine
<RX14>
and changing the icr file works just fine
<oprypin>
if the dependent program would read the config file at its compile time it would not be updated
Ven has joined #crystal-lang
<oprypin>
but dependent program's runtime operations can be anything - and its runtime output becomes the main program's compiletime result
<RX14>
Papierkorb, wording these SHA1/MD5 warnings is pretty hard, "password checks" is a bit vague, and md5/sha1 shouldn't be used in password hashing anyway so i'm not sure what to put
<Papierkorb>
> shouldn't be used in password hashing anyway
<RX14>
well i mean even sha256
<Papierkorb>
That's why we need to tell them not to
<RX14>
script/bcrypt should be used
<Papierkorb>
Because people still think that it's okay to use SHA-1.
<Papierkorb>
Or that they "just need to add a few rounds"
<RX14>
but sha256 is still secure, doesn't mean it should be used for password hashing
<Papierkorb>
You may know that, but others don't
<Papierkorb>
The wording is hard to get right of course
<RX14>
for sure the note's fine but it feels like we should be more generic
Ven_ has quit [Ping timeout: 268 seconds]
<Papierkorb>
RX14: I think both is necessary. This is kinda a security reminder, and as we can't force people to not do security related things if they have no idea, we need to lend them a hand and show them in general and for specific use-cases, what's a bad idea
<Papierkorb>
Maybe something like "This algorithm is not intended to be used to secure access to resources, like user passwords."
Ven_ has joined #crystal-lang
<Papierkorb>
Ideally, with a mention of bcrypt or scrypt, if any of those two is in the stdlib
<RX14>
bcrypt is in
<RX14>
Crypto::Bcrypt::Password is great
<Papierkorb>
Then append "See `Crypto::Bcrypt::Password` for this use-case"
<TheGillies>
Anyone know where "resolve" is located?
<TheGillies>
because it's for not crystal programmers
<TheGillies>
it's just a binary that takes a config file and maps it to another binary
<TheGillies>
That's the end goal anyway
<TheGillies>
like "/foo" could run the foo binary
<oprypin>
TheGillies, uhhhh parse toml and put it into a crystal source file and then use the config as a compile time construct ¯\_(ツ)_/¯
<TheGillies>
oprypin: That's what i've been trying to do. I need to iterate over the construct though, only macro interation method i know is "for" and it wants a literal
<oprypin>
TheGillies, i mean as in 1. run a program that reads config.toml and writes it into a file config.cr CONFIG = { ... }
<oprypin>
2. compile the actual program that has require "config" and uses CONFIG
<TheGillies>
oh and just require file the?
<TheGillies>
the file
f-mer has quit [Ping timeout: 260 seconds]
<TheGillies>
I swear I'm dyslexic
<RX14>
that's what the run macro does, runs a normal crystal program at compile time and interprets it's stdout as crystal code
<oprypin>
RX14 , oooh i get it now
<RX14>
so just have a crystal file which parses the toml and emits the kemal routes
<RX14>
oprypin, you didn't understand the run macro?
<oprypin>
{{run("toml_parser.cr")}} assuming toml_parser.cr writes a crystal data structure to stdout would achieve the same effect as that require
<oprypin>
RX14, no i was just like "welp it returns a string, what now"
<RX14>
lol
<TheGillies>
It's not a string it's actual crystal code
<TheGillies>
heh
<RX14>
sure run() returns a string
<RX14>
a macro string
<RX14>
which is pased using {{}}
<TheGillies>
Ah
<TheGillies>
got it
<TheGillies>
Thats what I meant, but I didn't know how to say it
<RX14>
you can use run() and then use .stringify on it
<RX14>
and then do whatever with the string
<RX14>
but by default it returns the code as a macroid
<RX14>
which is pasted as crystal code like a normal macro
splitty__ has joined #crystal-lang
splitty_ has joined #crystal-lang
splitty___ has quit [Ping timeout: 246 seconds]
splitty__ has quit [Ping timeout: 268 seconds]
<oprypin>
any neat way to do uhhh reject_with_index! other than manually incrementing?
<oprypin>
in fact i dont even need the item, i literally determine whether the item stays only by its index
<FromGitter>
<jwoertink> I saw there's ductape.cr which can read javascript
<FromGitter>
<jwoertink> so I guess that could be used to do the transpiling
<FromGitter>
<jwoertink> I'm just curious if anyone has already done that work or not
<RX14>
looks unlikely
<FromGitter>
<jwoertink> Yeah, I didn't see anything looking around. Right now fez has ruby as a dependency just for the sake of that gem, and the sass one.
<RX14>
I don't get why you wouldn't just use babel directly myself
<RX14>
not everything has to have a DSL in your favourite language
<FromGitter>
<jwoertink> agreed. Using babel directly would either require it to be included in your web app (which I don't like), or have node as a dependency
<RX14>
if it's for programatic usage sure but for web frameworks they should just use something like webpack on the commandline
<FromGitter>
<jwoertink> which would defeat the purpose of getting rid of ruby
<RX14>
don't you need node to run it anyway?
<FromGitter>
<jwoertink> no
<FromGitter>
<jwoertink> I don't have node installed
<FromGitter>
<jwoertink> I actually haven't used webpack yet. Maybe I can just start looking in to that route since it seems to be getting more popular
<FromGitter>
<jwoertink> guess it's time to install node!
<RX14>
i havent actually used webpack directly
<RX14>
i found a tool called vbuild which appeals to me a lot more as an opinionated tool with sane defaults
<RX14>
built on top of webpack
<RX14>
aand it's changed name?
<FromGitter>
<jwoertink> oh? Haven't heard of that either. Damn, I'm out of the loop
<RX14>
i guess it transcended being a vue specific tool so it got renamed poi? idk
<FromGitter>
<jwoertink> oh ok. Thanks for the link!
<FromGitter>
<akzhan> Node/tsnode is root of frontend technologies de facto. Webpack - kind of something strange deal with assorti of good and bad javascript practices. Anyway it has no alternative yet.
snsei has quit [Remote host closed the connection]
<RX14>
and the poi docs are broken because some random cdn's down...
pduncan has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter>
<bew> Oohh... And I lost 10mins of my life... Thx!
yogg-saron has joined #crystal-lang
<FromGitter>
<bigDaddyS1oth> ^That'll happen a lot in programming.
<FromGitter>
<bew> Ahah yeah I know, but I ran into this specific problem myself a lot of times already (with block, without block), but can't get used to it... In a few decades maybe! ^^
<oprypin>
i think things would be better if it required an explicit signature
<oprypin>
`def foo(bar, &)` like `def foo(bar, &block)` but you dont care about referencing it
<FromGitter>
<bew> Thats a nice idea, but I'm not sure asterite will agree with that
<FromGitter>
<bew> Eg. `def foo` (without block), `def foo(&)`(with block), the necessity to add parentheses only for that is not optimal imo
<FromGitter>
<bew> Especially when the method with block is a few line long
<oprypin>
i think parentheses should be necessary anyway
<oprypin>
should be required, that is
<RX14>
why? it's ugly
<RX14>
and not neccesary
<RX14>
"properties" being functions, having exactly the same syntax is one of the things I like most about ruby
<oprypin>
it's not necessary to make an exception for that case
<DeBot>
oprypin: Syntax error in eval:17: unexpected token: a (parentheses are mandatory for def arguments) - https://carc.in/#/r/21xi
<RX14>
oh yeah that was what it was
<RX14>
sorry
<oprypin>
parentheses are mandatory, .. oh except for that one case
<oprypin>
just arbitrary
<RX14>
it's not arbitrary
<RX14>
when the 1 case is when they're empty
<RX14>
it's unneccesary visual noise when reading code
<RX14>
one of the things that ruby got very very right is making code as easy to read as possible with very few noisy symbols
<oprypin>
got it right in a few specific places but not generally
<RX14>
I disagree, I like ruby's syntax a lot
<oprypin>
I want to measure the time my program takes to run, I don't care about these user/sys/whatever things, just want a number, what should i use?
<RX14>
still use time
<RX14>
just check real time
<RX14>
ignore the user/sys ones
<RX14>
other than that i don't know
<oprypin>
ok I want to automate this because i want to optimize for time by tweaking a constant
<RX14>
make a crystal script?
<oprypin>
crystal script that parses the output of `time` or what
<RX14>
no just executes the program and collects t1 and t2
<FromGitter>
<akzhan> Btw, what is recommended to build flame graphs of code profile?
<RX14>
there's scripts to parse perf output as a framegraph
<RX14>
you should use --release --debug as crystal compile flags though
<RX14>
so you get optimizations *and* debug info
<FromGitter>
<akzhan> Thanks @RX14
<oprypin>
that's a new one
<RX14>
oprypin, which?
<RX14>
instruments?
tilpner has joined #crystal-lang
<oprypin>
--release --debug
<RX14>
is it?
<oprypin>
i mean it sounds crazy
<RX14>
it doesn't really. release/no release is optimization level, all --debug has ever done has emit debug info or not which is orthogonal
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<bigDaddyS1oth> Hey fellas I'm still getting an issue with radix on `shards install`. `git command failed: git ls-tree -r --full-tree --name-only -- shard.yml (). Maybe a commit, branch or file doesn't exist?`
<FromGitter>
<bigDaddyS1oth> I've changed to `branch: master` `version: ~> 0.3.8` and `commit: [the current commit]`
<oprypin>
bigDaddyS1oth, do you get any output from that git command? try to run it manually
<FromGitter>
<bigDaddyS1oth> `fatal: Not a git repository (or any parent up to mount point /) ⏎ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).`
<oprypin>
ehhhh can you run it in any git repository that contains shard.yml?
<oprypin>
honestly i have no idea, just testing the fringe theory that your git version is too old
<FromGitter>
<bigDaddyS1oth> I'll pick one of the shard folders in the `/lib` folder
<FromGitter>
<bigDaddyS1oth> nnnnnope same output
<oprypin>
those are not git repositories
<FromGitter>
<bigDaddyS1oth> damn uh...now I gotta recall where I've ran `git init`
<FromGitter>
<fridgerator> possible to rescue from undefined method?
<oprypin>
fridgerator, it is a compile time error
<FromGitter>
<fridgerator> oh right
<oprypin>
no exception is happening, nothing to rescue
<oprypin>
fridgerator, you can try if thing.responds_to? :method_name
<FromGitter>
<fridgerator> yep, thats what i'm looking for
<FromGitter>
<fridgerator> I tried it already, but forgot the `?`
<oprypin>
and feel free to share the actual use case. this is really rarely needed.
whomp has joined #crystal-lang
<FromGitter>
<fridgerator> I'm writing an extension for Crecto, I need to see if a method is defined on a user defined class
<FromGitter>
<fridgerator> else I will provide a default
<FromGitter>
<fridgerator> but I don't want to add the default to crecto, because its not needed if the extension library is not used
<oprypin>
doesnt tell me much. nevermind.
<FromGitter>
<bigDaddyS1oth> @oprypin I think it's because that particular shard.yml file is in a folder I created just to have a bunch of shards to look at the source code if I ever decide to get more into that
<oprypin>
bigDaddyS1oth, just git clone them, that's better anyway
<oprypin>
what can be easier than copying an url from the address bar and doing git clone
<FromGitter>
<bigDaddyS1oth> @oprypin yea it makes more sense that way once I think about it...
<FromGitter>
<bigDaddyS1oth> I can run `shards install` in any of the shards in the `../lib` folder, just not the directory I created where the `.shards` `lib`are.
<oprypin>
uhhh this sounds weird
<FromGitter>
<bigDaddyS1oth> exactly
<FromGitter>
<bigDaddyS1oth> I'll just `git clone` them. Easier than whatever I'm attempting to do
<FromGitter>
<carsonbaker> @thegillies can you paste your code?
<FromGitter>
<carsonbaker> @whomp your path prefix of /opt/local/... makes me think you're using macports, not homebrew. do you have both installed, or something?
<FromGitter>
<fridgerator> is it possible to render another ecr template file from within an ecr template file? like a partial?
<oprypin>
fridgerator, at the very least you can insert results of rendering one template into another template
<whomp>
works now, thanks carsonbaker~
<whomp>
*!
<FromGitter>
<carsonbaker> cool deal
Ven has joined #crystal-lang
Ven is now known as Guest81488
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter>
<elorest> What is the convention involving hyphens vs underscores for file names. In ruby at least for the first long time it was underscores but I’m seeing a ton of hyphens in crystal projects.
<TheGillies>
I was just wondering the same thing today
<FromGitter>
<elorest> I would think so because i think it looks way cleaner. But many things in crystal use hyphens including crystal-db, crystal-mysql, etc.
<FromGitter>
<elorest> Hmmm. I hope so but I’m seeing a lot of hyphens.