<FromGitter>
<kevinsjoberg> straight-shoota: Are you looking into the problem I talked about yesterday? I fixed it in asdf-crystal, but the permanent solution would be to adjust the dylib path to be @executable_path/../embedded/lib/libyaml-0.2.dylib for macOS.
<FromGitter>
<kevinsjoberg> I looked into the distribution-scripts yesterday and have found the place to do the change, but wasn't sure how to test it out.
<FromGitter>
<kevinsjoberg> I can confirm that the binary you linked contains the hardcoded path for libyaml.
_ht has joined #crystal-lang
sorcus has quit [Ping timeout: 245 seconds]
daemonwrangler has joined #crystal-lang
hendursaga has joined #crystal-lang
hendursa1 has quit [Ping timeout: 240 seconds]
hendursaga has quit [Remote host closed the connection]
hendursaga has joined #crystal-lang
alexherbo2 has joined #crystal-lang
<frojnd>
Hi tehre
<frojnd>
I get `Unhandled exception: no results (DB::NoResultsError)` when selecting column that does not exist in sqlite database. How can I rescue this?
<frojnd>
I will not know at a runtime if column exists or not exists depending on search criteria
<FromGitter>
<naqvis> doesn't normal exception process work?
<frojnd>
I think it should. I talked to someone in sqlite chan and said this zero row return is specific to scalar search queries. Not sure if this is is a bug or..
<frojnd>
Ok this is just how it is. It's expected from me to write resuce for scalar
<FromGitter>
<dinko-pehar> Actually, based on delimiter it recognizes and applies highlight on content inside delimiters (in vscode)
<FromGitter>
<naqvis> that should be vs code plugin doing some tricks, but to crystal compiler `heredoc` is just a string
<FromGitter>
<naqvis> and heredoc are used when you have strings spanning multiple lines
<FromGitter>
<dinko-pehar> OK, thank you again @naqvis
<FromGitter>
<naqvis> 👍
<FromGitter>
<naqvis> > *<frojnd>* I think it should. I talked to someone in sqlite chan and said this zero row return is specific to scalar search queries. Not sure if this is is a bug or.. ⏎ ⏎ that's the same behavior in Crystal-db. This `NoResultsError` is only raised when you call `QueryMethods#scalar` http://crystal-lang.github.io/crystal-db/api/0.10.1/DB/QueryMethods.html#scalar(query,*args_,args:Array?=nil)-instance-method
<FromGitter>
<naqvis> for other query methods it shouldn't be raised
<frojnd>
@naqvis 👍
<FromGitter>
<naqvis> but question would be, if you are executing a query against a db with column you don't know if its present or not, shouldn't rdbms raising an error for columns which are not part of DDL?
<FromGitter>
<kevinsjoberg> straight-shoota: I saw your post on GitHub. Out of curiousity, how did you go about not building libyaml dynamically? I'm fairly new to the C eco system in general.
<FromGitter>
<kevinsjoberg> Thanks, didn't know about that flag. :)
kevinsjoberg has joined #crystal-lang
<straight-shoota>
Me neither
<straight-shoota>
I'm by far not an expert on this
<straight-shoota>
but when building libraries you usually have a choice of building static and/or dynamic
<kevinsjoberg>
I appreciate it nevertheless. I think we should be all good now then. Future versions of the binary will work as expected and my patch to asdf-crystal will make sure prior binaries work properly as well. :)
<kevinsjoberg>
and now I learned something else. Had to look up what "ack" was slang for, haha.
<straight-shoota>
:D
<FromGitter>
<ryanstout> quick question. Installing the compiler from source, how do I copy things into /usr? If I copy crystal_build_dir/bin/* or crystal_build_dir/.build/* to /usr/bin for example, I get errors about it not being able to find the prelude. (Would adding a make install be an option?)
<FromGitter>
<ryanstout> are there docs on this anywhere?
<straight-shoota>
you can't put crystal_build_dir/bin/crystal in PATH
<straight-shoota>
it needs to be a symlink with a different name, otherwise the wrapper script from the repo calls itself when trying to figure out the env config
<FromGitter>
<ryanstout> ok, that explains why it hangs now
<FromGitter>
<ryanstout> which file needs to be a symlink? (sorry, a bit confused)
<FromGitter>
<ryanstout> thanks for the help
<straight-shoota>
I mean something like `ln -s crystal_build_dir/bin/crystal crystal-local`
<straight-shoota>
eh, less confusingly: `ln -s crystal_build_dir/bin/crystal /usr/bin/crystal-local`
<FromGitter>
<ryanstout> ok, I rebuild that part of the container, which seemed to fix it. Not sure what changed. Do I need to the CRYSTAL_PATH set to that build to prevent it from using the pacman one?
<straight-shoota>
not really
<straight-shoota>
CRYSTAL_PATH is usually not configured globally, the wrapper just sets it directly before executing the compiler
<FromGitter>
<ryanstout> ok, thanks
<FromGitter>
<ryanstout> thanks for the help
<straight-shoota>
yw
<FromGitter>
<ryanstout> I would offer to add a `make install` PR, but I don't really know `make`
<straight-shoota>
I think make install would indeed be useful
<FromGitter>
<ryanstout> ok, so next issue is trying to build shards using `crystal-local`. If I symlink to just `crystal` it hangs
<FromGitter>
<ryanstout> and it looks like shards just tries `crystal`
<straight-shoota>
you should be able to build shards with `make CRYSTAL=crystal-local`
<FromGitter>
<ryanstout> cool, thanks
<straight-shoota>
If you can't make the PR yourself, you could at least post a feature request for make install
<FromGitter>
<ryanstout> will do
<FromGitter>
<ryanstout> next issue, I just tried building shards on the latest shards release, and on master. Using both 1.0.0 of crystal and master I built. I get: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=609bf942f1397c69073edeaa]
<straight-shoota>
is shards_build_dir/lib/molinillo installed?
<straight-shoota>
the makefile should do that
<FromGitter>
<ryanstout> I'm guessing its not, how would I check if its installed
<FromGitter>
<ryanstout> I don't have a shards command currently
<FromGitter>
<ryanstout> (trying to build it)
<straight-shoota>
just ls the directory
<FromGitter>
<Blacksmoke16> iirc it should fallback on curl or something
<straight-shoota>
yes, the makefile should download it, even if no shards is available for bootstrap
<FromGitter>
<ryanstout> but src is the full path?
<straight-shoota>
lib directory relative to working directory
<straight-shoota>
yes
<straight-shoota>
src is for grabbing the global standard library, lib is the local shard dependencies
<FromGitter>
<ryanstout> ok, thanks. Sorry for all of the noob questions
<FromGitter>
<ryanstout> ok, looks like that worked
<FromGitter>
<ryanstout> thanks
<FromGitter>
<ryanstout> can I do a PR that adds to the docs somewhere? (though I'm only partially understanding the details of it)
<straight-shoota>
hm I don't think there is any documentation about building the compiler you could expand on
<FromGitter>
<ryanstout> ok, I'll try to add some docs and do a PR when I get a few. Any other details that should be in there?
duane has joined #crystal-lang
<frojnd>
Hm. I'm trying to understand db scalar select statement. `select rowid, date from dailymeditation where DATE == DATE('2021-02-02');` gives me: https://termbin.com/8oqb in sqlite terminal but code in crystal: `db.scalar "select rowid, date from dailymeditation where DATE == DATE('2021-02-02');"` gives me: `33`
<frojnd>
How can I get both rowids or dates?
<FromGitter>
<Blacksmoke16> doesnt sql just use `=`
<FromGitter>
<Blacksmoke16> if you just want to iterate over something, just use `query_each` then
alexherbo2 has quit [Read error: Connection reset by peer]
alexherbo20 has joined #crystal-lang
alexherbo20 has quit [Ping timeout: 252 seconds]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 265 seconds]
alexherbo2 has joined #crystal-lang
<repo>
Blacksmoke16: heya! quick question about athena serializer: is it possible to somehow annotate classes from other libs?
<repo>
i'm writing c bindings for a library and ultimately would need to serialize the objects into json. it would feel kind of weird though to add the annotations (and pull athena serializer as a dep) in that c binding lib
<repo>
the properties of those objects are in fact getters using the c lib
<repo>
some of which might be expensive/unnecessary to always call
<FromGitter>
<Blacksmoke16> or alternatively have some wrapping type
<FromGitter>
<oprypin:matrix.org> oh nice, https://github.com/sdogruyol/tren*is* the native interpolation solution. but could've been done without separate files too
<straight-shoota>
+1
<FromGitter>
<oprypin:matrix.org> & without macro run is also possible, i suppose
<FromGitter>
<rishavs> If I use `Random::Secure.urlsafe_base64(4, padding: false) `, the size of the resulting string is not 4, but is 6. Is this expected? ⏎ https://play.crystal-lang.org/#/r/b4mq
<FromGitter>
<Blacksmoke16> thats prob what `padding: false` does
<FromGitter>
<rishavs> i tried all variations, true/false/not specified. In all cases the size of the string is larger than the gievn value ⏎ https://play.crystal-lang.org/#/r/b4mv
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
<FromGitter>
<Blacksmoke16> right
<straight-shoota>
The argument determines the number of bytes, not the number of characters
<FromGitter>
<Blacksmoke16> it'll then base64 encode those bytes which has some size overhead as well afaik
<straight-shoota>
exactly. 4 bytes encoded in base64 takes 6 characters, plus 2 for padding
<FromGitter>
<rishavs> ah. got it.
<FromGitter>
<RespiteSage> @oprypin:matrix.org Have you used the `.from_stream` methods in `crSFML` at all? I'm not sure how or if they're supposed to work.
<FromGitter>
<RespiteSage> I see they exist, but I don't see them in any of the examples.
<FromGitter>
<RespiteSage> I'm trying to download an image and turn it into a texture. In my use case (just messing with the library to make a little domain-specific data visualization tool), it's fine to write a temp file, though, so instead of using a stream I just wrote to the temp file and then used `.from_file`.
<FromGitter>
<RespiteSage> Well, I might make an attempt at that. It seems useful to be able to do with the shard.
<FromGitter>
<oprypin:matrix.org> @RespiteSage: `MemoryInputStream` is very easy and saves you the temp file (though it's still not streaming)
<FromGitter>
<RespiteSage> Yeah, that's a good point.
<FromGitter>
<RespiteSage> I don't really need to stream, so I'm happy with that solution.
<FromGitter>
<oprypin:matrix.org> probably an implementation of `InputStream` based on `IO` would be very useful :o
<FromGitter>
<ryanstout> if I have a recursive type that looks like: ⏎ ⏎ ```@@data : Type = Type{"key" => "value"}``` ⏎ ⏎ but is there a simpler way to take a more complex data structure (think JSON) and convert it to a custom type (without specifying the type on all Hashes. (or am I thinking about this wrong) [https://gitter.im/crystal-lang/crystal?at=609c53702ee2b13d95a5bc93]
<FromGitter>
<Blacksmoke16> recursive aliases are bad
<FromGitter>
<ryanstout> @Blacksmoke16 I'm parsing something similar to JSON
<FromGitter>
<Blacksmoke16> could you do something like `JSON::Any`?
<FromGitter>
<ryanstout> isn't that a recursive alias?
<FromGitter>
<Blacksmoke16> similar concept but it uses an actual type that accepts a value of a scalar value, or a more complex type made up of also this type https://crystal-lang.org/api/master/JSON/Any.html#new(raw:Type)-class-method