#ruby - 24 December 2015
« Back 1 day Forward 1 day »
[01:34:05] shevy: shibly possibly you have to do so in configure step e. g. --disable-install-rdoc and such
[01:35:44] shibly: ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /home/shibly/ruby-2.2.4/ruby-build/lib/ruby/gems/2.2.0 directory.
[01:38:42] shibly: pontiki: It's root:root permission to /home/shibly/ruby-2.2.4/ruby-build/lib/ruby/gems/
[01:45:30] shibly: pontiki: https://www.ruby-lang.org/en/documentation/installation/#building-from-source
[01:46:30] pontiki: which says this: "By default, this will install Ruby into /usr/local. To change, pass the --prefix=DIR option to the ./configure script."
[03:03:34] hesco: my bundler does not respect my rbenv version: https://gist.github.com/hesco/c3f3b4cbd89e719d9a1b What do I need to do here, please?
[03:24:49] shevy: Harry usually, what I think works best in like 90% of the cases, build something that you find useful
[03:25:41] Harry: yeah that's what I was thinking however nothing is immediately jumping to mind. Anything you can think of that mgiht be useful to you or others?
[03:27:16] shevy: Harry https://rubygems.org/gems/cookbooks is useful to me because I can use it, despite the flaws it has, to compile things from source easily, query package information and such
[03:28:08] shevy: Harry that's how it looks for e. g. ruby then http://shevegen.square7.ch/screenshot.png
[03:40:56] Ox0dea: As an aside, that would actually be pretty neat for about five seconds, and I'd be surprised if zsh didn't make it pretty straightforward to implement.
[03:41:52] Harry: yeah haha seems like something I'd appreciate for a few seconds then get annoyed with
[03:46:36] Ox0dea: I initially assumed Brytiuk was some smart fellow who'd designed some very efficient algorithm for finding anagrams.
[07:23:03] Guest79386: hey, can someone help me out with a seemingly simple regex problem? => https://gist.github.com/Haseeb-Qureshi/b71e2554c0b99a5d294d
[07:34:46] belak: Is there a way with rbenv to specify a local version or ruby, but not require it to be an exact patch version?
[08:03:40] camus: hello, i'm trying to run my script - https://gist.github.com/anonymous/9a730323a7d8be8a41ce - and am getting the following error:
[08:04:35] camus: fullcontact.rb:18:in `<main>': undefined local variable or method `response' for main:Object (NameError)
[08:05:19] camus: I'm thinking that's because I created my variable inside of a block, so it's not going to be available to the method that is getting called in association with it?
[12:13:38] ruboto: Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
[12:19:07] ljarvis: adaedra: you showed an example where it's not evaluated then said "here, it does." which was confusing :)
[12:19:34] adaedra: ljarvis: yeah, saw this afterwards, it depends which question you think the answer is to.
[12:19:47] ruboto: adaedra # => undefined local variable or method `ceci_ne_sera_pas_evalu??' for main:Object (NameError) ...check link for more (https://eval.in/490205)
[12:22:28] Bish: hi helpers, i want to add a unique id to a mysql table with sequel, i use the before_create method to do that. i do i get sure, that it's unique
[12:23:06] ruby-lang016: I would to know now please, what is wrong with if ((a < u.length) && (b > v.length || u[a] <= v[b])) then
[12:24:32] adaedra: are you sure of your values? You can use pry to get a REPL just before the expressions and test them.
[12:27:59] ruboto: https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
[12:28:47] ruboto: To properly use gist, please enable syntax highlighting, either by choosing the language manually or by entering a proper filename. If you post multiple things, separate them into multiple files. If you have a Github account, please update your gist with new information instead of posting a new one.
[12:29:22] adaedra: mh, there's no more "choosing the language manually" tho, we should update that.
[12:38:57] adaedra: I'm looking, but you may want to look yourself through pry or printing values that the values are the ones you expect.
[12:39:14] adaedra: It's easier to see if a code is doing wrong if you know what it's supposed to do ;)
[12:54:47] adaedra: Also, just aside: if you want to share code with the internet, better have your methods and variables as english names. Helps understanding.
[12:59:53] adaedra: instead of `for i in (a..b)`, your can use `(a..b).each do |i|` which is more common in Ruby.
[15:55:38] Christmus: as far as Windows compatibility, does anyone know if this is classified as a bug or normal behaviour?
[15:55:39] Christmus: Dir.glob('C:\*') #=>  -- Dir.glob('C:/*') #=> [ .. actual directory contents .. ]
[15:59:54] Christmus: right, I have to escape the \ - Now I have to find out what is returning only one backslash to begin with
[16:00:57] active-padawan: i forked gem from github, now i need to add this local fork into my project. but file .gemspec does not exists (he is in .gitignore)
[16:01:38] Christmus: shevy: I also know where the bug is coming from. I'm using ENV.fetch('APPDATA')
[16:06:33] shevy: Christmus if it is just the \ versus / part, just pass through a method that handles this for you properly
[16:07:14] shevy: my windows machine is downstairs so I can not test but from what I recall, I never had any path issues on windows, my scripts would work fine on linux and windows
[16:08:45] Christmus: irb(main):016:0> ENV.fetch('APPDATA') => "C:\\Users\\Zarthus\\AppData\\Roaming"
[16:09:01] Christmus: I can fix it by calling .gsub('\\', '/'), but I'd much rather discover why it is happening :)
[16:11:29] Christmus: luckily modern windows machines have no problems with /, but it still sounds like a ruby bug
[16:12:25] shevy: I hate having to deal with C: and D: and E: when I have mounted USB devices as well, on windows
[16:14:46] Christmus: Mostly because Linux support for games is a lot shittier than Windows support for programming
[16:16:06] Bish: luckily games always worked on linux, wine for me, im not that kind of a gamer though
[16:16:34] Christmus: I run archlinux on my laptop and have a server which mitigates some of the pain
[16:18:43] shevy: but this is really just \\ versus / so Christmus will have that covered soon enough
[17:17:09] DylanJ: ChameleonSix: you're trying to create an instance of the class you're defining inside the class - as you define it.
[17:20:28] ChameleonSix: Below the Name class, instantiate a new Name instance set to the variable name with any title you choose.
[17:32:42] dingman: Can anyone tell me why the method in https://eval.in/490270 keeps hanging at random places?
[17:35:48] dingman: I can paste that, too, but it's long and the loop hangs even with it commented out.
[17:36:50] shevy: can't see what should hang where exactly, you may have to continue to play with it and try to find the minimal amount of code that could show the hang-behaviour
[17:44:53] hxegon: ChameleonSix to_s with an integer argument returns that integer in a different base
[17:46:51] shevy: bitwise operations are not too trivial a thing compared to other operations like 2 ** 3
[17:49:14] Papierkorb: Just write some numbers down and apply bitwise operations on them. That's 101 computer knowledge for a programmer.
[17:53:53] dtordable: Is it the guide of Ruby that includes foxes pictures a good way to learn ruby?
[17:59:16] shevy: hmm the changelog was chopped recently https://github.com/ruby/ruby/blob/trunk/ChangeLog
[18:03:30] shevy: dtordable you can work through https://pine.fm/LearnToProgram/chap_01.html but it's also quite old... I think the best way is to just dive into coding
[18:11:20] shevy: here is a longer explanation: http://stackoverflow.com/questions/690151/getting-output-of-system-calls-in-ruby
[18:16:53] shevy: I use this with aliases, so typing "rubylogs" opens up the page for the ruby changelog https://github.com/ruby/ruby/blob/trunk/ChangeLog
[18:59:36] cyrus_mc: Have the following snippet of code : https://gist.github.com/anonymous/6e643242146cc646d12b - basically I am trying to strip off the end of the path (which happens to be a git repository)
[19:00:22] cyrus_mc: line 3 works if I specify the string directly in .match. However if I use variable current_dir which is set to Dir.pwd (current directory)
[19:01:09] cyrus_mc: shevy: if I output current_dir it prints /var/opt/gitlab/git-data/repositories/vcc-ops/testing.git/custom_hooks
[19:01:25] cyrus_mc: but if I type that literal into the 3rd line it works, but if I try to use the variable it retunrs nil
[19:03:04] shevy: I don't understand your code at https://gist.github.com/anonymous/6e643242146cc646d12b
[19:03:32] cyrus_mc: shevy: All I am trying to do, is determine the current directory. So current_dir = Dir.pwd
[19:03:54] shevy: >> '/var/opt/gitlab/git-data/repositories/vcc-ops/testing.git/custom_hooks'[/([^\/]*?)\.git$/]
[19:04:35] cyrus_mc: shevy: if you run this repository = /([^\/]*?)\.git$/.match('/directory/testing.git') and then output repository
[19:06:08] cyrus_mc: shevy: if I run what I showed about and print out repository I get testing.git, so from what I see the above regex strips off the edning of the path
[19:07:17] shevy: I have no idea what you are doing there cyrus_mc, what you write, and what your code shows, does not seem to align. At any rate, chopping off parts from a string works fine:
[19:07:19] shevy: >> "/var/opt/gitlab/git-data/repositories/vcc-ops/testing.git/custom_hooks".gsub(/testing.git.+/,'')
[19:07:20] ruboto: shevy # => "/var/opt/gitlab/git-data/repositories/vcc-ops/" (https://eval.in/490449)
[19:07:21] cyrus_mc: shevy: but assuming that regex works as I thin it is, I just want to perform that regex on the value of current_dir
[20:08:18] Hanmac: shevy try to find the cat on this image: http://hanmac.deviantart.com/art/Cat-Black-Hole-579975802
[20:09:07] hxegon: my cat does that too. the secret is realizing shadows have gradients and black cats don't
[20:10:34] Hanmac: hxegon: my one does like to lie on the black leather jacket of my mother ... without touching you cant find the cat ;P
[20:18:27] ^CrYpto^: i started reading the book, and it seems ok but trying to remember each bit of code is a little harder than i thought
[20:20:11] shevy: you actually don't need to memorize anything really, the common operations will become logical very quickly, and if not, you can always extend class String etc.. to the way how you want to use existing code means anyway
[22:02:11] Ox0dea: ChameleonSix: The problem there is that #initialize is returning `nil`, which has no #+ method.
[22:04:47] shevy: VeryBewitching if it returns nil then it may be useless, and ideally, you can decouple this anyway, such as if you use a method to do it for you
[22:16:14] shevy: so when you have code like: @hi = puts 'Hi!', or let's say @foo = some_method('hello world') then it's kinda ... not too overly useful to return a nil there, if @foo already was nil before. unless you need to keep track of some nil value specifically... but I rarely have this ever, either it is a boolean or some string or array or hash
[22:24:47] condimentalphysi: i've been stuck on this thing for an hour now. let's say that I need to solve for a 3 digit code that only has numbers from 0 - 9. how do I write the loop/recursion to get it to plug it appropriately?
[22:48:40] VeryBewitching: shevy: (sorry, had stepped away for coffee and was waylaid by Christmas cheer) I usually initialize variables to an empty type, don't usually assign nil, but will return it sometimes from a method.
[22:57:04] VeryBewitching: Gabapentin lets me get up and move around every day, so I kinda have my vote there.
[23:02:12] VeryBewitching: I live with chronic pain, gabapentin is responsible for daily happiness potential.
[23:03:10] wolffles: i didnt know what ponicorn was so i googled it. got this https://www.youtube.com/watch?v=O2D-ZVKU4i4
[23:04:39] wolffles: and Ox0dea im assuming its some innate drive for little girls to ride phallic beasts
[23:06:00] shevy: if you want to up the ante for psychedelic trips, listen to https://www.youtube.com/watch?v=O_AdYv8gYDw ... but better don't
[23:08:02] shevy: I don't remember all examples, but one was toilet paper on the head as part of a hat
[23:08:41] shevy: there were some inventors who deliberately made such inventions... in particular, when they would be *almost* useful but not quite so
[23:09:39] wolffles: http://www.dailyonigiri.com/2010/01/weird-japanese-inventions/ the rain water device has potential
[23:13:22] shevy: I dunno, I like to have code in classes, then be able to re-use them whenever I need to
[23:16:44] tamouse__: they're emotional; any reasoning about them is post hoc and merely justifying those emotions :)
[23:17:40] Ox0dea: I think you're begging the question in purporting emotion to be inherently unreasonable.
[23:24:13] adaedra: Joyeux No??l, Merry Christmas, Sch??nes Weihnachten, God Jul, and all other things.
[23:27:34] Ox0dea: I've just never heard of somebody hiding ~/bin, and I'm gonna help diagnose you. :P
[23:29:04] Ox0dea: nfk: For what it's worth, that little snippet will tell you exactly how many visible directories you have in $HOME.
[23:29:18] nfk: Ox0dea, also i'll point out that ~/bin has never been standard directory, at least not on Linux anyway
[23:39:20] nfk: one would assume it would generate something on the first run but youtube-dl is too prudent for that
[23:40:00] nfk: i could have just read the manpage, i was just derping at how there's no ~/.youtube-dl which used to be an obvious go-to place, even Quake 3 Arena knew where to puts the user files