Activity Graph

Page 1 of 1


[15:32:36] blood: has joined #ruby
[15:33:11] blood: How do I prevent ruby from resolving environment variables passed to shell execute? If I run my script manually, everything works as expected
[15:33:33] blood: I'm currently passing env vars as %%ENV%%
[15:50:16] blood: Quit: Page closed


[17:11:26] blood: has joined #ruby
[17:14:56] blood: I can't get my ruby program to execute a command file properly : Any ideas?
[17:15:02] blood: Nothing is ever written to log.txt
[17:15:30] blood: when using system, the same issue occurs
[17:24:51] blood: NL3limin4t0r: if i move the write line before the call to my cmd, it creates it
[17:25:08] blood: for some reason calling the cmd just gets stuck there and never returns
[17:32:34] blood: NL3limin4t0r: good point it does not. However, the cmd is never being executed as it should be writing to another log file indicating it is running. If i execute the cmd manually, the log is updated as expected.
[17:33:11] blood: basically the cmd starts a weblogic process and eventually enters a running state
[17:40:52] blood: I just tried executing 'dir' and same result
[17:40:56] blood: ok let me try that
[17:45:58] blood: N3limin4t0r: same issue happens. Any debugging I can turn on to see what is happening?
[17:47:07] blood: I'm using ruby 2.4.4p296 (2018-03-28 revision 63013) [x64-mingw32]
[17:47:10] blood: if that helps
[17:48:30] blood: very nice, let me try that
[17:49:35] blood: hrmm, doesn't work for mingw32, it fails during install
[18:18:30] blood: NL3limin4t0r: so i got it installed but it doesn't seem to be doing anything
[18:19:32] blood: ok im able to use `byebug rubyfile.rb`
[18:19:38] blood: let me dig further
[18:25:07] blood: so running `c` in byebug will go to next `byebug` command i have in my rb file?
[18:25:20] blood: byebug creates a breakpoint ?
[18:25:40] blood: ok when i use `c` it just runs for a few more seconds then exits
[18:25:45] blood: yet i have multiple byebug's
[18:25:58] blood: shall i post the entire rb file?
[18:27:29] blood:
[18:27:41] blood: i removed the byebug's
[20:11:50] blood: Quit: Page closed


[14:15:21] blood: has joined #ruby
[14:17:26] blood: ruby's win32 service keeps complaining that the service i'm trying to configure doesn't exist but it does... any ideas?
[14:17:36] blood: I'm assuming the issue is it isn't handling the spaces properly
[15:41:07] blood: anyone know why this service can't be found? is it the spaces?
[15:48:57] blood: havenwood:
[15:51:56] blood: Oracle sets this name, I'm just trying to make it work to configure post install
[16:06:08] blood: what does it result in?
[16:06:53] blood: I tested your changes, same error
[16:07:17] blood: i created a dummy service called 'TestService' and that works fine
[16:07:31] blood: so is this a bug in win32-service
[16:11:05] blood: interesting, I cant even change it with sc....
[17:12:56] blood: Quit: Page closed


[05:02:56] blood: has joined #ruby
[05:03:32] blood: Anyway to copy xml namespaces -> remove namespaces -> do some xpath queries -> copy back namespaces?
[05:03:48] blood: using Nokogiri
[05:59:55] blood: Quit: Page closed
[13:22:06] blood: has joined #ruby
[13:22:55] blood: Is there a way to ignore namespaces while querying xpath using Nokogiri? I cannot remove all namespaces from the document as it breaks the application that I am using.
[13:29:02] blood: hrmm seems like setting default_namespace on root node works
[14:06:19] blood: darix: yea I tried storing all namespace definitions then resetting them before write and nokogiri crashes =)
[14:06:34] blood: would be nice to just say ignore namespace during a xpath query
[14:09:41] blood:
[14:09:47] blood: pasted 2 examples in this file
[14:10:07] blood: how would I query in xpath (nokogiri) for line 8 and line 25
[14:10:16] blood: using namespaces
[14:14:27] blood: nokogiri really needs an option to disable namespace requirements assuming you have xml with namespace only in root
[14:14:45] blood: Pretty sure REXML does not do this
[14:14:51] blood: but REXML is painfully slow
[14:17:37] blood: I can do the following if i remove namespaces /weblogic-web-app/session-descriptor/cookie-name
[14:18:41] blood: and /web-app/filter[filter-name='psfilter']
[14:19:12] blood: so with namespaces it would be //xmlns:cookie-name and //xmlns:filter[filter-name='psfilter'] ? I leave out the root?
[14:19:56] blood: so i always leave out parents?
[14:20:53] blood: Problem is, im working on a puppet module for this and handling namespaces is annoying
[14:21:01] blood: I think I may just go back to REXML
[14:21:19] blood: requiring namespace when only the root has it is ridiculous
[14:22:29] blood: no idea what binding.pry is, I've literally only worked on ruby for a few days. I'm a java dev =)
[14:25:52] blood: Nokogiri doesn't like this
[14:25:54] blood: Error: /Stage[main]/Main/Xml_fragment[remove_psfilter]: Could not evaluate: ERROR: Invalid expression: //xmlns:[filter-name='psfilter']
[14:26:04] blood: that is wrong
[14:29:08] blood: darix:
[14:29:29] blood: however I'm now getting rid of remove_namespace call as it breaks things
[15:02:53] blood: darix: solved issues by switching to css instead of xpath
[15:03:15] blood: well not all =)
[15:04:33] blood: filter[filter-name='psfilter'] Can I do something similar with css?
[16:03:58] blood: Quit: Page closed


[01:37:14] blood: Quit: Page closed


[00:02:59] blood: Radar: node.has_elements? -> !node.element_children.empty? for REXML -> Nokogiri
[00:03:08] blood: cant find anything else in API
[00:03:19] blood: that look right?
[00:36:11] blood: given the following XML using Nokogiri: , @document.xpath(xpath) finds nothing. Any idea?
[00:36:19] blood: This is without namespaces
[00:36:33] blood: oh forgot the xpath again
[00:36:58] blood: xpath '/weblogic-web-app/session-descriptor'
[00:38:11] blood: oh it is working nm, something else is wrong
[02:01:33] blood: Radar:
[02:01:40] blood: any idea how i convert this to Nokogiri?
[02:03:02] blood: @document.root.elements.delete_all("session-descriptor/cookie-name/*[not(@Puppet::Util::XmlFile.Managed)]")
[02:03:18] blood: basically deleting anything that doesnt have that attribute
[02:03:49] blood: I know I can just loop through each node and handle it but wondering if there was a shorter way like it is done in this repo
[02:47:30] blood: got it all working in Nokogiri =)
[03:40:52] blood: Radar: thanks, im just having trouble with generating xml files properly.
[03:41:07] blood: files that do not exist
[03:45:57] blood: @document = => 'UTF-8').to_xml , shouldn't this work for an empty xml document
[14:16:07] blood: has joined #ruby
[14:17:09] blood: I'm trying to have each node be a child of previous in xml but not sure how to do this when I use `xml.send`.
[14:17:42] blood: Ideally i would like to just pass an xpath that is created in XML without having to iterate through each node
[14:18:05] blood: Also, this is for a new XML file that does not exist
[14:20:28] blood: yup exactly
[14:20:35] blood: but is there no way to just specify a complete xpath?
[14:20:50] blood: right but in the builder it needs to be within the block
[14:21:00] blood: so how would i do that in ruby?
[14:21:42] blood: I'm using recurse within the root block but not sure how to create a block as I go through
[14:23:02] blood: Only other thing I can think of to make this easier is to just generate an XML with root node then use xpath to insert everything else
[14:39:09] blood: worked perfect, thanks again


[23:15:20] blood: has joined #ruby
[23:19:11] blood: given the following xml using Nokogiri :, Why wouldn't the following code return any results ?
[23:20:33] blood: woops /web-app/filter-mapping[filter-name='psfilter']
[23:21:56] blood: baweaver: i was printing out debug
[23:22:43] blood: sure there are a million ways to write it, thats not the question here
[23:25:13] blood: Radar: how would i ignore namespace?
[23:25:42] blood: ah so i add that when i create the XML doc right?
[23:25:50] blood: thanks, let me try
[23:31:31] blood: Radar: yup that worked thanks
[23:31:53] blood: was scratching my head not realizing it was the namespace all this time
[23:31:58] blood: =) thanks again
[23:32:43] blood: Radar: do you prefer Nokogiri over REXML?
[23:33:25] blood: ok great, I'm currently migrating xml_fragment puppet module to Nokogiri so I can also use it for HTML. Just making sure I chose right =)
[23:40:24] blood: Remote host closed the connection
[23:40:43] blood: has joined #ruby


[13:52:32] blood: Quit: Page closed


[00:11:54] blood: Is there no way to remove a parent element after matching a specific element by value using REXML?
[00:12:27] blood: yes one moment
[00:14:41] blood: mroutis:
[00:15:48] blood: Currently with xml_fragment, it will call the remove_tag method which calls the REXML code as you see in gist. This only removes the element matched but will leave the parent empty
[00:16:07] blood: I tried to review the ruby docs but couldn't find anything on how to remove a parent element
[00:21:58] blood: mroutis: if you need more information let me know =) Thanks!
[00:23:45] blood: Basically, I need to modify/remove/add XML
[00:23:55] blood: I have no issues with modify/add , only remove
[00:24:23] blood: So when using REXML, it will remove the matched element from xml properly but it doesn't handle the parent (assuming the parent isn't root)
[00:25:07] blood: I'm trying to match an element based on a value and have it remove all elements including children up to root
[00:27:31] blood: Because I only want to delete an element if a child element contains a value I specify. So when a child element is matched, I want to delete it as well as any parents it has up to root
[00:27:43] blood: If I can do that then sure let me know =)
[00:28:21] blood: I assume I should just check children on each element as I traverse then delete if it contains my criteria
[00:29:34] blood: If this were java, i would be done already but just starting to work with ruby =)
[00:31:27] blood: mroutis: better? I'm only using REXML since it was used for this puppet module
[00:32:54] blood: According to this, REXML is painfully slow
[00:33:03] blood: i should give nokogiri a shot
[02:29:40] blood: So I'm currently traversing nodes to find a specific match and delete the parent node if found. The issue is, I'm trying to traverse children within children until a match is found or there is no more children. I can't seem to find out how to do this with REXML. Any ideas?
[03:08:16] blood: Is there a better way to handle this ? This runs pretty slow
[03:08:25] blood: But it does work...
[03:10:14] blood: mroutis: I got a method to work but REXML runs extremely slow
[03:10:59] blood: I'll need to convert what I have to nokogiri
[03:16:31] blood: What version of nokogiri supports ruby 2.1.9?
[05:55:19] blood: is this a takehome test? god help you when you take a test for real
[05:56:08] blood: start with a book for the basics
[05:56:46] blood: 2 days to learn it? sounds like someone didnt pay attention =)
[05:57:03] blood: no school is going to give 10 days to learn a language
[05:58:31] blood: that doesn't prove anything
[05:58:40] blood: what course is this?
[06:00:23] blood: 12 week course, i would never trust anyone that tried this
[06:00:30] blood: this is like bootcamp
[06:00:40] blood: you cram a ton of information then lose it all
[06:00:48] blood: do it right and pick up a book
[06:01:41] blood: and why can you not pick up a book first then attempt this bootcamp?
[06:02:56] blood: ok your choice =)
[06:33:19] blood: Using Nokogiri, the following doesn't find a match even though my xpath query is correct @document.xpath("/weblogic-web-app/session-descriptor/cookie-name").each do |el| el.content=value["value"] end
[06:33:33] blood: using an old version 1.7.2 since I'm forced to use Ruby 2.1.9 atm
[06:37:27] blood: interesting, using css worked
[06:37:33] blood: @document.css("/weblogic-web-app/session-descriptor/cookie-name").each but xpath does not


[23:20:43] blood: has joined #ruby
[23:22:17] blood: I'm using puppet's xml_fragment module which uses REXML and i'm trying to add support to remove a tag along with its parent assuming parent isn't root. Any idea how I can accomplish this?
[23:22:46] blood: This is where the removal is done for a single tag