#ruby - 05 May 2017
« Back 1 day Forward 1 day »
[00:13:17] Radar: I would hope your colleagues would suggest an alternative rather than just dismissing it.
[01:33:45] c_nick: Hi .. I used Ruby 2.3.3 and installed the sqlite3 gem, the gem gets installed but it fails for sqlite3_adapter, i have downloaded the libsqlite3.dll from sqlite3 website and copied it in the C:\WIndows directory. When i try with Ruby 2.0 everything works fine. Even Ruby 2.2.6 does not work
[05:22:31] baweaver: https://github.com/jaysonvirissimo/ruby-mws/blob/master/lib/ruby-mws/version.rb
[05:23:36] nesoi: I tried gem build ruby-mws.gemspec and it returned Invalid gemspec in [ruby-mws.gemspec-: no such file or directory - git ls-files
[05:31:44] baweaver: http://stackoverflow.com/questions/2577346/how-to-install-gem-from-github-source
[05:39:22] baweaver: Why not use a more maintained gem like https://github.com/hakanensari/peddler >
[05:41:09] baweaver: still though, a 4-5+ year old gem with little to no updates is potentially risky
[05:47:23] baweaver: Most of the community use Unix-like OS's, meaning they rarely think about Windows users
[05:48:25] baweaver: Radar wrote an entire guide on that one (that I'm too lazy to google. Help a brother out Radar?)
[05:52:03] baweaver: if that gem name is in the gemspec itself though, remove it so it defaults to the Gemfile
[05:52:34] nesoi: so should I just delete the entire directory under gems which contains the old version or is there a better way to remove it?
[05:56:13] baweaver: as long as the Gemfile specifies a different path to that gem it'll go there to find it
[05:57:59] baweaver: in the Gemfile of Application Foo you want to edit its Gemfile to point to your local Gem Bar
[06:00:17] baweaver: Make sure your Ruby script is in its own directory, and add a Gemfile to it to make sure it points to that
[06:08:42] hays_: is there any hope that ruby will get things like pandas, numpy, scipy, matplotlib, sklearn, etc
[06:14:11] nesoi: baweaver: I think I got it to work by just copying the entire directory over the old one
[07:33:01] JustJosh: Does anybody have tips for setting up a local environment to contribute to Ruby Core?
[07:40:12] KrzaQ: What is the 'Data' constant? I can't use it in my scripts because they yell at me for redefining a constant, but it contains now data
[07:45:07] herwin: JustJosh: `make` creates an executable that you can use without installing, so something like `make && bin/ruby -I lib/whatever test/test.rb`
[07:53:06] herwin: there might be smarter solutions, but this works and i haven't spent enough time in the mri-source to be bothered by it
[09:39:07] al2o3-cr: why? #<RuntimeError: implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly.>
[10:47:20] al2o3-cr: it must be doing 'Z'.prepend('a').prepend('b').prepend('c') by the number of elements
[11:20:08] mortimer: In one of my app, with big loop (displaying progress of process), printing result to stdout significantly slows whole process
[11:21:21] mortimer: With the speed the proccess, the maximum speed, it's about 1k in second (or even more)
[11:21:56] mortimer: ^.^ This is why to my class Progressbar I added option to turn off displaying result :P
[11:22:18] canton7: limit yourself to printing a couple of times a second, or once every N iterations of your loop
[13:20:10] LufyCZ: Hi, Im a beginner, and I would want to ask, how could you tell if a variable is something, and then do something. If the variable is not the something proceed further. WIth this I mean: x = asd (would be gets) if x = asd, do something, if x = dsa, do something else. How could you accomplish this ?
[14:38:22] LufyCZ: Hi, how can I replace a string, that was put in by the user by a number ? In particular: symbol = + , but I need to make a number out of it so that + = 1. Thanks
[14:44:57] mortimer: Do You want it to work with complex expression, or only "number *operation* number" ?
[14:48:00] mortimer: Second case is better to write with something like this:https://paste.ofcode.org/SRErQj8Ts396TZkyrhqLXY
[15:31:37] ytti: A ruby is a pink to blood-red colored gemstone, a variety of the mineral corundum (aluminium oxide).
[17:01:07] havenwood: haylon: Ask away! Lot of folk here have used it and some might know the answer.
[17:02:44] haylon: I'm trying to convert this Python script that uses its flavor of Mechanize to the Ruby flavor. I see it setting some settings like #set_cookiejar(), #set_handle_equiv() and some other parts, but I didn't see those in the docs, or initalize method for the class, otherwise I'm not looking for the correct words.
[17:39:32] makerops: I tried content_type, accept, default_headers, but it keeps sending application/xml
[17:47:18] haylon: you might have to manually set the header. I think there's an option to set manual headers, and just put in Content-Type: application/xml
[17:54:01] makerops: yeah, I tried overriding it in the headers, but I think the default acccfept is getting precedence when apache processes the request
[18:20:44] havenwood: LufyCZ: Here are three related gems you might look at: https://github.com/diasks2/ruby-nlp#numbers
[19:17:33] havenwood: ddffg: "Creates a directory (defaults to ~/bin) and place any executables from the gem there. These executables run in Bundler's context."
[19:17:56] havenwood: "Bundler's context" just means using the exact versions of gems from the Gemfile.lock.
[21:01:31] amperry: hi folks, can someone point me in the direction of a quick primer on 'nokogiri'? I'm trying to rewrite some files that all have an '<h2>' element surrounded by two '<br>' elements.
[21:04:44] ljarvis: amperry: http://www.nokogiri.org/tutorials/modifying_an_html_xml_document.html#creating_new_nodes
[21:18:36] DeeJayh: Basically I'm trying to get the output to 1;2;3 instead of 1111111111111111;222222222222222222;3333333333333
[21:20:47] havenwood: DeeJayh: Just for future reference, if you name your gist with a .rb extension it'll do nice syntax highlighting and make it easier for us to clone and try.
[21:27:46] DeeJayh: logically it should be calling as fast as the processor can handle, and as a float, but each iteration it should store the current number of elapsed seconds as an integer (thus cutting off the float and leaving a whole number)
[21:28:39] DeeJayh: so change = 0, eventually elapsed will equal 1, so puts elapsed and save change as 1
[21:29:10] DeeJayh: now that change is 1 and elapsed continues to be 1, they shouldn't puts again until elapsed becomes 2
[21:30:08] havenwood: DeeJayh: I'd suggest first rewriting your ternary operator as an if statement or case statement.
[21:32:07] DeeJayh: @havenwood, why does no one in any language like single line if statements? I just got told the same thing for a similar style in python. They work just as well and end in less line of code. Is it a readability issue, or are you saying I'm missing a logical error and might notice it better if I wrote it out instead of one lining it?
[21:33:09] DeeJayh: winning_color = winning_number.between?(37,38) ? "Green" : (winning_number.between?(1,9) || winning_number.between?(19,27) ? (winning_parity == "Even" ? "Black" : "Red") : (winning_parity == "Odd" ? "Black" : "Red"))
[21:36:17] DeeJayh: yea I changed it to change != elapsed ? (puts elapsed) : (puts "Nope") and it just constantly puts Nope
[23:12:10] matherr: without the trailing zero it gives correct answer. And with 0 too in case of two digit numbers.
[23:16:15] Zarthus: https://ruby-doc.org/core-2.3.0/doc/syntax/literals_rdoc.html#label-Numbers is something I found just out in the loose which should be a decent starting point
[23:17:46] matherr: I was trying to experiment with different numbers and noticed that behaviour, and how it only happened with 3 digit numbers
[23:24:40] DeeJayh: @havenwood, I just ended up needing some kind of noop, my logic was fine, but it was doing what I thought it was and taking line 9 as the ending of line 8, so now I have: