00:00
<
FromGitter >
<Blacksmoke16> oh
00:01
<
FromGitter >
<Blacksmoke16> crystal handles it for me
00:01
<
FromGitter >
<tenebrousedge> o.o
00:01
<
FromGitter >
<tenebrousedge> yay Crystal ?
00:03
<
FromGitter >
<Blacksmoke16> by handle it for me i mean it knows to not return the body
00:04
<
FromGitter >
<Blacksmoke16> so i can just define another action thats the same as the GET version
00:05
<
FromGitter >
<tenebrousedge> yay! :D
00:06
<
FromGitter >
<Blacksmoke16> Yea, makes my life easier
00:14
Nicolab has quit [Quit: Leaving.]
00:22
alex`` has quit [Quit: WeeChat 2.7]
00:27
ur5us has quit [Ping timeout: 260 seconds]
00:28
<
sorcus >
Good night everyone.
00:42
ur5us has joined #crystal-lang
01:43
_whitelogger has joined #crystal-lang
01:47
return0e has quit []
02:02
gangstacat has quit [Ping timeout: 248 seconds]
03:08
uu91 has quit [Remote host closed the connection]
03:18
gangstacat has joined #crystal-lang
03:21
duane has joined #crystal-lang
04:33
ur5us has quit [Ping timeout: 260 seconds]
04:46
<
FromGitter >
<spTorin> How I can build crystal project without type filename.cr? Just `crystal build` in project dir don't work.
04:47
<
FromGitter >
<Blacksmoke16> then `shards build`
04:52
gangstacat has quit [Quit: Δis!]
04:53
<
FromGitter >
<grkek> @Blacksmoke16 how does granite handle the connections ? If I make a connection is it stored in the global scope ?
04:55
<
FromGitter >
<Blacksmoke16> is added to there
04:55
gangstacat has joined #crystal-lang
04:55
<
FromGitter >
<grkek> So as long as I require granite in some file I am able to access the connection right ?
04:56
<
FromGitter >
<spTorin> Oh, I see. If needed to compile one file - `crystal build`. If need build project - always use `shards build`. Tnx!
04:56
<
FromGitter >
<Blacksmoke16> should be fine yea, its defined on the class level
04:56
<
FromGitter >
<grkek> Nice
04:57
<
FromGitter >
<Blacksmoke16> by default if you dont supply a connection in your model it'll use the first
04:57
<
FromGitter >
<grkek> I also have weird errors when trying to shard install the deps
04:57
<
FromGitter >
<Blacksmoke16> about `crystal-db`?
04:57
<
FromGitter >
<grkek> yeah
04:57
<
FromGitter >
<grkek> couldn't resolve db ~> 0.7.0
04:57
<
FromGitter >
<grkek> 1) 8.0
04:58
<
FromGitter >
<grkek> you're a hero
04:58
<
FromGitter >
<Blacksmoke16> i try
04:58
<
FromGitter >
<grkek> thank you a lot
04:58
<
FromGitter >
<Blacksmoke16> @spTorin yea `crystal build` will compile a (single?) file, however `shards build` also does additional things like installing dependencies if needed
04:59
<
FromGitter >
<Blacksmoke16> before building each target
04:59
<
FromGitter >
<Blacksmoke16> `shards build --production` will not install develop dependencies for example
04:59
<
FromGitter >
<Blacksmoke16> as well as adding the `--release` flag
05:01
<
FromGitter >
<grkek> the --release flag is so tasty mmh
05:06
<
FromGitter >
<grkek> is this a known issue some sort of ?
05:06
<
FromGitter >
<grkek> @Blacksmoke16
05:06
<
FromGitter >
<Blacksmoke16> did you include an adapter?
05:06
<
FromGitter >
<Blacksmoke16> require*
05:06
<
FromGitter >
<grkek> oh my I forgot that
05:06
<
FromGitter >
<grkek> :D
05:10
<
FromGitter >
<Blacksmoke16> that would do it
05:14
<
FromGitter >
<grkek> Yeah it worked nicely
05:15
<
FromGitter >
<Blacksmoke16> π
05:15
<
FromGitter >
<grkek> what is the engine for sqlite ?
05:15
<
FromGitter >
<Blacksmoke16> hm?
05:15
<
FromGitter >
<grkek> `User.migrator(table_options: "ENGINE=InnoDB DEFAULT CHARSET=utf8").create`
05:15
<
FromGitter >
<grkek> but for sqlite
05:15
<
FromGitter >
<grkek> that is for mysql right
05:15
<
FromGitter >
<grkek> ?
05:15
<
FromGitter >
<Blacksmoke16> yea
05:16
<
FromGitter >
<grkek> what does sqlite use
05:16
<
FromGitter >
<grkek> since I got this error
05:16
<
FromGitter >
<grkek> `no driver was registered for the schema "sqlite", did you maybe forget to require the database driver? (ArgumentError) β `
05:16
<
FromGitter >
<Blacksmoke16> no that means you didnt register a connection
05:16
<
FromGitter >
<Blacksmoke16> er
05:16
<
FromGitter >
<Blacksmoke16> nvm
05:16
<
FromGitter >
<Blacksmoke16> did you install the sqlite shard?
05:17
<
FromGitter >
<grkek> yeah
05:17
<
FromGitter >
<Blacksmoke16> and did like `require "granite/adapter/sqlite"`?
05:17
<
FromGitter >
<grkek> yes
05:19
<
FromGitter >
<grkek> these two are currently what I am using
05:20
<
FromGitter >
<Blacksmoke16> hmm
05:21
<
FromGitter >
<Blacksmoke16> same issue if you remove mysql/pg stuff?
05:21
<
FromGitter >
<grkek> w8
05:21
<
FromGitter >
<grkek> yup
05:22
<
FromGitter >
<Blacksmoke16> whats your shard.yml look like
05:24
<
FromGitter >
<Blacksmoke16> that error is coming from `crystal-db` so its like the driver shards aren't being required correctly
05:25
<
FromGitter >
<grkek> I'll do an Shards update
05:25
<
FromGitter >
<grkek> w8
05:25
<
FromGitter >
<grkek> db 0.7.0
05:25
<
FromGitter >
<grkek> nope, same issue
05:26
<
FromGitter >
<Blacksmoke16> hrm
05:29
<
FromGitter >
<grkek> It's a bug I guess ?
05:29
<
FromGitter >
<Blacksmoke16> dunno, let me see if i can reproduce i guess
05:30
<
FromGitter >
<grkek> Go for it
05:34
duane has quit [Ping timeout: 240 seconds]
05:35
<
FromGitter >
<Blacksmoke16> also happens on db 0.8.0
05:36
<
FromGitter >
<grkek> the same thing ?
05:36
<
FromGitter >
<Blacksmoke16> yes
05:36
<
FromGitter >
<Blacksmoke16> not sure whats up
05:37
<
FromGitter >
<grkek> well, my first bug discovered :D
05:37
<
FromGitter >
<Blacksmoke16> ohh
05:38
<
FromGitter >
<Blacksmoke16> your connection string needs to supply the "protocal"
05:38
<
FromGitter >
<grkek> the protocol ?
05:38
<
FromGitter >
<grkek> where ?
05:38
<
FromGitter >
<Blacksmoke16> `sqlite3:./data.db`
05:38
<
FromGitter >
<grkek> I do have that
05:38
<
FromGitter >
<grkek> sqlite://./db.sqlite3
05:38
<
FromGitter >
<grkek> does it have to be like
05:38
<
FromGitter >
<grkek> sqlite3:
05:38
<
FromGitter >
<grkek> ?
05:39
<
FromGitter >
<Blacksmoke16> yes
05:39
<
FromGitter >
<grkek> oml this is so stupid
05:39
<
FromGitter >
<grkek> why
05:39
<
FromGitter >
<grkek> is there a version of sqlite
05:39
<
FromGitter >
<grkek> other than 3
05:39
<
FromGitter >
<Blacksmoke16> prob 1 and 2? :p
05:39
<
FromGitter >
<grkek> used widely as the 3rd
05:40
<
FromGitter >
<grkek> Okay it worked nicely now
05:41
<
FromGitter >
<Blacksmoke16> π
05:41
<
FromGitter >
<grkek> yet again a hero we need but we dont deserve
05:48
<
FromGitter >
<Blacksmoke16> you flatter me
05:51
<
FromGitter >
<grkek> global variables
05:51
<
FromGitter >
<grkek> are no where to be found ?
05:51
<
FromGitter >
<grkek> like does crystal not support them ?
05:51
<
FromGitter >
<Blacksmoke16> no
05:51
<
FromGitter >
<Blacksmoke16> can use a module with some class methods tho
05:51
<
FromGitter >
<Blacksmoke16> what are you trying to do?
05:52
<
FromGitter >
<grkek> nothing just interested
05:52
<
FromGitter >
<grkek> also wouldn't it be better to use structs for granite models ?
05:52
<
FromGitter >
<Blacksmoke16> no, because they should be mutable
05:53
<
FromGitter >
<grkek> oh right the struct is immutable
05:55
<
FromGitter >
<grkek> My framework went from 90k rps
05:55
<
FromGitter >
<grkek> to 124 in couple of secs
05:55
<
FromGitter >
<grkek> when I tried to create a db entry for each
05:55
<
FromGitter >
<grkek> request
05:55
<
FromGitter >
<grkek> I fucking hate sql databases and would love to use a built in one
05:56
<
FromGitter >
<grkek> a key/value one to be specific
05:56
<
FromGitter >
<grkek> like a leveldb
05:56
<
FromGitter >
<grkek> but that would mean no more multiple instances
05:57
<
FromGitter >
<Blacksmoke16> would always make a PR π
05:57
<
FromGitter >
<Blacksmoke16> depending on what you're doing maybe use redis
05:57
<
FromGitter >
<Blacksmoke16> 124 sounds quite slow tho
05:58
<
FromGitter >
<Blacksmoke16> what are you doing?
05:58
<
FromGitter >
<grkek> its not the frameworks fault probably
05:58
<
FromGitter >
<grkek> t. not the sql guy
05:58
<
FromGitter >
<Blacksmoke16> you can do `Post.create name: "foo", body: "bar"` btw
05:59
<
FromGitter >
<Blacksmoke16> news it up with those args then saves it and returns the saved instance
05:59
<
FromGitter >
<grkek> damn nice
06:00
<
FromGitter >
<grkek> but yeah
06:00
<
FromGitter >
<grkek> 124 too slow
06:00
<
FromGitter >
<grkek> I might just go with levels db and no-sql
06:00
<
FromGitter >
<Blacksmoke16> why bother implementing a DB in the first place, leave it up for the user to decide which they want
06:00
<
FromGitter >
<grkek> Is postgres any faster
06:01
<
FromGitter >
<grkek> since this is a direct IO
06:01
<
FromGitter >
<grkek> operation
06:01
<
FromGitter >
<grkek> Same speed
06:01
<
FromGitter >
<grkek> :D
06:01
<
FromGitter >
<grkek> well this has been a great journey
06:02
<
FromGitter >
<grkek> my friends but I have to kill myself now
06:03
<
FromGitter >
<grkek> ill try with preview_mt now
06:04
<
FromGitter >
<grkek> it got worse
06:04
<
FromGitter >
<grkek> its at 41 now
06:04
<
FromGitter >
<grkek> why do sql databases even exist
06:04
ht_ has joined #crystal-lang
06:08
<
FromGitter >
<grkek> now that is tasty
06:51
ht_ has quit [Remote host closed the connection]
06:52
<
FromGitter >
<grkek> 22k for writes
06:52
<
FromGitter >
<grkek> damn nice
06:52
<
FromGitter >
<grkek> beat the minikeyvalue storage
06:52
<
FromGitter >
<grkek> george hotz made :D
07:12
return0e has joined #crystal-lang
07:17
<
FromGitter >
<grkek> this is what I came up with
07:17
<
FromGitter >
<grkek> `connection :database`
07:17
<
FromGitter >
<grkek> the symbol is treated as the path of the database
07:18
<
FromGitter >
<grkek> you can also pre-define it in a global context instead of accessing it directly
07:18
<
FromGitter >
<grkek> if you misspell the defined database and the connection a warning message will pop up
07:19
<
FromGitter >
<grkek> changed it to storage
07:20
<
FromGitter >
<grkek> so it is more explicit via naming
07:20
<
FromGitter >
<grkek> connection seemd a bit confusing :D
07:23
<
FromGitter >
<grkek> and decided to use json serializers
07:23
<
FromGitter >
<grkek> as my models
07:41
<
FromGitter >
<codenoid> very cool
07:50
<
FromGitter >
<grkek> @codenoid
07:50
<
FromGitter >
<grkek> updated it
08:07
yukai has quit [Ping timeout: 268 seconds]
08:41
ur5us has joined #crystal-lang
08:55
Nicolab has joined #crystal-lang
09:05
<
FromGitter >
<Nicolab> Hello
09:09
<
FromGitter >
<grkek> Hi @Nicolab
09:29
uu91 has joined #crystal-lang
09:36
<
FromGitter >
<grkek> the storage symbol acts as a path to the database
09:37
<
FromGitter >
<grkek> so basically doing this
09:37
<
FromGitter >
<grkek> `:"database_name/example"`
09:37
<
FromGitter >
<grkek> acts as if it were a table in the database
09:37
<
FromGitter >
<grkek> but in reality it creates another database in the database folder
09:38
<
FromGitter >
<j8r> little advice: avoid symbols, they are not type-safe
09:38
<
FromGitter >
<grkek> and if you want to access data from two tables you would do something like this
09:39
<
FromGitter >
<grkek> the thing is that I convert the symbols to strings at the end so it doesn't matter
09:39
<
FromGitter >
<grkek> redefine the storage
09:40
<
FromGitter >
<grkek> to overwrite the previous definition
09:40
<
FromGitter >
<grkek> idk
09:42
<
FromGitter >
<grkek> if that looks awful
09:42
<
FromGitter >
<grkek> then you can do this
09:43
<
FromGitter >
<grkek> is it okay to use begin / rescue since I've had many warnings about avoiding begin
09:43
<
FromGitter >
<grkek> from ameba
09:43
<
FromGitter >
<grkek> @j8r
09:43
<
FromGitter >
<j8r> @grkek use strings then
09:44
<
FromGitter >
<j8r> using symbols to convert to strings is useless
09:44
<
FromGitter >
<grkek> hm
09:44
<
FromGitter >
<grkek> you are right
09:44
<
FromGitter >
<grkek> I thought it looked cool
09:44
<
FromGitter >
<grkek> :D
09:44
<
FromGitter >
<grkek> and it can be typed faster than strings
09:44
<
FromGitter >
<grkek> : <- one symbol
09:44
<
FromGitter >
<grkek> "" <- two symbols
09:45
<
FromGitter >
<grkek> nah I like symbols
09:45
<
FromGitter >
<grkek> ill let them in
09:45
ur5us has quit [Ping timeout: 260 seconds]
09:45
<
FromGitter >
<grkek> or not
09:45
<
FromGitter >
<grkek> see you manipulated me
09:45
<
FromGitter >
<grkek> :D
10:49
DTZUZO has joined #crystal-lang
11:16
<
FromGitter >
<grkek> how to remove a property from a class programatically ?
11:18
<
FromGitter >
<j8r> there is talk to remove them in the future
11:19
<
FromGitter >
<j8r> that's not idiomatic Crystal
11:19
<
FromGitter >
<j8r> you can remove a property from a class, no sure to understand?
11:20
<
FromGitter >
<grkek> that is very sad
11:20
<
FromGitter >
<j8r> so one can see all possible values
11:20
<
FromGitter >
<grkek> I like symbols
11:22
<
FromGitter >
<grkek> for example I have a password field in a json mapped user object
11:22
<
FromGitter >
<grkek> and I don't want to display that password field
11:22
<
FromGitter >
<grkek> what do I do then ?
11:26
<
FromGitter >
<j8r> just an ivar?
11:26
<
FromGitter >
<grkek> ivar ?
11:26
<
FromGitter >
<grkek> instance var
11:26
<
FromGitter >
<j8r> instance variable
11:26
<
FromGitter >
<grkek> it is an instance variable yes
11:27
<
FromGitter >
<j8r> `@password : String`
11:27
<
FromGitter >
<grkek> when it receives a string it encodes
11:27
<
FromGitter >
<grkek> true I have that
11:27
<
FromGitter >
<j8r> it is not exposed then
11:27
<
FromGitter >
<grkek> how do I make it temporarily disappear
11:27
<
FromGitter >
<grkek> when it is converted to json
11:27
<
FromGitter >
<grkek> with mapping
11:27
<
FromGitter >
<grkek> it is
11:27
<
FromGitter >
<j8r> I guess you'll have to write a custom `to_json` that deletes the value
11:28
<
FromGitter >
<j8r> that do `@password = ""`
11:28
<
FromGitter >
<grkek> instant kms
11:28
<
FromGitter >
<j8r> let me try
11:30
<
FromGitter >
<j8r> ok you can just do it manually at the end?
11:30
<
FromGitter >
<grkek> How can I do it manually ?
11:30
<
FromGitter >
<grkek> I mean I want to but how
11:31
<
FromGitter >
<grkek> one option is that
11:31
<
FromGitter >
<grkek> custom to_json function
11:31
<
FromGitter >
<grkek> ill edit the mapping macro
11:31
<
FromGitter >
<j8r> but there is still the possibility to use the standard, unsafe one
11:32
<
FromGitter >
<j8r> bad idea to edit the macro
11:33
<
FromGitter >
<j8r> by custom method I mean one that is in the object
11:37
<
FromGitter >
<grkek> why is it a bad idea to edit the macro ?
11:38
<
FromGitter >
<j8r> of the stdlib?
11:38
<
FromGitter >
<grkek> yeah
11:38
<
FromGitter >
<j8r> by monkey-patching, it will impact every object, and everyone using your lib
11:39
<
FromGitter >
<grkek> I wont monkey-patch it
11:39
<
FromGitter >
<grkek> I will rename
11:39
<
FromGitter >
<grkek> and re-define
11:39
<
FromGitter >
<grkek> it
11:39
<
FromGitter >
<j8r> ha ok, but not necessary
11:39
<
FromGitter >
<j8r> jut call the method
11:39
<
FromGitter >
<grkek> what are your suggestions
11:39
<
FromGitter >
<j8r> and do after the call `@password = ""`
11:39
<
FromGitter >
<j8r> give me several minutes
11:39
<
FromGitter >
<j8r> brb
11:40
<
FromGitter >
<grkek> okay
11:45
alex`` has joined #crystal-lang
11:53
<
FromGitter >
<j8r> same thing with mapping
11:56
<
FromGitter >
<grkek> thats a nice solution
11:56
<
FromGitter >
<grkek> but I came up with something else
11:56
<
FromGitter >
<grkek> thank you anyways !
11:57
<
FromGitter >
<j8r> and you will have to maintain the method if you just copy-paste and edit the stdlib method
11:57
<
FromGitter >
<j8r> there are new features sometimes
12:07
<
FromGitter >
<grkek> Yes I know that I will have to maintain the method thank you !
12:07
<
FromGitter >
<j8r> np!
12:25
Nicolab has quit [Ping timeout: 258 seconds]
13:01
<
FromGitter >
<grkek> i did it the stdlib way
13:01
<
FromGitter >
<Blacksmoke16> there are some stdlib options but nothing as nice :(
13:02
<
FromGitter >
<grkek> i made that
13:02
<
FromGitter >
<grkek> the schema is a rename of
13:02
<
FromGitter >
<grkek> JSON.mapping
13:02
<
FromGitter >
<grkek> :D
13:02
<
FromGitter >
<Blacksmoke16> oh boy, fair enough
13:02
<
FromGitter >
<grkek> if it has hidden: true it skips to render it
13:02
uu91 has quit [Remote host closed the connection]
13:02
<
FromGitter >
<grkek> but now it requires an additional .to_safe
13:02
<
FromGitter >
<grkek> method
13:03
<
FromGitter >
<grkek> by default to_json renders it with the password
13:05
<
FromGitter >
<grkek> I dont quite remember the stdlib call
13:08
<
FromGitter >
<grkek> also I hate the double space indentation
13:08
<
FromGitter >
<grkek> WHY NOT JUS TUSE TABS
13:08
<
FromGitter >
<grkek> WHAT IS WRONG WITH THIS LANGUAGE
13:13
<
FromGitter >
<j8r> tabs has also issues
13:13
<
FromGitter >
<j8r> look at Makefile
13:23
<
FromGitter >
<grkek> @j8r do you have any solution except a JSON.parse
13:24
<
FromGitter >
<grkek> i mean is there anyway to convert back to an object
13:24
<
FromGitter >
<grkek> fro ma string of json
13:24
<
FromGitter >
<grkek> withotu parse
13:24
<
FromGitter >
<grkek> :D
13:25
<
FromGitter >
<j8r> `Object.from_json`
13:26
<
FromGitter >
<grkek> I will probably think about that
13:26
<
FromGitter >
<grkek> when Itry to improve the performance
13:30
<
FromGitter >
<grkek> How to check if a class has a method or not ?
13:30
<
FromGitter >
<grkek> the method I want to execute ?
13:30
<
FromGitter >
<grkek> liek for example if u have .to.json
13:30
<
FromGitter >
<grkek> or not
13:30
<
FromGitter >
<grkek> or something like that
13:32
<
FromGitter >
<j8r> why
13:33
<
FromGitter >
<grkek> I found it
13:33
<
FromGitter >
<grkek> its okay
13:33
<
FromGitter >
<grkek> thank you
13:33
<
FromGitter >
<grkek> anyways
13:34
<
FromGitter >
<j8r> duck typing?
13:34
<
FromGitter >
<grkek> or not
13:35
<
FromGitter >
<grkek> I mean I want to know if a class has a .to_safe method or not
13:36
<
FromGitter >
<j8r> `to_safe` for the json?
13:36
<
FromGitter >
<grkek> no
13:36
<
FromGitter >
<grkek> for a calss
13:36
<
FromGitter >
<grkek> class*
13:36
<
FromGitter >
<j8r> what does this method?
13:36
<
FromGitter >
<grkek> something like this
13:36
<
FromGitter >
<grkek> if content[1] has to_safe method
13:36
<
FromGitter >
<grkek> call to_safe
13:36
<
FromGitter >
<j8r> but what is to_safe?
13:36
<
FromGitter >
<grkek> if not call to_json
13:36
<
FromGitter >
<grkek> to_safe is my own method
13:36
<
FromGitter >
<grkek> liek to_json
13:36
<
FromGitter >
<grkek> but removes the secret stuff
13:36
<
FromGitter >
<j8r> ok, so it does json stuff also
13:37
<
FromGitter >
<grkek> yeah
13:37
<
FromGitter >
<j8r> it could be in a module
13:37
<
FromGitter >
<j8r> then, include it to any object you need
13:37
<
FromGitter >
<grkek> it is in a module
13:37
<
FromGitter >
<grkek> yes
13:37
<
FromGitter >
<grkek> but I need to check
13:37
<
FromGitter >
<j8r> so check the module
13:37
<
FromGitter >
<grkek> if the passed in value has the method or not
13:37
<
FromGitter >
<grkek> how do I d othat ?
13:37
<
FromGitter >
<grkek> do*
13:37
<
FromGitter >
<j8r> `.is_a? MyModule` β If true, it means it has `to_safe`
13:38
<
FromGitter >
<grkek> Aw thats so sick
13:38
<
FromGitter >
<grkek> Error: undefined method 'to_safe' for String (compile-time type is (String | User))
13:39
<
FromGitter >
<grkek> :(
13:43
<
FromGitter >
<j8r> have you use an intermediary variable?
13:43
<
FromGitter >
<j8r> `first_content = content[1]`
13:43
<
FromGitter >
<grkek> yes i use that
13:44
<
FromGitter >
<j8r> strange, can you carc.in a reduced example?
13:45
<
FromGitter >
<grkek> hmmm cant really reduce it now
13:45
<
FromGitter >
<grkek> ill try to figure it out
13:49
<
FromGitter >
<grkek> there is nothing in that
13:49
<
FromGitter >
<grkek> carcin
13:51
alexherbo2 has joined #crystal-lang
13:59
<
FromGitter >
<grkek> okay I did it :D
14:00
<
FromGitter >
<Blacksmoke16> `if obj.responds_to? :to_safe`
14:03
<
FromGitter >
<grkek> is that a thing ?
14:04
<
FromGitter >
<j8r> better to check types instead
14:04
<
FromGitter >
<j8r> imho, better for understanding
14:05
<
FromGitter >
<grkek> right
14:05
<
FromGitter >
<j8r> @grkek the carc.in compile
14:06
<
FromGitter >
<grkek> try two different types
14:06
<
FromGitter >
<grkek> oh
14:06
<
FromGitter >
<grkek> its two different types
14:06
<
FromGitter >
<grkek> this is interesting
14:08
<
FromGitter >
<grkek> Error: undefined method 'to_safe' for String (compile-time type is (String | User)) β β Did you mean 'to_unsafe'?
14:09
<
FromGitter >
<j8r> as said above, an intermediary var has to be used - and it would be more efficient
14:10
<
FromGitter >
<grkek> intermediary var
14:10
<
FromGitter >
<grkek> what is that
14:10
<
FromGitter >
<j8r> each `Array#[]` to a lookup
14:10
<
FromGitter >
<j8r> so `fist_content = content[1]`
14:10
<
FromGitter >
<grkek> it is not an array
14:10
<
FromGitter >
<grkek> it is a tuple
14:10
<
FromGitter >
<grkek> content
14:10
<
FromGitter >
<grkek> is a tuple
14:11
<
FromGitter >
<j8r> ha ok
14:11
<
FromGitter >
<Blacksmoke16> is `to_safe` required?
14:11
<
FromGitter >
<grkek> yeah it is probably
14:11
<
FromGitter >
<grkek> because when I try to
14:11
<
FromGitter >
<grkek> cast it to as(thing)
14:11
<
FromGitter >
<grkek> liek
14:12
<
FromGitter >
<grkek> as(Grip::DB::Mode;)
14:12
<
FromGitter >
<grkek> it works
14:12
<
FromGitter >
<grkek> ; - typo
14:13
<
FromGitter >
<j8r> don't know then
14:13
<
FromGitter >
<grkek> :D
14:13
<
FromGitter >
<grkek> its okay
14:13
<
FromGitter >
<grkek> I can link you the repo
14:13
<
FromGitter >
<grkek> if you want to see the source
14:14
<
FromGitter >
<j8r> I can take a quick look yes
14:15
<
FromGitter >
<Blacksmoke16> if its required for a model to implement id suggest putting an `abstract def to_safe : String` in it
14:16
<
FromGitter >
<grkek> whoops
14:16
<
FromGitter >
<grkek> wrong one
14:16
<
FromGitter >
<grkek> sorry
14:16
<
FromGitter >
<grkek> no its the correct one
14:16
<
FromGitter >
<grkek> sorry again
14:17
<
FromGitter >
<grkek> here is the check
14:19
<
FromGitter >
<grkek> @Blacksmoke16 I think I hacked around it
14:19
<
FromGitter >
<grkek> so fat
14:19
<
FromGitter >
<grkek> far*
14:19
<
FromGitter >
<grkek> will try that later
14:19
<
FromGitter >
<grkek> thank you guys
14:20
<
FromGitter >
<grkek> hm
14:20
<
FromGitter >
<grkek> I didn't know about that
14:21
<
FromGitter >
<grkek> but I just wanted to create a small subset of res codes
14:21
<
FromGitter >
<grkek> for the "REST"
14:21
<
FromGitter >
<grkek> suite you know ?
14:21
<
FromGitter >
<grkek> :D
14:21
<
FromGitter >
<Blacksmoke16> im pretty sure you can just do `context.response.status = content.first`
14:21
<
FromGitter >
<Blacksmoke16> and not do the case
14:22
<
FromGitter >
<grkek> rlly ?
14:22
<
FromGitter >
<j8r> @grkek if you do `puts typeof(content)`.
14:22
<
FromGitter >
<j8r> what does it returns?
14:22
<
FromGitter >
<grkek> let me check
14:22
<
FromGitter >
<Blacksmoke16> symbol should be autocasted to the enum value, dont think it would work with `200` int tho
14:23
<
FromGitter >
<grkek> (String | User)
14:23
<
FromGitter >
<Blacksmoke16> its going to be a union of every action's return type
14:23
<
FromGitter >
<grkek> trueee
14:23
<
FromGitter >
<Blacksmoke16> gl :p
14:24
<
FromGitter >
<grkek> i already did it
14:24
<
FromGitter >
<grkek> tho
14:24
<
FromGitter >
<grkek> I got it to work its just too hacky
14:24
<
FromGitter >
<grkek> idk
14:24
<
FromGitter >
<grkek> its not a problem for me it just looks ugly af
14:31
<
FromGitter >
<j8r> and `String` is a `Grip::DB::Model`?!
14:32
<
FromGitter >
<j8r> that what the compiler is saying
14:32
<
FromGitter >
<grkek> no it is not
14:32
<
FromGitter >
<grkek> When the passed in object
14:32
<
FromGitter >
<grkek> is not a Grip::DB::Model
14:32
<
FromGitter >
<grkek> it goes to to_json routine
14:32
<
FromGitter >
<grkek> when it is it goes to a to_safe routine
14:32
<
FromGitter >
<grkek> to keep the secrets out of the response
14:33
<
FromGitter >
<grkek> @Blacksmoke16 the rps went down to 40k
14:33
<
FromGitter >
<grkek> still great compared to the sqlite3
14:33
<
FromGitter >
<grkek> massacre
14:33
<
FromGitter >
<grkek> also you can use granite as well with grip
14:33
<
FromGitter >
<grkek> you just have to install it with grip and confiugre it
14:33
<
FromGitter >
<grkek> configure thats it
14:56
<
FromGitter >
<grkek> Lost the multi threading with leveldb multiple instances but
14:56
<
FromGitter >
<grkek> I am going to make it work
14:56
<
FromGitter >
<grkek> somehow
14:56
<
FromGitter >
<grkek> :D
15:23
<
FromGitter >
<jgillich> When I do `Dir.mkdir_p "~/test"` I get a `~` dir in the current dir (so it's not resolved as $HOME). Does anyone know why that is?
15:28
<
FromGitter >
<Fryguy> File.expand_path was recently change to
*not* expand home by default, so it's possible mkdir_p was using that under the covers?
15:28
<
FromGitter >
<Fryguy> (I honestly still don't understand why expand_path was changed that way...very confusing since it's no longer expanding my path)
15:28
<
FromGitter >
<Blacksmoke16> looks like it just splits on `/`
15:29
<
FromGitter >
<Blacksmoke16> prob should call expand path first, and give open to `mkdir_p` to expand home?
15:29
<
FromGitter >
<Blacksmoke16> workaround would be to just like `Dir.mkdir File.expand "~/test", home: true` i think would do it
15:30
<
FromGitter >
<Fryguy> `Dir.mkdir File.expand_path "~/test", home: true`
15:31
<
FromGitter >
<Blacksmoke16> oops, right yea ^
15:39
<
FromGitter >
<grkek> Okay switching it to redis
15:39
<
FromGitter >
<grkek> @Blacksmoke16
15:39
<
FromGitter >
<grkek> is it a good idea :D ?
15:41
<
FromGitter >
<Blacksmoke16> depends on what you want to do?
15:41
<
FromGitter >
<grkek> Use it as a DB
15:41
<
FromGitter >
<grkek> lmao
15:41
<
FromGitter >
<Blacksmoke16> i mean i suppose you could use it as a like JSON document DB, although prob not the best choice...
15:42
<
FromGitter >
<Blacksmoke16> more so meant as a cache
15:43
<
FromGitter >
<grkek> meh
15:43
<
FromGitter >
<grkek> it works so
15:43
<
FromGitter >
<grkek> doesn't really matter
15:43
<
FromGitter >
<grkek> ?
15:43
<
FromGitter >
<Blacksmoke16> id be more so in favor of not supporting any db and letting the user implement the one they want
15:44
<
FromGitter >
<grkek> At least support one of the quickie db's
15:45
<
FromGitter >
<Blacksmoke16> i wouldnt, that makes one db tightly coupled to your app, i.e. would be installed when installing your app
15:45
<
FromGitter >
<Blacksmoke16> which if i dont want to use i have a random dep that doesnt do anything
15:46
<
FromGitter >
<grkek> hmmm
15:47
<
FromGitter >
<grkek> so that sounds interesting
15:47
<
FromGitter >
<grkek> I am going to create a branch with it
15:47
<
FromGitter >
<grkek> then
15:47
<
FromGitter >
<Blacksmoke16> if anything have a separate shard that adds additional functionality for a given db
15:47
<
FromGitter >
<Blacksmoke16> to keep it optional
15:48
<
FromGitter >
<grkek> Ill have a branch
15:48
<
FromGitter >
<grkek> that sounds better
15:49
<
FromGitter >
<Blacksmoke16> as a temp thing to figure it out, or a perm thing?
15:50
<
FromGitter >
<grkek> perm thing :D
15:50
<
FromGitter >
<grkek> branch for a redis integration
15:50
<
FromGitter >
<grkek> i guess
15:50
<
FromGitter >
<Blacksmoke16> that sounds like an aweful idea
15:50
<
FromGitter >
<grkek> why tho
15:50
<
FromGitter >
<grkek> should I at least fork it ?
15:50
<
FromGitter >
<Blacksmoke16> now you have to maintain your app twice
15:50
<
FromGitter >
<grkek> or just create a shard
15:50
<
FromGitter >
<Blacksmoke16> and how would that work with releases
15:50
<
FromGitter >
<grkek> another shard
15:51
<
FromGitter >
<grkek> separate shard
15:53
<
FromGitter >
<Blacksmoke16> that would be better i think
15:53
<
FromGitter >
<Blacksmoke16> ideally the other shard wouldnt define the whole app, just add/alter functionality when required
15:54
<
FromGitter >
<grkek> jjust like kemal does
15:54
<
FromGitter >
<grkek> things
15:54
<
FromGitter >
<grkek> yeah that would be nice
16:07
<
FromGitter >
<grkek> done
16:07
<
FromGitter >
<grkek> :D
16:08
<
FromGitter >
<grkek> who is c17r and why does he view all of the messages ?
16:10
<
FromGitter >
<j8r> cr7?
16:11
<
FromGitter >
<j8r> Christiano Ronaldo reads our messages :)?
16:12
<
FromGitter >
<grkek> no
16:12
<
FromGitter >
<grkek> c17r
16:12
<
FromGitter >
<grkek> Christian Sauer
16:13
<
FromGitter >
<grkek> also how to overwrite a class with redefinition of the same class from a different shard ?
16:14
<
FromGitter >
<Blacksmoke16> hm?
16:15
<
FromGitter >
<grkek> nevermind
16:23
alex`` has quit [Quit: WeeChat 2.7]
16:23
alexherbo2 has quit [Remote host closed the connection]
16:27
<
FromGitter >
<Blacksmoke16> ok
16:29
ht_ has joined #crystal-lang
16:41
Nicolab has joined #crystal-lang
16:59
<
FromGitter >
<grkek> Interestingly
16:59
<
FromGitter >
<grkek> I did
16:59
<
FromGitter >
<grkek> this guy
16:59
<
FromGitter >
<grkek> yay
17:00
<
FromGitter >
<grkek> basically you can plug in any key-value storage
17:00
<
FromGitter >
<grkek> so in the future ill just make a grip-keyvalue
17:00
<
FromGitter >
<grkek> and allow you to plug in any key/value storage you want
17:01
<
FromGitter >
<wontruefree> Chicago Crystal released a new video
17:01
<
FromGitter >
<wontruefree> the state of AI in crystal
17:01
duane has joined #crystal-lang
17:01
<
FromGitter >
<grkek> niceee
17:07
<
FromGitter >
<Blacksmoke16> did you just copy the whole handler?
17:18
Groogy has quit [Quit: WeeChat 2.7]
17:24
<
FromGitter >
<grkek> Yes I did
17:24
<
FromGitter >
<grkek> and then realized I could just change the method
17:24
<
FromGitter >
<grkek> and inherit from a calss
17:24
<
FromGitter >
<grkek> class*
17:26
FromGitter has quit [Read error: Connection reset by peer]
17:27
FromGitter has joined #crystal-lang
17:31
<
FromGitter >
<Blacksmoke16> ill have to wait and see how that looks then
17:37
<
FromGitter >
<grkek> You were right I should let the user implement the db
17:37
<
FromGitter >
<grkek> :D
17:37
<
FromGitter >
<Blacksmoke16> :p
17:37
<
FromGitter >
<grkek> basically it is done so far
17:37
<
FromGitter >
<grkek> db's are pain in the ass
17:37
<
FromGitter >
<grkek> plus crystal is bitching about instance variables in macros
17:37
<
FromGitter >
<Blacksmoke16> or at least design things using interfaces that the user can define
17:37
<
FromGitter >
<Blacksmoke16> implement*
17:37
<
FromGitter >
<grkek> nah
17:37
<
FromGitter >
<grkek> fuck it
17:37
<
FromGitter >
<grkek> let em use granit
17:37
<
FromGitter >
<grkek> e
17:37
<
FromGitter >
<grkek> :D
17:44
<
FromGitter >
<grkek> Lets keep the keyvalue stores a bit off to the shore
17:46
<
FromGitter >
<grkek> does it really need 30 days
17:46
<
FromGitter >
<grkek> :D ?
17:46
<
FromGitter >
<Blacksmoke16> yes
17:48
<
FromGitter >
<grkek> Cries in crystal
19:05
<
FromGitter >
<btihen> @thedracle - did you get a websocket working? How about onewithout SSL?
19:25
alex`` has joined #crystal-lang
19:26
Nicolab has quit [Ping timeout: 240 seconds]
19:26
alexherbo2 has joined #crystal-lang
19:42
Nicolab has joined #crystal-lang
20:04
<
FromGitter >
<Nicolab> ok `getter` makes the job :)
20:06
<
FromGitter >
<Blacksmoke16> if you're using class vars whats the point of using the sturct?
20:06
<
FromGitter >
<Blacksmoke16> struct*
20:06
<
FromGitter >
<Blacksmoke16> `class_property` is the same as `property` but defines a class level getter/setter
20:07
<
FromGitter >
<Blacksmoke16> is also `class_getter` and `class_setter` ofc
20:07
<
FromGitter >
<Nicolab> `module` is a class?
20:08
<
FromGitter >
<Blacksmoke16> `module` is a module
20:12
<
FromGitter >
<Nicolab> ok that's from who seemed to me
20:12
<
FromGitter >
<Nicolab> well what I'm trying to get is: `App.db.uri`, `App.mailer.credientals`, etc β β Also, the `App` module is my main module wich have some methods
20:12
<
FromGitter >
<Blacksmoke16> where do the values come from?
20:13
<
FromGitter >
<Blacksmoke16> or they just static hardcoded within the type?
20:13
<
FromGitter >
<Nicolab> just config data set at initialization (by hand and via ENV)
20:14
<
FromGitter >
<Nicolab> immutable
20:14
<
FromGitter >
<Nicolab> they are not intended to be changed at runtime
20:14
<
FromGitter >
<Blacksmoke16> then just do
20:15
<
FromGitter >
<Blacksmoke16> would prob do it
20:16
<
FromGitter >
<Blacksmoke16> `class_getter db : DB.class = DB`
20:17
<
FromGitter >
<Nicolab> Great, thank you very much @Blacksmoke16 π π
20:19
<
FromGitter >
<Nicolab> just for info a module is stored in the heap or the stack? As much as I get into good habit from the start in Crystal
20:21
<
FromGitter >
<Blacksmoke16> good question, its never actually instantiated so im not sure
20:21
<
FromGitter >
<Nicolab> ok
20:22
alex`` has quit [Quit: WeeChat 2.7]
20:58
alex`` has joined #crystal-lang
21:00
ur5us has joined #crystal-lang
21:01
DTZUZO has quit [Ping timeout: 260 seconds]
21:01
DTZUZO_ has joined #crystal-lang
21:02
alexherbo2 has joined #crystal-lang
21:10
<
FromGitter >
<tenebrousedge> what are people's opinions about react vs vue for a hopefully-simple frontend? I don't anticipate doing anything more complicated than listing and viewing resources (images)
21:19
duane has quit [Ping timeout: 240 seconds]
21:21
<
alexherbo2 >
how to get the path to the program?
21:22
<
alexherbo2 >
(at compile-time)
21:22
<
alexherbo2 >
I want to embed a configuration file relative to the binary path
21:23
<
alexherbo2 >
if you have examples of best practices for doing it you can shoot :p
21:23
<
alexherbo2 >
thanks tenebrousedge
21:23
<
FromGitter >
<tenebrousedge> np
21:24
<
alexherbo2 >
you think it's better to source a file relative to the binary path when running
21:24
<
alexherbo2 >
or embed the configuration in the program
21:25
<
alexherbo2 >
`executable_path` is at runtime no?
21:25
<
alexherbo2 >
not sure how to differenciate
21:26
<
alexherbo2 >
when doing compile or runtime
21:26
<
FromGitter >
<tenebrousedge> I don't think there's much difference. Using a config file written in Crystal can make it easier to express some things
21:32
duane has joined #crystal-lang
21:35
alexherbo20 has joined #crystal-lang
21:36
alex`` has quit [Ping timeout: 240 seconds]
21:37
alexherbo2 has quit [Ping timeout: 268 seconds]
21:37
alexherbo20 is now known as alexherbo2
21:37
<
FromGitter >
<Blacksmoke16> one thing im doing for athena is load in the config file's contents via `read_file` macro
21:37
<
FromGitter >
<Blacksmoke16> then doing `.from_yaml` at runtime
21:38
<
FromGitter >
<Blacksmoke16> so you dont need to include the file with the binary on deploy
21:38
<
FromGitter >
<Blacksmoke16> move*
21:38
alex`` has joined #crystal-lang
21:39
<
FromGitter >
<Blacksmoke16> once custom yaml tag processor feature is done, it'll make it a bit cooler
21:39
<
FromGitter >
<Blacksmoke16> like add one to resolve env vars at runtime, to respect the current env
21:42
duane has quit [Ping timeout: 240 seconds]
21:44
duane has joined #crystal-lang
21:49
<
FromGitter >
<tenebrousedge> @Blacksmoke16 which do you prefer: react, vue, or a stab in the eye with a sharp stick?
21:56
<
FromGitter >
<Blacksmoke16> mm i never used either, i usually go with Angular :shrug:
21:56
<
FromGitter >
<tenebrousedge> people still use angular?
21:56
<
FromGitter >
<Blacksmoke16> not angularjs
21:57
<
FromGitter >
<Blacksmoke16> angular proper
22:00
ht_ has quit [Remote host closed the connection]
22:29
<
FromGitter >
<Nicolab> @tenebrousedge I have used Angular (long ago) and React. β This is only my personal opinion but I prefer React much more for reasons of productivity, maintenance and performance.
22:30
<
FromGitter >
<Nicolab> The only tricky thing with React is that you have to find your own organization (structure and good practices). Once found, it rubs
22:32
<
FromGitter >
<Nicolab> I am not a fan of all the marketing (hype) around React, a lot of article pumped on each other relay bad practices (in any case that does not lend itself to it shitting in a big project)
22:35
<
FromGitter >
<Nicolab> By avoiding some false good practices (you have to sort out the good and the bad), React is great.
22:36
<
FromGitter >
<Nicolab> Again, that's just my opinion :)
22:40
<
FromGitter >
<Nicolab> If you are looking for a less time-consuming store than Redux, I take pleasure in coding with plop
https://github.com/Nicolab/storux β β Inevitably I like it, I designed them according to my ideals and those of my colleagues who also wanted a certain type of store respecting the pattern flux. ^^
23:02
<
FromGitter >
<Blacksmoke16> angular is better for larger projects iirc
23:02
<
FromGitter >
<Blacksmoke16> but for small stuff prob is overkill
23:07
<
FromGitter >
<Nicolab> Why better?
23:09
<
FromGitter >
<Nicolab> At this level I think it's a matter of preference, I felt no limits with React.
23:11
yukai has joined #crystal-lang
23:11
<
FromGitter >
<Nicolab> I just understood what you meant (better for big projects than for small ones)
23:17
<
FromGitter >
<tenebrousedge> I'll take a look at storux
23:21
<
FromGitter >
<Nicolab> @tenebrousedge Note: that if you are new to React / Angular, perhaps it is better to start with a better documented store with examples of integrations with React or Angular. In a second time, once you see the interest of a state store, come back to try Storux.
23:36
<
FromGitter >
<straight-shoota> oprypin, how difficult was it to get the workflow on Github Actions set up?
23:36
<
oprypin >
straight-shoota, difficult in what sense
23:36
<
oprypin >
i honestly dont know the baseline of what should be difficult :D
23:37
<
FromGitter >
<straight-shoota> Did you need like a dozen try and error runs? Or more?
23:38
<
FromGitter >
<straight-shoota> Yeah
23:38
<
FromGitter >
<Blacksmoke16> actions is pretty cool
23:38
<
oprypin >
it's quite a similar philosophy
23:38
<
FromGitter >
<Blacksmoke16> some stuff is missing tho, but prob not a big deal
23:38
<
FromGitter >
<straight-shoota> So it still took you 2 hours to get it running?
23:39
<
FromGitter >
<straight-shoota> Great job π
23:40
<
FromGitter >
<straight-shoota> Why do you build the compiler? The one coming with `crystal:latest` should already work.
23:41
<
FromGitter >
<straight-shoota> Btw GC should work on win32, so `-Dgc_none` is not necessary
23:41
<
FromGitter >
<straight-shoota> You're already building libgc anyways
23:41
<
oprypin >
straight-shoota, what do u mean, the point is to test crystal master, not test some old compiler
23:43
<
FromGitter >
<straight-shoota> Yeah, eventually we want to test the compiler. But the compiler itself is not ported yet. And cross compiling hello world or even the standard library should be totally fine with latest.
23:44
<
oprypin >
no, i'm not sure you understand
23:44
<
FromGitter >
<straight-shoota> For now there should be no strict requirement to build the compiler. I was just wondering if there was some reason that you needed a master build
23:44
<
oprypin >
if this CI is merged to Crystal, then, on any commit to Crystal master, this CI will test..... crystal latest release (always the same)
23:45
<
oprypin >
no i didnt need master build, just but like... master is what i want to test
23:45
uu91 has joined #crystal-lang
23:46
<
FromGitter >
<straight-shoota> Yes, I was just not expecting that for what is essentially a PoC :D
23:46
<
FromGitter >
<tenebrousedge> @Nicolab I've written my own version of redux at one point. I'll take a look at storux
23:48
<
oprypin >
hehe it's not just a PoC. it would already prevent regressions in producing a helloworld :p
23:48
<
FromGitter >
<straight-shoota> You're totally right!
23:49
<
oprypin >
but i see your point too
23:49
<
FromGitter >
<Nicolab> @tenebrousedge Oh ok! Nice :)
23:49
<
FromGitter >
<straight-shoota> And with #8664 this would be really useful
23:50
<
FromGitter >
<tenebrousedge> I wish the crystal api docs had a message at the top that said "you're looking at an old version, click here to get the latest"
23:50
<
FromGitter >
<straight-shoota> @tenebrousedge Yeah, that's much necessary
23:51
<
FromGitter >
<Nicolab> π
23:54
uu91 has quit [Remote host closed the connection]