<FromGitter>
<jwoertink> Is there anything in crystal similar to how in ruby you can do `Array(nil)` to get an empty array if the thing is nil?
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
<FromGitter>
<fridgerator> do you know the type that will be in the array?
<FromGitter>
<fridgerator> like `Array(String).new` ?
<FromGitter>
<jwoertink> well, like, if I pass a hash of Hash(String, Array(String)?), and do something like `params["x"]`. that value could be an array of strings, or nil
<FromGitter>
<jwoertink> so with ruby, I would do something like `Array(params["x"]).empty?`
<FromGitter>
<jwoertink> because it will either be an empty array or an array of strings
<FromGitter>
<fridgerator> i dont know if the `not_nil!` is necessary
<FromGitter>
<jwoertink> bleh :p That's what I figured
<FromGitter>
<fridgerator> yeah I don't know of a way without checking for nil
<FromGitter>
<jwoertink> cool, thanks
<FromGitter>
<jipiboily> Hey folks! I'm super new here, didn't even go through the doc yet...looking at the tools to see if I can do what I want, easily.
<FromGitter>
<jipiboily> Is there an ORM that's kinda used by a good chunk of the community?
<FromGitter>
<jipiboily> I saw it, as well as like 6 or 7 others, none seemed very popular at first. Is crecto *wildly* used?
<FromGitter>
<fridgerator> I don't know if any of them are wildly used at this point
<FromGitter>
<jipiboily> fair enough
<FromGitter>
<jwoertink> Yeah, by "wildly", do you mean by like more than 5 people?
<FromGitter>
<jipiboily> I don't have a def, but I guess, maybe a decent percentage of the crystal community...doesn't look like any has this traction at first. And your answers sort of confirms my theory :)
<FromGitter>
<jipiboily> so, most people are just doing plain SQL, with like crystal-pg?
<FromGitter>
<jipiboily> When using a DB, that is.
<FromGitter>
<fridgerator> I wrote crecto because I liked how ecto separates the business logic from the database logic
<FromGitter>
<fridgerator> whereas with active record everything is in the model
<FromGitter>
<jwoertink> I'm doing manual SQL for now because I'm still trying to get my crystal work flow going. I tried active_record but it didn't seem updated often
<FromGitter>
<jipiboily> gotcha; I like that. Will look. Any big features still to be done that I should be aware is lacking?
<FromGitter>
<jwoertink> I like how crecto is being setup, so I'll end up switching to that
<FromGitter>
<jipiboily> yeah, also saw active_record.cr wasn't very active.
<FromGitter>
<jipiboily> I'll give it a shot. kermal + crecto seems like what I'll try.
<FromGitter>
<jipiboily> Thanks folks! :)
<FromGitter>
<fridgerator> only supports mysql and postgres right now
<FromGitter>
<jipiboily> all I need is pg, so I'm good.
<FromGitter>
<jipiboily> Is there a Crystal Conference yet?
<FromGitter>
<jipiboily> @ukd1 you should organize a Crystal conf in SF :D
<FromGitter>
<fridgerator> there has been some meetups in various places, I thought I read about something they were trying to organize in SF
<FromGitter>
<jipiboily> I used to work with @ukd1 who I think is organizing the SF meetup...hopefully he knows. Right Russ?
<FromGitter>
<jipiboily> ok, another noob question here...well, not noob, but I like to know what's idiomatic and/or common when learning new languages and tools. Is there a more common way to build web apps in Crystal? More specifically, is it more generally accepted to build a backend app which is just an API with a front-end app in React or Angular, or people are often rendering views on the server side?
<FromGitter>
<jipiboily> I might go the Crystal+React route...but curious to what's common, if there is anything common, yet!
<FromGitter>
<jwoertink> I don't think anything is really common yet
<FromGitter>
<jipiboily> gotcha
<FromGitter>
<fridgerator> I think its a preference thing
<FromGitter>
<jwoertink> The language itself is only about ~3 years old, and really only start gaining some serious traction in the past year ish
<FromGitter>
<fridgerator> but IMO a lot of people are moving towards more of a microservice architecture, where the backend and frontend are separate
<FromGitter>
<jipiboily> Exciting stuff so far.
<FromGitter>
<jwoertink> me personally, I can't stand react or angular, so I render views on server side, but yeah, all about preference
<FromGitter>
<jipiboily> :+1:
<FromGitter>
<jipiboily> Thanks guys
<FromGitter>
<jwoertink> Welcome to the community!
<FromGitter>
<jipiboily> :heart:
<FromGitter>
<jwoertink> Now there's 9 of us!
<FromGitter>
<jwoertink> :D
<FromGitter>
<jipiboily> lol
<FromGitter>
<fridgerator> "there are literally dozens of us"
Ven has quit [Ping timeout: 246 seconds]
<FromGitter>
<jwoertink> hahah. Baker's dozen
Ven has joined #crystal-lang
bew78 has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<bew78>
Hi, is it possible to parse a json looking like: `[1, 2, 3]` with JSON.mapping ?
<FromGitter>
<jipiboily> What are you folks using for database migrations? `micrate` is not working here, and can't find why at first; maybe there's an alternative?
<FromGitter>
<jwoertink> lol
<FromGitter>
<jwoertink> Ruby
<FromGitter>
<jipiboily> :)
<FromGitter>
<jwoertink> I tried micrate and ran in to issues, so for now I just use Ruby to supplement what I can't do easily in crystal
Ven has quit [Read error: Connection reset by peer]
xmonader has quit [Remote host closed the connection]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 268 seconds]
Ven has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Qchmqs has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Ven has quit [Ping timeout: 264 seconds]
Ven has joined #crystal-lang
bew78 has quit [Quit: WeeChat 1.7]
bew has joined #crystal-lang
bew is now known as bew78
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Ven has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ven has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
Ven has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
olek_poz has quit [Ping timeout: 260 seconds]
alibby has joined #crystal-lang
Ven has quit [Ping timeout: 246 seconds]
Ven has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
Philpax has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
Qchmqs has quit [Quit: Konversation terminated!]
greengriminal has joined #crystal-lang
A124 has quit [Quit: '']
Ven has quit [Ping timeout: 258 seconds]
A124 has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 258 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 256 seconds]
Ven has joined #crystal-lang
olek_poz has joined #crystal-lang
bew78 has quit [Quit: WeeChat 1.7]
pawnbox has quit [Remote host closed the connection]
Ven has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 256 seconds]
pawnbox has joined #crystal-lang
bmcginty has quit [Ping timeout: 240 seconds]
bmcginty has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
<adam12>
dyld: Library not loaded: /usr/local/opt/libevent/lib/libevent-2.0.5.dylib
<adam12>
Hmph interesting.
<adam12>
libevent: stable 2.1.8 (bottled)
<adam12>
I guess that explains why the 2.0.5 version isn't found .. but I wonder how other Crystal'ers are handling this.
<FromGitter>
<jipiboily> I had this yesterday when trying the brew version of migrate. Used their Crystal APPi instead. Also wondering what's up with that.
<adam12>
I could build from source instead of using brew version, but I have my own things I thought about distributing so it makes sense maybe to figure out this linking bit.
bew78 has joined #crystal-lang
<bew78>
How do I simply transform an Array(Array(T)) to Array(T) by merging all the arrays ?
<Papierkorb>
maybe I should create a github pages block and write stuff like this down. Something's telling me you'll not be the last who asks about this.
<FromGitter>
<elorest> Thanks for your help. It works when I provide the entire path: "@[Link(ldflags: "/Users/isaac/workspace/hello_c/helloworld.o")] ⏎ "
<FromGitter>
<elorest> I've spent the last 4 hours reading everything I could find about linking on stackoverflow, google pages, github issues.
<Papierkorb>
elorest, the quick rundown is that Crystal uses an external linker (not sure if it's `gcc` or using `ld` or whatever for that). So in fact you can write anything in the ldflags: argument there to have it copied *verbatim* to the linker line
<Papierkorb>
elorest, your same code, try the build command and pass --cross-compile to it. It'll print a gcc line to use to link your program. You'll see it copied your helloworld.o path to it
<FromGitter>
<elorest> Yeah I noticed that. Thanks. This seems to work fine: "@[Link(ldflags: "#{__DIR__}/helloworld.o")]"
<Papierkorb>
elorest, that's even abused by Crystal itself: Passing $(), or ``, enables you to run code, effectively allowing you to e.g. use tools pkg-config to grab correct ldflags. I fear all of this makes much more sense if you have a C background
<Papierkorb>
Good to know, thought about asking you to try that too
<FromGitter>
<elorest> thanks for your help I'm working on writing a wrapper around bluez for bluetooth support in linux.
bjz has joined #crystal-lang
<FromGitter>
<elorest> I've done a decent amount with c++ but basically nothing with c unfortunately. Thanks so much for your help