<jhass>
okay apparently I didn't pick a wide enough range, that was a "no idea, that depends on so many factors man"
<jhass>
:P
<jokke>
jhass: i'm not sure how to handle all the messages asynchronously
<jhass>
spawn a fiber for each?
<jokke>
hm yeah. have no experience in concurrency with crystal
<jokke>
*with
<jokke>
i'm writing my thesis and part of it is going to be an api which caches data from a meteor project and provides json representation of that data
<jokke>
and i want it to be performant
<jhass>
just wrap anything that blocks or waits into a fiber
<jhass>
then while the fiber is blocked crystal will run another one that is no longer blocked for you
Ven has joined #crystal-lang
<jokke>
yeah
<jokke>
and last but not least, how stable would you think it would be (assuming i write perfect code)
<jokke>
i know, stupid questions but you've got alot of experience with crystal so you can make educated guesses
<jhass>
carc.in chokes on non-UTF-8 or otherwise weird input sometimes, but if you keep an open begin/rescue around the main handler and don't pass user data through unsafe features without being careful it should be fairly solid
<jhass>
I wouldn't depend a business on it yet, but yeah
<jokke>
thanks, that's the kind of answer i was looking for
BlaXpirit has joined #crystal-lang
<jokke>
i think the more people code in crystal, the better for crystal
<jhass>
and running it under a supervisor that always restarts on crashes should give you some extra margin
<jhass>
sure
<jokke>
yeah
<jokke>
jhass: how about debugging btw. i've found it very difficult
<jhass>
(I do that for carc.in so I have actually no idea if it crashes frequently :P)
<jokke>
:D
<jokke>
like: what do i do if i get a segfault, how do i debug it
<jhass>
waj pushed some stuff that should at least give you proper line numbers for the current stack and allow some stepping through, though no value access yet as far as I can tell
<jhass>
so you do build -d and run it through valgrind and/or gdb
<jokke>
oh ok! that's better than what i knew
BlaXpirit has quit [Client Quit]
<jokke>
i wonder what the code looks like in gdb...
BlaXpirit has joined #crystal-lang
<jhass>
mmh? it attaches the source, so unless you hit a bug where line numbers are off, you get just your regular source
<jokke>
ah ok wow
BlaXpirit has quit [Client Quit]
<jokke>
makes sense i guess
BlaXpirit has joined #crystal-lang
<chdorner>
by the way, is there a list of missing things that crystal should support? or just when somebody reports something?
<DeBot>
jhass: Program received and didn't handle signal TRAP (5) - http://carc.in/#/r/gsi
<jokke>
oooh
<jokke>
that's cool!
<jokke>
like binding.pry :)
<jokke>
kinda
<jhass>
well... "kinda" :D
<jokke>
:D
<jokke>
that's really very very helpful
<jhass>
vjdhama: I'd link the first File::Stat too and maybe even omit the "See" then. Are you sure ENOENT is the only Errno it can raise? I'd expect at least EPERM too and what not
<jokke>
wooah that's so cool!
leafybas_ has quit [Read error: Connection reset by peer]
leafybasil has joined #crystal-lang
<jokke>
if one could see local vars then it'd be a bliss
<vjdhama>
jhass: couldn't generate any other.
<vjdhama>
jhass: should i just mention that it might raise a error from from error mentioned in Errno.
<vjdhama>
*errors
<jhass>
man 2 stat lists a whole bunch of possible errors
<jhass>
so yeah just say something like "Raises Errno in case of an error"
<vjdhama>
ok thanks
<vjdhama>
jhass: Is it ok to have multiple commits in a single PR.
<vjdhama>
jhass: I made few mistakes. Didn't review the commit before pushing. That's why PR has multiple commits.
<vjdhama>
won't happen agian
<vjdhama>
*again
vjdhama has quit [Read error: Connection reset by peer]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vjdhama has joined #crystal-lang
Philpax has joined #crystal-lang
n0xff has quit [Ping timeout: 268 seconds]
<jhass>
vjdhama: sorry, afk
<jhass>
vjdhama: ideally I'd like one commit per logical change, so for this one would be better
<jhass>
I'll post you squash instructions
<vjdhama>
jhass: thanks
<jhass>
vjdhama: though with dropping the "see" I meant the entire paren, since it feels redundant to linking it in the former sentence now to me
<vjdhama>
jhass: Aha
<vjdhama>
my mistake
<trapped>
hmmm "expected 'api_key' to return String?, not Nil"
<vjdhama>
jhass: should i update it?
<jhass>
vjdhama: yes, please :)
apt-get has joined #crystal-lang
<jhass>
trapped: is there a question? ;)
<trapped>
isn't String? shorthand for String|Nil
<crystal-gh>
[crystal] jhass pushed 5 new commits to master: http://git.io/vnorc
<crystal-gh>
crystal/master 528c935 Oleksii Fedorov: [http/request] Make @uri memoized
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Philpax has quit [Read error: Connection reset by peer]
Philpax has joined #crystal-lang
apt-get has quit [Read error: No route to host]
<dyulax>
I never used multithreading, and I am confused about all this terminology: processes, threads, fibers, locks, etc. Also, it seems OS behave differently regarding this. Does anybody know any good introductory text about multithreading? (I tried Google, still confused)
<jhass>
dyulax: I don't know any good tutorial, got most of it from my university courses. But you can ask questions if you want ;)
<jokke>
dyulax: same here
<jokke>
jhass: dining philosophers? :)
<jhass>
hah, well that's just a tiny thing
<jokke>
the philosophers? sure :)
<jhass>
also had a nice course on concurrency stuff in general (Java though)
<jhass>
your issue seems unfamiliar btw
<jokke>
it always annoyed me that they've translated it incorrectly. It makes much more sense when there are chopsticks between them instead of forks
<jhass>
hehe
<jokke>
:)
<jhass>
yeah I always eat with a single fork too
<jokke>
most people do, go figure.
<crystal-gh>
[crystal] waterlink opened pull request #1569: Add HTTP::Params class - convenient wrapper over raw http params (master...http/params/make-it-a-convenient-hash-wrapper) http://git.io/vnKZY
<jokke>
even most philosophers
<jhass>
idk here it's pretty common to use a spoon to "aid" for noodle stuff
<jokke>
yeah
<jokke>
true
<jokke>
you're from germany, right?
<jhass>
yup
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sfcgeorg_ has joined #crystal-lang
<dyulax>
I am so lost I don't know exactly what to ask. I wish there was any Coursera class on this.
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: http://git.io/vnKCS
<dyulax>
I will keep reading and then I ask :-) thanks
<jhass>
dyulax: if you have a specific problem we can also probably suggest a general approach to look into, then by just researching how to implement it you should be able to get fairly far and learn some stuff drive by
sfcgeorge has quit [Ping timeout: 240 seconds]
<dyulax>
What I am trying to do: I have a CPU with 8 cores. Let's say I have a huge CSV file I want to process. If I do that normally, my application will only use 1 core, but it could use 8. How could I use all of those 8 cores? Can I, Crystal, detect how many cores my CPU has and then create N new processes?
<dyulax>
Alas, all these processes will be distributed among the cores or the OS will handle it?
<jhass>
a Channel is more like a classic queue, except for coroutines instead of threads
<jhass>
but you don't even need to know that much about it, for now "what you put into .send will come out of .receive" should be enough
<jhass>
we'll deal with terminating the pipeline (it's essentially a small pipeline or producer consumer pattern we're doing here) once that part works, eg. when you have a program that fails to quit when its done ;)
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
Ven has quit [Client Quit]
leafybasil has quit [Ping timeout: 252 seconds]
<sfcgeorg_>
Do Crystal C bindings work with C++ libs too or just pure C?
<jhass>
in theory they would work with C++ libs if you manually translated the mangling at hand on your system. So in practice no, best find or write a C wrapper
nopc0de is now known as j2k
<sfcgeorg_>
Okay :) I'm wondering how hard it would be to write a Crytal wrapper for a native widget toolkit. Wx looks nice but is C++. Tk has a C lib I think but the docs are horrible.
leafybasil has joined #crystal-lang
j2k is now known as j2k_
<jhass>
you've seen jhass/crystal-gobject ? :P
NeverDie has joined #crystal-lang
<jhass>
now with improved signal handling! estimation: only 90% broken!
<jokke>
:)
<jokke>
jhass: have you actually managed to spawn some simple gui with it?
<jhass>
sure, look at the samples
<jokke>
oh!
<jhass>
github_desktop_notifications uses it too
leafybas_ has joined #crystal-lang
leafybasil has quit [Read error: Connection reset by peer]
<jokke>
why do you call it crystal-gobject?
<sfcgeorg_>
Hmm interesting
<jhass>
because it's a generator using gobject-introspection
<jhass>
so _in theory_ it can handle all gobject based libs
<sfcgeorge>
I guess I have to learn what gobject is.
greengriminal has quit [Quit: Leaving]
greengriminal has joined #crystal-lang
<sfcgeorge>
I was hoping to produce a simple GUI toolkit like Shoes in Ruby. Most GUI code seem horrible. I don't know how terse a wrapper could be in Crystal.
<jokke>
gui code is always horrible
<andrew-l>
yeah, just look at CSS... :-)
<jhass>
I think the glade example (greeter.cr) is surprisingly terse already, for Gtk :P
<jhass>
but yeah, even if the generator gets perfect, it'll need some manual glue code still and then one could think of building nice abstractions upon it
<sfcgeorge>
I also found https://github.com/amerobin/sapphire which is a Crystal binding for Cocoa on OS X, but again the implementation is rather complex.
<sfcgeorge>
Hmm I suppose I'm just used to HTML + CSS. JS makes a mess of it all though.
<jhass>
well, let me rephrase, complex or guly
<jhass>
*ugly
<jhass>
:P
<jhass>
and the JS part is what you write in code these days, both Qt and Gtk favor markup languages too for the most part these days (QML and Glade respectively)
<asterite>
jokke: we were planning on removing curses from the standard library. You could do an ncurses binding and then do rofi-curses on top of that, using shards to connect them
<asterite>
If you agree, I'll remove curses from the standard library
<sfcgeorge>
All the ones I've seen certainly are complex and/or ugly, which is why I'd like to make a crystal_tk_shoes or something. But then I still have to write the nasty interface code.
<jokke>
jhass: i just pushed my curses project to github (first travis project for me!). https://github.com/jreinert/rofi-curses It has a very weird bug: if it's being passed a _lot_ of lines either via stdin or file it segfaults exactly after three chars are entered.
<asterite>
There's obviously no pressure, but if somebody asks what happened to the (very poor and incomplete) bindings, we can point them to your repo (again, this is very unlikely to happen)
<jokke>
asterite: i do agree. the stdlib bindings are very limited
<jokke>
i'll split them up when i get the chance
<sfcgeorge>
Hmm while a dynamic language is nice for GUI dev it seems like another layer of complexity on top of GTK. And why JS not Python or Ruby :-/
<asterite>
I'll remove them then. In any case none of us want to maintain that and it can perfectly be a 3rd party library
<jokke>
anyway removing it from stdlib won't break my code since i use my own bindings
<jhass>
sfcgeorge: ruby-gir and python-gobject ? ;)
<jhass>
wait, python-gobject-introspection, they like the long names :P
<jokke>
python m(
greengriminal has quit [Quit: Leaving]
<sfcgeorge>
Right. There's just a lot to get your head around before doing anything.
<jokke>
sfcgeorge: that's why i never write guis :D
<jokke>
i did back when i coded java
<jokke>
but personally i almost always prefer console programs over gui
<jokke>
the only gui program i use is firefox and robomongo
<jokke>
*s
<jokke>
or rather "frequently use"
<sfcgeorge>
I have done Java Swing and that's alright, though I did write a wrapper to make creating buttons not take 7 LOC ;) But Swing isn't native so it feels off.
<jokke>
yeah
<jokke>
and
<jokke>
java
<sfcgeorge>
Hehe. Well Java 8 got lambdas (kinda) that shorten a lot of code, so that's kinda nice.
wonderbread_ has joined #crystal-lang
<jhass>
asterite: saw my earlier suggestion regarding buffered channels?
wonderbreadz has quit [Ping timeout: 244 seconds]
wonderbread_ is now known as wonderbreadz
<asterite>
I guess waj should answer that, don't know if he's reading this (he got a bouncer :-P). If you close a channel, remaining items must be seen in the receive side, as far as I know
<jhass>
if I read the implementation right (granted, I didn't actually try), close will kill all current receivers
<jhass>
regardless if the channel is drained or not
<jhass>
waj: you need to configure auto away if you disconnect from the bouncer ;P
dyulax has quit [Read error: Connection reset by peer]
dyulax has joined #crystal-lang
Ven has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: http://git.io/vn6za
<crystal-gh>
crystal/master 9c164d8 Ary Borenszweig: Fixed a small typo
<sfcgeorge>
That appears to be written in Ruby. But it should be possible to write a Crystal REPL in Crystal as the Crystal compiler can be used from within Crystal :)
<buggs>
why aren't you using onigoruma instead of pcre?
<slash_nick>
onigoruma? demon wheel?
<bjmllr>
you mean onigmo? ruby switched to that around 2.0 iirc. i think some people would have preferred it, pcre was just easier to set up, as i understand it.
<bjmllr>
pcre docs are much more complete imo
ljfa has joined #crystal-lang
ljfa has quit [Client Quit]
<jhass>
buggs: what bjmllr said, it's not out of question yet, pcre was just way easier to integrate for now
<RX14>
jhass, got any idea on that compiler error?
<jhass>
RX14: make clean and make sure you got crystal 0.8.0 installed
<RX14>
oh...
<jhass>
alternatively git checkout 0.8.0; make; git checkout -; make
<RX14>
why isn't community updated to 0.8.0 yet?
<jhass>
anatolik is on vacation or something
<jhass>
said he'll do it by the end of the month
<asterite>
Yes, pcre was our first option. What is the benefit of onigmo?
<RX14>
can nobody else accept patches?
<jhass>
I updated my OBS repo thus
<RX14>
i suppose the is responsible for his package