Activity Graph

Page 1 of 15 | Next »


[12:59:03] canton7: catphish, can you give an example of its usage?
[12:59:30] canton7: what would the point of a while loop which does nothing be?
[13:06:02] canton7: ah, gotcha. I think you'll have to write it the same way as in C, with an empty block
[13:09:51] canton7: 'while (process_once) { }' ?
[13:10:54] canton7: yeah, I wasn't thinking


[22:43:00] canton7: baweaver, looking at the code (haven't tried to run it), looks like it will give the wrong answers if you have ',' or '..' outside of the { }? Also no support for having a literal { or }?
[22:44:27] canton7: might want to put some limitations in the readme then? (the string being expanded can't contain the sequences '{', '}', ',', '..'
[22:46:09] canton7: (also we seem to be going the way of node.js, with 5-line methods being turned into their own packages, complete with code of conduct)
[22:48:11] canton7: well, except that you end up here:
[22:50:11] canton7: yes, but the probability increases with the number of packages in your dependency tree
[22:50:53] canton7: the solution is "don't use a package to provide something you could implement by adding a file or two to your project"
[22:52:44] canton7: of course there's a tradeoff
[22:53:01] canton7: but writing 5 lines of code yourself isn't "burning through a ton of engineer time"
[22:53:27] canton7: and really you need to be checking your dependencies, which burns its own engineer time
[22:54:01] canton7: (license, known issues, whether it's maintained, etc)
[22:54:29] canton7: of course, I was taking an extreme example
[23:39:38] canton7: baweaver, Array#product
[23:42:06] canton7: you can regex that! /((?:|[^\\])(?:\\\\)*){(.+[^\\](?:\\\\)*)}/
[23:42:33] canton7: but, I tend to just go back to a token-based parser with a bit of state to say "in escape" at that point...
[23:43:03] canton7: yeah, you could quite happily use StringScanner for that
[23:43:37] canton7: though I tend to just loop through character by character
[23:44:10] canton7: oops, /((?:^|]^\\].....
[23:44:40] canton7: but, you'll want to be processing your input to remove escapes, which means you want to be copying non-escaped input chars to your output anyway
[23:44:55] canton7: but yeah, not too much difference


[10:26:53] canton7: Bish, well it does slightly more: `from ? [from].flatten : []`
[10:27:04] canton7: That's the sort of thing that I might put in a little helper method
[10:55:52] canton7: yeah, flattens and provides an empty array as the default value
[12:03:15] canton7: deathwishdave, things like that rarely come out-of-the-box, since "registration" is a word which means something slightly different to everyone which puts it in their requirements...
[12:03:27] canton7: deathwishdave, you'll find tools which help you to build a rails app which can do those things, though


[15:43:53] canton7: tkonto, 'unless' with two cases gets confusing fast: don't do it
[15:44:39] canton7: you probably want 'if errorcode != 200 && errorcode != 201' or 'if !(errorcode == 200 || errorcode == 201)'
[15:45:11] canton7: and the syntax is 'if errorcode != 200 && errorcode != 201 <newline> retry <newline> end' or 'retry if errorcode != 200 && errorcode != 201'


[11:20:45] canton7: RougeR, for the same reason that 'workers = result.dig(:work, :workers); workers += `' "doesn't work"
[11:21:09] canton7: in that it increments the 'workers' variable, not the value of result[:work][:workers]
[11:37:01] canton7: but, there's no need for dig here. Just do 'result[:work][:workers] += 1'
[12:03:50] canton7: well, '+=' will expand to 'result[:work][:workers] = result[:work][:workers] + 1'


[17:46:43] canton7: za1b1tsu, it's about apps vs gems, see some of the articles here:
[17:48:00] canton7: long story short: bundler/gemfile is for locking down the exact versions of gems that your application uses. gemspec is used when creating a gem, is used tell consumers what gems your library depends on, and you specify lax ranges rather than specific versions


[12:17:35] canton7: adac, give us some sample input and sample output?
[12:23:06] canton7: what's the input?
[12:31:10] canton7: you have two inputs: the regex, and the string the regex is applied to. You've only given us one of those two
[12:33:54] canton7: or something like 's[1..-2].split('|')' . Depends how much you want to check that the input is well-formed
[12:36:54] canton7: ACTION has written regexes to parse regexes more times than he would have liked


[11:24:41] canton7: Looks like it's interpreting it as a time, and "5 minutes + 90 seconds" is the same as "6 minutes and 90 seconds"
[11:28:27] canton7: *is the same as "6 minutes + 30 seconds"
[11:29:14] canton7: replace . with / and it works


[14:47:49] canton7: that's pretty easy to test :P
[14:48:01] canton7: you expected a string when you got an array


[10:36:19] canton7: Quit: ZNC -
[10:36:46] canton7: has joined #ruby


[13:41:56] canton7: Quit: ZNC -
[13:42:17] canton7: has joined #ruby


[11:39:43] canton7: depends whether you want a column that's called 'id' and is the primary key


[11:07:15] canton7: A comes before a in ascii
[11:07:45] canton7: &>> /[A-z]/.match?('q')
[11:11:00] canton7: &>> /A-z/.match?('[')
[11:11:08] canton7: &>> /[A-z]/.match?('[')
[11:11:16] canton7: ^ note that A-z also catches a bunch of other characters


[12:59:03] canton7: indeed, because it doesn't appear between the 'begin' and the 'rescue'
[12:59:16] canton7: if you want to catch errors from it, put it in its own begin/rescue block
[13:01:12] canton7: catching different sorts of errors
[13:01:48] canton7: 'rescue OneTypeOfException' ... 'rescue AnotherTypeOfException' ...


[11:49:09] canton7: grr12314, from phaul's doc: Matches rxp against the contents of $_. Equivalent to rxp =~ $_.. Looking at the doc for =~ (in the same page): "If a match is found, the operator returns index of first match in string, otherwise it returns nil."
[11:49:20] canton7: so yes, it operates on $_, and returns the index of the first match


[16:49:46] canton7: there's a ternary in there
[16:50:18] canton7: x[n - 1] ? (x.minmax.uniq * '-') : x
[16:53:42] canton7: you pretty much only see it in golf
[17:12:26] canton7: it's also impossible to google for if you don't know what it does, so it's not very discoverable
[17:12:36] canton7: and it's only one char shorter than just using quotes


[00:10:16] canton7: Quit: ZNC -
[00:10:43] canton7: has joined #ruby


[10:49:14] canton7: asphyxia, that just means a method which has a single parameter, called 'a'. It could be an array, or anything else: there's no enough information to say


[16:05:26] canton7: JJonah, that hastebin is empty?


[09:18:43] canton7: more context?


[15:29:05] canton7:{ |k,v| array.include?(k) } ?
[15:31:20] canton7: is values_at guaranteed to return the values in the right order? The docs don't say, but I guess it'd make sense
[15:31:42] canton7: siaw23, or 'array.include?(k.to_sym / k.to_s / whatever)`
[15:48:40] canton7: ah, only looked in the 2.0.0 docs


[23:08:06] canton7: that makes sense, surely? If someone is depending on a particular version of your gem, you shouldn't be able to just break that
[23:09:46] canton7: but if they let you fix the gemspec, they let everyone else completely break things


[23:10:15] canton7: Quit: ZNC -
[23:10:35] canton7: has joined #ruby


[02:42:50] canton7: *.net *.split
[02:56:47] canton7: has joined #ruby


[21:06:14] canton7: Remote host closed the connection
[21:07:05] canton7: has joined #ruby


[09:16:21] canton7: Ping timeout: 240 seconds
[09:18:32] canton7: has joined #ruby


[19:43:31] canton7: we've used gollum with success before


[16:43:19] canton7: (btw, try and avoid unless...else - it tends to do people's heads in
[16:45:59] canton7: sagax, another way of writing that would be `env = "development" if !ENV.has_key?("NODE_ENV") || !["production", "development", "test"].include?(ENV["NODE_ENV"])`
[17:45:07] canton7: Mike11, Enumerable#slice_before
[17:46:41] canton7: mroutis, try an input of [20, 2, 30, 3, 4, 40, 4, 5, 6] ;)
[17:47:15] canton7: that's not what I said...
[17:48:15] canton7: >> [20, 2, 30, 3, 4, 40, 4, 5, 6].slice_before{ |x| x < 10 }.to_a
[17:48:24] canton7: >> [20, 2, 30, 3, 4, 40, 4, 5, 6].slice_before{ |x| x > 10 }.to_a


[11:08:04] canton7: Quit: ZNC -
[11:08:23] canton7: has joined #ruby


[00:07:27] canton7: *.net *.split
[00:15:45] canton7: has joined #ruby


[08:42:50] canton7: lucas_, some suggestions on how to get curl to introduce that newline:
[09:11:20] canton7: he didn't hang around for long...
[09:12:25] canton7: _phaul, objects which are equal MUST have equal hash codes
[09:17:00] canton7: _phaul,, mouseover and click ("click to toggle source")
[09:17:15] canton7: and the doc: "Returns a hash value based on this struct's contents"
[09:18:36] canton7: (things like Set and Hash start off using the object's hash code, and if two objects have the same hash code they check #eql? to see if they're actually equal
[13:49:42] canton7: crankharder, wrong channel?
[13:52:11] canton7: I'm sorry? I'm asking crankharder whether he posted in the wrong channel by mistake, as his message doesn't appear to have anything to do with ruby
[13:52:15] canton7: I know I'm in #ruby :P
[13:52:54] canton7: ACTION is very confused
[14:04:41] canton7: and a third person who seems to be fixated on the idea that the person who pointed out what channel this is doesn't know which channel this is...


[13:53:14] canton7: YokoBR, you likely need to have bundler installed?


[11:00:09] canton7: mattb20, first point: you need to set up the expectations *first8
[12:30:20] canton7: >> [[1,[2,3,4]],[5,[6,7,9]]].flat_map{|a,b|[a].product(b)}
[12:30:24] canton7: ACTION shaved a couple of characters off


[10:28:41] canton7: what does "does not work" mean?
[10:31:29] canton7: what's the actual problem you're having?
[10:31:58] canton7: what does the additional warning say?
[10:34:31] canton7: and you've definitely imported the right root cert into firefox?
[10:36:30] canton7: the right VA, rather
[10:37:43] canton7: what about `openssl req -new -nodes -x509 -days 365 -extensions v3_ca -keyout insecure_ca.key -out insecure_ca.crt`?
[14:03:08] canton7: also File.file? and
[14:03:20] canton7: (e.g. File.file?('/some/file'))
[14:19:37] canton7: MagePsycho, using one of the suggestions which tbuehlmann and I gave you?
[14:19:50] canton7: oh, you mean run the rakefile using rake?
[14:23:11] canton7: MagePsycho, there's a parameter you can pass to rake to get it to load a particular file
[14:29:30] canton7: MagePsycho, use a hash
[14:38:55] canton7: MagePsycho, so you want to use a hash but you're not allowed to use a hash?
[16:01:15] canton7: MagePsycho, I'm not sure what the 'set' method does, but it doesn't define a new variable...


[10:06:18] canton7: I find a lot depends on the depth of the program - how much of the application a single type is used in, how many types interact with each other. Beyond a certain depth, I really miss the guarantees of a good type system
[10:06:52] canton7: being able to say "find all the places where this is used" or "rename this" or "change the type of this, now tell me everywhere else I need to change" speeds you up a lot


[14:32:16] canton7: Quit: ZNC -
[14:38:42] canton7: has joined #ruby
[14:42:29] canton7: Client Quit
[14:44:00] canton7: has joined #ruby


[13:56:48] canton7: can't you just check whether a domain has been added to any other account?


[14:16:20] canton7: Quit: ZNC -
[14:16:42] canton7: has joined #ruby
[14:21:51] canton7: Quit: ZNC -
[14:22:08] canton7: has joined #ruby


[18:02:24] canton7: Ping timeout: 255 seconds
[18:03:19] canton7: has joined #ruby
[18:08:00] canton7: Ping timeout: 260 seconds
[18:09:20] canton7: has joined #ruby


[07:47:21] canton7: Ping timeout: 240 seconds
[07:48:43] canton7: has joined #ruby


[07:16:52] canton7: Ping timeout: 245 seconds
[07:21:47] canton7: has joined #ruby


[02:44:51] canton7: *.net *.split
[02:45:19] canton7: has joined #ruby
[02:46:59] canton7: *.net *.split
[02:47:53] canton7: has joined #ruby
[13:14:21] canton7: gray_-_wolf, look at FFI::LastError ?
[13:15:22] canton7: gray_-_wolf, it's often the case that either the ffi machinery, or stuff that wraps it, calls other functions internally, which messes up GetLastError. Ruby methods can also call into stuff which sets the last error
[13:15:33] canton7: (I assume -- that's how it is in other languages)
[13:15:58] canton7: so it's common that the ffi lib will record the LastError itself after calling a native function, and save it for you


[12:15:35] canton7: Ping timeout: 240 seconds
[12:20:05] canton7: has joined #ruby


[12:21:51] canton7: Ping timeout: 265 seconds
[12:23:43] canton7: has joined #ruby


[11:10:12] canton7: warrshrike, 'head' might be nil
[11:10:34] canton7: in fact, head is guaranteed to be nil
[11:13:28] canton7: ruby is pass-by-value, but everything is an object
[11:14:55] canton7: the references to the objects are passed around by value
[11:17:11] canton7: no, a reference to the object is directly given to the assignee
[11:18:28] canton7: yes. '7' is an object. a holds a reference to the '7' object. that reference to the same '7' object is then copied into b
[11:19:35] canton7: correct. 'b = 9' creates a new '9' object, and assigns a reference to it to the 'b' variable
[11:21:00] canton7: no, 'uppercase' does not mutate the object it was called on. It returns a new object.
[11:22:06] canton7: 'upcase!' however does. If you did 'a = x; b = a; b.upcase!; then 'a' is now 'X'
[11:22:48] canton7: you're mutating backpop[target-1], by changing its 'next' property
[11:23:24] canton7: whether or not an object is mutated when a method is called depends on whether or not the method mutates the object it's called on, yes
[11:23:32] canton7: upcase does not mutate, upcase! does, see my example just above
[11:25:20] canton7: "call by value"?
[11:30:30] canton7: ruby passes references to objects by value
[11:30:42] canton7: those objects can be mutated (if they expose methods which mutate them)
[11:34:54] canton7: so it just returns the thing which was passed in?
[11:36:01] canton7: right, but it returns the thing which was passed in?
[11:57:54] canton7: ACTION wonders how many people have to say the exact same thing...


[14:07:58] canton7: it's remainder.
[14:08:27] canton7: 75 % 4 = 3, because 4 * 18 = 72, and 75 - 72 = 3


[16:14:31] canton7: how do you get rid of the decimal part of a number *without* rounding?
[16:16:24] canton7: reminds me of ...
[16:17:42] canton7: you're going to have to explain why... an example is a good way to do that
[16:18:23] canton7: right, and what's 'big_decimal_value' and 'csv_value'?


[13:29:58] canton7: from the languages which use "message passing" that I've used (which don't include things like erlang or elixir, granted), the only practical difference I've noticed is the ability to say "when someone calls a method on this class, which I haven't defined, run this code instead of raising an error"
[13:30:29] canton7: (and perhaps to easily say "invoke the method foo on an object", without the overhead of reflection)
[23:04:01] canton7: Quit: ZNC -
[23:26:26] canton7: has joined #ruby


[12:25:50] canton7: *.net *.split
[12:27:24] canton7: has joined #ruby
[15:01:21] canton7: *.net *.split
[15:03:14] canton7: has joined #ruby
[15:16:20] canton7: I know all of those words. I've no idea what to make of the order you've put them in
[15:16:26] canton7: what's a hex timestamp? What's a unicode timestamp?
[15:17:21] canton7: then what chance do other people have, if you only use 7 words to describe your issue? :P
[15:18:11] canton7: ah right, so we've moved from unicode timestamps to a unix timestamp, progress!
[15:18:48] canton7: now have you actaully got a hex *string*? Or a number? How are you reading the binary file? Post an example of you input, as apeiros asked
[15:19:29] canton7: ACTION thought so too


[10:56:01] canton7: dang`r`us, from looking at that table, looks like "X, reduced accuracy" means "X, but with the most accurate portion removed"
[10:56:19] canton7: so if X is a year-month-date, the "reduced accuracy" removes the date component, leaving just year-month
[10:56:35] canton7: likewise if X is hours-mins-secs, the "reduced accuracy" removes the secs, leaving hours-mins


[10:50:34] canton7: brosso, so what's wrong with `s = "C0DE" s << "BASE"`?
[10:51:13] canton7: (as in, what are you trying to do with the escapes?)
[10:51:42] canton7: I'm not sure that answers my question?


[15:39:27] canton7: "\G will match the match boundary, which is either the beginning of the string, or the point where the last character of last match is consumed."
[15:41:11] canton7: (copied from stackoverflow)
[15:42:32] canton7: I mean, you don't need (0x20.chr) there, or lots of things... That's not the point :P


[10:34:17] canton7: leitz, "use a variable" in what sense?
[10:37:31] canton7: yeah, "5e3" is scentific notiation for "5 * 10^3"


[13:21:43] canton7: mojtaba, what are you trying to do?
[13:22:00] canton7: mojtaba, if you want to run an interactive ruby console, run 'irb'


[21:25:43] canton7: L59... should be nightly-announce?


[15:25:13] canton7: drale2k_, bear in mind you'll have to make sure that process terminates if someone just closes the web page


[14:00:09] canton7: Quit: ZNC -
[14:00:25] canton7: has joined #ruby


[12:41:57] canton7: TomyWork, iso8601?
[12:42:12] canton7: that's the bog-standard date/time serialization format. It's standard to use it in json as well


[15:17:23] canton7: at work, we have a document control system and process, so documentation is kept outside the repo (but still somewhere project-specific)


[16:57:20] canton7: Xentil, 'next'
[16:58:10] canton7: think about a block passed to #each -- 'next' exits the block early, 'return' exits the scope around the #each itself
[17:09:01] canton7: true, I meant 'break' not 'return'
[17:10:51] canton7: oh, no, I'm confusing myself and it's late. I did mean 'return' -- it exits the scope of the #each, returning control to the caller
[17:11:45] canton7: hmm? If a() calls b() calls c(), and c has a 'return', control is returned to b, not a
[17:13:57] canton7: and your gist says "return control to the caller of the topmost method or lambda" -- to the *caller* of the topmost method of lambda. Not to the topmost method or lambda itself, which is what you said just above
[17:15:08] canton7: why not just "returns from the topmost method lambda or method"?
[17:17:48] canton7: >> f = proc{ return }; g = lambda{ f.(); puts "bla"}; def h; f.(); puts "woo"; end; h
[17:19:37] canton7: yeah, I don't get that.
[17:21:20] canton7: "try stuff until it works"
[17:22:12] canton7: 'fraid I can't devote too much time - still at work


[10:28:56] canton7: I'd guess not, as multiple elements may have the same hash, so the set/hash needs to do equality on the element itself as well


[13:44:01] canton7: Bish, is this more a question of making sure that people don't register a subdomain which doesn't belong to them?
[13:44:47] canton7: most people do that by requiring that the person creates a TXT record with a magic value you supply
[13:45:35] canton7: Bish, create a random number, then base64/32/whatever-encode it.
[13:45:46] canton7: or just pick random letters out of a set
[13:46:57] canton7: Bish, so user signs up, provides their subdomain. You say "OK that's great, I need you to create a txt record with <this value>. User does that, clicks "check now". You check for the presence of that TXT record with that value. If it's found, all good, the user controls that subdomain


[15:25:11] canton7: bmurt, sinatra?
[15:36:36] canton7: bmurt, I don't think rake defines a 'set' method? Certainly, I can't use it in my rakefile...
[15:36:52] canton7: bmurt, what exactly does your rakefile look like? What requires does it have?
[15:37:14] canton7: bmurt, you said you were using ruby and rake
[15:37:27] canton7: so now you're saying rake isn't relevant to this?
[15:37:56] canton7: either way, it's just a method. You'd need to look at the requires to see what's defining it
[15:38:15] canton7: or other context, e.g. if you're in a class subclassing/including another


[03:04:58] canton7: Quit: ZNC -
[03:14:50] canton7: has joined #ruby