Bish

Activity Graph

Page 1 of 29 | Next »

2019-07-16

[14:13:57] Bish: how do people regulary encode fields in csv that have multiple values
[14:13:58] Bish: like an array
[14:14:26] Bish: in this case it's string it could be comma separated itself, but that's od
[14:15:19] Bish: well, okay
[14:16:27] Bish: well, as you can expect csv wasn't my choice, and json is not making me happy in any way either
[14:16:37] Bish: well, in some ways, but not all
[14:18:29] Bish: also how do you encode much data with json?
[14:18:36] Bish: one big array? one document per line?
[14:22:24] Bish: i've done that in private a lot of time where nobody was watching
[14:22:31] Bish: never expected it to be used somewhere as "format"
[14:47:16] Bish: ACTION would rather use csv
[14:47:20] Bish: ACTION maybe not for rpc
[14:49:16] Bish: yeah you said xml already :p

2019-07-15

[06:50:39] Bish: *.net *.split
[07:16:22] Bish: has joined #ruby
[08:26:27] Bish: *.net *.split
[08:36:21] Bish: has joined #ruby
[12:59:22] Bish: catphish: why not put nginx in front, or aren't we talking http?

2019-07-11

[10:05:48] Bish: &> [*1..49].combinations(6).first
[10:05:51] Bish: > [*1..49].combinations(6).first
[10:05:55] Bish: >> [*1..49].combinations(6).first
[10:06:27] Bish: how would i get a random combination?
[10:22:28] Bish: is that a question?
[10:22:39] Bish: enumrators o not have the "sample" method
[10:26:12] Bish: yeah but you're letting out one part of my code :D
[10:26:28] Bish: i want a combination of 6 numbers
[10:26:34] Bish: not 6 random number
[11:50:24] Bish: havenwood: well, lottonumbers
[11:51:07] Bish: NL3limin4t0r: i always tend to get confused with combinations & permutations
[11:51:22] Bish: but taking 6 random numbers gives me duplicate numbers
[11:51:33] Bish: and i THINK combinations dont have that
[11:52:11] Bish: havenwood: i want 6 unique numbers out of [1..49]
[11:52:33] Bish: havenwood: sample does not hit things twice?
[11:52:43] Bish: oh, okay
[11:53:01] Bish: never noticed
[11:53:42] Bish: still i would be interested how would i get a random combination that way
[11:53:58] Bish: would i be calling next random amount of times? or is there a way to navigate
[11:54:09] Bish: ytti: well, i always thought i know what sample is doing
[11:54:24] Bish: so there was no need for me to check it, so i thought
[11:54:53] Bish: it does, i just didn't expect it to be
[11:55:15] Bish: i thought sample might hit a number twice
[11:55:31] Bish: ytti: yeah, still i would like to know to get a random element out of a iterator
[11:55:35] Bish: out of curiousity
[11:55:46] Bish: or would be calling next a random number of times the way to go
[11:56:52] Bish: enumerator*
[11:58:06] Bish: well, assume i needed it to do that way
[11:58:10] Bish: [*1..10].combination(6)
[11:58:46] Bish: is there a better way to call "next" rand(1..10) times)
[11:58:55] Bish: on that enumerator
[11:59:08] Bish: i guess not.
[11:59:50] Bish: yes, but that's expensive af
[11:59:59] Bish: and basicially calling next 10 times
[12:00:12] Bish: scratch that.. more than that ofc
[12:00:20] Bish: n^k whatever
[12:01:44] Bish: havenwood: okay, thanks
[12:03:05] Bish: but shouldn't be that one sized
[12:05:24] Bish: really odd that that enumators way of counting "it's element" is iterating through

2019-07-08

[14:15:40] Bish: has joined #ruby
[15:00:13] Bish: ACTION said we need this 3 years or something ago

2019-06-20

[16:03:21] Bish: *.net *.split

2019-06-15

[06:27:40] Bish: *.net *.split
[06:38:22] Bish: has joined #ruby

2019-06-14

[03:22:03] Bish: *.net *.split
[03:38:50] Bish: has joined #ruby

2019-06-13

[14:04:43] Bish: Ping timeout: 248 seconds
[14:21:29] Bish: has joined #ruby

2019-06-07

[09:24:53] Bish: has joined #ruby
[09:25:09] Bish: can i make nokogiri NOT encode node attributes?
[10:51:14] Bish: (s="accca").gsub(/a(.*)a/) { "{#{$1}}" }
[10:51:33] Bish: why isn't this working as i expected :o
[10:51:42] Bish: do i get the return value of the block?
[10:51:55] Bish: no doesn't seem like it
[11:42:09] Bish: ytti: where are the as ?
[11:42:28] Bish: thats what i would expect that only the ccc get surrounded
[11:42:44] Bish: ah okay, it does replace the full match, i get it.

2019-06-06

[09:48:41] Bish: Quit: leaving

2019-05-24

[10:07:00] Bish: this channel is getting silent geez

2019-05-12

[01:48:35] Bish: *.net *.split
[02:45:17] Bish: has joined #ruby

2019-05-09

[14:47:00] Bish: i disagree with the rails part
[14:47:05] Bish: rails was never worth learning, ruby is
[14:47:32] Bish: _sfiguser: what do you mean by saying network programming?
[14:47:49] Bish: ruby is bad with threads, as long as it is not IO-only
[14:47:57] Bish: so depending on your usecase ruby could be bad
[14:48:43] Bish: or stay with sinatra/roda :p
[14:49:13] Bish: but i have no clue what "network programming" is
[14:49:17] Bish: routing tcp packages?
[14:53:18] Bish: i think ruby-code-style doesn't really fit asynchronous programming
[14:53:32] Bish: i always cringe when i see on_event { ... } stuff in ruby
[14:56:05] Bish: oh ruby is good for that
[14:56:24] Bish: that's the best thing about ruby, it's super high, and crafting "strings"/buffers with it is great
[14:57:35] Bish: >> "\x19\x91\x12\x83".unpack("L+")
[14:57:39] Bish: love shit like that
[14:58:13] Bish: the ruby-elf package or rubyelf gem don't know handels nicely with binary stuff

2019-05-07

[12:50:46] Bish: >> Time.iso8601(Time.iso8601)
[12:50:54] Bish: >> require 'time';Time.iso8601(Time.iso8601)
[12:51:04] Bish: >> require 'time';Time.iso8601(Time.now.iso8601)
[12:51:30] Bish: this makes funny output for me
[12:53:00] Bish: hm, maybe because timezones?
[12:53:26] Bish: hm, it doesn't do it anymore! whats going on
[12:53:51] Bish: >> require 'time';Time.now.iso8601(Time.now.iso8601)
[12:53:56] Bish: i get it.
[12:55:23] Bish: well.. it doesn't make sense, but the Time instance also has a iso8601 method that takes a parameter
[12:55:27] Bish: no clue what the result is
[12:55:34] Bish: t.now.iso8601(Time.now.iso8601)
[12:55:45] Bish: maybe it tries to find a pooint in time between those 2
[12:55:50] Bish: which is really close

2019-04-26

[11:02:43] Bish: has anyone tried falcon so far, or any other way to use http/2 with ruby?
[11:03:03] Bish: i want to push messages to the browser like a chat message and don't quite now how
[11:09:22] Bish: well i guess thats not what http/2 does
[11:09:35] Bish: so i still have to use websockets? when i want to do something like that?
[11:09:45] Bish: that sucks

2019-04-13

[16:49:37] Bish: *.net *.split

2019-04-11

[23:21:43] Bish: *.net *.split
[23:27:59] Bish: has joined #ruby

2019-04-10

[09:31:47] Bish: adam12: i think i found the cause of the problem
[09:32:15] Bish: i am using text_part and html_part
[09:32:26] Bish: which results in a "multipart/alternative"
[09:32:42] Bish: as soon as you have file attachments thunderbirds expects multipart/mixed
[09:33:12] Bish: thunderbird seems to see the attachment just as another version of the email as instead of a attachments
[09:51:12] Bish: return unless enabled && self.class.valid?
[09:51:23] Bish: ACTION didnt think about this but this should work
[09:56:51] Bish: still that looks better, doesnt it?
[09:56:59] Bish: return unless enabled && !self.class.valid?
[09:59:10] Bish: hm, for me "return unless enabled && self.class.valid? works
[10:01:24] Bish: but that doesnt make sense :p
[10:02:22] Bish: you can just skip checking enabled then and just return if valid
[10:03:25] Bish: mhlei: if you define & inside a parameter list (in "def") you say you want to get the given block as a proc
[10:03:47] Bish: if you call a method with the operator you pass a proc as a block
[10:04:06] Bish: &&> [1].map {|x| x.inc }
[10:04:46] Bish: &&> [1].map {|x| x.succ }
[10:05:18] Bish: &>> [1].map {|x| x.inc }
[10:05:31] Bish: haha. oh man
[10:05:34] Bish: &>> [1].map {|x| x.succ }
[10:05:43] Bish: &>> [1].map(&:succ)
[10:05:57] Bish: mhlei: these 2 are identical as you can see
[10:06:53] Bish: the reason for that is:
[10:07:29] Bish: :x.to_proc is Proc.new { |obj| obj.x }
[10:07:40] Bish: and &:x implicitly calls .to_proc on the symbol ":x"
[10:07:51] Bish: &>> [1].map(&(:succ.to_proc))
[10:09:27] Bish: &>> [1].map(&Proc.new {|x| x.succ})
[10:09:40] Bish: all the same thing, just syntactic sugar around it
[10:13:23] Bish: haha, fun if you define [] with a &block, and then do [&:x] you get an array of one proc, that would be confusing af to a novice
[10:15:50] Bish: mhlei: 2 > not 2 &
[10:16:22] Bish: phaul: oh its yours :)?
[10:24:40] Bish: adam12: yeah, m.content_type = m.content_type.gsub('alternative','mixed') "fixes" it
[10:28:26] Bish: &>> def self.to_proc; ->(x){p x} ;end;[*1..2].each(&self)
[10:55:52] Bish: mhlei: yw :)

2019-04-09

[13:21:41] Bish: someone having tried attaching files with the mailg em?
[13:21:57] Bish: i tried mail["test.csv"] = content_of_file
[13:22:09] Bish: and its also appended in the mail, but the client doesnt show theres a file attached
[13:22:57] Bish: while gmail does :o
[13:39:14] Bish: Content-Type: text/csv;\r\n charset=UTF-8;\r\n filename=lol.csv
[13:39:27] Bish: it seems to add newslines in a content section of a field
[13:39:47] Bish: (m=Mail.new).attachments["lol.csv"] = "test";p m.to_s
[13:39:49] Bish: can anyone confirm?
[13:39:53] Bish: >> require 'mail'
[13:40:03] Bish: &> require 'mail'
[13:42:54] Bish: it's odd, i see the code and it has those thing snot in there
[13:47:36] Bish: does it the same way, as it seems
[13:52:43] Bish: as you can see it does the same thing :/ adds \r\n for some reason
[13:52:57] Bish: inside a header value.. while \r\n is used to seperate heder values
[13:53:46] Bish: seems like thunderbbird doesnt like this one
[13:54:27] Bish: can you deliver a mail like that to your thunderbird of your choice?
[14:03:16] Bish: m.parts.first.header.fields.map(&:encoded)
[14:03:21] Bish: this doesnt look correc
[14:03:33] Bish: tContent-Type: text/plain;\r\n charset=UTF-8\r\
[14:04:49] Bish: do you think this is a bug?
[14:07:54] Bish: inside the VALUE of the header
[14:08:08] Bish: trying to find out right now, why
[14:09:32] Bish: m.parts.first.header.fields.map(&:encoded)
[14:12:02] Bish: ofcourse the "encoded" method is nowhere to be found
[14:15:36] Bish: i hate that gem
[14:15:44] Bish: it works much better than its code quality suggests
[14:27:58] Bish: there are alooot of issues on attachments with that
[14:28:05] Bish: interesting
[14:29:18] Bish: holy shit what is that crap
[14:29:21] Bish: field has an attribute field
[14:29:41] Bish: abstraction.jgp
[14:31:53] Bish: adam12: jeremyevans is the last one committing to that :)
[14:33:32] Bish: https://github.com/mikel/mail/blob/master/lib/mail/fields/content_disposition_field.rb#L36
[14:33:42] Bish: this seems to be the line that does that adding of \r\n
[14:33:47] Bish: it looks pretty intentional?
[14:33:48] Bish: but wrong?
[14:36:51] Bish: i can't find references that want it that way, no clue why he does ti
[18:32:27] Bish: adam12: okay, thanks :o

2019-04-05

[09:26:31] Bish: has joined #ruby
[12:59:29] Bish: can someone bring conditionvariables closer to me?
[12:59:46] Bish: i am using them and they increase my performance, but i really don't get why this is needed for performant shared state

2019-03-15

[09:58:02] Bish: Ping timeout: 250 seconds

2019-03-13

[13:00:44] Bish: kke: haha, that's good to know
[13:05:25] Bish: what's even to_hash isn't that to_h?
[14:32:21] Bish: kke: ** should be used with super extra care either way
[14:32:26] Bish: thanks for the enlightenment
[14:32:39] Bish: on the long/short thing

2019-03-12

[10:25:59] Bish: well Hash has 2 elements i want it to be one
[10:26:08] Bish: at some point Hash checks for equality
[10:27:04] Bish: oh im guessing i might be able to do that with the default proc
[10:27:53] Bish: well that's not what i am asking
[10:28:04] Bish: i don't want to change == of "Test"
[10:28:45] Bish: isn't eql? a alias of == or the other way around?
[10:29:12] Bish: well for the object im working on, it is :(
[10:30:40] Bish: Tuor: wrap it the code inside begin; <code>; rescue ErrorType => e; end;
[10:30:55] Bish: and lines behind that rescue will work for that errortype
[10:31:15] Bish: ljarvis: yeah and my question is if i can change that :/, i want a hash that uses ===
[10:32:05] Bish: ljarvis: background is my ORM, it uses equality(==) if content of rows are the same and === for the database ids
[10:32:27] Bish: i liked it until now
[10:32:30] Bish: and why?
[10:33:15] Bish: i don't follow
[10:33:33] Bish: last time i checked === can be whatever you like there is no "standard"
[10:33:41] Bish: and == works correctly
[10:37:06] Bish: why do == and === exists if you want them to be the same, the fuck?
[10:37:37] Bish: ljarvis: yes, to the last part
[10:38:00] Bish: and sure, === is a standard operator.. but NOWHERE used in the codebase of ruby standardlibrary (atleast as i hae seen)
[10:38:09] Bish: just for "case" and everyone knows that
[10:38:30] Bish: afaik === is exactly that the "case" equality
[12:04:34] Bish: al2o3-cr: what?
[12:05:38] Bish: al2o3-cr: i don't follow, what are you refering to?
[12:06:36] Bish: get a better hobby than trolling
[12:12:39] Bish: that depends on the purpose
[12:13:03] Bish: for web, yes
[12:38:32] Bish: cache.each do |k,(last_filled:,data:)| pattern matching like this possible in ruby?
[12:43:44] Bish: gotta know what "shit" is handed to me
[13:18:40] Bish: al2o3-cr: so i better write my own brainfuck interpreter so i don't have to know about it's features
[13:25:47] Bish: how bad is spawning a thread that is sleeping all day, unless it's woken up
[13:45:18] Bish: c-c: puh... i have a call inside my code that gets a Coupon code from a database
[13:45:30] Bish: it has to be a single code (bad software design)
[13:45:45] Bish: but it also has to be fast, because it gets called thousand times a second
[13:46:05] Bish: so i have a thread in background, that manages the cache (gets codes from the database ⇒ ram, when neeeded)
[13:46:46] Bish: no, it's just i have to start that thread somewhere, and doing it in the "get" call would mean, if i have to check if that thread is already spawned every call
[13:47:47] Bish: so, the get methods manages the cache itself?
[13:48:50] Bish: why is everyone in this channel in troll mood today? if you got so much better to do, go ahead and do it
[13:52:14] Bish: i did an antisocial comment?
[13:52:26] Bish: "that is beyond my skill"? do you mean that one?
[15:59:16] Bish: if a coniditonvariable#wait times out, does i still hold the mutex lock? i guess so, right?