Bish

Activity Graph

Page 1 of 29 | Next »

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:04:56] Bish: can somebody tell me what problem conditionvariable solves
[10:05:03] Bish: i don't quit get it what its good forẞ
[10:05:32] Bish: canton7: why does and or && matter
[10:08:40] Bish: oh i see
[10:17:21] Bish: does Hash check existence of a thing with === ?
[10:18:47] Bish: well, if i do h[some_method_creating_a_new_object] = true
[10:19:03] Bish: == of those 2 objects is false, === of these 2 objects is true
[10:19:38] Bish: not really, trying to artificially create one right now
[10:21:26] Bish: class Test; def === b;true;end;end;
[10:21:36] Bish: h={};class Test; def === b;true;end;end;h[Test.new] = 1; h[Test.new] = 1;h
[10:21:49] Bish: can i somehow make that hash check for equality with === ?
[10:22:15] Bish: >> h={};class Test; def === b;true;end;end;h[Test.new] = 1; h[Test.new] = 1;h
[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?

2019-03-11

[11:38:58] Bish: has joined #ruby
[11:39:24] Bish: is there a queue which can have timeout on .pop
[13:45:03] Bish: Xeago: like calling it non blocking and rettrying?
[14:01:27] Bish: marz_d`ghostman: no, never
[14:02:36] Bish: sarcasm, ofcourse someone has done that
[14:05:51] Bish: is Queue implemented in C?
[14:56:41] Bish: whats the gag about conditionvariables
[14:56:54] Bish: i mean.. can't you just re-open mutexes as you like?
[14:56:58] Bish: in that example on the man page
[14:57:53] Bish: http://ruby-doc.org/stdlib-2.0.0/libdoc/thread/rdoc/ConditionVariable.html
[16:35:18] Bish: ytti: im guessing that depends on what something is
[16:36:10] Bish: &> [1].map(&->(a=1,b=2){ a+1 })
[16:36:30] Bish: >> [1].map(&->(a=1,b=2){ a+1 })
[16:37:12] Bish: >> [1].map(&Proc.new { |a,b=2| a+b+1 })
[16:37:41] Bish: ytti: also, if you want to call & with parameters you can help yourself with clojures & nasty hacks
[16:38:36] Bish: matsaman: i was thinking about something like overwriting .to_proc of Symbol
[16:38:47] Bish: then you could stuff like
[16:38:56] Bish: .each(&:_add_1)
[16:39:30] Bish: or implement a .to_proc for arrays
[16:39:47] Bish: and give parameters that way
[16:40:10] Bish: readability, people will hate you if you put that inside a gem
[16:40:48] Bish: Short is not readable, no
[16:41:09] Bish: assembler has the shortest statements i know, how is that readable
[16:41:19] Bish: or ask the haskellers about short = readable, they would say yes
[16:42:39] Bish: filterM (const [True,False]) [1,2,3]
[16:42:44] Bish: its super short, but what is it?
[16:43:12] Bish: took me days to understand whats happening there
[16:43:58] Bish: i disagree
[16:44:32] Bish: the code i posted solves a hard problem and makes it a simple one, even though you need a lot of learning to understand it
[16:44:53] Bish: monkeypatching to_proc introduces errors like hell and solves a really simple problem
[16:45:57] Bish: i think having clojures is a good way to go about it
[16:46:06] Bish: .each(&some_clojure_generator(3))
[16:46:11] Bish: tada, you have parameters in it
[16:48:37] Bish: well, it wouldn't be part of the language, either way
[16:48:49] Bish: a to_proc hack wouldn't be a part of the language
[16:49:19] Bish: a clojure on the other hand is a feature of ruby, my approach is more ruby as what you suggest
[16:50:48] Bish: matsaman: yeah if you want that as a feature in a language you want haskell :p
[16:51:07] Bish: what i wrote before was the implementation of this
[16:51:55] Bish: i never used pandoc

2019-02-26

[09:30:05] Bish: Ping timeout: 245 seconds

2019-02-25

[15:58:55] Bish: has joined #ruby
[15:59:01] Bish: there is nothing in default ruby that makes
[15:59:19] Bish: [{a:3}].map {|x| x[:a] } less cumbersome, right?
[16:00:06] Bish: phaul: im guessing u know what i want?
[16:02:33] Bish: |a:| holy shit that works?
[16:11:16] Bish: what is actually the reason hashes dont have method access to it's contents?
[16:11:29] Bish: as long as they're symbols
[16:11:45] Bish: because of things like {to_h:1}

2019-02-13

[10:17:14] Bish: has joined #ruby
[15:01:22] Bish: Quit: leaving

2019-02-11

[09:26:11] Bish: does rescue always change the return value of a block?
[09:26:23] Bish: begin;...;rescue ...;end;
[09:26:33] Bish: i remember something being fishy about that
[09:26:45] Bish: but i also fell into the trap using "return" inside a proc
[11:18:32] Bish: Ping timeout: 268 seconds

2019-02-06

[10:51:20] Bish: isn't there a do missing?
[10:51:43] Bish: well it seems to be optional
[10:51:53] Bish: for x in y do;...;end

2019-02-04

[14:40:02] Bish: any reason this should not be multipart?
[14:40:19] Bish: chruby and rvm sucks </opinion>
[15:32:18] Bish: isn't that more or less what happens by default in ruby
[15:32:59] Bish: i once wrote a module that takes a module and makes a method (fibonacci for example) memoized
[15:33:14] Bish: and i think i didn't use a single send. while that wouldn't have bothered me