RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <wontruefree> I thought your link was to fossil
<FromGitter> <wontruefree> never mind
marmotini has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5y3y why does this time out?
marmotini has quit [Ping timeout: 246 seconds]
<FromGitter> <Blacksmoke16> gets stuck in an infinite loop or something
<FromGitter> <ezrast_gitlab> @Blacksmoke16 The default log level is something higher than debug
<FromGitter> <Blacksmoke16> oh, so it just loops till it gets some input then?
<FromGitter> <ezrast_gitlab> The `r.gets` is blocking, yeah. Changing `debug` to `error` makes it show up: https://play.crystal-lang.org/#/r/5y41
<FromGitter> <Blacksmoke16> ah, is there a non blocking version, say you wanted to assert that nothing got logged
<FromGitter> <ezrast_gitlab> I think you have to do the read in a separate fiber but I'm not 100%
<FromGitter> <Blacksmoke16> hmm
johndescs has quit [Ping timeout: 268 seconds]
johndescs has joined #crystal-lang
S0bait has joined #crystal-lang
spacemanspam has joined #crystal-lang
marmotini has joined #crystal-lang
Raimondi has joined #crystal-lang
marmotini has quit [Ping timeout: 258 seconds]
S0bait has quit [Quit: Connection closed for inactivity]
dannyAAM has quit [Ping timeout: 252 seconds]
dannyAAM has joined #crystal-lang
marmotini has joined #crystal-lang
<FromGitter> <rishavs> I want to implement a feature where user can upload an image from the JS SPA to my crystal server. Not sure how to go about it. Should I convert the image to base64 on the client side and then send the string as a normal POST request payload? Or is there a more natural way of doing file upload?
<FromGitter> <bararchy> Before I start making PRs , did anyone already worked on extending X509 and RSA ? (Create private/public key, create new certificate , create CA and sign certificate etc..)
moei has joined #crystal-lang
<FromGitter> <bararchy> @kingsleyh As RX14 mentioned that all OpenSSL contributions are welcome to main crystal repo, do you mind PRing crystal-ecdsa? If you need help I will be happy to provide it
<FromGitter> <j8r> I hope OpenSSL would be split up from the stdlib
<FromGitter> <j8r> to install it, we could have `crystal-openssl` like `ruby-openssl` and `python3-openssl` - no big deal
<FromGitter> <rishavs> I want to create a simple image upload feature in my crystal server. on the client side, I am using ES6 fetch to send the file as ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c346a9c12db9607e754af0d]
<FromGitter> <rishavs> If I try ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I get `Cannot extract form-data from HTTP request: could not find boundary in Content-Type (HTTP::FormData::Error)`. Not sure how to proceed [https://gitter.im/crystal-lang/crystal?at=5c346b8673360b4d55d7550b]
ashirase has quit [Ping timeout: 245 seconds]
ashirase has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <rishavs> is there a way to get the file size form the IO itself? I dont want to actually store the file and then find its size. An attacker could send a huge junk file to kill my server
<FromGitter> <j8r> no
<FromGitter> <rishavs> hmm... how do I handle such attacks then?
<FromGitter> <j8r> maybe it's possible to evaluate the file size in client side
<FromGitter> <rishavs> its a SPA, so its easy to circumvent the checks there
<FromGitter> <j8r> agree
<FromGitter> <j8r> You want to prevent sending big files?
<FromGitter> <rishavs> yes.
<FromGitter> <j8r> You can gets the IO until it reach X bytes
<FromGitter> <rishavs> Ah. that sounds like what i had in mind
<FromGitter> <j8r> you can use a Tuple for the buffer
<FromGitter> <j8r> `buffer = Bytes.new 4096`
<FromGitter> <j8r> something like `io.raw &.read slice`
<FromGitter> <rishavs> is it possible to rustle up a carc.in? I am very bad at io/buffers and can use a sample
<FromGitter> <j8r> sure :)
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.27.0/File.html#size%28filename%29%3AUInt64-class-method wouldnt this work?
<FromGitter> <rishavs> @Blacksmoke16 I want to avoid writing it to disk altogether
<FromGitter> <Blacksmoke16> ah right, and that assumes its on disk
<FromGitter> <rishavs> otherwise someone can send me a dummy file gigs in size and it will fill up my server file system
<FromGitter> <j8r> @rishavs https://crystal-lang.org/api/master/IO.html#read_fully%3F%28slice%3ABytes%29-instance-method
<FromGitter> <Blacksmoke16> if you use nginx
<FromGitter> <rishavs> thanks @j8r
<FromGitter> <j8r> I doubt it's the proper way :/
<FromGitter> <rishavs> @Blacksmoke16 I haven't yet put the server on production. STill working on it on localhost. I plan on using Nuster (HAProxy derived). STill haven't read through the documents though.
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <Blacksmoke16> docker can help with that, i found its best to try and have local and prod as close as possible
<FromGitter> <Blacksmoke16> took a while but i got nginx/ssl certs localy so i just do like dev.domain.com
<FromGitter> <Blacksmoke16> going to use heroku or something for prod?
<FromGitter> <rishavs> Digital ocean is the current plan
<FromGitter> <Blacksmoke16> gotcha
<FromGitter> <j8r> @rishavs there is https://crystal-lang.org/api/master/IO.html#gets%28limit%3AInt%2Cchomp%3Dfalse%29%3AString%3F-instance-method !!
<FromGitter> <j8r> you can set a limit
<FromGitter> <Blacksmoke16> what if they send one line thats is a gigs worth of bytes
<FromGitter> <Blacksmoke16> would just stop?
<FromGitter> <rishavs> I am trying this now. with slice of 100kb ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Stranegely, it doesnt returns 0 even if i try uploading a file of 30 kb or 200 kb [https://gitter.im/crystal-lang/crystal?at=5c34a3375ec8fe5a851ea8d7]
<FromGitter> <rishavs> the doc for .read says `Reads at most slice.size bytes from this IO into slice. Returns the number of bytes read, which is 0 if and only if there is no more data to read (so checking for 0 is the way to detect end of file).`
<FromGitter> <rishavs> Not sure if that is a bug in Crystal or I am just understanding the doc wrongly. Anyway, I got what I needed by doing; ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Now I can find the filesize without havinbg to write the file on disk. Thanks @j8r and @Blacksmoke16 [https://gitter.im/crystal-lang/crystal?at=5c34a4435ec8fe5a851eaee9]
<FromGitter> <Blacksmoke16> all him, i didnt do anything :p
marmotini has quit [Ping timeout: 258 seconds]
<FromGitter> <rishavs> thanks all the same. you have helped tons in the past. :)
ua has quit [Ping timeout: 245 seconds]
ua has joined #crystal-lang
<FromGitter> <j8r> @rishavs https://carc.in/#/r/5y83/edit
<FromGitter> <j8r> I think it's better than slice, because else you need `String.new(slice).rstrip '\u{0}'`to remove zeros (unless I miss something)
<FromGitter> <bararchy> @j8r the idea is to move OpenSSL out of standard reop, but, because this move has yet to come, RX14 said he will accept all PR to the main repo so that we can have an easier workflow on that
<FromGitter> <j8r> @bararchy 👍
<FromGitter> <girng> good morning!!
<FromGitter> <girng> @proyb6 what language is that person referring to?
<FromGitter> <girng> I mean, what repo
<FromGitter> <staleo> Any plans on moving the chat to discord, gentlemen? Sooner or later you'll have to, sadly.
<FromGitter> <j8r> @staleo no
<FromGitter> <staleo> @j8r ok
<FromGitter> <j8r> some wants Slack, or Discord
<FromGitter> <bararchy> why would we have to move it to Discord?
<FromGitter> <j8r> or even Spectrum
<FromGitter> <rishavs> @staleo why do we need to move anyway? Is gitter shutting down?
<FromGitter> <j8r> eventually adding a bridge, why not?
<FromGitter> <girng> what is going to happen to gitter??
<FromGitter> <j8r> that's not the question @girng
<FromGitter> <j8r> > Any plans on moving the chat to discord, gentlemen? Sooner or later you'll have to, sadly.
<FromGitter> <girng> > Sooner or later you'll have to
<FromGitter> <Blacksmoke16> id rather discord imo, but not a big deal
<FromGitter> <girng> implies something going to happen to gitter
<FromGitter> <Blacksmoke16> would just be one less tab i have to have open :3
<FromGitter> <bararchy> on Arch I need to install libc++ from AUR to use the discord app :(
<FromGitter> <proyb6> @girng I have no idea what repo 20 years ago
<FromGitter> <girng> discord app is bloated electron bloatware IMO, don't use it
<FromGitter> <j8r> @girng don't know what he said this
<FromGitter> <j8r> @staleo why do did say this?
<FromGitter> <girng> ^
<FromGitter> <staleo> I did say this only because its a matter of time when ppl and projects migrate from the poorer platforms to the better ones. Cmon, gitter's slowly dying.
<FromGitter> <staleo> slowly, but inevitably
<FromGitter> <staleo> didnt mean to harass any of your user habbits, tho
<FromGitter> <j8r> I don't think so
<FromGitter> <j8r> Have you the numbers to confirm this, or is it just a personal taste?
<FromGitter> <j8r> Gitter is Open Source and supported by Gitlab
<FromGitter> <staleo> Personal taste, thats true. However, just to compare what the two are offering, i believe i dont really need any sort of numbers to confirm anything
<FromGitter> <bararchy> @staleo what kind of integration does Discord have with github?
<FromGitter> <j8r> The big problem of Discord is the future: they are raising funds, sure, but they are still not profitable
<FromGitter> <staleo> @bararchy hmm, is this messy list telling nothing on your right what you call an integration?
<FromGitter> <j8r> they might add limitations to overcome this, ads, etc in the future
<FromGitter> <staleo> @j8r quite true. On the other hand, they might not, which would also be quite true.
<FromGitter> <bararchy> @staleo don't get me wrong, I hate gitter, the mobile app is unusable, the only reason I don't just use IRC is the `code styling` , but, I use Discord for my D&D sessions with friends, we even created a bot to manage aspects of the game, so I know both quite well. ⏎ Slack is much better, but , it's closed and you need invites to join which sucks much more
<rkeene> wontruefree, That's me with Fossil -- I like Fossil a lot
<FromGitter> <staleo> @bararchy dungeon defenders? :) You pls don't get me wrong neither, I dont actually hate anything. It's only a cold analisys of what is for a certain extent better, and what is for some reasons worse.
<FromGitter> <bararchy> Dungeon and Dragons :) text-based via Discord
<FromGitter> <bararchy> even have a repo to handle all the things hahah https://github.com/bararchy/neve_midbar
<FromGitter> <girng> crystal's community is already so niche regarding chat rooms and communities. the more chat rooms that are made, the more sporadic the user base will become. then, after "some people flock to discord, and then see no one is really there"... everyone will just come back to gitter (since it's known as the "main chat hub")
<rkeene> Crystal is an even smaller community than Tcl, so... keep that in mind :-D
<FromGitter> <staleo> @girng true, but nobody forces Crystal HQ to launch 500 rooms at once. Just a little announcement to migrate to D, and there will be nobody here within a week.
<FromGitter> <girng> @staleo that's prob true, but gonna need to get lead devs to do that, which gonna be hard to convince IMO
<FromGitter> <bararchy> I think the main thing is that Discrod isn't opensource
<FromGitter> <j8r> @staleo they need to earn money, like with WhatsApp adding ads and sharing personal infos with Facebook (they said they'll never do this, but they did)
<FromGitter> <j8r> how they will earn money? That's unsure
<FromGitter> <staleo> @girng oh, I ofc not gonna do that, haha. Besides, i feel like a paid Discord promoter. Awful feeling. Enough for today.
<FromGitter> <j8r> the main point is: everyone wants something (me Matrix, others Slack, Discord etc), but Gitter is good enough :)
<FromGitter> <straight-shoota> rkeene, that uint conversion is useless. It's the same value anyway and can't be bigger than Int32::MAX
<FromGitter> <staleo> Another thing guys. Do you know any of the shards to operate with pictures? Like, cropping, resizing, extracting a colour for particular point, etc?
<FromGitter> <bararchy> https://github.com/stumpycr/stumpy_png ?
<FromGitter> <bararchy> Also http://shards.info/ and http://crystalshards.xyz/ is a great way to find shards
<FromGitter> <straight-shoota> re/ gitter Sure, Gitter has some issues and there are probably better platforms. But it works and is an established channel. If you don't like Gitter, you can join the IRC channel instead. Changing has a cost, and unless there is something really wrong with Gitter, I don't think it's worth considering alternatives.
<FromGitter> <staleo> @bararchy gourgeous, thx!
Raimondi has quit [Ping timeout: 240 seconds]
<FromGitter> <staleo> @straight-shoota okay, sounds reasonable. Sir, btw wish you a nice and promising start at Crystal team! Cant wait to see a v 1.0 version, haha.
<FromGitter> <DanilaFe> Matrix is great, can confirm
<FromGitter> <DanilaFe> Though its flagship client, riot, is quite slow
<FromGitter> <DanilaFe> And Gitter is probably more accessible
<rkeene> straight-shoota, It's Int32::MAX minus 1024*1024
<rkeene> But true
Raimondi has joined #crystal-lang
<FromGitter> <jwoertink> Has anyone here looked at the red programming language?
<FromGitter> <jwoertink> https://www.red-lang.org/p/about.html
<FromGitter> <girng> nope but looking now
<FromGitter> <jwoertink> I like their statement "Cross-compilation done right"
<FromGitter> <jwoertink> statically compiled and has a repl apparently?
<FromGitter> <girng> what is ren and red?
<FromGitter> <girng> are they the same syntax??
<FromGitter> <bararchy> Seems like programming inside an array :)
<FromGitter> <jwoertink> yeah no clue. I just heard about it this morning
<FromGitter> <j8r> on HN?
<FromGitter> <jwoertink> first thing I saw that I liked was
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c34d8f36370df0b91ad1f36]
<FromGitter> <jwoertink> yeah, on HN
<FromGitter> <girng> i can't find the syntax
<FromGitter> <girng> i click on syntax and it goes to a different site, tht's about REN
<FromGitter> <girng> WTF
<FromGitter> <girng> so it's like coding in blocks of square brackets?
<FromGitter> <girng> i thought square brackets are for arrays
<FromGitter> <jwoertink> well, I always thought of parenthesis for passing arguments to methods, but lisp would disagree lol
<FromGitter> <girng> so is it a functional programming language?
<FromGitter> <jwoertink> no clue.
<FromGitter> <girng> LOL
<FromGitter> <girng> hmmmmm
<FromGitter> <jwoertink> I looked at it for about 2 seconds. I just saw how nice the cross-compile was, and the fact that it's statically compiled but still had a built in repl
<FromGitter> <girng> @bararchy lol so true
<FromGitter> <girng> i'm looking at examples here https://en.wikipedia.org/wiki/Red_(programming_language)
<FromGitter> <girng> @jwoertink damnit why did you tell me about this now i wanna fiddle around in it
<FromGitter> <girng> 😆
<FromGitter> <jwoertink> LOL
<rkeene> The Red cross-compiler stuff isn't much different than the GCC stuff. A triple matches to a set of attributes, which define all that stuff.
<rkeene> GCC's handling is basically openend overrides though
<rkeene> open-ended, rather
<RX14> rkeene, with gcc, a compiler emits for one triple though
<RX14> so you need n compilers to compile for n triples
<rkeene> The compiler part is real small though
<RX14> yeah, which was important in the 80s
<rkeene> Most of the size is the platform-specific files that you'd have to collect, and not build
<RX14> only if you want to link
<FromGitter> <jwoertink> I don't know anything about that sort of thing. Compilers go right over my head which is impressive considering I'm tall lol
<rkeene> (And I have a BUNCH of cross-compilers)
<RX14> crystal and clang emit for any architecture with 1 library
<RX14> but then of course linking is your problem
<RX14> 1 binary*
<rkeene> (aarch64-generic-linux-gnu arm-android9-linux-androideabi arm-linux-gnueabihf arm-slackware-linux-gnueabi armv6-hardfloat-linux-gnueabi armv7-hardfloat-linux-gnueabi hppa64-hp-hpux11.11 i386-pc-solaris2.10 i486-slackware-linux i586-mingw32msvc mips-unknown-linux-musl mipsel-unknown-linux-uclibc nios2-linux-uclibc powerpc-ibm-aix5.3.0.0 sparc-sun-solaris2.10 sparc-sun-solaris2.8 x86_64-apple-darwin11
<rkeene> x86_64-generic-linux-musl x86_64-redhat5-linux x86_64-unknown-freebsd8 x86_64-unknown-linux-musl x86_64-unknown-netbsd5 x86_64-w64-mingw32)
<FromGitter> <jwoertink> It would be nice to see that level of ease in crystal though. I know we have `--cross-compile --target "x86_64-unknown-linux-gnu"` though I've ran in to issues with that. But it would be cool to see something like `crystal build --platform=Darwin` or `--platform=Linux-ARM`
<rkeene> RX14, Clang supports much fewer platforms than either LLVM or GCC
<RX14> rkeene, and crystal supports far fewer still!
<rkeene> Yeah, the lack of platform support is the main reason I haven't used Crystal for anything but my own internal toy projects
<RX14> but red i assume doesn't have the linking problem for the same reason as go:
<RX14> no libc dependency
<RX14> rkeene, any particular platforms you're interested in?
<rkeene> Go also doesn't support that many platforms, so it's difficult to find cases where I can use it :-(
<rkeene> RX14, The above list is what I compile for usually -- though no need for HP-UX anymore
<rkeene> And NIOS2 is only for some things
<FromGitter> <kevinelliott> RE: Gitter, Slack, Discord, etc. I have an alternative to suggest that I think is quite nice. Zulip. They have a nice article on why it’s better than Slack. https://zulipchat.com/why-zulip
<RX14> what do you work on which needs such broad support?
<FromGitter> <kevinelliott> And https://zulipchat.com/for/open-source/
<rkeene> A lot of different projects
<FromGitter> <kevinelliott> "The best chat for open source projects"
<RX14> @jwoertink that'll only be possible with a third-party tool which could build chroots for various platforms to link with
<rkeene> I have AIX, Solaris, Linux, and Windows in production at my datacenter job, and I use a bunch of the same tools on ARM (various backing distributions)
<rkeene> FreeBSD/NetBSD is mostly for other people to use
<RX14> nice
<RX14> maybe crystal will get there one day
<RX14> we'll be a long way behind rust and clang probably forever
<rkeene> I tried to switch to Clang a few years ago and it didn't even support Solaris at the time -- not sure if it has made progress there given that Solaris isn't long for this world
<RX14> SPARC or x86 solaris?
<FromGitter> <kevinelliott> I miss Slowaris and Openslowaris :(
<rkeene> Both
<rkeene> Mostly SPARC, but we have some x86 as well
<RX14> i'd be surprised if it didnt support x86 solaris
<FromGitter> <kevinelliott> You guys are still running sparcs? Rad.
<RX14> since thats easy
<RX14> (clang)
<FromGitter> <kevinelliott> I need to get me a replacement UltraSparc 5 so I can keep my feet warm. Winter is cold.
<rkeene> I'm reasonably sure that it didn't
<rkeene> kevinelliott, You get an M9000
<FromGitter> <kevinelliott> *drool*
<rkeene> Fun fact, NetBSD won't boot on an M5000/M9000 :-(
<RX14> "thats not a lot of ram" "oh thats 16 dimms per row"
<rkeene> We had some domains with >1TB of RAM
<rkeene> But I think you are looking at the CPUs
<rkeene> That domain had 192 CPUs
<rkeene> The memory is just telling you about how they are arranged on the system board (what you would call a "motherboard" in a system that only had one)
<RX14> llvm seems to have a sparc backend
<rkeene> LSB (Logical System Board here, since it's abstracted out)
<RX14> probably isnt well maintained though
<rkeene> RX14, Yeah, but Clang doesn't support it
<rkeene> (Or didn't at the time -- LLVM had a SPARC backend, but Clang couldn't use it)
<RX14> yeah that sucks
<rkeene> It's fine -- compiling gcc isn't a lot of work
<RX14> oh i know it's not
<RX14> gcc will still be around for a long long time
<rkeene> For some things, I compile for even more platforms as one-offs
<rkeene> Haiku and MINIX, mainly
<RX14> how do you get shared libraries /libc for those platforms built?
<rkeene> I have a script that collects that stuff
<RX14> some cross-env script?
<RX14> ah nice
<RX14> so you run that on the target machine?
<RX14> to collect a tarball of the environment
<rkeene> Yeah
<RX14> nice
<rkeene> Then it's just a matter of binutils/gcc for that platform, easy peasy
<RX14> the main use for cross-compiling in crystal is just to bootstrap other architectures
<RX14> so it's easier to just transfer the object file and link on the target
<rkeene> Harder to do a stage0 build of Crystal that way
<RX14> lol
<rkeene> I've been working on doing stage0 builds of compilers as well
<RX14> tell me
<RX14> i did it for crystal
<RX14> took me nearly a week of 12 hours a day to write a script to build one
<rkeene> https://github.com/oriansj/stage0 is an interesting approach
<RX14> it's 150 compiler builds
<RX14> I doubt anyone will ever make a crystal compiler written in C for a simpler bootstrap
<RX14> but an interpreter might be doable
<RX14> or maybe even just a really really hacky well-typed crystal -> ruby "transpiler" could work
<rkeene> Excellent, I tried to build this at one point for Crystal but it was tedious and gave up
<RX14> it was incredibly tedious
<rkeene> I then looked at compiling Crystal for PNaCl and using that, but LLVM in PNaCl didn't go
<RX14> sometimes when a compiler didn't build you had to backtrack 3 levels
<RX14> like a commit broke building a compiler that could build a compiler
<RX14> and there's loads of patches required
<rkeene> One of my projects is a Linux/x86_64 distribution. It has long-life guarentees, and to make it viable to support that I need to be able to build any historical release at any point in its life in the future and get something compatible with the original release. To ensure that the system the distribution is being compiled on doesn't influence the resulting binaries, the entire distribution is
<rkeene> cross-compiled (you can compile it on Mac OS X, or Linux/arm -- you still get a Linux/x86_64 installer ISO at the end)
<RX14> I havent tried that script on too many platforms (basically run ./download then ./bootstrap) and I doubt it'll ever work on anything other than x86_64
<RX14> having to patch in $architecture support at each one of 150 builds is fairly unreasonable
<RX14> so the crystal -> ruby basic transpiler approach will be the only one reasonable for that distro
<RX14> maybe I should try that one day
<rkeene> What would be cool is a Crystal that emitted platform-independant C with a small platform-specific set of function calls for doing platformy stuff
<rkeene> It doesn't have to be good C either, since it'd only be used to compile Crystal
<RX14> eh, you could equally do that with LLVM ir
<RX14> for lower cost
<rkeene> There's a C LLVM backend, but it's not got the platform-specific stuff split out last I looked
<RX14> the thing is that both the IR and C, while textual, are machine generated artifacts
<rkeene> When I looked at the IR, it wanted to encode in the IR the library and system call mechanisms
<rkeene> So it was very platform specific
<RX14> yeah the IR isn't platform-independent
<RX14> just like C after the preprocessor :P
<rkeene> You couldn't take the IR and run it on Windows -- but that's basically what I'm proposing
<RX14> the problem I was trying to solve with that bootstrap script is the trust problem
<RX14> not the portability problem
<rkeene> For the trust problem, I really liked https://github.com/oriansj/stage0 's approach
<RX14> yeha
<RX14> rkeene, I don't think emitting C is going to be easy
<RX14> and it wouldn't be possible with the LLVM C backend since it has the same problem as the IR
<RX14> that crystal emits platform-specific IR
<rkeene> Yeah
<RX14> because LLVM is designed around IR being pletform specific on the data layout level
<RX14> i.e. struct padding, etc
<rkeene> But it would be cool if there were such a thing :-)
<RX14> everything's raw sized so there's no aliases like size_t etc
<RX14> anyway, gtg
<rkeene> Pieces
<rkeene> I'm real glad this bootstrap exists -- I don't know if you remember, but I was here wanting such a thing a year or so ago :-D
<rkeene> I still have the branch of my version control repo where I started to add this bootstrap
marmotini_ has joined #crystal-lang
<rkeene> Almost exactly 2 years ago, in fact 2017-01-09
<RX14> rkeene, yeah i remember :)
<RX14> actually, in the future, wasm+nodejs API might become the answer
<RX14> if crystal ever gets that as a cross-compile target
<RX14> but i guess nodejs and V8 are even less portable...
<RX14> :(
sagax has quit [Ping timeout: 244 seconds]
Renich has quit [Read error: Connection reset by peer]
Raimondi has quit [Ping timeout: 240 seconds]
<rkeene> Well, if you could compile it for DOS on i80x86 I'm working on a real small DOS+i80x86 emulator (i.e., implements BIOS and DOS and maps them to the host platform -- so that INT 0x21 AH=0x37 (DOS's OPEN call) maps to fopen())
<rkeene> (Microsoft recently open sourced MS-DOS, making this a bit easier so I can test the binaries and see the assembler that corresponds with them)
<rkeene> Oops, 0x3D for OPEN (0x37 is for setting/getting the switch flag for arguments)
<FromGitter> <rishavs> How do i use IO.rewind? ⏎ If I try ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5c34fd83357dd7655d39994a]
<FromGitter> <jwoertink> the error happens at the `part.body.rewind`?
<FromGitter> <jwoertink> maybe use `seek(0)`?
<FromGitter> <jwoertink> or you could do `part.body.pos = 0` I think
<FromGitter> <kevinelliott> @rkeene oh nice, MS-DOS is open source now? I want to learn how to do BIOS and DOS emulation.
<FromGitter> <kevinelliott> That’s wild.
<rkeene> They have both binaries and source there, so it's easy to work with
marmotini_ has quit [Ping timeout: 244 seconds]
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
Raimondi has joined #crystal-lang
sagax has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
<FromGitter> <malkomalko> Just a check in to say how much I've enjoyed my first few weeks programming in Crystal :D
<FromGitter> <malkomalko> This is going to be a power house language when 1.0/parallelism lands
<FromGitter> <bararchy> that's nice to hear @malkomalko
return0e has quit [Ping timeout: 245 seconds]
<FromGitter> <rishavs> @jwoertink neither worked. :/ `seek(0)` give sme `unable to seek` error
<FromGitter> <jwoertink> hmm... I'm not sure. Is `part.body` an IO object directly? Or is it something that inherits from IO?
<FromGitter> <rishavs> its a formdata part. `HTTP::FormData.parse(ctx.request) do |part|`
return0e has joined #crystal-lang
<FromGitter> <jwoertink> I'm not totally sure. I haven't worked with that much
<FromGitter> <domgetter> Is there a way to specify a library function with unknown return type? The library function I'm trying to link to returns a function pointer, but it's for a collection of different functions with various signatures. If I target one of those functions, it works, but as soon as I try to generalize, the compiler doesn't like it.
<FromGitter> <domgetter> Also, is there a way to specify a library function twice? If I could write out one for each signature, that would work too
<FromGitter> <domgetter> It seems I should be able to specify the return value as a Void*, then cast it to some Proc*, then call .value and then .call . Is this how others do it?
<FromGitter> <domgetter> I tried that, but my program crashes. If anyone knows any resources on dealing with void pointer stuff in Crystal, that would help too
<FromGitter> <eliasjpr> Im a little confused how the JSON annotation root and key params work see https://play.crystal-lang.org/#/r/5ybr
<FromGitter> <eliasjpr> ```code paste, see link``` ⏎ ⏎ Data = root ⏎ Value = key [https://gitter.im/crystal-lang/crystal?at=5c351a4457c6883f9b83befb]
dalpo has quit [Ping timeout: 246 seconds]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <bew> @domgetter hey, can you show the header for those functions? Also how would you use that in C for example? (if you know C)
<FromGitter> <bew> @eliasjpr hey, i think root works in the other way, as in
<FromGitter> <bew> As in: root: "data", key: "value"
<FromGitter> <bew> But never tried like this, with multiple fields with same root.. For this json i'd use a class for the outer object, and another one for the inner data
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <girng> how can i make a method have a 100% chance of returning something? no ` not Nil` stuff??
<FromGitter> <Blacksmoke16> give it a non nilable return type
<FromGitter> <Blacksmoke16> i.e. `User`
<FromGitter> <Blacksmoke16> or `Int32`
<FromGitter> <girng> works fine: ` db = DB.open "mysql://#{GO["mysql_user"].as_s}:#{GO["mysql_password"].as_s}@#{GO["master_server"].as_s}/master?initial_pool_size=5"` ⏎ but `db = connect_to_mysql(GO["mysql_user"].as_s, GO["mysql_password"].as_s, "master", 5)` ⏎ ⏎ gives me `instance variable '@db' of GameServer must be DB::Database, not Nil` [https://gitter.im/crystal-lang/crystal?at=5c352b3d5ec8fe5a8522587f]
<FromGitter> <girng> what in the heck, connect_to_mysql RETURNS DB.open!!!
<FromGitter> <girng> some reason connect_to_mysql is having a possibly chance of returning a Nil
<FromGitter> <Blacksmoke16> What's that method look like
<FromGitter> <girng> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c352c9482a6c30b90a76d97]
<FromGitter> <Blacksmoke16> Puts returns nil
<FromGitter> <girng> O_O
<FromGitter> <Blacksmoke16> Set db open to a var, do puts, then have the car as last Val
<FromGitter> <Blacksmoke16> Var*
<FromGitter> <Blacksmoke16> Also can set a return type so you catch this stuff
<FromGitter> <girng> okay i removed my puts and rescue, got https://paste.ee/p/BCvuJ
<FromGitter> <girng> let me do what u said
<FromGitter> <Blacksmoke16> Driving home, afk a while
<FromGitter> <girng> eh same thing 💳. screw having a separate method to connect. just gonna do `db = DB.open` inside my `connect_to_master` method instead of having it call another connect to mysql method.
<FromGitter> <Blacksmoke16> Fair enough
<FromGitter> <Blacksmoke16> Was that the whole error?
<FromGitter> <girng> yeah lol
<FromGitter> <Blacksmoke16> What if you set return type of that method to DB::
<FromGitter> <Blacksmoke16> Database
<FromGitter> <Blacksmoke16> DB::Database
<FromGitter> <girng> it says `instance variable '@db' of GameServer must be DB::Database, not DB::Database.class`
<FromGitter> <girng> db is set in class like `property db : DB::Database`
<FromGitter> <Blacksmoke16> And are setting it like @db = connect...
<FromGitter> <girng> well, kinda
<FromGitter> <girng> this is inside my initialize ⏎ ⏎ ```@db, @master_server = connect_to_master``` [https://gitter.im/crystal-lang/crystal?at=5c353909aac7082e6ff5fab6]
<FromGitter> <girng> then in connect_to_master i do ` db = connect_to_mysql(GO["mysql_user"].as_s, GO["mysql_password"].as_s, "master", 5)` but doesn't work
<FromGitter> <girng> and i return it ` {db, master_client}`
<FromGitter> <girng> but it does work if i do db = DB.open
<FromGitter> <Blacksmoke16> Dunno with out messing with it