<FromGitter>
<sdogruyol> Great to see your company on the list @bararchy 👏
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
<Papierkorb_>
Why is MySQL so popular over postgres with Crystal?
<Papierkorb_>
is the postgres driver just bad?
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Tuxified has joined #crystal-lang
<FromGitter>
<crisward> Not sure, for me it's because I came from a Lamp background, so mysql is more familiar.
<FromGitter>
<crisward> In terms of github stars, the postgres driver seems miles ahead
<Papierkorb_>
Postgres is simply miles ahead
<Papierkorb_>
Also, no Oracle, so that's a plus by itself
<FromGitter>
<crisward> I've been tripped up by postgres a few times. Also used to be slower in php, probably a driver issue. With databases its often easier to stick with what you know. I actually use Mariadb, which as you may know is a fork of mysql.
<FromGitter>
<bew> @bararchy
<FromGitter>
<bew> The link in the wiki is 404
<FromGitter>
<bararchy> @bew Are you sure, it seems to work for me
<FromGitter>
<bararchy> Thanks for confiramtion Papierkorb_ :) ⏎ @bew maybe local issue ?
<FromGitter>
<bew> it was on my phone, I'm re-checking
<livcd>
oh just saw that the rubymotion guy retweeted sdogruyol for crystal survey :-)
<FromGitter>
<sdogruyol> yeah 👍
<livcd>
too bad microsoft took him :-)
<FromGitter>
<bew> @bararchy it works on the computer, but on the phone it redirects to a random page everytime (neuralegion.com/VOpWZ or neuralegion/RinpZ ...), during 4-5 loads I got the page (without 404) only once..
<FromGitter>
<bararchy> Woot
<FromGitter>
<bararchy> wierd
<FromGitter>
<bararchy> let me check
<FromGitter>
<bew> weird again, it seems to be working now, I didn't change anything
<FromGitter>
<bararchy> Seems to work for me on both FireFox for android and the regular android browser
<FromGitter>
<bararchy> thanks for checking though :)
<FromGitter>
<bew> I'm using chrome on android
<FromGitter>
<bew> btw, great job ;)
<FromGitter>
<bew> ( @bararchy: and the button "view on github" is broken for me too ^^ (blank page) =
<Papierkorb_>
bararchy, what are some algorithms or "technology" your tool, or similar tools, commonly use?
A124 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter>
<bararchy> Similar tools are using static mutations usually, we use genetic algorithms and Neural networks :)
<FromGitter>
<bararchy> Thanks @bew
<Papierkorb_>
Well I guess exploiting could be considered an optimization problem lol
<FromGitter>
<bararchy> Yeha the "view on github" shouldn't even be there, I can't find a way to remove it from the jekyll theme
<FromGitter>
<bararchy> haha
<FromGitter>
<bararchy> Papierkorb_, well , it all depends on the goal, if the thing you want to achive is crashing the application, then it is hahah
snsei has joined #crystal-lang
<Papierkorb_>
bararchy, I never looked much into stuff like that. Sounds interesting though. Maybe if I have time besides revamping bindgen :3
<crystal-gh>
[crystal] akzhan closed pull request #4931: [WIP] try to reproduce bug in 32bit (master...example-of-bad-code-for-x86-bigint) https://git.io/v5afi
<Papierkorb_>
bararchy, though thanks for the pointers. Interesting that AI (now?) finally reached offensive security
<FromGitter>
<bararchy> Papierkorb_ I'm thinking about using bindgen in our product, I want to generate bindings to TensorFlow so we can use there Neural Network + cuda tech, or maybe Torch, both in C++
snsei has quit [Ping timeout: 246 seconds]
<FromGitter>
<marin117> Does anybody know how to bind C define in Crystal
<Papierkorb_>
marin117, write a real C function which simply invokes that macro, then bind that C function
<Papierkorb_>
Macros don't really "exist" to the C compiler, they don't have any output by themselves. They don't even have to expand to a valid expression by itself, making matters worse and automatically binding macros a nightmare
<FromGitter>
<marin117> I have to bind "official" library so I can't write my own functions
claudiuinberlin has joined #crystal-lang
<Papierkorb_>
Sure you can, just write a single .c file doing those wrappers
<Papierkorb_>
It's not possible otherwise
<Papierkorb_>
Well, or you reimplement the C macro in Crystal
alex-edf has joined #crystal-lang
<FromGitter>
<marin117> Thank you :) I guess I'll figure out something
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
bmcginty has quit [Ping timeout: 240 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmcginty has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
claudiuinberlin has joined #crystal-lang
ShalokShalom_ has joined #crystal-lang
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ShalokShalom has quit [Ping timeout: 240 seconds]
<alex-edf>
Hi guys, what is the Crystal equivalent to do this?
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb_>
Well, what did you not understand of the docs?
<alex-edf>
The byte thing
<Papierkorb_>
the what thing?
<alex-edf>
I'm not familiar with byte manipulation, so I don't understand the data I get
<alex-edf>
which type it's
<alex-edf>
what it looks like
<Papierkorb_>
You can't implement a protocol you don't understand
<Papierkorb_>
Look at #read_bytes again. it even has an example.
<FromGitter>
<ziprandom> morning to all
<Papierkorb_>
And then ask specific questions on that please
claudiuinberlin has joined #crystal-lang
<FromGitter>
<ziprandom> what is the current state of cross compiling and static binaries (+musl). Is there already a stable way to create fully contained binaries to run as a rkt container (possibly on raspberry py)?
<Papierkorb_>
RX14 worked on static compiling recently, including a statically linked compiler. he may know more
<RX14>
well the best you can do is install the static versions of the libraries and add --status to crystal build
<RX14>
you do need musl though
<RX14>
and to build libevent and libgc
<RX14>
since the apk packages dont provide static versions of those
<FromGitter>
<ziprandom> do I have to be on arch? (I'm on debian)
rohitpaulk has quit [Ping timeout: 246 seconds]
<RX14>
no you need to be on alpine
<RX14>
so do it in docker
<RX14>
with a 2-stage build
<RX14>
honestly its not worth the effort
<RX14>
if you're building a docker container anyway
<RX14>
you might as well take the easy route
<FromGitter>
<ziprandom> hmm, but can't it be automated? I mean truely portable binaries would be really something
<FromGitter>
<ziprandom> what's the easy route?
<RX14>
the easy route is dont build static libraries in docker
<alex-edf>
Papierkorb_: how to read the first 4 bytes?
<RX14>
because it's much less useful inside docker
<RX14>
outside docker they're really useful
<RX14>
but inside docker theres little point apart from binary size
<RX14>
and you can do that with alpine anyway
<Papierkorb_>
alex-edf: Did you actually look at , and try to understand, the sample snippet in the docs?
<FromGitter>
<ziprandom> hmm, I don't understand but also I'm new to this.
<RX14>
if you dont understand then you probably dont want static binaries
<FromGitter>
<ziprandom> basically I wonder whether I can compile a crystal programm down to a binary that works by itself
<alex-edf>
Papierkorb_: yes
<FromGitter>
<ziprandom> and crossplatform
<Papierkorb_>
alex-edf: What is not clear about it? Try to be precise please.
<RX14>
@ziprandom yes you can but it's hard and very very unlikely to be worth the effort
<FromGitter>
<ziprandom> oh, sorry didn't want to spam the whole thread here
<RX14>
blame gitter
<RX14>
its fine from irc
<Papierkorb_>
Yeah no problem, we're fine ziprandom. In fact, thank you for using gist and not copy/pasting into gitter directly :)
<RX14>
@ziprandom GO is special because it reinvents the world just so it can do that
<RX14>
it doesnt use any of the traditional infastructure and simply does syscalls directly
<RX14>
recreates it own libc in go
<Papierkorb_>
Wait, does Go have its own linker?!
<FromGitter>
<ziprandom> I just think if crystal could do that it would make scripting languages go extinct
<RX14>
go is everything
<RX14>
go does everything
<Papierkorb_>
Holy sh..
<RX14>
yup
<RX14>
in fact it doesnt need a linker Papierkorb_
<RX14>
because it's all go
<RX14>
it needs a trditional linker to link to C
<Papierkorb_>
Ah, so the internal linker only supports Go
<RX14>
but it just emits the binary without linking because it knows where everything is
<RX14>
Papierkorb_, yup
<RX14>
@ziprandom sure, get us google fuinds and we'll do that
<RX14>
unmtil then we have to be a little more conservative with the NIH
<FromGitter>
<ziprandom> yeah no pressure, you are my gods anyway
<vegai>
well, the Go creators were plan9 people
<vegai>
I figure they found the existing compilers/linkers distasteful
<Papierkorb_>
alex-edf: Did you look endianess up? Do you still have questions on what that is?
<vegai>
and not just their implementation, but fundamental design as well
<RX14>
which would be great if they didnt have terrible taste in how to recreate things
<vegai>
creating new ones was probably not a big deal to them
<Papierkorb_>
vegai: Oh then it might actually be interesting to look at their architecture, and how it differs from the "classic" design
<RX14>
Papierkorb_, the go compiler is completely from scratch
<RX14>
it only just got SSA
<FromGitter>
<ziprandom> I just have a little use case where I made a small website for people using hugo (static site generator) which is really how most of the websites should be done, but I have to write a script for easy building and deployment, because they don't know how to use the console. So writing a little local webserver that they could use to get a CMS feeling for it would be really fun in crystal, but not If I have to
<FromGitter>
... make them compile it ..
Gasher^ is now known as Gasher
<Papierkorb_>
RX14: "from scratch" in which sense?
<RX14>
as in no LLVM no nothing
<Papierkorb_>
Looks like they were told "here is unlimited time and money, go wild"
<RX14>
they wrote the go compiler from go to register allocation to emitting ELF from scratch
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<vegai>
Papierkorb_: no, really, they had written several compilers before. It was probably not a big deal at all to them
<Papierkorb_>
Which explains why go is so fast at compiling i guess
<RX14>
vegai, writing a compiler is always a big deal
<Papierkorb_>
does it do any big optimizations?
<vegai>
don't you ever get the feeling when looking at existing things that "I could do this alone much better if I didn't overengineer it so much"
<RX14>
just because they know HOW to do it only makes it a bit less hard
<vegai>
they actually were able to do that
<Papierkorb_>
Sure it's a big deal, but not as big as when you never done anythign like this before
<RX14>
Papierkorb_, idk
<alex-edf>
Papierkorb_: Yep
<vegai>
RX14: if you're a pioneer in the field, it must be a bit easier
<RX14>
vegai, yeah a bit
<Papierkorb_>
alex-edf: Did that clear it up, or do you have follow up questions?
<RX14>
but i would never say its not a big deal
<RX14>
or even easy
<RX14>
its always hard
<alex-edf>
how to convert the endian byte to integer (decimal) and vice-versa?
<Papierkorb_>
alex-edf: endianess only applies to multi-byte values. a byte doesn't have an endianess, but an integer (Int32, so four bytes) has
<vegai>
go's git repo is a bit funny
<vegai>
first commit's timestamp is from 1972
<RX14>
lol
<Papierkorb_>
alex-edf: in fact, just ignore the whole endianess parameter for now.
<alex-edf>
I feel stupid :|
<Papierkorb_>
alex-edf: Grab a crystal compiler and try the sample. You can also use the public playground
<alex-edf>
I have a message, said '{message:"ls"}' I need to get its length, and write to stdout the endian value
<Papierkorb_>
I'm confident your computer uses base 2 to store it
<Papierkorb_>
Base 10 machines died out long time ago
<Papierkorb_>
Though I still don't see how bases and endianess are related
<FromGitter>
<bararchy> RX14 for me when static compiling , the first Exception just crashes everyting with invalid mem exception
<RX14>
oops
<RX14>
well aparrently not in my compiler
<RX14>
as we've proved
<FromGitter>
<bararchy> You used a modified libevent or gc right ?
<RX14>
no
<RX14>
it just worked
<Papierkorb_>
alex-edf: grab a crystal compiler, or the public playground, and just *try* the snippets.
<FromGitter>
<bararchy> cool
<FromGitter>
<bararchy> I remmber something about unwind not playing nice
Tuxified has joined #crystal-lang
Tuxified has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
Tuxified has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Philpax__ has joined #crystal-lang
sz0 has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
Tuxified has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
<crystal-gh>
[crystal] asterite opened pull request #4934: Let fun names and method calls start with Uppercase (master...feature/fun-names) https://git.io/v5rU5
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
snsei has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
Philpax__ has quit [Ping timeout: 264 seconds]
snsei has quit [Remote host closed the connection]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<Freezerburn> So I've got an interesting problem using HTTP::Client. I'm trying to make an SVN post-hook that leaves a comment on JIRA with information about commits. So I'm trying to get the basics of this working by testing a simple GET via their rest api at the URL "https://mycompany.atlassian.net/rest/api/2/issue/test-issue" which should return a large JSON object. I'm using their basic auth via the
<FromGitter>
... "basic_auth(username, password)" function on HTTP::Client, and setting the "Content-Type" header to "application/json". I create the client with the base url "https://mycompany.atlassian.net" and then use the get function with "/rest/api/2/issue/test-issue". However, when I do this, I'm getting a 404 not found HTML page back instead of the ... [https://gitter.im/crystal-lang/crystal?at=59b17e5b9acddb2407127a87]
<FromGitter>
<Freezerburn> (read through the code meaning: I went through the HTTP::Client code and related classes)
sp4rrow has quit [Read error: Connection reset by peer]
sp4rrow has joined #crystal-lang
alex`` has quit [Read error: No route to host]
rumenzu has quit []
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
p0p0pr37 has quit [Remote host closed the connection]
_p0p0pr37 has joined #crystal-lang
Groogy has quit [Ping timeout: 240 seconds]
_p0p0pr37 has quit [Changing host]
_p0p0pr37 has joined #crystal-lang
<FromGitter>
<krypton97> Is there any disadvantages using packages that contains c bindings?
<FromGitter>
<krypton97> I've tested two image packages and the one that contains c binding tends to be faster
<FromGitter>
<luislavena> @krypton97 it might be faster, but if the call to C takes long time, it will block the fiber scheduler from allowing other fibers to work.
<FromGitter>
<krypton97> Well, I'ma stick to the crystal one if so
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #crystal-lang
Tuxified has joined #crystal-lang
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
rohitpaulk has quit [Remote host closed the connection]
<crystal-gh>
[crystal] asterite closed pull request #4934: Let fun names and method calls start with Uppercase (master...feature/fun-names) https://git.io/v5rU5
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: https://git.io/v5rSe
<crystal-gh>
crystal/master 16be884 Ary Borenszweig: Disallow top-level funs that start with Uppercase
<crystal-gh>
crystal/master 952d95f Ary Borenszweig: Let fun names and method calls start with Uppercase
<oprypin>
well of course it will have "any" effect, the question is how much. also disregard the version jump, it's the same difference as, say, LLVM 3.8 and 3.9
<oprypin>
so not likely to have a big effect
<oprypin>
only one way to find out
<FromGitter>
<crisward> Semver can be a bit misleading at times, the number is always read as a degree of difference, not as a measure of compatibility, which is of course what it is. Someone should come up with a second number based on the number of cool features added. AwesomeVer.
<FromGitter>
<fridgerator> +1 for AwesomeVer
<FromGitter>
<crisward> You can't +1 AwesomeVer, you have x10 it! 😉
<FromGitter>
<opensas> also, very usually minor breaking changes gives the impression of a mayor change
<FromGitter>
<jwaldrip> @ysbaddaden & @asterite would you mind reviwing #4838 again?
<FromGitter>
<jwaldrip> It still shows as requesting changes.
sp4rrow has joined #crystal-lang
<FromGitter>
<jwoertink> Anyone know if there's any MCrypt shard, or if it's built in to crystal?
<RX14>
i added an option to the formatter to force block usage but it was reverted because i need to make both block styles act the same regarding precedent
<oprypin>
i'm just wondering now -- `{ | | }` and `&.` could really be unified into something different, because together with `do | | end` the variation is way too high for 3 things that act the same
<oprypin>
> This is a work in progress. Compatibility across LLVM releases is not guaranteed.
<RX14>
well
<RX14>
id rather do a source transform, that way is probably worse performance
<RX14>
at least try this way first
<oprypin>
it probably rewrites though
<oprypin>
what I also dislike is that syntactically such a feature does not fit in
<RX14>
yeah thats the other issue
<oprypin>
well it's not too bad. something like `iter def` could define the blockless version for free, OR there could be a symbol for a blockless call like `foo.bar@.to_a`
<FromGitter>
<drosehn> *Picked up from @ CodeWisdom on twitter:* "Computer language design is just like a stroll in the park. Jurassic Park, that is." -- Larry Wall
rizo[m] has left #crystal-lang ["User left"]
<FromGitter>
<asterite> I'd also like to have yield make iterators. But it's really hard. And blocks, as oprypin mentions, make it even harder. And compile times will be even bigger. I would be OK with an implementation that used fibers to suspend the execution... at least that's how it's done in Ruby and nobody complains (but probably because the performance of that is on par with everything else). But I don't know how to implement
<FromGitter>
... that either...
<RX14>
well with fibers you just spawn a new fiber and pass the method a block which sends the item to a channel
<RX14>
it's doable rn with the stdlib
<RX14>
making it efficient is the hard bit
sp4rrow has joined #crystal-lang
<FromGitter>
<asterite> Yes, but using channels is very slow. I think it shouldn't be necessary. When you call `next` you'd resume that fiber, and `yield` would pause it... somehow... I don't know :-P
<oprypin>
people are gonna ignore a feature with such a big performance hit
<RX14>
are channels really so slow or is it the fiber switches?
<FromGitter>
<asterite> I mean, Enumerator with channels is definitely possible, I was able to do it. But it's slow. Maybe we could start with that, at least, and hope that later the performance will improve
<FromGitter>
<asterite> Ah, yes, fiber switches are slow
<oprypin>
asterite, yield would just wait on a channel(nil)
<oprypin>
and next would send to it
<FromGitter>
<asterite> I don't think performance matters much. Probably other things matter... Ruby is relatively slow but still fast enough for most web things, for example. If you have something slow you rewrite it with a faster construct (in Ruby that's not always possible unless you drop to C)
<RX14>
i think performance matters in crystal though
<RX14>
we're a language built with a message about performance
<FromGitter>
<asterite> Yes, but for example Rust is more performant
sp4rrow has quit [Client Quit]
<RX14>
taking the stance that performance doesn't *really* matter in the stdlib will likely get us bad PR somewhere down the line
<FromGitter>
<asterite> Yeah... probably
<FromGitter>
<asterite> That's why there's no magic iterator so far :-P
<oprypin>
stdlib simply wouldn't use this then......
<RX14>
yeah rust is faster but i'd imagine thats mainly to do with their custom IR lowering and opt steps, and the lack of GC
<RX14>
mostly the latter i'd guess
<oprypin>
asterite, the thing is though, such a feature would not be used often for blocks in blocks. it's just a neat abstraction for a state machine
<RX14>
in pure numerical or struct-based code i don't imagine we'd be different from rust
sp4rrow has joined #crystal-lang
<oprypin>
incremental/cached compilation would certainly help with compilation times
<FromGitter>
<asterite> RX14: for iterators, Rust can avoid allocating them at all and then compile to very efficient instructions. In our case when iterators are class-based it's kind of impossible. Unless... someone implements a good escape analysis algorithm for Crystal :-P
<oprypin>
but yeah, if even for you it's really hard, then i dunno
sp4rrow has quit [Client Quit]
<RX14>
@asterite we're too used to you doing the impossible lol
<oprypin>
lol
<RX14>
i think blocks are crystal's 0-cost abstraction
<oprypin>
asterite, curiously enough, this feature could be the gateway to some easy optimizations
<FromGitter>
<asterite> RX14 lol
<RX14>
for iteration we're already on par with rust with nice semantics but it's the mutation chains that are the issue
<oprypin>
you could inline its usages as well
<RX14>
because all the map blocks which can be inlined (i.e. not iterators) are creating new arrays
Philpax__ has joined #crystal-lang
<RX14>
also with the iterators being class-based im not sure how this would work because we just capture the block