Page 1 of 10 | Next »
[12:43:08] catphish: i'm running a TLS server in ruby using OpenSSL, it's come to my attention that i need to use better DH keys, but i can't work out how to specify a DH key in an ssl context, is anyone familiar with this?
[11:49:25] catphish: is there anything like throw / catch that will allow me to "redo" from inside nested blocks?
[11:50:35] catphish: i'm trying to make an http download that follows redirects, i just want to restart an outer block when a redirect is enountered
[11:51:09] catphish: but it's looking like i may need to make it recursive instead, which i like less
[11:57:58] catphish: phaul: throw/catch doesn't really provide a mechanism to go back to the top sadly
[13:00:09] catphish: is it possible to tell ruby to stop reading a script from STDIN and start executing it (other than closing the pipe)?
[13:01:35] catphish: oh i think this is probably what i want, the reason is that i want to mix code and data
[13:07:58] catphish: i suspect the answer is "yes, but with its own syntax", but i have no idea what that does :)
[13:17:00] catphish: ryouba: i can summarize: rescue is for handling errors, throw/catch is more like "break" for flow control
[13:33:31] catphish: one would normally use "break" to break out of one level of loop (to jump down to the current end statement) but for more complicated breaking out, throw/catch can be used, i'm not sure i've *ever* needed to use it, always seems too messy
[17:26:32] catphish: i'd like to represent some integers in a base-26 alpha format, is there a trivial approach to this?
[11:02:57] catphish: i have a strange bug whereby i have a gem that uses readline to ask a user for some input, if i run the gem's bin directly, all is well, but if i run it via rubygems's wrapper, readline randomly prints "\r" to my screen when i've entered a line of text
[16:02:08] catphish: i have an odd requirement, i'd like my ruby process to re-exec itself, is there a good way to get the full command line to do so?
[15:56:19] catphish: ruby has some really weird behaviours with class finding :( https://paste.ubuntu.com/p/h4vZ29sVVK/
[16:18:58] catphish: ruby's always had behaviour i didn't understand with regard to finding classes within parent classes
[13:00:33] catphish: def process_one; something_that_returns_true_or_false; end; while(process_one);
[13:01:31] catphish: i've been writing C for a couple of weeks and i'm in the habit of writing: while(something_that_processes_and_tests);
[13:02:42] catphish: the use base being to have one method that processes something once, and a separate method that runs it repeatedly, but allows the loop to be broken
[13:03:37] catphish: canton7: so the loop doesn't do nothing, it's just that the work is done as part of the test
[13:07:33] catphish: i suppose in C it's just an empty statement (the semi-colon at the end is actually a complete statement hat does nothing)
[12:54:57] catphish: i have a requirement to run http requests though an ssh connection (in ruby) - is there an obvious approach to this?
[12:56:26] catphish: if net::ssh can do port forwarding channels, and i can get net::http to use one, that would be the best
[13:04:29] catphish: i can see how that works, but it's functionally no different to: if ("A".."M").include?(char) == true; puts "hoho"; end
[13:08:09] catphish: you can puts within the case statement, or it can return a value as in my link example
[13:13:21] catphish: `when ("A".."M").include? char` should work... it evaluates to true when the char is in that range
[13:14:13] catphish: it's just a horrible way to use "case", you might as well just use if and elsif
[13:16:51] catphish: ruby allows method calls without them, but sometimes it's ambiguous and hence not valid
[14:43:50] catphish: al2o3-cr: oh that's beautiful, thanks! i had no idea it was that easy to do on the fly
[15:05:01] catphish: responses have a return code, the class it just an added niceness, it's redundant in terms of data
[15:05:54] catphish: requests have no such redundancy, the only place the request method is specified in in the class name
[15:06:10] catphish: but again, it's purely a matter of taste, someone had to make a decision, they did
[15:08:59] catphish: personally i find the subclassing of http requests to be an annoyance, but not enough to warrant a complaint
[15:09:56] catphish: i always end up with case statements in order to create instances of Net::HTTP::Request
[15:24:12] catphish: sometimes it's much more convenient being able to instantize a get request directly, other times it's annoying :)
[13:31:10] catphish: is it practical to use a SIGCHLD handler to reap terminated child processes? i was thinking of doing so, but i have a million concerns about race conditions
[13:32:02] catphish: specifically, what happens if a signal arrives during a signal handler execution? will it queue another one?
[13:33:16] catphish: someone writes "pending signals of the same type are not queued", so i'm not sure how this could be used :(
[00:22:06] catphish: looks like i should probably use Array#delete_if to iterate and allow me to delete items at the same time
[13:25:56] catphish: i have a rails process that i'd like to fork to run tasks, is there any way to avoid needing to close database conneections prior to forking? i assume not, but i can see it being a bit messy having to shut down the database connections and reconnect for every fork :( thought i'd ask if there is any standard solution to this
[13:26:52] catphish: it seems to me that one can't reliably close the connection post-fork without risking interruption to the connection in the parent
[19:15:25] catphish: nickjj: yeah i don't remember the details, but i recall it related to the interaction between development, test, and production environments
[14:57:43] catphish: i'm a little confused, i found some documentation that states that Process.setproctitle will change a process name, but when i use it, it seems to instead change the cmdline
[14:59:00] catphish: oh, i'm quite certain it changes the cmdline on linux, the documentation was on OSX
[14:59:40] catphish: i'm quite happy with the cmdline behaviour, it shows up in process lists and isn't truncated as process names are
[13:34:50] catphish: feature request (unless it already exists): the ability to defer signal handlers until the end of a block
[13:36:10] catphish: i assume one could create this manually by setting up and tearing down signal handlers as needed
[14:47:29] catphish: the most common signal my applications will see is TERM, and i don't necessarily want a process to exit until it's finished something critical
[14:48:03] catphish: other signals are just used to trigger things, and again i may not want them to happen instantly
[12:39:49] catphish: TvL2386: in that case you might want to consider changing to use any? and empty?
[12:41:16] catphish: means the database (with mysql at least) only has to pull entry instead of all of them
[10:54:13] catphish: i'm trying to stream a large quantity of data to a command using net::ssh, struggling to find an example, does anyone happen to know how to do this?
[10:56:58] catphish: Net::SSH::Connection::Channel#send_data buffers data to be sent to the channel, which is perfect, but i don't see a callback to let me know when more data is wanted
[11:01:49] catphish: all the examples i find are just sending really small amounts of data all at once to Net::SSH::Connection::Channel#send_data
[11:05:40] catphish: ah got it, looks like i can monitor Net::SSH::Connection::Channel#output which is the output buffer on each invocation of #on_process
[15:14:19] catphish: is there likely to be any way i can store an integer variable directly in a mmap'd file with ruby?
[15:15:11] catphish: i guess i can make a wrapper that at least makes it look like that's what's happening but uses pack/unpack behind the scenes
[15:23:42] catphish: actually even mmap itself isn't marvellously implemented, i'll go back to normal file operations, will check out msgpack
[15:29:55] catphish: the first question was really just how to constantly synchronize a number from ruby-land into a file
[15:31:32] catphish: the use case of this is to store a pointer to a location in another file, and i just realised it might not be necessary at all... i know where i am in the other file because i'm always at the end of it
[15:42:52] catphish: havenwood: i was gonna go with 128 bit because why not, it's going to consume a whole disk block anyway :)
[15:43:30] catphish: but after some thought i'm worried about syncing the pointer file and the data at the same time
[15:44:17] catphish: since i always write the end of the data file, its probably better to calculate the sequence number simply by seeking to the end of the data file
[15:46:03] catphish: the goal here is to collect some data, simultaneously write it to a journal file, and sent it to network clients along with a location integer, if a client connection is lost, it can reconnect and resume from the last location it received
[15:47:02] catphish: so i think i can just open the file at startup with O_APPEND, check the seek location, divide it by my block size, and that's my sequence number
[15:52:02] catphish: i had assumed that if i sync'd every write before i transmitted it i'd be good :(
[15:52:44] catphish: but in all honesty, it doesn't matter, in the case of a crash, data's being lost constantly because it's not being collected at all, so a few missed items in the journal is meh
[15:53:30] catphish: the aim is more to allow clients to come and go at will and catch up, when they come back
[15:54:40] catphish: also, seriously, what's the point in having sync if it doesn't block until the data hits the physical disk?
[14:15:34] catphish: does ruby cache references to classes? in particular does it cache them inside other classes?
[14:16:16] catphish: i have an odd situation where 2 different classes are both calling "User" but are referencing different classes
[14:17:00] catphish: no, it's the same class, but a different version of it, it was releaded at some point
[14:18:01] catphish: rails has some magic that reloads classes between requests, but i'm trying to work out why some old versions are still being referenced
[14:19:18] catphish: so i suppose my question is why in one class, User would reference one class and on another it would reference a different class, i assime there's a leven of caching somewhere that rails isn't invalidating
[14:22:33] catphish: except that even referencing it as SomeClass i get different results depending on where it's called