ctp

Activity Graph

Page 1 of 2 | Next »

2019-06-18

[22:14:25] ctp: Ping timeout: 252 seconds
[22:20:12] ctp: has joined #ruby
[22:20:12] ctp: has joined #elixir-lang

2019-06-07

[06:21:40] ctp: Ping timeout: 252 seconds
[06:24:08] ctp: has joined #ruby
[06:24:08] ctp: has joined #elixir-lang

2019-05-03

[21:39:06] ctp: *.net *.split
[22:07:28] ctp: has joined #ruby
[22:07:28] ctp: has joined #elixir-lang

2019-04-28

[06:08:43] ctp: Ping timeout: 268 seconds
[06:10:16] ctp: has joined #ruby
[06:10:16] ctp: has joined #elixir-lang

2019-04-26

[12:01:44] ctp: Ping timeout: 252 seconds
[12:02:58] ctp: has joined #ruby
[12:02:58] ctp: has joined #elixir-lang
[13:15:58] ctp: Ping timeout: 250 seconds

2019-04-24

[09:37:57] ctp: Hi folks. I still struggle with merging two maps. Does someone has a hint for me? https://stackoverflow.com/questions/55826922/merging-elixir-maps
[09:51:02] ctp: Hm, OK, I see this could help somehow, took a look at merge/3 yesterday, but how to actually concatenate those 2 lists just for the key c?
[09:55:12] ctp: Aaaaaah, click :) You're my hero. Ofc :D

2019-04-23

[17:05:34] ctp: Hi folks. When using map as argument for a function, how can I set a specific value within this map to a default value? Concretely:
[17:06:24] ctp: https://www.irccloud.com/pastebin/Vxpty3OO/
[17:06:56] ctp: breaks with "cannot find or invoke local \\/2 inside match. Only macros can be invoked in a match and they must be defined before their invocation. Called as: licenses \\ ['BY-ND', 'BY-SA', 'PDM', 'BY', 'BY-NC-SA', 'BY-NC-ND', 'CC0', 'BY-NC']"
[17:07:58] ctp: same with a simple def search(query, licenses \\ ['BY-ND', 'BY-SA', 'PDM']) do ... ... ... end works fine, but not with a map as argument
[17:12:40] ctp: OK, I stripped it down to:
[17:12:43] ctp: defmodule TestA do def foo(a,b,c \\ "bar") do IO.puts "#{a}, #{b}, #{c}" end end
[17:12:52] ctp: defmodule TestB do def foo(%{a: a, b: b, c: c \\ "bar"}) do IO.puts "#{a}, #{b}, #{c}" end end
[17:13:28] ctp: benwilson512: hm, not sure, what you mean ...
[17:14:29] ctp: right, I see the point
[17:15:34] ctp: Aaaah, OK, this makes sense. Thank you!
[20:52:06] ctp: Hm, somehow struggling with this
[20:52:26] ctp: def search_all(%{q: query_string} = args) when Map.has_key?(args, :page) do ... end
[20:52:51] ctp: how can i define a guard like this?
[20:52:59] ctp: cannot invoke remote function Map.has_key?/2 inside guards
[20:54:33] ctp: concretly:
[20:54:41] ctp: https://www.irccloud.com/pastebin/N457ray3/
[21:02:28] ctp: Hm, how can I realize this? Spent a while on it but no idea how to check the map for a key in such a way
[21:17:14] ctp: Randyr: "pattern match the key" is actually what I was thinking of, just wonder how to check the existence of these keys without the has_key? call above
[21:21:37] ctp: Oh right, ofc
[21:24:13] ctp: OK, it was actually the order that is important.Thanks!
[22:51:47] ctp: Hm, how can I merge these both maps?
[22:51:51] ctp: foo = %{a: 1, b: 2, c: [%{d: 3, e: 4}, %{d: 5, e: 6}]}
[22:52:02] ctp: bar = %{a: 1, b: 2, c: [%{d: 7, e: 8}, %{d: 9, e: 0}]}
[22:52:42] ctp: What I want to have is %{a: 1, b: 2, c: [%{d: 3, e: 4}, %{d: 5, e: 6}, %{d: 7, e: 8}, %{d: 9, e: 0}]}
[22:53:44] ctp: Somehow difficult :)
[23:04:42] ctp: Hm, I guess I am too tired. Will check it tomorrow.

2019-04-13

[07:43:58] ctp: Ping timeout: 252 seconds
[07:45:52] ctp: has joined #ruby
[07:45:52] ctp: has joined #elixir-lang
[16:50:08] ctp: *.net *.split

2019-03-22

[04:33:45] ctp: Ping timeout: 268 seconds
[04:36:11] ctp: has joined #ruby
[04:36:11] ctp: has joined #elixir-lang
[11:00:20] ctp: Ping timeout: 252 seconds
[11:00:56] ctp: has joined #ruby
[11:00:56] ctp: has joined #elixir-lang

2019-03-04

[11:51:58] ctp: Hi folks. How to reject empty/blank elements in a nested array in a clean way? Something like [ ["", "foo", "bar"], ["", "baz", "qux"] ].reject(&:empty?) but for array of arrays
[11:55:59] ctp: yes, was thinking of something like [ ["", "foo", "bar"], ["", "baz", "qux"] ].map(&:reject(&:empty?)) but this somehow doesnt look correct
[11:58:58] ctp: yepp, compact doe not
[12:02:15] ctp: yes, i know, just wonder how to map and reject in one step.
[12:02:41] ctp: https://www.irccloud.com/pastebin/QQJ6Y0Dm/
[12:06:51] ctp: yes, that's it. thanks!
[13:02:35] ctp: ok, almost, there. last issue:
[13:03:57] ctp: [["[[foo", "bar]]", "a", "b"], ["[[baz", "qux]]", "c", "d"]]
[13:04:24] ctp: how to replace the "[[" and "]]" (in the strings) by "" (blank)
[13:04:35] ctp: map over map?
[13:19:32] ctp: input.map! { |im| im.map! { |s| s.gsub(/\[\[|\]\]/, "") } }
[13:19:45] ctp: urgh, this looks ugly :)
[13:26:42] ctp: ah, right. this makes sense

2019-03-01

[22:52:37] ctp: *.net *.split

2019-02-26

[13:51:33] ctp: has joined #ruby
[13:52:31] ctp: hi folks. I struggle a little bit with a sort of i guess easy to solve issue. i have the following array:
[13:52:43] ctp: ["{ \"type\": \"INFO_INTEGRITYCHECK_BEGIN\", \"data\": {}}\n", "{ \"type\": \"INFO_INTEGRITYCHECK_FINISHED\", \"data\": {\"conflicting\": 0}}\n\n"]
[13:53:42] ctp: and need to transform it into an array of hashmaps
[13:54:00] ctp: the other thing is to remove all the newlines
[13:54:49] ctp: which i hoped to get rid of with something like foo.each { |line| line.gsub(/\n/ !~ line) }
[13:58:27] ctp: yes, they are. the thing is, later i want to filter e.g. for specific type etc
[13:58:57] ctp: hm. you mean JSON.parse maybe?
[14:01:27] ctp: tbuehlmann: you're my hero :) i just tried to parse the entire thing in one :)
[14:33:08] ctp: tbuehlmann: it goes through a series of transformations incl. multiline fields etc.but i managed it to be as json'ish as possible :D

2017-09-03

[08:19:01] ctp: has joined #ruby
[08:19:46] ctp: Max SendQ exceeded
[08:20:17] ctp: has joined #ruby
[08:20:56] ctp: Max SendQ exceeded
[08:21:25] ctp: has joined #ruby
[08:22:14] ctp: Max SendQ exceeded
[08:22:41] ctp: has joined #ruby
[08:23:21] ctp: Max SendQ exceeded

2017-09-01

[11:50:00] ctp: Remote host closed the connection
[14:03:57] ctp: has joined #ruby
[22:13:03] ctp: Remote host closed the connection

2017-08-29

[15:05:03] ctp: has joined #ruby

2017-08-12

[12:19:23] ctp: Remote host closed the connection

2017-08-11

[11:54:47] ctp: has joined #ruby

2017-08-08

[10:10:29] ctp: Ping timeout: 268 seconds

2017-08-07

[09:32:12] ctp: has joined #ruby
[10:36:26] ctp: Read error: Connection reset by peer
[10:36:45] ctp: has joined #ruby

2017-08-06

[10:51:35] ctp: Ping timeout: 246 seconds
[10:55:26] ctp: has joined #ruby
[17:21:27] ctp: Ping timeout: 240 seconds

2017-08-05

[11:48:43] ctp: has joined #ruby

2017-07-29

[18:45:42] ctp: Remote host closed the connection

2017-07-28

[20:32:02] ctp: has joined #ruby

2017-07-27

[20:42:52] ctp: has joined #ruby
[22:41:27] ctp: Remote host closed the connection

2017-07-23

[09:19:15] ctp: has joined #ruby
[09:59:58] ctp: Remote host closed the connection
[13:14:16] ctp: has joined #ruby
[13:15:37] ctp: Remote host closed the connection
[13:16:33] ctp: has joined #ruby
[14:31:15] ctp: Remote host closed the connection

2016-06-16

[07:15:25] ctp: has joined #ruby
[08:53:56] ctp: Read error: Connection reset by peer

2016-06-12

[12:06:01] ctp: has joined #ruby
[12:09:29] ctp: Client Quit
[16:16:16] ctp: has joined #ruby
[16:26:33] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[19:15:52] ctp: has joined #ruby
[19:22:06] ctp: Ping timeout: 246 seconds

2016-06-11

[16:48:37] ctp: has joined #ruby
[17:29:04] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[18:47:31] ctp: has joined #ruby
[21:25:55] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[21:34:09] ctp: has joined #ruby
[21:57:13] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[21:59:26] ctp: has joined #ruby
[22:06:24] ctp: Quit: My Mac has gone to sleep. ZZZzzz…

2016-05-26

[08:23:07] ctp: has joined #ruby
[12:03:20] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[14:45:54] ctp: has joined #ruby
[15:01:26] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[15:31:16] ctp: has joined #ruby
[15:35:40] ctp: Ping timeout: 252 seconds

2016-05-25

[00:06:09] ctp: Quit: My Mac has gone to sleep. ZZZzzz…

2016-05-24

[12:25:21] ctp: has joined #ruby
[12:39:52] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[14:36:42] ctp: has joined #ruby
[14:48:26] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[14:48:48] ctp: has joined #ruby
[14:59:21] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[23:47:05] ctp: has joined #ruby

2016-05-23

[11:54:31] ctp: has joined #ruby
[11:58:30] ctp: Client Quit

2016-05-22

[07:10:35] ctp: has joined #ruby
[07:19:18] ctp: Quit: My Mac has gone to sleep. ZZZzzz…

2016-05-18

[05:12:56] ctp: Ping timeout: 246 seconds

2016-05-17

[08:18:00] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[16:33:23] ctp: has joined #ruby
[18:51:52] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[19:46:09] ctp: has joined #ruby
[21:58:26] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[21:59:45] ctp: has joined #ruby

2016-05-16

[19:10:41] ctp: has joined #ruby

2016-05-14

[20:28:03] ctp: has joined #ruby
[20:34:22] ctp: Quit: My Mac has gone to sleep. ZZZzzz…

2016-05-13

[05:11:09] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[06:58:16] ctp: has joined #ruby
[10:01:10] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[10:59:25] ctp: has joined #ruby
[11:09:07] ctp: Ping timeout: 244 seconds

2016-05-12

[04:59:01] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[06:52:07] ctp: has joined #ruby
[08:45:08] ctp: Ping timeout: 265 seconds
[12:09:43] ctp: has joined #ruby
[12:10:26] ctp: hi folks. how to lstrip/rstrip the whitespaces in such expression: ["| a | b | c | d |", "| e | f | g | h |"].map { |arr| arr.split('|')}.map(&:strip)
[12:10:50] ctp: the .map(&:strip) is at wrong place :)
[12:14:51] ctp: apeiros ["| a | b | c | d |", "| e | f | g | h |"].map { |arr| arr.split('|')} returns [["", " a ", " b ", " c ", " d "], ["", " e ", " f ", " g ", " h "]] so i thought i could map over this array and apply strip on all elements (which are arrays), but i get a NoMethodError: undefined method `strip' for ["", " a ", " b ", " c ", " d "]:Array
[12:15:36] ctp: ah, ok !
[12:16:35] ctp: yepp, i understand. thx!
[12:22:02] ctp: ok, last question where i really see no way how to make it. i have now this array of arrays foo = [["", "a", "b", "c", "d"], ["", "e", "f", "g", "h"]]. how to delete an element (array) from it, where second field is "b" and third element is "c"? so afterwards foo should be [["", "e", "f", "g", "h"]]
[12:22:06] ctp: apeiros: yes
[12:24:22] ctp: apeiros: awesome! thx
[12:32:00] ctp: ok, i hoped something like this would work
[12:32:01] ctp: [["a", "b", "c", "d"], ["e", "f", "g", "h"]] - [["a", "b", _, _]]
[12:37:16] ctp: norc: hmhm, hard to follow for me :) i usually do fp and pattern matching :)
[12:37:48] ctp: i'll try it with the delete_if
[12:39:26] ctp: so the delete_if would be the ruby'ish way to delete an element based on pattern, right?
[12:40:31] ctp: ok, gimme a try
[12:47:02] ctp: argh, [["a", "b", "c", "d"], ["e", "f", "g", "h"]].reject { |x| x == ["a", "b", _, _] } was what i thought about, but this doesn't work. [["a", "b", "c", "d"], ["e", "f", "g", "h"]].reject { |x| x[0] == "a" && x[1] == "b" } is obviously what i'm looking for. but why doesn't the "don't care var" version work exactely?
[12:51:56] ctp: apeiros uuups, ok, i thought the _ has same meaning as in elixir :) now it
[12:51:59] ctp: s clear
[13:02:50] ctp: Ping timeout: 244 seconds
[18:36:00] ctp: has joined #ruby
[21:51:20] ctp: hi folks. how do i split a string using a delimiter but adding some exception? "foo | bar \| bla | baz".split("|") should split by "|" but not for "\|"
[21:56:19] ctp: aegis3121 hm, actually the input string is "| a | b | c \|d | e | f |". what i need as output is ["", " a ", " b ", " c \|d ", " e ", " f "]
[21:56:59] ctp: so the first "|" becomes ""
[21:57:42] ctp: so in the end split at "|" but not at "\|"
[22:03:04] ctp: no one has an idea?
[22:07:41] ctp: aegis3121 hm, i'm sort of confused :)
[22:08:03] ctp: so, "| a | b | c \|d | e | f |" is my input string. i'm parsing $stuff
[22:08:39] ctp: i have no control about this input
[22:10:06] ctp: foo = "| a | b | c \|d | e | f |"
[22:10:14] ctp: foo.split!("|")
[22:10:26] ctp: -> ["", " a ", " b ", " c ", "d ", " e ", " f "]
[22:10:39] ctp: what i need is:
[22:10:49] ctp: ["", " a ", " b ", " c \|d ", " e ", " f "]
[22:17:21] ctp: ok, here's the concrete code :)
[22:17:25] ctp: ["| [[freebsd:hosts:host1|host1]] | 2.4.3 | 2015-05-12 |","| [[freebsd:hosts:host2|host2]] | 2.4.1 | 2016-09-03 |"].map { |arr| arr.split('|').map(&:strip) }
[22:17:39] ctp: [["", "[[freebsd:hosts:host1", "host1]]", "2.4.3", "2015-05-12"], ["", "[[freebsd:hosts:host2", "host2]]", "2.4.1", "2016-09-03"]]
[22:17:39] ctp: returns:
[22:17:52] ctp: ok, mom
[22:20:04] ctp: aegis3121 https://gist.github.com/asconix/77550529e5f06ac8c26965b80b982e89
[22:21:39] ctp: the context is: it's dokuwiki syntax, pipes are used for table's vertical borders as well as for link texts in [[url|linktext]], so i use [[url\|linktext]] to distinguish
[22:24:39] ctp: yepp. i understand, but if i use single quoted strings, there's still the problem how to not split at '\|'
[22:24:40] ctp: ['| [[freebsd:hosts:host1\|host1]] | 2.4.3 | 2015-05-12 |','| [[freebsd:hosts:host2\|host2]] | 2.4.1 | 2016-09-03 |'].map { |arr| arr.split('|').map(&:strip) }
[22:25:22] ctp: ok, gimme a try :)
[22:27:12] ctp: vaejor i don't think so, but the docs i parse autogenerated and produce them
[22:27:25] ctp: would it help, if it wasn't?
[22:27:51] ctp: s/i parse/i parse are
[22:28:54] ctp: yepp, i see
[22:31:39] ctp: i somehow miss the glue between the input string and the regex :) the day today was maybe a little too long ...
[22:33:32] ctp: aaaaaah, ok. thanks guys!
[22:33:49] ctp: was juggling with .scan etc :)

2016-05-11

[12:03:47] ctp: has joined #ruby
[13:53:04] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[17:09:08] ctp: has joined #ruby

2016-05-10

[07:47:08] ctp: has joined #ruby
[14:14:55] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[16:43:27] ctp: has joined #ruby
[16:54:00] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[16:54:38] ctp: has joined #ruby
[17:12:41] ctp: Quit: Textual IRC Client: www.textualapp.com

2016-05-09

[06:39:58] ctp: has joined #ruby
[06:46:00] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[06:55:45] ctp: has joined #ruby
[14:15:03] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[14:15:35] ctp: has joined #ruby
[14:17:03] ctp: Client Quit
[17:29:30] ctp: has joined #ruby
[18:00:43] ctp: Quit: Textual IRC Client: www.textualapp.com

2016-05-07

[07:57:59] ctp: has joined #ruby
[08:17:01] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[08:17:21] ctp: has joined #ruby
[08:20:28] ctp: Client Quit
[11:11:17] ctp: has joined #ruby
[17:46:35] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[18:56:56] ctp: has joined #ruby
[19:22:38] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[19:39:43] ctp: has joined #ruby
[21:58:50] ctp: Quit: My Mac has gone to sleep. ZZZzzz…
[22:13:07] ctp: has joined #ruby
[22:30:39] ctp: Quit: My Mac has gone to sleep. ZZZzzz…

2016-05-06

[17:43:10] ctp: Quit: My Mac has gone to sleep. ZZZzzz…