#ruby - 04 October 2015
« Back 1 day Forward 1 day »
[02:46:58] baweaver: Anyone familiar with gem name aliasing? Tempted to have a longhand and shorthand version of a gem. The obvious solution is to just push two gems and keep them in sync.
[02:51:59] baweaver: it'll go through .*sh_history files looking for patterns for aliasing, and grade your last days shell session
[02:52:24] shevy: https://rubygems.org/gems/terminal-size/versions/0.0.6 - I still have not found out how this is effectively done
[02:52:59] Radar: shevy: https://github.com/rking/terminal-size/blob/master/terminal-size.gemspec#L8
[03:04:33] baweaver: I will say I'm beginning to become very fond of some of rails datetime maths....
[03:25:11] baweaver: Looking into how to reverse read from a file in ruby without loading the entire thing into memory
[03:27:08] eam: baweaver: read the file in reverse and write out a new one. Write every time you encounter a \n
[03:28:33] baweaver: finding common substring patterns, where history could have been used, what aliases you should probably write already, etc.
[03:31:50] baweaver: first section goes over zsh aliases, then editor macro/snippets, then code generators, then meta generators
[03:31:53] eam: if it's an interview question they might be pressing to see if you can handle reading buffers and parsing out separators
[03:33:03] baweaver: problem is I typed some invalid UTF-8 chat in there too somewhere so now I have to strip that bugger
[05:02:29] cantaberry: Using ubuntu with 1.9.1 and it can't find installed gems. How can I trouble shoot? The gem exists in /var/lib/gems/1.9.1/gems
[05:29:08] cantaberry: ["/usr/local/lib/site_ruby/1.9.1", "/usr/local/lib/site_ruby/1.9.1/x86_64-linux", "/usr/local/lib/site_ruby", "/usr/lib/ruby/vendor_ruby/1.9.1", "/usr/lib/ruby/vendor_ruby/1.9.1/x86_64-linux", "/usr/lib/ruby/vendor_ruby", "/usr/lib/ruby/1.9.1", "/usr/lib/ruby/1.9.1/x86_64-linux"]
[05:40:13] cantaberry: Amazing what happens when you look at the readme: https://github.com/gosu/gosu/wiki/Getting-Started-on-Linux
[05:52:05] cantaberry: Okay. I think it's finding the library now. The include doesn't fail... but it doesn't draw anything. Just hangs there.
[08:28:05] tmillc: cantaberry: gosu is fun but tricky. I got the tutorial program working fine, but the first original thing I tried implemented never worked out and I moved on.
[08:28:42] tmillc: but I also don't know much about gamedev so I was probably putting my logic in the redraw spot, or something, who knows.
[08:33:08] Neon: Hello. Do you know of a possibility to setup a global key input listener in a Ruby application (Windows)? E.g. I have the Ruby program running in background, press a key or key combination and in my Ruby program a handler for the key is called?
[08:44:12] baweaver: which would be different for every OS you'd use considering they treat input devices differently.
[08:45:13] baweaver: that being said, it can be used for nefarious purposes, so I won't say much more than that.
[08:47:44] Neon: That's a valid point so it's probably better that this is not an easily accessible feature. Thanks for the information though.??
[09:52:33] nix0: apeiros: Yeah, I know that. But I was wondering why name it 'opts'? Is that short for 'options' because it's an optionparser object not an options object.
[09:55:30] nix0: apeiros: Does it make more sense to name the block argument option_parser or something similar? I know it doesn't really matter but...
[12:38:22] TTilus: good afternoon, #ruby! (and now some football, u know, the one you play with your feet ;)
[13:26:28] Total_noob: ACTION Do not be fooled. The 'pros' do not need the noob help, and they code any time they feel to, Sundays included. .. Just discovered I had 1.9.3 Ruby installed all time long and that compiling newer worked out somehow too.
[13:49:59] jokke1: if i wanted to split a string at an _unescaped_ delimiter ":", how would i do this? The regex i'm using is /(?<!\\)(\\\\)*:/
[13:50:37] jokke1: but since lookbehinds have to have a fixed length, i can't leave the potential unescaped backslashes out of the match
[14:06:41] hololeap: does anyone know if eventmachine and activerecord play nice together? i'm having some strange issues
[14:09:50] hololeap: when i try to do a database call within the eventmachine loop it hangs the thread
[14:19:29] prateekp: in python there is setup.py which has options like extra_compile_args, libraries, include_dirs, library_dirs etc
[14:24:38] hololeap: [k-: it's running inside a EventMachine::ThreadedResource ... isn't that threaded automatically?
[14:26:58] [k-: if you do something large before your next breath, like sing a song (without breathing), you'd probably die
[14:28:53] hololeap: meh, i've used it before and didn't have any issues. i can't figure out what i'm doing differently...
[14:30:24] goldfish6744: is there no scheduler that can delay the start of new threads based on (non)-available resources
[14:32:32] goldfish6744: much like how, say, a web server blocks requests if it's running out of resources, yea
[14:34:57] goldfish6744: Win x64, but irrelevant, it was just a thought based on what [k- said earlier
[14:36:08] goldfish6744: and to add to that, I have sorry little understanding of Ruby, or of OO programming in general
[14:37:02] hololeap: ruby probably isn't the best program to learn OO concepts in. it's too easy to break the rules
[14:37:34] cantaberry: Can someone point me in the right direction? I think I'm having issues with the window attr_reader width in 17... https://gist.github.com/anonymous/8bde45386d90fd4635f1
[14:40:10] hololeap: you need to use instance variables (starts with a @) to be able to use it between methods
[14:46:38] hololeap: mono is actually pretty good from what i've seen. i just don't usually program in windows so i don't use .NET
[14:50:44] shevy: c# is now ranked 4 on TIOBE which we can all agree is the ultimate authority on programming languages popularity http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
[14:51:27] shevy: the TIOBE ranking is so good that ruby manages to jump +6 ranks in one year, can you believe this?
[14:52:11] shevy: I guess the only dataset that is somewhat useful is the objective-c versus swift one
[15:01:36] goldfish6744: but in the textual evaluation bit they also say Ruby users started working hard
[15:17:54] shevy: hololeap yeah probably... I am trying to get a better overall picture by using something like:
[15:19:12] shevy: php lost somewhat, python gained quite a bit, perl lost a bit and ruby is sorta in between perl and php
[15:22:26] shevy: Rails must have really been riding on a huge hype from back then, pretty every chart shows a jump in the 2006-2009 time span
[17:21:20] shevy: ideally show the code you are trying to use, and verify that the binary exists and works on your system
[17:38:57] DEA7TH: I've read somewhere that it's best practice in Ruby to keep your function bodies up to 2-5 lines of code, and split them into smaller functions if necessary. Is it a good practice to write bigger functions, if they are readable and can't be split into anything reusable? I've always hated functions which are only used in one place.
[17:44:23] shevy: the main argument for smaller methods is that they can be easier changed or modified
[18:18:30] yottanami: I need to create code/deployment/build/server configuration web based DOCUMENTATION. do you have any recommend?
[18:28:41] brojo: Anyone in here loooking for work? I need a Ruby developer to finish a project that was started by old programmer who disappeared on me. Please skype me: rob.j.1985 if you are interested.
[18:38:50] DEA7TH: Is it allowed to post job seeking/offerings on Freenode? Awesome, I didn't know that.
[19:33:36] DEA7TH: Whoever decided that IRC clients should display join/quit messages alongside with chat messages is an idiot. (or just lazy)
[19:36:21] DEA7TH: mIRC was actually the least awful client I used. Possibly except for Konversation.
[19:37:07] banister: DEA7TH mirc looks crappy though, it hasn't (iirc) improved its design much from the 90s
[19:47:34] dreinull75: I use Sequel for Object mapping and I need a simple way to visualize the objects. It's all just strings, numbers and dates and some associations. So I was thinking maybe here's someone who has done this kind of object preseantion before. I'm using Sinatra so any CSS or JS solution would be highly appreciated.
[19:48:22] dreinull75: I did Google but couldn't really come up since I'm lacking terminology for what I'm doing.
[19:53:20] ruby-lang280: Hello, I am looking to define a method that returns the area of a circle. I am getting an error, can someone please help me with this issue?
[19:53:45] ruboto_: ruby-lang280, You can find an overview of my commands at http://ruby-community.com/ruboto/commands
[19:54:53] BraddPitt: well ruby-lang280 post your code with what you expect to get and what you are actually getting
[19:55:07] ruboto_: https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
[19:55:15] shevy: DEA7TH I disabled seeing join and quit messages many years ago; I also don't see time stamps. It's much easier for me to focus on just what is said, rather than when it is said
[19:56:03] BraddPitt: because I have a persistent screen on my server that I ssh into for irc usage, so I know if what i'm seeing is stale text or new
[19:56:45] atmosx: You need to configure the client to at least notify you when someone that was talking the last 5-10 minutes parted.
[20:00:24] ruby-lang280: Hello, I am looking to define a method that returns the area of a circle. I am getting an error, can someone please help me with this issue?
[20:02:09] ruby-lang280: NoMethodError in AreasController#circle undefined method `**' for nil:NilClass Extracted source (around line #10): 8 9 10 11 12 13 @pi = 3.1416 @r = params[:radius] @area = @pi*@radius**2 end def triangle
[20:11:50] ruby-lang280: I understand, when I put radius instead of @r it's still giving the same error.
[20:19:51] DEA7TH: Timestamps are awesome. And Colloquy displays them unobstructively, which wasn't necessary but is nice.
[20:28:32] shevy: ruby-lang280 if this were true, then params[:radius] could not work because 'radius' is a string
[21:07:06] ruby-lang013: this is my first time logging in to this IRC, just wanted to see what it is like
[21:07:37] ruby-lang013: but i hear that this chat inst friendly to noobs, just wanted to see myself
[21:07:48] goldfish2310: helpful, generally, for people with precisely defined problems who post code
[21:09:19] ruby-lang013: been learning it for about a week, so im still trying to piece it together and understand the whats and whys
[21:11:52] BraddPitt: Can someone explain how this line finds .gitignore without specifying a path? https://github.com/laserlemon/figaro/blob/master/lib/figaro/cli/install.rb#L22
[21:12:09] havenwood: ruby-lang013: If you have any Ruby questions or need a code review this is a good place. There's a #RubyOnRails channel for Rails-specific stuff as well.
[21:12:55] ruboto_: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[21:15:40] havenwood: BraddPitt: Use File#exist? since File#exists? is deprecated. It just checks in the current working directory, right?
[21:21:07] BraddPitt: well a .gitignore is usually in the root of a dir. How is that method call supposedly finding the .gitignore if no path is supplied?
[21:33:57] HoloIRCUser3: Coraline: i have to teach scripting,but havent enoght time and must chose only one. So i decide choose ruby.
[21:35:54] HoloIRCUser3: Zhkirill: thanks for your opinions. I must convince my colegees because they arent so comfortable with ruby
[21:39:13] jhass: Ruby has fun stuff in stdlib for system scripting, for example https://github.com/ruby/ruby/blob/trunk/lib/un.rb#L9
[21:40:02] HoloIRCUser3: Jhass: I choose ruby but they told me to teach bash and powershell, but i havent enough time so i said ruby it could by good for several platforms..
[21:45:23] jhass: and many popular deployment/orchestration solutions are written in Ruby, https://github.com/markets/awesome-ruby#devops-tools
[21:51:48] msyvich: Is there a Ruby equivalent of of Underscore???s ???pluck???? http://underscorejs.org/#pluck
[21:55:18] jhass: baweaver: http://weblog.rubyonrails.org/2015/5/30/this-week-in-rails-enumerable-pluck-sqlite-collation-and-lots-more/