#ruby - 01 September 2018
« Back 1 day Forward 1 day »
[01:41:28] clorisu: does anyone know why I'm getting undefined local variable/method 'items' for these?: https://gist.github.com/brasscapon/c6c2547324e91982e580661f3469aaee https://gist.github.com/brasscapon/e6142ae50f8815b3f5d652310b3b5030
[01:42:08] SoulFunk: I need assistance with compiling the Ruby 2.5 port on FreeBSD/powerpc. Getting the following error: Unsupported relocation type 10 in non-PLT relocations
[01:50:31] baweaver: clorisu: Try putting a puts statement in the required file to see if it even runs.
[01:51:24] clorisu: baweaver: i get hashCanvasChallenge2.rb:6:in `<main>': undefined local variable or method `items' for main:Object (NameError)
[01:51:40] clorisu: because ive moved the items method into a different file im trying to retrieve from
[01:51:48] baweaver: Most of what I find out on Google indicates something wasn't built right or build deps are missing
[01:53:22] baweaver: I was seeing some things along the line of this: The problem is that when libclamav.so was built .o files were put in that
[01:53:30] clorisu: baweaver: i'm separating a file for coursework that i'm using to practice. i'm sure its being included in the sense that i'm sure they are in the same directory, thats about it. as for why its not working im not sure
[01:53:31] baweaver: But it was older - http://tech-pkg.netbsd.narkive.com/jnk4q5vl/unsupported-relocation-type-10-in-non-plt-relocations
[01:54:37] baweaver: https://stackoverflow.com/questions/3672586/what-is-the-difference-between-require-relative-and-require-in-ruby
[01:55:22] clorisu: so it seems its including the file but not the variable for some reason. is it because its a local variable?
[01:57:49] baweaver: If you're looking to have your data separated that's fine, but I'd serialize it in JSON
[02:00:53] baweaver: So learning how to use it and deal with it now will be a big help in understanding and recognizing it later.
[03:43:26] JJonah: is it possible to dynamically create a method (with `define_method` or any other way) whose arguments have default values?
[03:53:53] woodruffw: JJonah: yes, you can define default values via the block that you pass to `define_method`
[03:58:06] JJonah: woodruffw: thanks. i actually have a hash, and i want the keys of the hash to be the named arguments and its values to be their defaults. i can't figure out how to adjust your example for this case...
[04:01:04] woodruffw: that eval service is giving me internal server errors, maybe i should have chosen a better one :p
[04:10:13] JJonah: woodruffw: I actually want something more like this: https://hastebin.com/efexuwodil.ruby
[04:12:25] woodruffw: JJonah: yeah, i don't know if you can get both arbitrary keyword arguments *and* default values under ruby, unfortunately
[04:12:53] woodruffw: you can get what you want in that example, but i think you'll lose flexibility in terms of passing an arbitrary hash
[04:14:25] woodruffw: this works, but it doesn't handle default values for the trailing hash: https://hastebin.com/awupogezat.sql
[04:15:35] woodruffw: you could fake it by storing a default set of values somewhere and comparing the ones passed in **hsh to those
[09:57:00] clorisu: does anyone know why my ruby doesnt return the last line to terminal? ive tried across many files
[10:13:45] leitz: Is this a proper way to list class names in an array? The test is @integer_options.include?(@result.class). @integer_options = [Integer, Fixnum]
[10:15:20] leitz: Or use @result.class.to_s and put quotes around the array items. Both seem to work.
[10:48:52] TomyLobo: https://github.com/jnunemaker/httparty/pull/569/files this PR adds multipart/form-data to HTTParty. it's been merged since 0.16. I checked the spec files added in that PR, but I can't figure out how to actually enable multipart/form-data
[10:49:31] TomyLobo: do i need to just post files and it automatically switches to multipart/form-data or how does it work?
[11:09:43] leitz: Hey TomyLobo, we usually have some smart people from Europe on around this time. They may be sleeping in though. If you don't get an answer I'd just try stuff and see what doesn't blow up.
[12:22:11] pyrmont: @TomyLobo: It looks like it automatically switches. The request.rb file checks the value of Body#multipart? method and that just checks whether the params respond appropriately.
[20:31:53] leitz: This sort of works but gives an error on specs. /usr/local/bin/gem install -s https://rubygems.org/gems ftl_chargen
[20:32:12] leitz: WARNING: Unable to pull data from 'https://rubygems.org/gems/': bad response Not Found 404 (https://api.rubygems.org/gems/specs.4.8.gz)
[20:51:29] leitz: Not a crisis, I wrote the gems so I have them locally. Of course, I can't test them now. :(
[21:22:13] apeiros__: leitz: https://rubygems.org/gems is probably wrong for a source, just https://rubygems.org
[21:22:29] apeiros__: and since rubygems.org is the default, you shouldn't need to provide that via -s
[21:23:35] apeiros: also, "no, does not work" is still a terrible problem description and you should know better :-p
[21:29:30] leitz: <leitz> WARNING: Unable to pull data from 'https://rubygems.org/gems/': bad response Not Found 404 (https://api.rubygems.org/gems/specs.4.8.gz)
[21:31:58] leitz: gem install ftl_tools ERROR: Could not find a valid gem 'ftl_tools' (>= 0) in any repository ERROR: Possible alternatives: fgltools, atc-tools, bt-tools, fintools, flx-tools
[21:33:36] leitz: ERROR: Possible alternatives: freerider, feedreader, free_spider, fsxtrader, sheet_reader
[21:40:14] apeiros: leitz: see, so it was a different error. and what it means is that you wrote ftl_tools into the gemspec as a dependency, but didn't push it to rubygems
[21:40:30] apeiros: once you install it locally, it doesn't have to fetch it from rubygems.org anymore, hence that error vanishes
[21:43:03] apeiros: i.e. anything with an alphabetical part in the version is considered "prerelease"
[21:43:32] apeiros: and if you put that into the dependencies, you must be explicit with the version, or install with --pre (though, not sure that applies to dependencies)
[21:50:06] apeiros: ah, and I misspoke, `gem search` won't list it, not `gem list`. latter is for gems you installed.
[21:55:47] leitz: And you're right, adding --pre to the install let them install. Good to know since mine are going to be "pre" for a while.
[22:34:57] leitz: Ah, gem 3.0.0 can't push gems. ERROR: You are using a beta release of RubyGems (3.0.0.beta1) which is not
[22:45:03] leitz: So it might be tricky. I've written code that worked from 1.8.7 to 2.6, but my code base is usually very small and only using the standard library.
[22:46:32] leitz: mrush, you could clone the repo and run the tests. See what breaks. I don't think the owners will care.
[22:47:58] mrush: leitz, will do. it'll be slow since i'm not great at ruby yet. basically i'd rather learn and implement whatever is necessary in order to have a ruby alternative to pydbg.
[22:49:46] mrush: thank you leitz :) if anyone does know of more current scriptable debuggers implemented in ruby, please do let me know.
[23:04:00] leitz: How do I change this to allow any version? s.add_runtime_dependency 'ftl_tools', '>= 0.0.1.pre.alpha'
[23:06:16] leitz: darix, changed it to ">= 0", but omitting sounds better. I hate having to increment the gem version because rubygems won't let you upload the same version.
[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:09] leitz: canton7, to a degree, yes. But when the changes are small, like fixing the gemspec, it seems like Rubygems isn't trusting your.
[23:09:20] darix: leitz: uploading a version is like freezing it. think of it as immutable. version numbers are cheap.
[23:09:46] canton7: but if they let you fix the gemspec, they let everyone else completely break things
[23:10:08] darix: leitz: example: many distros verify that the checksum of the upstream tarball (a gem in your case) doesnt change
[23:10:33] darix: leitz: so if you upload 2 different tarballs for the same version ... you would break that. and the first assumption would be ... someone broke into your account
[23:15:07] leitz: Okay, so I've removed the version parameter. https://github.com/makhidkarun/free_trader/blob/master/free_trader.gemspec#L18
[23:15:59] leitz: And back to the error. ERROR: Could not find a valid gem 'ftl_tools' (>= 0) in any repository
[23:34:39] leitz: Okay, time to close this up for the night. Too much frustration, too little understanding.