Activity Graph

Page 1 of 3 | Next »


[15:12:27] TeresaP: has joined #ruby
[15:12:38] TeresaP: Client Quit


[00:09:02] TeresaP: Ping timeout: 252 seconds


[18:58:55] TeresaP: has joined #ruby


[19:10:38] TeresaP: has joined #ruby
[19:11:07] TeresaP: Is there a good utility for copying files while preserving directory structure without using a system call?
[19:11:19] TeresaP: (And I don't mean copying entire folders. I have a list of files)
[19:11:38] TeresaP: FileUtils.cp_r seems to flatten
[20:38:42] TeresaP: shevy I'm on a mac
[20:39:08] TeresaP: I don't know if it matters
[20:39:14] TeresaP: But it definitely flattened
[20:39:24] TeresaP: I ended up having to use rsync
[20:43:35] TeresaP: gcno_files = Dir["{[!CodeCoverage/]**}/**/{[!ObjectiveC]*}.gcno"]
[20:43:45] TeresaP: FileUtils.cp_r(gcno_files, folder_name)
[20:43:59] TeresaP: I also tried a loop
[20:44:15] TeresaP: Yeah I'm copying individual files
[20:44:26] TeresaP: [11:11] <TeresaP> (And I don't mean copying entire folders. I have a list of files)
[20:45:15] TeresaP: You'd think there'd be something available to do this
[20:45:31] TeresaP: I feel like the way I did it is going to be less than stellar performance-wise
[20:50:53] TeresaP: Sounds about the same as https://gist.github.com/TeresaP/d8a2ca9c2dfa26c4da69
[20:52:20] TeresaP: Thanks for the sanity check
[21:02:04] TeresaP: That's a good idea eam


[22:01:21] TeresaP: has joined #ruby
[22:15:25] TeresaP: If I have a class Foo with a method "abc" and it calls another method also called "abc" in the Bar class, is there another way to force it to use the other class other than @core = Object.extend(Bar) and doing @core.abc?
[22:16:54] TeresaP: I don't have control over Bar
[22:17:33] TeresaP: Good point. One sec.
[22:17:52] TeresaP: Foo is a class, Bar is a module
[23:08:33] TeresaP: Quit: Page closed


[11:05:27] TeresaP: Ping timeout: 252 seconds


[18:15:23] TeresaP: has joined #ruby
[18:16:54] TeresaP: If I want to embed a module within a class and that module contains a class variable I want to access, how do I get to it? I tried setting attr_accessor to the variable but no dice.
[18:17:06] TeresaP: How do I get to it from outside the class, I mean
[18:22:42] TeresaP: Oh you're trying to convert a boolean
[18:23:13] TeresaP: bool_val ? 1 : 0
[18:24:26] TeresaP: shevy do you have an answer for my lame question by any chance? :)
[18:29:58] TeresaP: So that's my mistake probably
[18:30:04] TeresaP: because that's an instance variable
[18:31:12] TeresaP: attr_reader wouldn't expose it then?
[18:33:03] TeresaP: Ox0dea if I change it to @@foo, it doesn't seem to affect it either
[18:34:28] TeresaP: Hmm I was hoping to be able to call it like UpdateContent::Operation.modify_entity
[18:35:45] TeresaP: I just want to set some options for a user that happen to map to strings
[18:40:19] TeresaP: Thanks shevy
[18:47:29] TeresaP: Ox0dea yes one of them has a bunch
[18:49:50] TeresaP: Ox0dea It would be ugly, but I'm considering it.
[18:50:13] TeresaP: I suppose I could move the modules out of the class as well
[18:55:40] TeresaP: has joined #ruby
[19:53:06] TeresaP: apeiros kindof
[19:53:36] TeresaP: basically I need to either create a whole bunch of functions to return strings or pull the modules out of my class
[20:47:36] TeresaP: Well that was dumb. I forgot modules with constants can be accessed with Module::CONSTANT so I don't have to go through making functions to return the strings.


[00:00:30] TeresaP: jhass let's say I'm doing this: rescue RuntimeError => e
[00:01:00] TeresaP: And under certain conditions I may decide not to raise
[00:01:12] TeresaP: If I continue on from there, will the thread be dead?
[00:03:32] TeresaP: I have good reasons :)
[00:03:47] TeresaP: jhass what counts as handling it then?
[00:04:13] TeresaP: ah ok great
[00:04:16] TeresaP: sounds like that'll work then
[00:04:26] TeresaP: jhass I was just trying to determine if I needed to recreate the thread :)
[00:04:31] TeresaP: sounds like no
[03:20:09] TeresaP: Ping timeout: 246 seconds


[23:16:17] TeresaP: has joined #ruby
[23:18:11] TeresaP: Hey guys. Noob garbage collection question. If I create a thread, in an initialize method, what's the best practice for cleaning it up? I realize threadname.exit will clean up, but I'm wondering if I should just have a destructor or manually call a cleanup method to kill it or what
[23:19:11] TeresaP: We don't have to do Thread.exit?
[23:19:26] TeresaP: jhass If we hit an exception it's cleaned automatically too, then?
[23:21:17] TeresaP: Thanks a lot jhass. Feels weird not cleaning up
[23:24:21] TeresaP: shevy that seemed harsh, haha
[23:55:00] TeresaP: Another noob threading question if you don't mind. I am kicking off a thread with Thread.new { self.remove_old_screenshots}. If I have a "loop" (infinite loop) going inside that that checks for conditions before executing, what would prevent that loop from being executed more than once
[23:55:20] TeresaP: Besides those conditions not being met
[23:57:42] TeresaP: I'm handling some exceptions that are due to an error in the parent test framework, so I'm not sure that's a good idea is it?
[23:58:16] TeresaP: Do I need to create a new thread if I'm not "raising" after hitting the exception?
[23:59:20] TeresaP: jhass ^ (sorry, keep forgetting to tag)


[18:26:36] TeresaP: has joined #ruby
[18:27:36] TeresaP: If I have a class with some public and some private methods and I want to randomly call one of the public methods, is there an efficient way to do it?
[18:29:31] TeresaP: Ooh I didn't know about this public_send thing
[18:29:48] TeresaP: Was definitely on the right track with Class.public_instance_methods(false)
[18:32:24] TeresaP: This is amazing
[18:35:24] TeresaP: 0x0dea I'm writing a monkey test
[18:39:48] TeresaP: How does public_send and send compare to obj.method(str).call?
[18:42:19] TeresaP: jhass who is 'they' in this case? The class?
[18:43:16] TeresaP: jhass I'm not using attr_*
[18:44:30] TeresaP: MonkeyGestures.method(:method_name).call doesn't actually do it
[18:46:02] TeresaP: Ox0dea just trying to understand the differences :)
[18:46:14] TeresaP: ah yeah that would make sense jhass
[18:46:34] TeresaP: I have one, was just being dumb
[18:47:27] TeresaP: haha you guys are funny
[18:48:07] TeresaP: I'll use public_send. It works great
[18:48:09] TeresaP: Thanks so much
[19:30:07] TeresaP: jhass Ox0dea question about that public_send syntax...
[19:30:46] TeresaP: If I want to call a method where I set the parameter if the user hasn't set it, is there a way to use public_send without passing a parameter?
[19:31:55] TeresaP: Interesting
[19:35:36] TeresaP: Ox0dea or jhass I'm still missing something, I think. Any idea where there might be some more documentation on that send/public_send syntax?
[19:39:59] TeresaP: That's...interesting
[19:40:03] TeresaP: Maybe I'd better give an example
[19:43:32] TeresaP: Ox0dea jhass https://eval.in/470635
[19:44:10] TeresaP: I'm using eval.in incorrectly, probably. But bear with me :)
[19:45:41] TeresaP: jhass orly
[19:46:41] TeresaP: jhass whoops.
[21:51:42] TeresaP: Ping timeout: 246 seconds


[16:43:45] TeresaP: has joined #ruby
[18:13:45] TeresaP: Ping timeout: 246 seconds


[17:58:10] TeresaP: Ping timeout: 246 seconds


[20:55:07] TeresaP: has joined #ruby
[20:57:06] TeresaP: OT: Did web chat.freenode.net get an upgrade?
[20:58:22] TeresaP: I said "OT" but didn't realize there was an off-topic changel
[20:58:30] TeresaP: has joined #ruby-offtopic
[20:58:50] TeresaP: Did web chat.freenode.net get an upgrade? I can't see user names on the right bar anymore.
[21:01:12] TeresaP: Maybe I will try another browser
[21:01:31] TeresaP: Mine looks nothing like that
[21:01:57] TeresaP: Thanks jhass
[21:04:05] TeresaP: Yup looks like it's Safari


[00:21:31] TeresaP: has joined #ruby
[00:26:30] TeresaP: I have another question about Arrays/Hashes :-|. If I have an array of hashes (some are nested), and I want to use a key to look up something that is in one hash and get the value from something that matches that key and is nested inside a different hash, what's the best way to go about that?
[00:31:25] TeresaP: shevy -- are you saying there's nothing out there that can do lookups so I should just write something
[00:39:32] TeresaP: Ox0dea I probably sucked at explaining it
[00:39:35] TeresaP: http://pastie.org/private/koowkjtvze333mh0xbd1uq#1-2
[00:40:44] TeresaP: For each article, I want to say match the article id with a given value to a "children" hash with that id, then get its title
[00:42:10] TeresaP: It's proprietary so I had to mask some stuff
[00:42:21] TeresaP: But yes, rather annoying
[00:42:43] TeresaP: Sorry, getting called away. I'll be back in a bit
[06:54:17] TeresaP: Quit: Page closed


[01:07:10] TeresaP: Ping timeout: 246 seconds
[05:47:01] TeresaP: has joined #ruby
[06:03:02] TeresaP: Sorry for the probably obvious answer this question begs, but I can't figure out how to add an item with a particular format to an existing Hash http://pastie.org/private/drfcui7wyfsewsxmxlfeq
[06:07:01] TeresaP: I've got the first part in an object, which I read in from JSON, but I'm being stupid about the second part.
[06:07:36] TeresaP: That's good to know abut merge
[06:08:29] TeresaP: I've been programming for quite a few years now, but never had the opportunity to create/use hashes until recently
[06:08:37] TeresaP: For some reason they still trip me up
[06:20:03] TeresaP: I'll try that Ox0dea
[06:20:10] TeresaP: I was trying to do
[06:20:20] TeresaP: blah = {"foo" => ["bar"]}
[06:20:24] TeresaP: or some such crazy stuff
[06:21:28] TeresaP: yes just the one
[06:23:42] TeresaP: I made that way too hard
[06:38:37] TeresaP: Ping timeout: 246 seconds
[16:14:48] TeresaP: has joined #ruby
[16:16:09] TeresaP: Alright, I'm being dumb about Hashes again. What are you guys' favorite tutorials for creating Hashes beside the ruby-doc.org site. I need some more visual examples of adding elements to Hashes.
[16:17:05] TeresaP: imperator C#
[16:17:21] TeresaP: But truthfully I never had reason to use Hashes before
[16:17:26] TeresaP: Or at least, i didn't know I did
[16:18:02] TeresaP: Basically, I get the simple cases
[16:18:18] TeresaP: I'm trying to match a particular format defined by another developer
[16:18:29] TeresaP: the keys are repeated
[16:18:36] TeresaP: I'm just missing something obvious
[16:19:36] TeresaP: http://pastie.org/10322443
[16:19:55] TeresaP: As I read in some source data, I need to generate a file like that
[16:20:09] TeresaP: But it's incremental
[16:20:37] TeresaP: See I knew it would be obvious
[16:20:49] TeresaP: So I just need to create a new hash each time and append it to the array
[16:21:03] TeresaP: Thank you!
[16:21:11] TeresaP: I don't know why it's tripping me up so bad
[16:24:09] TeresaP: I'll get there. Just need to sit down and pour over it for a bit, I think.
[16:25:18] TeresaP: I still haven't quite been able to let go of calling functions with this(format)
[17:28:22] TeresaP: Quit: Page closed


[17:06:40] TeresaP: has joined #ruby
[17:07:21] TeresaP: I'm having trouble trying to use the json gem. According to documentation, when I do JSON.parse(string version of json), I should get a hash, but I get an array instead.
[17:07:35] TeresaP: Anyone know what the cause of that might be?
[17:09:57] TeresaP: imperator http://pastie.org/10320506
[17:10:03] TeresaP: That's the simple code
[17:10:10] TeresaP: It's an array with 47 elements
[17:10:36] TeresaP: Each of which are hashes
[17:11:01] TeresaP: Do I really have to loop through each item if I want to find something?
[17:13:02] TeresaP: The JSON has a bunch of elements/(names?) called "entityType" and I want to find all entityTypes that match the value "foo"
[17:13:33] TeresaP: thanks dfockler
[17:13:39] TeresaP: I suppose that makes sense
[17:16:03] TeresaP: Thanks dfockler :)
[19:15:00] TeresaP: Anyone know what the equivalent of right-clicking individual files and compressing them is on OS X? I need a system call or some sort of ruby gem method
[19:15:08] TeresaP: Has to be exactly the same sort of compression
[19:16:12] TeresaP: yes nofxx, currently I do a system call to use 'ditto' (OS X) but it only takes one file or folder
[19:17:18] TeresaP: I'd hate to have to create a temp folder and zip that
[19:17:50] TeresaP: nofxx the problem isn't being able to zip, it's finding a way to zip that exactly mirrors what OS X does
[19:18:46] TeresaP: I tried asking over on macdev too, but no luck
[19:19:30] TeresaP: I don't know... something about how it compresses
[19:19:56] TeresaP: I just know that's what I need. No one documents anything
[19:20:18] TeresaP: (On my team)
[19:20:55] TeresaP: It does matter, because I tried using something awhile back that seemed identical and it wasn't
[19:21:58] TeresaP: I tried that one before
[19:22:08] TeresaP: I'll look into the -h flag
[19:25:16] TeresaP: 0x0dea I've been using ditto, but unfortunately the requirements have changed from a folder to individual files to be added to the zip
[19:25:29] TeresaP: I'm cross referencing the list of files I need to add with a .xml file
[19:25:44] TeresaP: Apparently ditto only takes 1 file OR 1 folder
[19:25:56] TeresaP: So I guess I'm stuck copying files to a temp dir and deleting it after
[19:27:38] TeresaP: I'm using ditto -ck --rsrc --sequesterRsrc
[19:28:02] TeresaP: 0x0dea (forgot to tag)
[19:28:14] TeresaP: oh, you have an O and 0
[19:28:20] TeresaP: that's not confusing :)
[19:28:41] TeresaP: I believe it has something to do with how much it's compressing the images
[19:30:17] TeresaP: Apparently -ck uses Info-ZIP's zip
[19:37:15] TeresaP: Thanks for your recommendation. I've looked into that but I'll revisit
[19:38:17] TeresaP: oh hey zlib has a gem
[19:40:56] TeresaP: zlib has a Zip.default_compression = Zlib::DEFAULT_COMPRESSION
[19:42:00] TeresaP: smoking first pick a project, then read up on the Ruby documentation that will support your ability to do that
[19:42:12] TeresaP: damn autocorrect
[19:46:20] TeresaP: smoaking it might be helpful to take a class on programming, so you get the gist of how to think about programming. From there, it's easy to learn multiple languages.
[19:52:40] TeresaP: smoaking how did you end up in this chat
[19:53:18] TeresaP: smoaking I'm going to place you at 40-50 years old, no college experience?
[19:53:52] TeresaP: definitely a troll
[20:29:29] TeresaP: Does FileUtils.touch not take a path to a file? Part of the path doesn't exist and it's choking on it, but the docs don't mention that limitation
[20:29:48] TeresaP: I'm expecting too much, I guess
[20:31:09] TeresaP: I want it to generate any missing parts
[20:31:45] TeresaP: jhass yeah I suppose you're right
[20:32:03] TeresaP: I'm being lazy :)
[22:46:28] TeresaP: Ping timeout: 246 seconds
[23:11:38] TeresaP: has joined #ruby
[23:13:54] TeresaP: I'm saving some JSON data I've got in a JSON object to a file with File.write but it's adding => where we have :. Is there a setting to change that or do I have to reprocess the file to sub => for :?
[23:17:36] TeresaP: I parsed the JSON with JSON.parse, then grabbed one of the Hash items and saved that.
[23:18:07] TeresaP: Thanks Ox0dea, I guess that should've been obvious
[23:26:41] TeresaP: God JSON.pretty_generate is beautiful
[23:29:40] TeresaP: Ha, that's ok
[23:32:30] TeresaP: I couldn't find any unparse stuff


[11:28:43] TeresaP: Ping timeout: 246 seconds


[18:19:17] TeresaP: I need to get all subfolders that start with 1 or more digits followed by an underscore followed by 1 or more of any character
[18:22:59] TeresaP: Thanks jhass
[18:24:56] TeresaP: Dir.glob("[0-9]*_*") works, somehow
[19:13:07] TeresaP: Is Zippy recommended over Rubyzip for creating archives?
[19:22:41] TeresaP: What is the recommended zip mechanism?
[19:23:44] TeresaP: ruurd what gem would you recommend to assist in zipping files
[19:25:43] TeresaP: I found a few places that recommended Zippy but the documentation is not great
[19:26:39] TeresaP: Yeah, I might just use that even though it is supposedly less abstracted
[19:26:57] TeresaP: Isn't that kindof frowned upon?
[19:31:38] TeresaP: I don't remember the reason, but I seem to remember someone in here was very anti-system calls :)