<FromGitter>
<fridgerator> you can use it to generate bindings for you
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter>
<MrSorcus> @fridgerator I know about this shard, but i want to do it by hands...
<FromGitter>
<fridgerator> ah
<FromGitter>
<bew> It would be something like `fun binn_is_valid(ptr : Void*, type : Int32*, count : Int32*, size : Int32*) : Bool`
<FromGitter>
<bew> And for type, count & size you can use `out` syntax to help
<FromGitter>
<MrSorcus> > It would be something like `fun binn_is_valid(ptr : Void*, type : Int32*, count : Int32*, size : Int32*) : Bool` ⏎ With this i have no problems. ⏎ > And for type, count & size you can use `out` syntax to help ⏎ Thanks, i will try it. [https://gitter.im/crystal-lang/crystal?at=5a0cd75b982ea2653f84a762]
<FromGitter>
<MrSorcus> @bew Oh, it's so easy. Thank you so much.
<FromGitter>
<bew> You're welcome;)
<hightower4>
How do I print value of errno? E.g. if I call File.readable?( some_file) and want to see the original error from the syscall
<FromGitter>
<bew> I so think errno is set when determining if the file is readable or not, it not an error if the file is not
<FromGitter>
<faultyserver> I'm getting a "no such app"
<hightower4>
bew right, right. But let's say I ask for .readable? and it gets Permission denied while running a stat() or something. So I'd like to get that error out.
<FromGitter>
<drosehn> Note that you have to capture the value of Errno *immediately* after the return from the system routine which failed. If anything you do calls some other system routine, then all bets are off as to what `Errno.value` will have in it.
<FromGitter>
<drosehn> Also, you should not check the value of Errno unless the system routine you called did fail. If it succeeded, then you might get the value of Errno from some earlier call to a system routine.
<FromGitter>
<codenoid> can i "upload" a file within HTTP::Client with *`multipart/form-data
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lacour has quit [Quit: Leaving]
sz0 has quit [Quit: Connection closed for inactivity]
illy_ has quit [Remote host closed the connection]
balduin has quit [Ping timeout: 268 seconds]
balduin has joined #crystal-lang
<FromGitter>
<jwaldrip> is 0.24.0 stable. my homebrew did not get the latest
qard has joined #crystal-lang
<FromGitter>
<marksiemers> @jwaldrip - it is not. the next stable release will be 0.24.1 AFAIK
<FromGitter>
<marksiemers> I don't know the details, but there was a mistake in the release and versioning process, I think
<FromGitter>
<jwaldrip> gotcha
<FromGitter>
<jwaldrip> gotcha makes sense. Its been quite awhile since they have cut a full release. I hope everything is kosher over at manas. :-/
DTZUZO has quit [Ping timeout: 248 seconds]
<FromGitter>
<jwaldrip> Also hope we can still look forward to a 1.0 release near the first of the year as they stated last year.
<FromGitter>
<marksiemers> @faustinoaq - I see you created the vscode-crystal-lang extension. ⏎ Is that how you got the debugging tools to work, or is there something else that did that?
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<ziprandom> hey @sdogruyol I'm trying to implement an api wrapper with kemal that proxies requests to another api. basically feeding the request made to the server into HTTP::Client like this: https://pastebin.com/uhMzFPxN works nice for get but breaks for post: "Content-Length header is 1526 but body had 0 bytes (ArgumentError)"
<FromGitter>
<sdogruyol> hmm I remember an issue like that
<FromGitter>
<sdogruyol> have you tried Kemal master?
<FromGitter>
<sdogruyol> (meanwhile pastebin is blocked here..)
<FromGitter>
<sdogruyol> can you share a gist instead?
<FromGitter>
<ziprandom> hmm, no because if incompatibilities
<FromGitter>
<ziprandom> using crystal 0.23.1
<FromGitter>
<ziprandom> kemal master uses 0.24 already, no?
<Papierkorb_>
Looks like I'll have to relicense affected shards. "fun times ahead."
<Papierkorb_>
To something equally restrictive (or more restrictive, within reason), but with a "your patents are mine now" clause like modern GPLs do.
<sevensidedmarble>
I've never thought about it too indepth
<sevensidedmarble>
I always just ust the MIT license
<Papierkorb_>
sevensidedmarble: So yeah, um do what the `MUST` block on the right tells you. If you're unsure, just ask again
<Papierkorb_>
Man licenses suck
<sevensidedmarble>
is including the mpl in my same LICENSE file best practice?
<sevensidedmarble>
or is it better to use a seperate file?
hightower2 has joined #crystal-lang
<Papierkorb_>
What you usually do if you have multiple licenses in your project is to have a `LICENSE.X` file per license, with X being the short name of the license
<Papierkorb_>
like `LICENSE.MIT` and `LICENSE.MPL2`. FOSS projects tend to use COPYING over LICENSE as name prefix, but that makes no difference really
<Papierkorb_>
At the end of your README, in your License section, you put what license you use (Didn't the crystal project generator already do that?). You can append a short notice there that the file(s) at `src/foo/bar.cr` use the MPL-2 license.
<sevensidedmarble>
ah alright
<Papierkorb_>
Honestly, there's barely a right or wrong on how to do it.
<sevensidedmarble>
also yeah the default crystal generator doesnt have a license section for the generated readme
<sevensidedmarble>
thanks thats helped a lot
<sevensidedmarble>
I've always felt a little intimidated by modifying others source code because of fear of fucking up the license stuff
<Papierkorb_>
Don't worry too much. "Best effort basis" is legit, and no sane person will just go out of their way and sue you to oblivion. At worst case, you may get a snarky email.
<Papierkorb_>
And even if they want to sue you, they have to in your jurisdiction. If someone would sue me in the US, I couldn't care less: “Wrong continent, buddy.”
<FromGitter>
<bararchy> ^this is why patent rules don't really hold up
rohitpaulk has quit [Ping timeout: 255 seconds]
<sevensidedmarble>
man I do not not understand nearly enough about macros in crystal
<sevensidedmarble>
I dont grok when/why theyre useful at all
<Groogy>
I probably overuse them to make my own DSL
<Groogy>
good to make your code more readable instead of copy pasting everywhere
<FromGitter>
<extremety1989> can someone make exemple with postgres CRUD ?
<FromGitter>
<sdogruyol> @Papierkorb that's some good Crystal macro code
<faustinoaq>
Hi, Why crystal don't declaration files like `.h` in C? Aren't declaration files useful for a typed language?
<Papierkorb_>
... huh? Why?
<FromGitter>
<sdogruyol> no, they're redundant..
<faustinoaq>
s/don't declaration/doesn't have declaration/
<Papierkorb_>
header files are really C/++ centric
<Papierkorb_>
They're only really useful if your language is split into translation units that can be compiled separately, to allow distribution of these units (aka static/dynamic libs) to be later easily written code for
<Papierkorb_>
Without sharing the original source code
<Papierkorb_>
Which simply doesn't apply to Crystal, nor Rust, nor ...
<Groogy>
Only old languages have header files
<Groogy>
it's a remnant from how bad compilers used to be
<Groogy>
Not even D has it
<FromGitter>
<sdogruyol> not even go
<Papierkorb_>
Though I did like it at some point to separate lengthy in-source docs from the implementation
<Groogy>
but it can generate it for you if you want to share the library
rohitpaulk has quit [Ping timeout: 248 seconds]
<Groogy>
but not the source
<Papierkorb_>
docs into the header for API description (Which it does anyway)
<watzon>
Very little financial backing, but a great community
<sevensidedmarble>
and it doesnt match char.ord to the value 17 for some reason
<sevensidedmarble>
never mind I'm stupid
<sevensidedmarble>
I didnt know you had to call .value on the enums members
<Groogy>
yeah enum is its own type
<FromGitter>
<claisne> you can do better @Sevensidedmarble if im not mistaken you can type: when Keys::ctrlQ?
<faustinoaq>
Groogy, Papierkorb_, @sdogruyol Yep, declaration files are a bit redundant, I tried modules with abstract methods in crystal https://carc.in/#/r/33m1 just for fun :)
<Groogy>
I mean I kind of do that for my backend in Boleite
<Groogy>
so I can in the future switch between OpenGL, DirectX and Vulkan
<FromGitter>
<extremety1989> i read that using structs better than classes
<Groogy>
then you read wrong?
<Groogy>
they have two vastly different behaviours, if you don't want the behaviour struct gives you, then you don't want structs
<faustinoaq>
"So how do you choose between a struct and a class? The rule of thumb is that if no instance variable is ever reassigned, i.e. your type is immutable, you could use a struct, otherwise use a class." ...
<Groogy>
if he is recommending you to prefer structs you shouldn't listen to him
<Groogy>
the only higher overhead is going to be memory allocation, but if you do the same on the stack you are going to get stackoverflow
<Groogy>
also if something is on the stack it is going to get copied everywhere, so if the struct is big enough it will mean everytime you use it, it is going to have a significant overhead
<FromGitter>
<extremety1989> i just started 2 days ago with crystal, i am javascripter))
<Groogy>
that's fine, it's a common mistake people do in other languages as well
<Papierkorb_>
Groogy: The amount of people not understanding what the heap/stack (not) is is too damn high
<Groogy>
heh yeah
<Groogy>
extreme that error looks sort of as if one of the repositories got updated and another haven't updated to a new thing
<Groogy>
or something
<Groogy>
if you have the HEAD of both
<FromGitter>
<extremety1989> what i hate about crystal libraries, there are few exemples..
<Papierkorb_>
Have you checked the docs?
rohitpaulk has joined #crystal-lang
<FromGitter>
<extremety1989> yeah,nothing found
<FromGitter>
<extremety1989> i just need to find good tutorial with postgres
rohitpaulk has quit [Ping timeout: 248 seconds]
Papierkorb_ has quit [Remote host closed the connection]
greengriminal has joined #crystal-lang
flaviodesousa has quit [Ping timeout: 248 seconds]
mark_66 has quit [Quit: Leaving.]
t-richards has quit [Quit: Connection closed for inactivity]
rohitpaulk has joined #crystal-lang
txdv has joined #crystal-lang
DTZUZO has joined #crystal-lang
qard has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
lacour has joined #crystal-lang
hightower3 has joined #crystal-lang
hightower4 has quit [Ping timeout: 240 seconds]
claisne has joined #crystal-lang
rohitpaulk has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
greengriminal has quit [Quit: This computer has gone to sleep]
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
greengriminal has joined #crystal-lang
claisne has quit [Quit: WeeChat 1.9.1]
<FromGitter>
<marksiemers> @sdogruyol - RE: the TFB. You may be right about using the `Fast` pipe. A few points there: ⏎ ⏎ 1) I'm trying to gather info, if that Fast pipe significantly speeds up plaintext (and/or json) on TE's hardware, then (at least for amber) it may mean we consider replacing or augmenting `radix` for routing. ⏎ 2) Using custom pipes is normal for amber, while this particular pipe looks hacky, the overall
<FromGitter>
... approach would be "normal" for an amber app. ⏎ 3) As-is, the fast pipe doesn't actually by-pass radix entirely, amber still uses it to see if it is a "valid" route. Still, in my local testing, we saw a relative performance gain (> 25%). Since we haven't been able to replicate the relative (amber vs crystal-raw) slowness in our ow ... [https://gitter.im/crystal-lang/crystal?at=5a0dde96f257ad9109a346d4]
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter>
<marksiemers> @Papierkorb_ for the JSON serialization and plaintext, that is exactly what those tests are for - known, hardcoded values. There are separate tests for dynamic data and incorporated databases. ⏎ The plaintext and JSON serialization are where we see a huge an unexpected difference between crystal-raw and kemal & amber. ⏎ A difference we can't reproduce, so we're trying to make educated guesses and see
<FromGitter>
... what (if any) difference it makes.
greengriminal has quit [Quit: This computer has gone to sleep]
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb>
it not using the libc isn't really important. It's a huge maintenance burden, and if you have any single C lib in your program, then you also need the libc. If that's worth it ..
qard has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]