<FromGitter>
<Blacksmoke16> seems i have to include the var in the macro, else it doesnt get applied
<FromGitter>
<snadon> I need a cron job that fetches files everyday. Is it possible to do it with Crystal? If so, where should I look first? Thank you, developing with Crystal has been amazing so far!
<FromGitter>
<Blacksmoke16> at a specific time?
<FromGitter>
<bew> @snadon why not simply use `cron` for that?
<FromGitter>
<snadon> @bew I have a project written with Lucky, and I was planning to create a Task so I can trigger the download whenever I need it if something goes wrong. But you are right, I guess I should just use cron with the ftp command.
<FromGitter>
<Blacksmoke16> https://github.com/robacarp/mosquito could be nice if you dont care about running the task at a specific time vs once every x time
chkilroy has joined #crystal-lang
duane has joined #crystal-lang
akaiiro has quit [Ping timeout: 244 seconds]
akaiiro has joined #crystal-lang
<FromGitter>
<fridgerator> @Blacksmoke16 have you used mosquito vs sidekiq.cr ?
<FromGitter>
<Blacksmoke16> i used ruby sideqkiq
<FromGitter>
<Blacksmoke16> i like mosquito because it has scheduled jobs, like cronesque run this task every x minutes or what have you
<FromGitter>
<Blacksmoke16> havent gotten *super* deep into it yet but so far i like
<FromGitter>
<fridgerator> eek "There is the potential for multiple instances or fibers running background jobs to interfere with each other, resulting in duplicate task executions"
<FromGitter>
<fridgerator> I just started implementing sidekiq.cr today, i'll stick with it for now
<FromGitter>
<Blacksmoke16> π
duane has quit [Ping timeout: 240 seconds]
duane has joined #crystal-lang
rohitpaulk has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
<FromGitter>
<HCLarsen> Hey guys. What's the deal with the Hash.new that takes a block? What's the block do?
<FromGitter>
<Timbus> Uh, looking at the source code, it appears to run the block when a key isn't found
<FromGitter>
<Timbus> and returns whatever the block outputs
<FromGitter>
<aisrael> Itβs a way for you to provide a dynamic βdefaultβ value for when the key is not found.
pbodev1 has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter>
<bararchy> RX14 great news regarding the windows port and rainforestQA sponsorship! Congratz
<FromGitter>
<codenoid> why crystal doesn't have string encrypt-decrypt library
<FromGitter>
<Timbus> There's a half-written libsodium wrapper that does pubkey encryption: https://github.com/andrewhamon/cox but you might need the symmetric-key bindings.
<RX14>
regarding windows exceptions i've rewritten most of the windows exceptions stuff and it's very nearly compiling
<RX14>
all the hard codegen errors seem to be gone (cross fingers), just some naming issues left
<RX14>
and who knows if it'll actually fix the segfaults
<FromGitter>
<straight-shoota> β€οΈ
<FromGitter>
<Grabli66> RX14, you are great. :)
vegai has joined #crystal-lang
<FromGitter>
<bew> @RX14 awesome work!! PR is coming soon? I'd like to see how Windows handles exceptions and how you implemented that :)
<RX14>
no timeframe on a PR because i've not got it to compile yet let alone not segfault at funtime
<RX14>
lol nice typo
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter>
<bararchy> `funtime errors` the only errors which are `fun`
rohitpaulk has joined #crystal-lang
gewo has quit [Quit: WeeChat 1.6]
hightower3 has joined #crystal-lang
<hightower3>
Is there a type of quote inside which "\" is literal?
<FromGitter>
<Timbus> %q() , I think?
<hightower3>
Indeed, thanks!
alex`` has quit [Ping timeout: 268 seconds]
alex`` has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
jokke1 has quit [Ping timeout: 245 seconds]
duane has joined #crystal-lang
duane has quit [Ping timeout: 264 seconds]
<jokke>
i need to pass the pointer to a struct to a c function, how can i do this in crystal. i instanciate the struct on the stack but how do i do the equivalent of &struct?
<jokke>
s/\./?/
<jokke>
ah
<jokke>
pointerof
jokke1 has joined #crystal-lang
<FromGitter>
<straight-shoota> exactly
<FromGitter>
<robacarp> @fridgerator re mosquito, it's designed to be essentially a sidekiq.cr. The only thing preventing it from isolating and preventing duplicate runs of the same job is using a redis transaction to pop/push the job.
<hightower3>
Is there a way to define a value for a constant unless already defined?
<hightower3>
How can I declare a variable that will hold a class? If I do @@var : Xyz, it expects an instance of Xyz, and if I do @@var : Class, it says "can't use Object as the type of a class variable yet, use a more specific type"
<FromGitter>
<Blacksmoke16> prob be much easier to use an orm but yea...
alex`` has quit [Quit: WeeChat 2.1]
<FromGitter>
<rishavs> having tried my hand at running bare db queries, i can't agree more. :p β But my current project is mainly for learning so I think it will be a good experience to stay away from ORMs
<FromGitter>
<Blacksmoke16> i mean if you want to learn the internals of how the DB works i guess :p
<FromGitter>
<rishavs> Just to add, my db column for children_ids has postgres array of type ` children_ids TEXT [],` and has data like `'{"cid110", "cid120" }'`
<FromGitter>
<rishavs> > i mean if you want to learn the internals of how the DB works i guess :p β Well I have moved from learning to masochism in the last few days but I am still a bit stubborn. :D
<FromGitter>
<Blacksmoke16> @drum445 im not sure what you are trying to do?
<FromGitter>
<drum445> @Blacksmoke16 Turn a sql result set into an object or array of object (predefined classes)
<FromGitter>
<drum445> I used JSON::Serializable so the dev doesn't need to make any changes to their class apart from include it
<FromGitter>
<Blacksmoke16> oh, i didnt notice that was your repo
<FromGitter>
<drum445> ah apologies
<FromGitter>
<Blacksmoke16> that'd prob work yea
<FromGitter>
<Blacksmoke16> Granite just has some syntax to make it prettier i.e.
<FromGitter>
<drum445> sweet, yeah seems to do the trick nicely but was a tad worried that JSON::Serializable could push breaking changes
<FromGitter>
<Blacksmoke16> `field name : String, json_options: {key: "foo"}`
<FromGitter>
<drum445> But it's stdlib so I doubt it will change much
<jokke>
sometimes they might have the same mapping
wontruefree has joined #crystal-lang
wontruefree has quit [Client Quit]
<FromGitter>
<rogics> Hi everybody! I am new to Crystal prog lang and I have a problem with exception handling inside EACH block, for example : SOCKETS.each { |socket| socket.send "Hi" } . How can I write code inside EACH block so I can catch errors on socket.send call. ?
<oprypin>
fiber switches are not possible in between those, not now, not in the future
<FromGitter>
<bew> @jspillers consider this https://play.crystal-lang.org/#/r/4jn8 the value of `@test` could change, and thus the type after the check would still be `String?`
<oprypin>
but threads tho
<FromGitter>
<straight-shoota> see my example
<oprypin>
oh. it's the most insidious example
<oprypin>
good stuff
<FromGitter>
<jspillers> @bew that makes sense - thank you
<FromGitter>
<bew> you're welcome ;)
<FromGitter>
<bew> @straight-shoota your example is good, fiber switch can be a big problem here too
<hightower3>
Is there a way to use YAML.mapping() or similar to set class variables, rather than to create instances with instance variables?
akaiiro has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<FromGitter>
<straight-shoota> hightower3, no. You need a manual parser for this.
FromGitter has quit [Read error: Connection reset by peer]
FromGitter has joined #crystal-lang
<oz>
Hugh... I hope the next crystal release does not break the JSON API. π
<FromGitter>
<bew> @oz what if it's better? ^^
<oz>
Better is nice, but if I don't enjoy chasing JSON::Type, and type casts. ;)
<hightower3>
straight-shoota: I looked at yaml/mapping.cr in the source and it looks like it would be trivial to copy & change it to work with class vars
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<FromGitter>
<straight-shoota> yeah, but why?
t-richards has quit [Quit: Leaving]
DTZUZO has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
FromGitter has quit [Read error: Connection reset by peer]
FromGitter has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
wontruefree has quit [Ping timeout: 264 seconds]
DTZUZO has quit [Read error: Connection reset by peer]
alex`` has quit [Ping timeout: 240 seconds]
FromGitter has quit [Read error: Connection reset by peer]