<FromGitter>
<rishavs> While using crystal-db, can I batch multiple select queries in a single db connection? ⏎ The round trip for each connection is adding up to be an issue
<FromGitter>
<proyb6> Is there an API is capable of resumable file uploads in the case of network interruptions, the files can resume uploading progress from where it stop?
flaviodesousa has joined #crystal-lang
<FromGitter>
<proyb6> Something like it can be cache a temporary/partial files for particular session until the server or application know it’s completed in a specific of period.
<FromGitter>
<fusillicode> i.e. `named_captures["property"]` may be `nil` but I have an explicit check with `next acc unless named_captures && named_captures.has_key?("number") && named_captures.has_key?("property")` about its presence 🤔
<FromGitter>
<fusillicode> Furthermore, even if I had a `String?` for the first element of the tuple inside the reduce accumulator I still get a runtime exception `Unhandled exception: Missing hash key: "5" (KeyError)`
<FromGitter>
<fusillicode> @j8r you're right I apologize to have cluttered the channel with that code, I'll try to move it on https://play.crystal-lang.org? ASAP (btw I may have figured it out the reason of the 2nd problem :) )
<FromGitter>
<j8r> @fusillicode btw you can use `if var = hash["str"]?` syntax to reuse an accessed value
<FromGitter>
<fusillicode> @j8r yes I knew that one but while trying to make the compiler happy I tried many things and one of these things was to switch to `has_key?`
rohitpaulk has joined #crystal-lang
<jokke>
is shovi here?
<jokke>
would be awesome if he/she would make a new release for baked_file_system
francisl has joined #crystal-lang
francisl has quit [Client Quit]
return0e has quit []
<FromGitter>
<yxhuvud> so who is that rufelo that spam the pull requests? Some new manas employee?
<FromGitter>
<j8r> nope
<FromGitter>
<j8r> It creates PRs based on old branches
<FromGitter>
<codenoid> wow
<FromGitter>
<codenoid> mmm
<FromGitter>
<j8r> this also highlights the fact that numerous branches are lying in the repo
<FromGitter>
<j8r> some are dead and has to be cleaned up, others may be useful
<FromGitter>
<j8r> like the Tar implementation one
<FromGitter>
<Sija> @yxhuvud looks like a spammer although I couldn’t tell you the motif
return0e has joined #crystal-lang
wuehlmaus has joined #crystal-lang
<wuehlmaus>
hi, all. Anything new on the "parallel" frontier?
rohitpaulk has quit [Ping timeout: 244 seconds]
<jokke>
hi wuehlmaus o/
<jokke>
not that i'm aware of
<jokke>
what's your usecase?
<FromGitter>
<ohenepee> where is the docs for this `loop` keyword? ⏎ ⏎ It says that its in the standard library in the language reference section of the *While* loop ⏎ *Or use `loop` , found in the standard library* [https://gitter.im/crystal-lang/crystal?at=5bae24b0eba8e60bc65b3e45]
Tortice has joined #crystal-lang
francisl has joined #crystal-lang
<Tortice>
How can I sort in lexicographical order?
<jokke>
Tortice: you mean like "0, 1, 10, 11, ..., 2, 20, 21" etc?
<Tortice>
Yes, with strings
<jokke>
builtin sort should do that
<jokke>
strings.sort
<jokke>
if strings is an array of strings
<jokke>
%w[foo bar baz].sort
<Tortice>
I get ["1", "11", "2"] with crystal eval 'puts ["1", "2", "11"].sort'
<FromGitter>
<yxhuvud> Yes, of course. strings are sorted lexicographically
<FromGitter>
<yxhuvud> if you want numerical sorting, convert them to numbes first
<FromGitter>
<yxhuvud> ie arr.sort_by &:to_i
<FromGitter>
<yxhuvud> &.to_i
<wuehlmaus>
jokke: i don't have one, i just know that many people wait on real parallelism to arrive in Crystal, so i ask evry once in a while.
<jokke>
yeah but they usually don't have an usecase for real parallelism
<jokke>
Tortice: isn't that what you wanted?
<jokke>
Tortice | How can I sort in lexicographical order?
<jokke>
what you want is: sort by the number prefix (numerical sorting) first and only if they match check the suffix. strings without a number prefix will be at the end
<jokke>
correct?
<Tortice>
I think so?
<Tortice>
either way great job and tyvm
<jokke>
no problem
<jokke>
how do you guys solve the problem of starting up crystal services that depend on a db being up in docker-compose? depends_on obviously can't know when a service is completely up so i can't really rely on that. since my service is always started way faster than the db it fails with Unhandled exception: (DB::ConnectionRefused)
<FromGitter>
<yxhuvud> another way could be to make sure the strings are equally long (and pad in FRONT) before sorting
<FromGitter>
<fridgerator> jokke I install `netcat` in my container, and use it in the start command: `command: bash -c 'while ! nc -q 1 postgres 5432 </dev/null; do sleep 1; done && ./bin/micrate up'`
francisl has quit [Quit: francisl]
francisl has joined #crystal-lang
<robacarp>
if you haven't tried it, socat is a great upgrade to almost everything I used to use nc for
<Tortice>
can I exclude "." and ".." from Dir.entries?
<FromGitter>
<j8r> @ezrast got it, I check if the file size is != 0
<FromGitter>
<dscottboggs_gitlab> @fridgerator why can't you just `rescue` the `DB::ConnectionRefused`, try again after a timeout a predetermined number of times. ⏎ ⏎ or you could set `restart: on-failure` ⏎ ⏎ or you could do the first thing, but instead of rescuing the exception, try to open a socket connection with the host/port a predetermined number of times. either way. [https://g
<FromGitter>
<KevinSjoberg> Or is forking it the way to go at the moment?
<FromGitter>
<vladfaust> I honestly don't know
<FromGitter>
<vladfaust> Do you actuallt have experience in maintaining/creating Sublime Packages?
<FromGitter>
<vladfaust> Are you able to continiusly develop it? Check out exisitng issues
<FromGitter>
<vladfaust> If you're able to fix most of them, then fork and update the package and propose it to the list telling how many issues you've fixed
<FromGitter>
<KevinSjoberg> @vladfaust I have some Sublime package experience, but I'm not a wizard. What I do have, is the willingness and time to maintain it. :slight_smile:
<FromGitter>
<KevinSjoberg> I think I'll reach out to @faustinoaq to see what he thinks.
<FromGitter>
<vladfaust> Then just use the forked version for yourself right now and propose PRs
<FromGitter>
<SeedyROM> Has anybody in here used `Readline.bind_key` to capture ansi escape sequences?
<FromGitter>
<SeedyROM> Specifically arrow keys.
<FromGitter>
<SeedyROM> Is it even possible?
<Tortice>
I'm trying to build a GUI with https://github.com/hedron-crystal/hedron - small question: How can I sleep without blocking the main thread/gui update loop?
<Tortice>
I tried to sleep in a channel but it executed instantaneously
<Tortice>
so I must be doing something wrong
Heaven31415 has joined #crystal-lang
<Heaven31415>
hi
<FromGitter>
<Blacksmoke16> o/
<FromGitter>
<codenoid> morning
francisl has quit [Quit: francisl]
Tortice has quit [Remote host closed the connection]
<FromGitter>
<asterite> Tortice: you probably can't, there aren't threads in Crystal
<FromGitter>
<vusaalab> Hi guys why this error happened undefined method 'status_code' for Nil (compile-time type is (HTTP::Client::Response | Nil)) ⏎ ⏎ ``` if @response.status_code == 404 ⏎ ^~~~~~~~~~~``` [https://gitter.im/crystal-lang/crystal?at=5bae8fe0c08b8b3067a3a3e1]
<FromGitter>
<Sija> haha, maybe your programmer friends are more chilled than mine, since it rly varies (but I don’t have much of programmer friends because usually they r damn boring ppl :P)
<FromGitter>
<Sija> one dude I met had ADHD, was doin’ some kind of synthetic, military-grade amphetamine prescribed by his doctor (sic!) and was listening to (what a surprise) lots of rock and metal
<FromGitter>
<bajro17> hahahha
<FromGitter>
<Sija> he was bit childish too, that IMHO gets along with rock and metal pretty well ;)
<FromGitter>
<bajro17> In my country most popular is turbo folk
<FromGitter>
<bajro17> some weird music with no sense
<FromGitter>
<fridgerator> I really dont undestand wtf you're talking about
<FromGitter>
<Sija> @fridgerator sorry if you felt offended (looking at your tshirt I reckon you might be a rock listener ;)), no harm intended :)
<FromGitter>
<fridgerator> I listen to all types of music
<FromGitter>
<Sija> I meant ppl who r suspended in one particular genre
<FromGitter>
<Sija> kind of you know, “rock fans”, not anyone who happens to listen to some rock bands
ua has quit [Ping timeout: 252 seconds]
<FromGitter>
<Sija> in my country we have for instance groups which universally listen to one genre of music, lets say punk - like anarchists, who think they do such a gr8 job fighting with the system, in the same time being part of it (beneficiares too, since in the end they live out of state supplies - food, shelter, energy - aside of some things they manage to generate by themselves…)
<FromGitter>
<Sija> “fly away my space rocket, you no need put money in my pocket, the door is closed, I just locked it, I put my … plug in your socket” :D
<FromGitter>
<Sija> proper bs
<FromGitter>
<Sija> haha, oh yeah, that’s one party piece
<FromGitter>
<bajro17> I plan to make shirt with this man picture and write touch my ta-lala for ladies hahahah