<FromGitter>
<christopherzimmerman> Does anyone know of any libraries that implement something like a hash, but the type of each key is handled like a tuple, where it's not a union? I thought some of the DB libraries would have it for schemas but haven't had any luck finding it
<FromGitter>
<christopherzimmerman> Nevermind, I'm an idiot, it's part of the standard library
<FromGitter>
<christopherzimmerman> Found it 30 seconds after asking
deavmi has quit [Ping timeout: 272 seconds]
<FromGitter>
<Blacksmoke16> aka a named tuple? :P
<FromGitter>
<christopherzimmerman> Yep :) Not sure how I missed it
<FromGitter>
<Blacksmoke16> they are immutable tho
<FromGitter>
<Blacksmoke16> is a key difference
deavmi has joined #crystal-lang
<FromGitter>
<Blacksmoke16> raz: is where i ended up
kradnoel has quit [Remote host closed the connection]
kradnoel has joined #crystal-lang
kradnoel_ has joined #crystal-lang
kradnoel has quit [Ping timeout: 256 seconds]
zorp_ has joined #crystal-lang
kradnoel_ has quit [Remote host closed the connection]
sagax has joined #crystal-lang
tdc has joined #crystal-lang
tdc has left #crystal-lang ["Leaving"]
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter>
<naqvis> @emanzx From the error it is evident that your system is missing openssl `openssl-devel` library.
<FromGitter>
<naqvis> Have it installed and then try compilation again
deavmi has quit [Ping timeout: 246 seconds]
deavmi has joined #crystal-lang
<FromGitter>
<emanzx> @naqvis thank god. that settle everythings.
sagax has quit [Remote host closed the connection]
<FromGitter>
<naqvis> 👍
<FromGitter>
<emanzx> ok seem crystal working again.. but im having lots of dependencies problem because im using 0.32.1 and its 0.34.0 in the wild now. But I manage to solve some dependencies if it happen caused by dependencies. But this one I have lost. can anyone point me again where is wrong? or I need to fix my code?
<FromGitter>
<emanzx> I do a log parsing of bind 9 RPZ log file. from there I take out information such as View, Client IP, Action, RPZ Zone and Query. So the things is there is a lot of same line and I need to count the how many time the line happen on specific time_bucket. So I took out all the same info into hash and make it as a key and the count as the value. The crystal version 0.28.0 bellow seem to accept it and ruby did
<FromGitter>
... too. So I was just following the flow as it is okay. But I know its not good but could not think of Idea to used as a key for the hash.
<FromGitter>
<emanzx> here the code that referred to_json.
<FromGitter>
<naqvis> data structure you have can't be converted to valid JSON, so you are receiving that error, i mean how `Hash(String, Hash(Hash(String, String), Int32))` would be represented in JSON?
<FromGitter>
<naqvis> do you have any output format, which you were targeting to store the calculated outcome?
<FromGitter>
<emanzx> currently I plan to save into json line.
<FromGitter>
<emanzx> let me see if I have any
<FromGitter>
<emanzx> okay here are the previous version of the code I have compiled with old crystal
<FromGitter>
<j8r> BTW by exprience, parsing by char is better than by line
<FromGitter>
<j8r> It can sounds it is, but not that harder to do, and more flexible and efficient
<FromGitter>
<j8r> I sounds like you are parsing logs?
<FromGitter>
<j8r> (Nvm, you already said it)
<FromGitter>
<emanzx> yup. Im parsing bind9 rpz logs.
<FromGitter>
<emanzx> @Blacksmoke16 im not sure myself but the early version of crystal are able to convert and save it to JSON. but im not sure it did it.. but I can parse back the JSON and reload back the Hash(String, Hash(Hash(String, String), Int32))
<FromGitter>
<Blacksmoke16> im prob not caught up on what the problem is
<FromGitter>
<Blacksmoke16> convert and save what to JSON?
<FromGitter>
<emanzx> here are the code I use to re read the JSON.
<FromGitter>
<Blacksmoke16> how is that useful tho?
<FromGitter>
<Blacksmoke16> shouldnt `1` be the key, and the value be that hash?
<FromGitter>
<emanzx> hmm..
<FromGitter>
<emanzx> maybe I turn that around
<FromGitter>
<emanzx> let me try
<FromGitter>
<emanzx> but can I have multple same key?
<FromGitter>
<emanzx> I mean I can have multiple value of key
<FromGitter>
<emanzx> and the value of value are different?
<FromGitter>
<Blacksmoke16> prob would make more sense to have it like `Hash(String, Array(hash(String, String))`
<FromGitter>
<Blacksmoke16> or really, use structs for this and not deal with hashes
<FromGitter>
<emanzx> sorry Im still lacking in programming.. crystal did teach me alot.. and I learn to use hash a lot in crystal most of the time I just use single variable for each value.. haha
<FromGitter>
<Daniel-Worrall> Anyone got a way to check the % progress of a HTTP request? I'll be downloading large files and I want to write in some progress bars or output status
<FromGitter>
<j8r> You can do a HEAD request at first to get the Content-Length header
<FromGitter>
<j8r> then, something like bytes read count / Content-Length
<FromGitter>
<Daniel-Worrall> how would I get the bytes read?
<FromGitter>
<Daniel-Worrall> I don't see anything exposed on HTTP::Client
<jhass>
yeah, you'd need to do something like IO.copy does but exposing the progress
<FromGitter>
<Daniel-Worrall> yeah, no, Idk
<FromGitter>
<watzon> Is there a flag that says what the target platform is? I know you can use `flag?(:linux)` etc to check if the target is linux, but what if I want to actually get the target? Any option besides `if flag?(:linux) ... elsif flag?(:windows) ...`?
<jhass>
what is the target then?
<jhass>
if linux is not a platform to you
<FromGitter>
<watzon> No, I mean I want to return the target platform as a string value rather than just checking if the target platform is a specific value. Something like ⏎ ⏎ ```{% puts flag(:target) %} ⏎ # => linux ⏎ ⏎ {% puts flag(:arch) %} ⏎ # => x86_64``` [https://gitter.im/crystal-lang/crystal?at=5ed3f619549761730b6cf013]
<FromGitter>
<watzon> Does anything like that exist?
<FromGitter>
<j8r> I think you can have the target triple
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
zorp_ has quit [Ping timeout: 256 seconds]
DTZUZU has joined #crystal-lang
Mikaela has quit [Quit: Mikaela]
Mikaela has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<FromGitter>
<emanzx> > *<jhass>* eh, ran into the struct pitfall, fixed: ehttps://play.crystal-lang.org/#/r/96re ⏎ ⏎ wow. thanks so much.. I will look into that. a lot of things are new to me. thanks again
<jhass>
watzon: Well, flags don't really have keys, so how would you reference them? You could parse Crystal::DESCRIPTION I guess...
<jhass>
might be better to shell out to `uname` though
_ht has quit [Quit: _ht]
<FromGitter>
<watzon> I was just thinking Crystal might have some way to expose the target triple seeing as those flags exist. It looks like the LLVM method just returns the default target triple, not the one the program was built with.
<jhass>
yeah, no I don't think that exists in any way
<jhass>
I mean it's just a little macro if else for the platforms you care about though
<oprypin>
so i'm on windows and getting the compiler to crash. all information i get is `Nil assertion failed (NilAssertionError)` because stack traces are not implemented. what are my options to track this down?
<oprypin>
ah damn, the only problem is that those constructs don't work either 😂
<jhass>
I think we even have some issue comment somewhere suggesting that
<jhass>
(including that in the message)
<oprypin>
`BUG: "!#{file}:#{line}!" at c:\code\crystal\src\nil.cr:106:10 should have been expanded (Exception)`
<oprypin>
hmm? im not sure what you're pointing at; if you still think you have a solution
<oprypin>
im stuck still
<jhass>
nah, just talking about your idea. I think somebody somewhere suggested having that generally
<jhass>
I think I had the idea at some point that you could have a kind of macro that you could call on a type instance and it would have access to its receiver AST node
<jhass>
that would be helpful now, could've just redefiend not_nil! as such a macro method then
<jhass>
idk, can you stick it into a debugger and let it print a backtrace for you?
<oprypin>
my idea was just to try to solve the prior issue, but it didn't work
<oprypin>
jhass: debugger, eh. i haven't had the best of time with that on Windows
<oprypin>
maybe it's time for it again
<jhass>
0.35 makes the debug info a lot better fwiw
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<oprypin>
jhass: im running master but don't forget that this is Windows
<oprypin>
the story about debug info there is completely separate
alexherbo2 has quit [Ping timeout: 256 seconds]
<jhass>
mmh
<jhass>
you would expect LLVM to abstract it at least somewhat
<oprypin>
latest fun one: `gawk -i inplace '{ gsub(".not_nil!", ".not_nil!(" NR ")"); print }' src/compiler/**/*.cr`