xco

Activity Graph

Page 1 of 11 | Next »

2019-04-24

[00:08:46] xco: has joined #ruby
[04:08:20] xco: Quit: xco
[04:14:42] xco: has joined #ruby
[04:14:42] xco: has joined #RubyOnRails
[04:20:35] xco: Quit: xco
[12:09:27] xco: has joined #RubyOnRails
[12:09:28] xco: has joined #ruby
[16:11:42] xco: Quit: xco
[17:39:11] xco: has joined #ruby
[17:39:11] xco: has joined #RubyOnRails
[20:07:34] xco: Quit: xco
[20:38:47] xco: has joined #ruby
[20:38:47] xco: has joined #RubyOnRails
[20:39:01] xco: Client Quit

2019-04-18

[16:52:53] xco: has joined #ruby
[16:52:53] xco: has joined #RubyOnRails
[16:53:06] xco: hello! it’s me again :P
[16:53:11] xco: i’m in IRB
[16:53:27] xco: how can i be sure i’m encoding strings the way i want
[16:53:31] xco: this is what i’m trying
[16:53:49] xco: str.encode("UTF-8")
[16:53:57] xco: where ‘str’ = “some string"
[16:54:23] xco: but i’m not sure it’s working because i’m working on a string that looks like this
[16:54:37] xco: str = “noël”
[16:55:04] xco: when i do str.length i get 5. which is weird
[16:55:18] xco: i don’t know what language “noël” is hahahahha
[16:55:22] xco: i’m just playing with it
[16:55:54] xco: but i doubt french has that kind of “e”. IDK :P
[16:56:07] xco: ah right, fuck it :P
[16:57:01] xco: so how do i get Ruby to tell me “noël” is 4 characters? why can’t Ruby know the encoding and count correct?
[16:57:06] xco: correctly*
[16:57:21] xco: it’s weird to see “noël” as length of 5 in Ruby
[16:58:09] xco: you just blew my mind hahaha
[16:59:14] xco: i’m doing all this in irb
[16:59:56] xco: Elixir conveniently provides byte_size(str) and String.length(str) so i thought there’d be something similar in Ruby
[17:01:50] xco: this is rocket science
[17:01:55] xco: at least to me
[17:02:04] xco: and weird at the same time
[17:02:09] xco: a lot of languages have this
[17:02:23] xco: and Ruby’s community is big enough to have it too. if no one does it i’ll fix this! :P
[17:02:30] xco: give me a year
[17:02:49] xco: 6months tops, first i have to learn unicode
[17:03:36] xco: oh really? why would it be a bad idea?
[17:06:08] xco: all this while i thought Date/Time was the most complicated, i’m adding Strings to that list
[17:06:20] xco: btw in irb i’m doing something like this
[17:06:26] xco: str.encode("ISO-8859-1")
[17:06:39] xco: not sure if it makes sense, prolly doesn’t because i’m getting back
[17:06:45] xco: Encoding::UndefinedConversionError (U+0308 from UTF-8 to ISO-8859-1)
[17:08:01] xco: interesting thread here https://stackoverflow.com/questions/13003287/encodingundefinedconversionerror
[17:09:21] xco: what the hell?!?!? hahahhaa
[17:11:00] xco: where did you get "noël" from? it acting differently from my "noël”!!
[17:13:31] xco: ah i see!
[17:13:46] xco: this is interesting
[17:14:17] xco: to the eye this is very confusing to someone who doesn’t know what’s going on under cover https://gyazo.com/cfe70707fe809fe51bbd9df8f7d79eb8
[17:14:33] xco: thanks for the enlightenment!
[17:15:29] xco: got some reference online?
[17:16:40] xco: i guess strings and encodings are a whole new subject to be studies carefuly
[19:47:46] xco: Quit: xco

2019-04-16

[08:36:28] xco: has joined #ruby
[08:36:28] xco: has joined #RubyOnRails
[10:44:46] xco: hi, i’m sort of benchmarking or trying to at least how much memory allocations a method uses. what tool can i use for that if this is possible at all
[10:51:24] xco: Quit: xco
[10:55:58] xco: has joined #ruby
[10:55:58] xco: has joined #RubyOnRails
[11:01:24] xco: Quit: xco
[15:54:25] xco: has joined #ruby
[15:54:25] xco: has joined #RubyOnRails
[16:47:03] xco: Quit: xco
[17:23:09] xco: has joined #ruby
[17:23:09] xco: has joined #RubyOnRails
[22:35:51] xco: Quit: xco
[22:48:55] xco: has joined #ruby
[22:48:55] xco: has joined #RubyOnRails
[23:58:37] xco: Quit: xco

2019-04-15

[11:02:05] xco: has joined #RubyOnRails
[19:20:55] xco: Quit: xco
[20:18:40] xco: has joined #RubyOnRails
[20:51:45] xco: has joined #ruby
[20:53:44] xco: i have an instance variable set like say @example = “something”. and would like to pass a bunch of of these to a method. how do i get the instance variable inside the method when the names of the instance variables change, so like how so i get to pass these instance vars into a method when i have to work with another instance var called @example1?
[20:54:19] xco: in a method like “def ex(instance_var, something); @instance_var … end
[20:54:40] xco: if i do do string interporlation obviously it won’t work cause i get a string
[20:56:28] xco: havenwood: right! thanks :) i’ll think of workign with this knowledge then
[21:19:05] xco: Quit: xco
[22:00:35] xco: has joined #ruby
[22:00:35] xco: has joined #RubyOnRails
[23:03:46] xco: Quit: xco
[23:43:06] xco: has joined #ruby
[23:43:06] xco: has joined #RubyOnRails
[23:44:46] xco: Client Quit

2019-04-13

[10:41:18] xco: has joined #RubyOnRails
[10:47:16] xco: Quit: xco
[10:51:23] xco: has joined #RubyOnRails
[11:12:58] xco: Quit: xco
[12:42:45] xco: has joined #RubyOnRails
[12:53:22] xco: Quit: xco

2019-04-12

[20:31:38] xco: has joined #RubyOnRails
[20:31:59] xco: Hi i’m looking through rails source code and often see this “#:nodoc:”
[20:32:02] xco: what does #:nodoc: mean?
[20:32:16] xco: does it mean it has not documention or do not document or what?
[20:48:14] xco: Quit: xco
[20:54:14] xco: has joined #RubyOnRails
[21:27:45] xco: has left #RubyOnRails: ()

2019-04-11

[03:19:47] xco: has joined #ruby
[03:20:46] xco: i want to make some steps to create my first ruby gem. but need some thougts. is it a good idea for a gem to make an api call to some other service? are there gems like that already
[03:21:35] xco: the gem i want to make will require an API secret key which if you’er using rails you’d put the key in your initializers folder but i’m not sure if this is a good idea
[04:07:30] xco: havenwood: thanks for the response. reason i asked was i thought if i created a gem like that it’d be “odd” since i haven’t personally used a gem that makes an API call
[04:08:30] xco: yeah and ENV variable would work too, good idea i’ll keep that option in my thoughts
[04:11:27] xco: yeah prolly a private gem right? i’m yet to see a public OS gem that makes use of keys like that
[04:15:06] xco: oooo awesome! this will give me an idea how to implement my api key part
[04:17:07] xco: thanks ;)
[04:25:09] xco: Quit: xco
[04:38:40] xco: has joined #ruby
[04:38:40] xco: has joined #RubyOnRails
[04:42:16] xco: Client Quit
[04:44:07] xco: has joined #ruby
[04:44:07] xco: has joined #RubyOnRails
[04:56:32] xco: Quit: xco
[10:21:37] xco: has joined #ruby
[10:21:37] xco: has joined #RubyOnRails
[11:56:23] xco: i’m fetching data from a table to display in a paginated table in the view. what’s a good approach, with performance in mind to cache data from the database? Ideally i’d like to have just one query to the DB so i don’t have to reload the data from the DB on each navigation with the pagination. This is what i have done so far but doubt it’s the best way to go around this https://gist.github.com/xcobar/7238284eecc52efa766b7ad67330c8fd
[11:56:36] xco: i’ll love some tips, advice
[14:07:37] xco: Quit: xco
[16:17:01] xco: has joined #ruby
[16:17:01] xco: has joined #RubyOnRails
[19:42:21] xco: Quit: xco

2019-04-10

[01:52:53] xco: Quit: xco
[10:19:37] xco: has joined #RubyOnRails
[11:04:34] xco: Quit: xco

2019-04-09

[10:54:30] xco: has joined #RubyOnRails
[11:21:16] xco: Hi I need help but don’t even know if this is possible. I think it is
[11:21:19] xco: I have this query
[11:21:20] xco: https://gist.github.com/xcobar/977aa688df3ee173559d49690383bf83
[11:21:37] xco: how do I load all the nested tables, and still select only some columns?
[11:22:30] xco: i’m not interested in loading all the columns as it’ll be slow. so how do i select, say learner.name and question.expiry_date for instance?
[12:37:49] xco: shenghi: thanks. this gives me this https://gist.github.com/xcobar/977aa688df3ee173559d49690383bf83 but the problem is getting the nested columns in
[12:37:56] xco: how do i do that?
[20:44:24] xco: i need help converting this to raw sql
[20:44:25] xco: Answer.joins(:learner, possible_answer: [question: [:quiz]])
[20:44:41] xco: in exchange for beer
[20:48:15] xco: actually i’ll keep my beer
[20:48:23] xco: pasting this in the console converts it to sql
[22:28:24] xco: havenwood: thanks :)

2019-04-08

[21:11:35] xco: has joined #RubyOnRails
[22:47:14] xco: Quit: xco
[22:53:51] xco: has joined #RubyOnRails
[23:09:23] xco: Quit: xco

2019-04-07

[15:37:38] xco: has joined #ruby
[15:39:18] xco: can i do this in Ruby if i want both methods to be peformed? https://gist.github.com/xcobar/7d8f2772d806fe8dc166301a33bc411d
[15:39:51] xco: this is one usage of “and” that i think i get right. someone please give thoughts
[15:42:36] xco: so in this case if i want to peform both methods i can do just this instead https://gist.github.com/xcobar/7d8f2772d806fe8dc166301a33bc411d
[15:42:49] xco: i wanted a one-liner to perform two methods
[15:46:06] xco: it’s not a big deal i just want to keep my programs short :D
[16:08:29] xco: has joined #RubyOnRails
[16:08:44] xco: Hi, I have something like this in my controller https://gist.github.com/xcobar/641a85d7590ea5715951b4b8b3fcfa5b
[16:08:54] xco: question concerns the ‘expires_in’ method
[16:08:58] xco: this is what i have notices
[16:09:16] xco: if i load the page for the first time in the Rails log i see some queries going on
[16:09:34] xco: after adding ‘expires’ the pages is fine but NO queries are generated
[16:09:37] xco: in the rails log
[16:09:57] xco: does this mean that the request for @answers from the db is not ran?
[16:10:23] xco: does this cache the results from the query as well?
[16:10:44] xco: until the cache expires (of course)
[18:36:22] xco: Quit: xco

2019-04-06

[06:39:27] xco: has joined #RubyOnRails
[07:29:13] xco: Quit: xco
[07:30:40] xco: has joined #RubyOnRails
[09:34:58] xco: Quit: xco
[09:38:01] xco: has joined #RubyOnRails
[09:38:24] xco: Client Quit
[09:39:06] xco: has joined #RubyOnRails
[14:03:39] xco: Quit: xco
[18:49:38] xco: has joined #RubyOnRails
[21:04:39] xco: Quit: xco
[21:34:14] xco: has joined #RubyOnRails
[22:52:11] xco: Quit: xco
[23:01:12] xco: has joined #RubyOnRails
[23:38:00] xco: Quit: xco

2019-04-05

[12:10:13] xco: has joined #RubyOnRails
[21:34:18] xco: Quit: xco
[21:52:53] xco: has joined #RubyOnRails
[21:58:49] xco: Quit: xco

2019-03-26

[01:57:18] xco: i’m having a weird problem
[01:57:46] xco: in my terminal doing ‘gem install activesupport’ works
[01:58:00] xco: if i do require active_support it comes out as “false”
[01:58:01] xco: any ideas?
[02:23:32] xco: sevenseacat: thanks fixed
[02:26:56] xco: is there a Rails method that can convert times in different time zones? Example given the current time in New York, it tells me what the local time in Berlin is?
[02:27:17] xco: i’m trying ActiveSupports #in_time_zone
[02:27:31] xco: but that value is off bye one :/
[02:27:37] xco: bye one hour
[02:27:50] xco: yeah i know that, how do i fix that
[02:27:55] xco: tthis is wha ti have
[02:28:09] xco: time.in_time_zone("Berlin")
[02:28:29] xco: where time = Time in new york
[02:28:38] xco: but i can’t add 1 like that what if DST resets?
[04:23:07] xco: Quit: xco
[04:50:23] xco: has joined #ruby
[04:50:23] xco: has joined #RubyOnRails
[04:56:15] xco: Quit: xco
[11:35:39] xco: has joined #ruby
[11:35:39] xco: has joined #RubyOnRails
[16:46:13] xco: Quit: xco

2019-03-25

[00:32:46] xco: al2o3-cr: want to review my what i was wriing? please? if you have time and willingness?
[00:35:57] xco: ok one minute
[00:52:05] xco: al2o3-cr: https://gist.github.com/xcobar/92deb10cdbbb2f9e2664e5ab27ff602a
[00:52:24] xco: i know it’s naive a bit but maybe comments will be appreciated :D
[00:52:46] xco: purpose of it is to parse an xml file and display the results
[00:56:01] xco: al2o3-cr: there’s a whole folder, runnable version here: https://www.dropbox.com/s/r63x6x2nm1xjh3u/cli.zip?dl=0
[01:00:49] xco: didn’t expect that hahaha
[01:01:29] xco: this makes me happy because this is the part where i write quickly to get tests to pass
[01:01:58] xco: after getting some sleeping i’ll looking into making it better/refactoring that’s why a clear pair of eyes and advise will be nice
[01:05:19] xco: signs of no sleep. sorry for the typos
[01:07:41] xco: phaul: maybe you can take a look too? :)
[01:08:49] xco: phaul: sure no problem! maybe i can help somehow? :P
[01:09:15] xco: at least i’ll find a type to fix in your README for sure :D
[01:11:49] xco: ok i’m sure you’ll figure a way through it
[04:07:32] xco: Quit: xco
[09:25:10] xco: has joined #ruby
[09:25:10] xco: has joined #RubyOnRails
[11:21:19] xco: phaul: i am
[11:26:10] xco: phaul: that’s a very nice point! I like it.
[11:26:40] xco: so Loco would better be a module than a class right? is this for best practice or it has something to do with performance, which side that this lean towards more?
[11:27:58] xco: by “instance state” you mean the calls to Loco.new….?
[11:29:36] xco: aaah right
[11:29:52] xco: and i don’t have those in my class
[11:30:14] xco: so why use a class then? … makes sense
[11:31:09] xco: thanks :)
[14:18:22] xco: just to confirm, you can’t test modules with minitest right? i haven’t found any link on google concerning this, i only see “testing modules with rspec” will i be right to assume minitest can’t test modules, only classes?
[14:40:32] xco: i’m trying to write a simple test with a module to further explain what’s going on
[15:56:36] xco: tbuehlmann: sorry was on calls, trying to write small test to show you
[16:08:12] xco: ok figured out why
[16:25:43] xco: Quit: xco
[17:15:40] xco: has joined #ruby
[17:15:40] xco: has joined #RubyOnRails
[19:38:02] xco: Quit: xco
[19:38:56] xco: has joined #ruby
[19:38:56] xco: has joined #RubyOnRails