<postmodern>
is Process.run() with a block equivalent to ruby's IO.popen?
_ht has joined #crystal-lang
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 252 seconds]
<FromGitter>
<erdnaxeli:cervoi.se> it seems to be similar, but the argument to the block is not the same in crystal
<FromGitter>
<erdnaxeli:cervoi.se> in ruby it's an IO object, while in ruby it's the Process object
hendursaga has quit [Ping timeout: 240 seconds]
hendursaga has joined #crystal-lang
vasanth has joined #crystal-lang
mipmip has quit [Quit: WeeChat 3.1]
vasanth has quit [Ping timeout: 268 seconds]
alexherbo2 has joined #crystal-lang
vasanth has joined #crystal-lang
postmodern has quit [Quit: Leaving]
Xeago has quit [Quit: Xeago]
Xeago has joined #crystal-lang
vasanth has quit [Ping timeout: 246 seconds]
<raz>
why does everyone have to screw with capitalization. Golang, typescript, etc. i don't get it. is it something with the food, too much teflon, or just the busted education system
<raz>
a Class is uppercase, a method is lowercase ffs. jesus wrote that on the stone tablets for a reason.
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 265 seconds]
<frojnd>
Hi there. I have this project with 3,3M of json files around 800 json files... I was thinking to put them into sqlite3 DB which I use with this project but looking at docs: https://github.com/crystal-lang/crystal-sqlite3 I can't find any example on how to insert json file into db.
<FromGitter>
<confact> @frojnd I think it doesn't exist exactly an import json to sqlite, you have to open all those files, parse and insert them to the database. You can probably do that in less than 40 lines of code.
<frojnd>
@confact parse them to strings?
<frojnd>
@confact and then insert them as text?
<FromGitter>
<Daniel-Worrall> frojnd, create structs with JSON serialization, then a method to insert them into the db
<FromGitter>
<Daniel-Worrall> If you don't know what the JSON objects will be, then you may have to go with `JSON.parse` https://crystal-lang.org/api/1.0.0/JSON.html#parse(input:String%7CIO):Any-class-method and deal with `JSON::Any`
<frojnd>
@Daniel-Worrall I Know what it will be I have them on a hard drive
<FromGitter>
<confact> Then serialization is better, like @Daniel-Worrall mentioned.
vasanth has joined #crystal-lang
<FromGitter>
<Daniel-Worrall> Yeah, ^, and you can define objects with the record macro like so https://carc.in/#/r/b2an
<FromGitter>
<Daniel-Worrall> Also, https://app.quicktype.io/ will take a JSON object and give you a language binding that will work for that JSON. Supports Crystal and speeds up writing bindings
vasanth has quit [Ping timeout: 252 seconds]
<FromGitter>
<riffraff169> maybe i read the question wrong, but he may just want to insert the raw json into the db...in which case just read the file and write to a varchar ?
<FromGitter>
<Daniel-Worrall> Then that's just text, and nothing to do with JSON
<FromGitter>
<riffraff169> right
<FromGitter>
<Daniel-Worrall> though you could remove the whitespace
<frojnd>
@riffraff169 yeah I think in my case that would be best for now to juts insert the raw json into the db
<FromGitter>
<riffraff169> i mean, if you are doing no interpretation, just later serving the json raw to somewhere else, then there is no need to parse and then recreate later
<frojnd>
I will just later serve the json raw to somewhere else. I will not manipulate (for now) json code within crystal lang project
<frojnd>
Just make an api and serve jsons
<FromGitter>
<Blacksmoke16> if you just want to serve a json file, prob could use nginx or something like that to do it
<FromGitter>
<riffraff169> and i wouldnt use a db....when you boil it down, a db is just a specialized filesystem...or an fs is a specialized db....it is already useful for what you need...just serve directly
<frojnd>
Yeah, depeding on some conditions,.. user will send get request (date or smth else) and api will serve that json
<frojnd>
I have an interesting issue: Running this inside icr just fine: `shopt -s nocasematch; for file in ../parser/SI/*; do if [[ ${file//[: ,.-]/} = *#{verse}* ]]; then echo "$file"; fi; done` but when running running inside crystal project I get --: -c: line 1: syntax error in conditional expression
<frojnd>
Can I not have conditional expressions inside `` ?
<FromGitter>
<Blacksmoke16> classic case of `icr` not actually running the code you think it is prob
<FromGitter>
<Blacksmoke16> wait, did you paste the correct line? thats not crystal
<frojnd>
Running that command inside bash also echos stuff
<frojnd>
It's cmd?
<FromGitter>
<Blacksmoke16> oh, icr is also a bash shell?
<frojnd>
Not sure what icr uses
<FromGitter>
<Blacksmoke16> i always just assumed it was crystal code only, but makes sense it can do more i guess
<FromGitter>
<Daniel-Worrall> It might be to do with working directory
<frojnd>
Ok let me pwd to see where I am
<frojnd>
Hm it's not that
<frojnd>
Let me read my code :)
<frojnd>
Passing of arguments is important!
sorcus has quit [Quit: WeeChat 3.1]
vasanth has joined #crystal-lang
sorcus has joined #crystal-lang
vasanth has quit [Ping timeout: 252 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 246 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 246 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 265 seconds]
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 268 seconds]
<FromGitter>
<HertzDevil> i mean you should be able to just enclose everything in backticks even if icr isn't a bash shell
r0bby has quit [Ping timeout: 245 seconds]
r0bby has joined #crystal-lang
thelounge1842 has joined #crystal-lang
<thelounge1842>
Hello. When and will the new Markdown parser be introduced to the standard library?
<thelounge1842>
Yes, I'm aware. Wansn't also CommonMark compliant iirc?
<thelounge1842>
Wasn't*
<FromGitter>
<Blacksmoke16> i doubt it, literally is only used to generate docs. Best off just using markd
<thelounge1842>
I see, thanks.
<straight-shoota>
markd might be incorporated into stdlib, but don't count on it
<FromGitter>
<Blacksmoke16> there was a PR to use markd for generating docs, but it was closed and i wouldnt bank on any progress being made anytime soon
<straight-shoota>
just use the shard
<FromGitter>
<Blacksmoke16> ^
<thelounge1842>
Understood, probably what I'm gonna end up doing. Thanks for informing me
<straight-shoota>
It really shouldn't make much of a difference whether it's in stdlib or a shard. Just need `shards install`