#ruby - 15 July 2019
« Back 1 day Forward 1 day »
[00:15:09] mnathani: I have some experience with PHP, trying to get into Ruby. Is there a guide / set of tutorials I can use to get me up to speed?
[00:57:29] Guest69247: @browser.input(:xpath =>"//input[@name='message']").set "This is a test message"
[00:57:56] Guest69247: @browser.textarea(:xpath =>"//input[@name='message']").set "This is a test message"
[09:49:29] tuor: hi, can this be shortened? ruby -e 'list = ; while gets; list << $_.split; end; puts list.join(" ")'
[10:35:08] manveru: but `ruby -ne 'print $_.split, " "'` is also possible if you don't mind a trailing space
[10:42:38] leitz: Anyone familiar with Sinatra? The form in line 58 has an action for line 51. The commented out lines 39 and 47 didn't seem to work, but manually setting the data does. It seems like I'm not passing "params" correctly. https://github.com/makhidkarun/ftl_tools/blob/pass_ship/lib/ftl_tools/crewgen.rb
[11:01:56] tuor: manveru: how does your second version work? I men it's nice (yes I don't mind some spaces at the end). The first is nice and still shorter then mine^^
[11:03:46] manveru: the benefit is that it doesn't have to fit all input in memory like my first version or yours
[11:04:10] manveru: but also means you won't know what the last item will be, so you get the additional space
[11:09:34] leitz: Figured out part of it, I forgot that the input was a string, even if it's a number.
[11:09:51] tuor: the -n is clear. but the part at the end I don't know what it is: `, " "` I google this topic befor and found your second solution but only without the last part.
[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?
[14:46:43] ngw: hi, generic question but help highly appreciated: how can I make this faster? https://gist.github.com/ngw/54a544b7f9dcd8964d7d27ae84c754ac
[15:15:55] leitz: I need an image for "that face you make when a senior person in the company mentions everyone should always keep their resumes current".
[15:20:50] ytti: http://hyperboleandahalf.blogspot.com/2010/04/alot-is-better-than-you-at-everything.html
[15:23:11] leitz: Our company competes for contracts so there's always a need to keep your CV updated. No real surprise there, just the mentioning of it. :)
[15:23:57] leitz: My biggest challenge is that I just moved to "programmer" from "linux guy", so my coding chops aren't in line with my years of career experience.
[15:26:41] ytti: having some subject matter expertise in any domain makes you much better programmer in that domain
[15:32:49] leitz: ytti, I've been working on the move for a long time. Mostly because I like to create solutions before the problems blow things up.
[15:39:27] leitz: ytti, yup. Over time the SA has become a commodity. In some ways, programmers (Java) are doing the same, but seem better at holding off management's low opinion of their value. The small business market seems to be helping.
[15:40:05] ytti: yeah you need programming and you need subject matter expertise to be really marketable
[15:40:26] ytti: like if you're good lawyer, you specialise in specific area where you are also expert in the domain, not just legal
[15:41:32] leitz: Agreed. Of course, that's one issue I'm trying to figure out how to overcome; Ruby isn't the language of choice for my domains. Ruby is the language I prefer, though.
[15:45:12] leitz: Jay McGavren (author of Head First Ruby and Head First Go) did a webinar and I asked if a skilled Go programmer could prototype an application as fast as a skilled Ruby programmer. His comment was that no language was faster than Ruby for rapid prototyping. Makes me wonder if that's a good angle to exploit.
[16:20:54] havenwood: ngw: You could process nth lines in parallel. The parallel gem or parallel command should both work. You could do your own threaded version without too much fuss.
[16:21:47] havenwood: ngw: Or you could even try async-io, for a more modern, fiber-backed solution.
[16:22:24] havenwood: ngw: What you have is reasonably quick for a single-threaded solution with fairly low memory use.
[16:27:34] ngw: havenwood: actually I'm an idiot, I was trying the code in irb and didn't realize that 99% of the problem was outputting the results...
[17:42:10] havenwood: Ah, ngw left, but commented on their gist showing a separate Fiber spun up to process each line: https://gist.github.com/ngw/54a544b7f9dcd8964d7d27ae84c754ac
[17:42:57] havenwood: Dunno why I even used an IO stream. I guess just multitasking fail. Anyways, seems several times faster on my machine. ¯\_(ツ)_/¯
[17:55:22] leitz: havenwood, unless the processing took a long time or the file was in memory, it seems like the read would be the choke-point.
[17:56:54] havenwood: leitz: Seems a good bit faster on my machine for whatever reason. I barely had time to write it and do a single benchmark, so no attempts to tune
[17:57:37] leitz: havenwood, hmm...I may be stuck in the spinning platter days, too. With smaller IO buffers.
[18:10:04] Eiam: you are reading a single line from a file, spinning off a new fiber to process it and continuing on with the read?
[18:23:32] leitz: Eiam, the fiber overhead should be minimal, compared to the IO load. However, with solid state drives and lots of disk cache, the difference won't be as great. Still, greater.
[18:24:37] leitz: You'd have to use a file size that saturated disk cache and RAM before seeing a significant slow down.
[18:28:11] havenwood: Eiam: i'm skeptical of my own results too ;P just have to wait until this evening to get some free time to poke at it.
[18:29:17] havenwood: Eiam: ioquatix has a PR open that makes fiber allocation even faster with a fiber pool: https://bugs.ruby-lang.org/issues/15997
[18:36:22] Eiam: havenwood: 10.14.5 has a new allocator for 32 GB and higher configurations to take advantage of the crazy ram people want to use with data processing etc
[18:36:34] havenwood: Eiam: in 2.6: Native implementations (arm32, arm64, ppc64le, win32, win64, x86, amd64) of
[18:40:44] ytti: I've used this library before: http://software.schmorp.de/pkg/libcoro.html and handled millions of HTTP requests using it.
[19:47:35] havenwood: ytti: Here's an interesting thread with folk serving tens of millions of files per day experimenting with Falcon (libcoro under the hood since backed by fibers): https://github.com/socketry/falcon/issues/40
[23:07:50] codiecypha: Hello I just wanted to know if any of you are very familiar with active record models
[23:41:49] vethis: using the paint gem alongside it, sometimes it just breaks tty. like, trying to var.ask(Paint["Prompt:","#somehex"]) just kills the prompt functionality. it prints the string in the right color but doesn't take input
[23:45:13] vethis: in fact any gem that colorizes terminal output in 256 mode doesn't work. lol i guess that's how tty is designed, which sucks because i've learned to love it. i just want my pretty colors :( if i knew more ruby i could probably hack it into the gem but that's beyond my skillset right now