I'm making a parser in rails for a website and I'm having trouble selecting only the stuff I want.
I want to select the following sibling to a td-tag that contains ONLY "World:", but there's another td-tag containing "Former World:" that I get too, and I don't want to select that one.
Here's my XPath selection:
//td[contains(text(), 'World:')]/following-sibling::td
So I want the tag containing ONLY "World:" and not the other one containing "Former World:"
Any ideas? Spent hours searching for a solution, but now I ended up here.
Does it work if you change it to
//td[text()='World:']/following-sibling::td
Have you tried testing the text with equals?
//td[text() = 'World:']/following-sibling::td
or
//td[. = 'World:']/following-sibling::td
Related
Is there a way (or plugin) to order tabs on Jenkins home page? By default, they are sorted in alphabetical order.
Only info I've found is 'no', but it is quite old.
I was looking for a plugin that lets me sort tabs manually a couple of weeks ago. I didn't find anything. So I'm almost sure the answer is still no.
As a workaround we use a prefix like "(0) Viewname A", "(1) Viewname B" etc. in order to have the most important views accessible by one click.
You can add a script to Jenkins, this way it will load each time the view is up.
Go to:
Manage Jenkins->Configure System-> URL of theme JS and add the script.
I used the following script:
sessionStorage["ts_direction::" + window.location.toString() +"::0"] = "type=string&value=3%3Aup"
This order the columns by the 4th column (remember this will affect all of the views!).
example:
You can try Nested View Plugin (a functional plugin based on the hudson.model.TreeView class) which allows grouping job views into multiple levels instead of one big list of tabs.
Alternatively prefix the names with numbers (e.g. 1-Foo, 2-Bar, 3-Baz, etc.).
Prefix the view name with a soft hyphen to make them appear at the end or with a space to make them appear infront
shy = String.fromCharCode(173);
chars = ['A','B','Z', shy + 'Z','a',' a','b','z',];
document.body.innerHTML = chars.toString() + '<br/>' + chars.sort().toString()
<html><head></head><body></body></html>
For a tag system, when entering a new item, I'd like the user to start typing a letter or two and see possible tags...similar to how SO tags work on the website i.e. Ajax.
Is there a way to do this on IOS?
Basically the Add Item screen has some empty text fields where you put the name etc.
I'd like to have an additional empty field where as you enter letters you see possible tags appear below and can then select one to tag the item.
The tags would be served from an entity or table so there would have to be a call to core data to supply them based on the letters typed.
Do I have to implement a full blown tableview to do this? Or is there a way to make the possible tags show up below the textfield box.
Thanks for any suggestions.
You could try a third party development in order to make what you want. In a recent project I have used this one:
https://github.com/EddyBorja/MLPAutoCompleteTextField
If your project is big and has many localizations, sometimes you find view controllers by searching for text displayed on that view controller's view. But in doing so you get a lot of search results you don't need that can make finding the file you're searching for cumbersome:
If you're like me and do this a hundred times a day, you want to have a way to omit Localizable files from your searches, for example. How?
In the Find Navigator tab, click the current search scope directly underneath the search bar:
Click "New Scope..." and give it a name. I picked 'Workspace W/O Localizable":
Add a Path condition that 'matches regex'. You can use a negative regex to exclude paths with "Localizable" in it. The regex to use is this: ^((?!Localizable).)*$
That's it! Just click the new search scope under "SEARCH SCOPES" and it will be the new default.
Quick tip which is a solution for some. You can easily change this by clicking on a result and hitting "delete." This will remove the result or group of results from the list. It will not affect your code ;)
Quick tip for xCode 9.4. Create a search scope of this to search just the swift files in your project.
The auto_complete_for dealio from script.aculo.us is great an all, but is there a way for me to selectively disable the fact that it always auto-selects the first item in the list?
The problem is that, if I want to type my own entry that is new, and novel, I don't want the first item in the list to be auto-selected. The reason is because when I TAB out of the field, it selects, and fills the text box with that first item.
I got around that, somewhat, by making the first item in the list the same as what I'm typing, but that's not perfect either, because the auto_complete list doesn't always update with every keystroke, depending on how fast I type. I've tried setting the list refresh rate to the lowest value (1 millisecond) but no go.
What I really want is an option in "auto_complete_for" that doesn't select that first item at all - the same way that Google Instant doesn't automatically select the first suggested search phrase - you have to arrow-down to select one.
Maybe I can do this via an HTML option that I'm missing?
Looking at the source, there doesn't appear to be an option for that, but I bet if you changed line 284 of controls.js to this.index = -1; it would do what you want.
Otherwise, it might be time to look for a different autocomplete widget.
If your requirements are too far away from the available plugin, then I guess there is no point in tinkering around. Its best to write your own JS code.
You might want to consider this: https://github.com/laktek/jQuery-Smart-Auto-Complete
or this : https://github.com/reinh/jquery-autocomplete
I'll add another alternative that works great with Rails 3:
http://github.com/crowdint/rails3-jquery-autocomplete
I recently implemented auto complete for more than a field for Rails 2.0.2.
The plugin I used is:- https://github.com/david-kerins/auto_complete . Not sure if it supports Rails 3.
I have also encountered issues on implementing the above scenario and have posted questions( Implementing auto complete for more than one field in Rails ; Implementing a OnClick kind of functionality and formatting wrt Rails Partial-Views ) on stackoverflow for the same, I have been lucky on getting things working for me based on my requirement.
Kindly refer to these questions, they might have relevance to your requirement.
I am working on some code that scrapes a page for two css classes on a page. I am simply using the Hpricot search method for this as so:
webpage.search("body").search("div.first_class | div.second_class")
...for each item found i create an object and put it into an array, this works great except for one thing.
The search will go through the entire html page and add an object into an array every time it comes across '.first_class' and then it will go through the document again looking for '.second_class', resulting in the final array containing all of the searched items in the incorrect order in the array, i.e all of the '.first_class' objects, followed by all the '.second_class' objects.
Is there a way i can get this to search the document in one go and add an object into the array each time it comes across one of the specified classes, giving me an array of items that is in the order they are come across in on the page i am scraping?
Any help much appreciated. Thanks
See the section here on "Checking for a Few Attributes":
http://wiki.github.com/why/hpricot/hpricot-challenge
You should be able to stack the elements in the same way as you do attributes. This feature is apparently possible in Hpricot versions after 2006 Mar 17... An example with elements is:
doc.search("[#href][#type]")
Ok so it turned out i was mistaken and this didn't do anything different to what i previously had at all. However, i have come up with a solution, wether it is the most suitable or not i am not sure. It seems like a fairly straight forward for an annoying problem though.
I now perform the search for the two classes above as i mentioned above:
webpage.search("body").search("[#class~='first_class']|[#class~='second_class']")
However this still returned an array firstly containing all the divs with a class of 'first_class' followed by all divs with a class of 'second_class'. So to fix this and get an array of all the items as they appear in order on the page, i simply chain the 'add_class' method with my own custom class e.g. 'foo_bar'. This then allows me to perform another search on the page for all divs with just this one tag, thus returning an array of all the items i am after, in the order they appear on the page.
webpage.search("body").search("[#class~='first_class']|[#class~='second_class']").add_class("foo_bar")
webpage.search("body").search("[#class~='foo_bar']")
Thanks for the tip. I hadn't spotted that in the documentation and also found another page i hadnt seen either. I have fixed this with the following line:
webpage.search("body").search("[#class~='first_class']|[#class~='second_class']")
This now adds an object into the array each time it comes across one of the above classes in the document. Brilliant!