w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Only loop XML elements with specific attribute in ASP
You can query and filter an XML document using XPATH: Dim xpath : xpath = "/*/Product[@New='True']" Dim xml Set xml = CreateObject("Msxml2.DOMDocument") xml.async = False xml.loadXML([YOUR XML STRING]) Dim root, xmlNodes, x Set root = xml.documentElement set xmlNodes = xml.selectNodes(xpath) If xmlNodes.length > 0 then For each x in xmlNodes response.write(x.text) Next Else response.write("not found.") End if set xmlNodes = nothing Set root = Nothing Set xml = Nothing I have tested this xpath on your XML structure, and it seems to work. More info on xpath syntax is here. HTH, Erik

Categories : Xml

How to get elements by a specific value of a custom attribute in jQuery?
Check out jQuery's list of attribute selectors. You're looking for something like $('div[data-role="content"]')

Categories : Jquery

XPath - find lowest elements with specific attribute values
Just add the predicate: there is no descendant with the true condition. //*[@MyCond='true'][not(descendant::*[@MyCond='true'])] or, equivalently, //*[@MyCond='true' and not(descendant::*[@MyCond='true'])]

Categories : Xml

Attribute is missing the Android namespace prefix
use android:color="#A00080FF" instead of color="#A00080FF" Sample:: <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <stroke android:width="2dp" android:color="#FFFFFFFF" /> <gradient android:startColor="#DD000000" android:endColor="#DD2ECCFA" android:angle="225"/> <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" android:topLeftRadius="7dp" android:topRightRadius="7dp"/> </shape>

Categories : Android

Reason why style attribute does not use the android: namespace prefix
From the documentation: Note: The style attribute does not use the android: namespace prefix. The reason style doesn't use the android namespace prefix is because it is part of the stock XML attributes.

Categories : Android

Resolving "prefix attribute must be followed by an interface or protocol" error
This line @interface HellowWorldViewController() UIViewController <UITextFieldDelegate> Is invalid because you look to be trying to specify a superclass and protocol adherence on a continuation category. You can't specify a superclass on a continuation category. You should probably have @interface HellowWorldViewController : UIViewController <UITextFieldDelegate> Or, if you already have the interface, then @interface HellowWorldViewController() <UITextFieldDelegate>

Categories : IOS

Attribute is missing the Android namespace prefix for tools:context
It is because xmlns:tools="http://schemas.android.com/tools" is missing. The code should look like this: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" tools:context=".MainMenuActivity" >

Categories : Android

Parsing XML elements with dynamic namespace prefix in PHP
You should use DOM - personally I believe this is true for the general case because "simple XML" is an oxymoron, but I know others disagree. It is certainly true when dealing with a complex document tree like SOAP. DOM provides getElementsByTagNameNS() (and other relevant NS-targeting methods) which allow you to specifiy the namespace URI (i.e. the thing that should remain static and be known ahead of time) instead of being specific about the prefix. $soapNsUri = 'http://schemas.xmlsoap.org/soap/envelope/'; $myNsUri = 'http://xyz.gov/headerschema'; $doc = new DOMDocument; $doc->loadXML($myRequest); $header = $doc->getElementsByTagNameNS($soapNsUri, 'Header')->item(0); $myHeader = $header->getElementsByTagNameNS($myNsUri, 'myHeader')->item(0); $sourceID = $myHeader->ge

Categories : PHP

Boost Spirit Qi Custom Syntesized Attribute (Set a specific member of a struct attribute via a semantic action)
How to set a struct member. Option 1 (phx::bind) Given a struct S struct S { int field1; std::string field2; int target_field; bool field3; }; You can assign to a field (e.g. target_field) like so: rule<It, S()> p = int_ [ phx::bind(&S::target_field, _val) = _1 ]; Now, you can make the bind more readable, by doing something like: auto target_field_ = phx::bind(&S::target_field, _val); p = int_ [ target_field_ = _1 ]; Proof of concept: live on Coliru #include "boost/spirit/include/qi.hpp" #include "boost/spirit/include/phoenix.hpp" namespace qi = boost::spirit::qi; namespace phx = boost::phoenix; typedef std::string::const_iterator It; struct S { int field1; std::string field2; int target_field

Categories : C++

.htaccess RewriteRule for https specific prefix urls
Replace your code with this: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{HTTPS} off RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s/+index.php?page=(paypaltest|postratingspro)[&;,s] [NC] RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{HTTPS} on RewriteCond %{QUERY_STRING} !(^|&)page=(paypaltest|postratingspro)([,;&]|$) [NC] RewriteRule ^(index.php)?$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NC]

Categories : Apache

any way to identify a specific app via iOS keychain access group prefix?
I do not believe there is a way to know what developer is associated with the keychain prefix. Last time I looked it was the App ID prefix, which is either the team ID of the developer or randomly generated (and I don't believe there to be a public index of either of these things).

Categories : IOS

Finding specific services with specific startname
There is no -Contains in WMI Query Language. The operators you are using are all PowerShell operators and the WQL operators are different. Get-WmiObject -Query "Select * from Win32_Service WHERE Name LIKE '%Altris%' AND StartName <> 'Localsystem'" For more information on WQL Operators, read http://msdn.microsoft.com/en-us/library/windows/desktop/aa394605(v=vs.85).aspx

Categories : Powershell

D3.js: Transferring the value of one attribute to another attribute, for a specific FDG node?
You are looking for the getAttribute() function. So something like this should work for you: selectedNodeCircles.attr("r", function() {return this.getAttribute("rSize")}) Remember that this in the function, is the circle itself and hence simply an element in the DOM, to the best of my understanding. You can confirm this by simply printing out this using console.log(this) right before the result statement. Hope this helps.

Categories : D3 Js

How to fetch attribute value under elements/elements in xml using LINQ
To get the value attribute you can use the following: var foo = (from n in xml.Descendants("property") where n.Attribute("name").Value == "TestcaseId" select n.Attribute("value").Value).FirstOrDefault(); Gives: 70592

Categories : C#

Can we use "link" attribute for element finding?
Not familiar with Selenium IDE, here I assume link=601-800 students means something like <a href='something'>601-800 students</a>. Then you can use By.XPath to locate the link with its text, or use By.LinkText, even By.PartialLinkText. driver.FindElement(By.XPath("//a[text()='601-800 students']")); //driver.FindElement(By.LinkText("601-800 students")); EDIT: If you have some links with the same text, try identify the unique ancestors. E.g. var headLink = driver.FindElement(By.XPath("//*[@id='header']//a[text()='601-800 students']")); var mainLink = driver.FindElement(By.XPath("//*[@id='main']//a[text()='601-800 students']")); If that's not possible, get them together by FindElements (note this is not FindElement), them index them. IList<IWebElement> links = driv

Categories : C#

Find model returns undefined when trying to get the attribute of a model by first finding the model by another attribute?
Someone on irc gave me this answer. Then I modified it to make it work completely. Basically I should have used filtered. App.Office.filter( function(e){return e.get('unique_attribute_a') == 'foo'}).objectAt(0) Then I can get the attribute like: App.Office.filter( function(e){return e.get('unique_attribute_a') == 'foo'}).objectAt(0).get('attribute_b') See the code in jsbin. Does anyone know WHY filter works but find doesn't? They both return RecordArrays.

Categories : Ember Js

Finding records by attribute value in a batman.js and rails 3 app
I was mistaken, this functionality exists in Batman out-of-the-box. YourApp.User.load({name: "wuliwong"}, (err, results) -> #do stuff with the results array The UsersController#index action in Rails now looks like this: def index if params[:name] @users = User.where(:name => params[:name]) else @users = User.all end end

Categories : Ruby On Rails

How to select all specific elements with all siblings of a specific element
Try var $h2s = $('h2'), $div = $h2s.parent(); var toTop = '<span class="top">Back to top</span>'; var $ct = $('<div />', { class: 'indexholder' }).append('<h2>On this page</h2>'); var $ul = $('<ul />', { class: 'index' }).appendTo($ct); $h2s.each(function(idx, el){ var $li = $('<li />', { id: 'index' + idx, text: $(this).text() }).appendTo($ul); var $h3s = $(this).nextUntil('h2', 'h3'); if($h3s.length){ var $l1ul = $('<ul />', { }).appendTo($li); $h3s.each(function(idx2, el2){ var $li = $('<li />', { text: $(this).text() }).appendTo($l1ul); }) } }) $div.replaceWith($ct) Demo: Fiddle

Categories : Jquery

Select all elements of a specific type with a specific class
I'd suggest: var spans = $('#tags_list > span.label-info'); JS Fiddle demo. spans is a jQuery object, which allows you to use jQuery methods on the results. If you'd rather have DOM-nodes instead, to use native JavaScript methods, then: var spans = $('#tags_list > span.label-info').get(); JS Fiddle demo. Or, in plain JavaScript: var spans = document.querySelectorAll('#tags_list > span.label-info'); JS Fiddle demo. The latter options will return an array (using get()) and a nodeList (with querySelectorAll()), both of which you'll have to explicitly iterate over in order to perform actions. References: CSS Selectors. document.querySelectorAll(). get(). jQuery Selectors.

Categories : Jquery

Finding Elements in Linq to XML
Following code give you the account number of the matching element, members.Where(x=> x.Element("AccountName").Value==validationName).Select(x=> x.Element("AccountNumber").Value).FirstOrDefault();

Categories : C#

Finding multiple elements
In case someone looks for this in the future, I got it to work: findElements(By.className("someclass")).then(function(elements_arr){ console.log(elements_arr.length); }); According to their source code, findElements returns a promise https://code.google.com/p/selenium/source/browse/javascript/webdriver/webdriver.js#803

Categories : Javascript

Finding Out Which Elements Are in the Viewport in Dojo
Thanks to a few pointers from a friend, I was able to put together a functional solution to this question. Assuming all the divs are within another div with the id articles, when the user scrolls the bottom of the element at least 50px into the viewport, I then apply a "read" class to the element. posts = dojo.query("#articles > div"); dojo.connect(window, 'onscroll', function(){ var vs = win.getBox(); var output; var readCount; for (var i = 0; i < posts.length; i++) { var includeScroll = false; var locInfo = domGeom.position(posts[i], includeScroll) var fullyOnScreen = locInfo.y + locInfo.h + 50; if ((fullyOnScreen > 0) && (fullyOnScreen < vs.h)) { //Apply "read"

Categories : Ajax

Finding and Updating PHP 2D Array Elements
Is there a reason you're using a multidimensional array instead of just an associative? You're not iterating over any indexes because there aren't any present within the aggregated array format. The correct format should be : Multidimension : $mailMessage = array( 0 => array( 'mailNumber' => $mailCount, 'mailID' => $mailID, 'mailDate' => $mailDate, 'mailSender' => $mailSender, 'mailSenderName' => null, 'mailMsg' => null ) ); Associative : $mailMessage = array( 'mailNumber' => $mailCount, 'mailID' => $mailID, 'mailDate' => $mailDate, 'mailSender' => $mailSender, 'mailSenderName' => null, 'mailMsg' => null );

Categories : PHP

Finding the number of form elements
As Amine hinted, use the :input selector: $(':input').length

Categories : Jquery

Finding consecutive elements in a vector
Due to the limitations of std::adjacent_find you can't use it quite the way you want to. However it can still be useful. What you can do is to iterate over the collection, and use std::adjacent_find in a loop, with the last returned iterator (or your outer loop iterator for the first call) until it returns end. Then you will have a complete set of consecutive elements. Then continue the outer loop from where the last call to std::adjacent_find returned a non-end iterator.

Categories : C++

Finding the number of elements between i and j in an integer array in o(1)
Dim result() as integer Dim C(1000) as integer Dim Buff() as integer Dim i as integer=50 dim j as integer=450 for count =0 to c.count-1 if c(count)>i and c(count)<j then dim length as integer=buff.count-1 redim result(lenght+1) for buffcount=0 to buff.count result(buffcount)=buff(buffcount) next result(result.count-1)=c(count) redim buff(result.lenght-1) buff=result end if next

Categories : Arrays

Finding common elements in two arrays of different size
Assuming you can have "holes" in your matched sequence (A = [1,3,2] AND B = [1,4,2] Then MatchSet = {1,2}) Maybe I am wrong but you could try this pseudo code: i <- 0; j <- 0; jHit <- -1 matchSet <- Empty While i < Length(A) AND j < Length(B): If A[i] == B[j] Then matchSet.add(A[i]) i <- i+1 jHit <- j End If j <- j+1 If j == Length(B) Then i <- i+1 j <- jHit+1 End If End Loop The first index (i) points to the next element of A not found in B whereas (j) is used to look for the next element of B (after the last element found in A). This yould give you a time complexity of O(mN) and space usage of O(N). Here you have an implementation in Python: def match(A,B): i = 0 j = 0 jHit = -

Categories : Arrays

Neo4j: finding if an edge exists between two nodes with an attribute using the Java API (without cypher or gremlin)
Assuming you haven't got those relationship indexed in a manual index, just figure out which of the two nodes has got the least relationships of the type(s) you're looking for and iterate over those to see if the node on the other side of that relationship is the expected one and the relationship has got that property (check in that order since "other node" check is cheaper than property lookup).

Categories : Neo4j

Finding a specific character in a file in Qt
The error message you've posted doesn't match the issue in your code. Possibly the error was caused by something else. QTextStream::read returns QString. You can't compare QString and const char* directly, but operator[] can help: QString s = stream.read(1); if (s.count() == 1) { if (s[0] == '$') { //... } } However reading a file by too small pieces will be very slow. If your file is small enough, you can read it all at once: QString s = stream.readAll(); int index = s.indexOf('$'); If your file is large, it's better to read file by small chunks (1024 bytes for example) and calculate the index of found character using indexOf result and count of already read chunks.

Categories : Qt

finding specific character from substring
Try this code. var strng1:String = new String(textcontrol1.text); var position1:Number = new Number(); position1 = strng1.indexOf('src="http://',0); strng1 = strng1.substring(position1 + 0); // search 2nd " character position1 = strng1.indexOf('"', strng1.indexOf('"') + 1); strng1 = strng1.substring(0, position1 + 1); textcontrol1.text = String(strng1);

Categories : String

Finding a specific xml element containt
There is one major error in your query: You are using Elements on root, but you are looking for the tag sdo which is not a direct child of the root tag. You have to use Descendants instead. Additionally, I think you want to have an OR instead of an AND regarding the text of TextBox1. Fix it: var masterco = from el in root.Descendants("sdo") where (from add in el.Elements("datafield") where (string)add.Element("ownerNodeSerial") == TextBox1.Text || (string)add.Element("ownerSdoIndex") == TextBox1.Text select add).Any() select el; To actually get the value you want, you should use a different query. There is really no need to select the sdo tag at all. var v

Categories : C#

Efficient method for finding elements in MATLAB matrix
Try doing something like this: for i = 1:1000 x = (a >= 0.5); x = (x < 0.6); end I found it to be faster than: for i = 1:1000 x = (a >= 0.5 & a < 0.6); end by about 4 seconds: Elapsed time is 0.985001 seconds. (first one) Elapsed time is 4.888243 seconds. (second one) I think the reason for your slowing is the element wise & operation.

Categories : Matlab

Finding specific key and return value in a multidimentional array
given that the two arrays exist above this block as $schedules and $allmembers, the following should work. foreach($schedules as &$event) { $participants = array_flip(explode(',', $event['participants'])); $addThese = array(); foreach($allmembers as $member) { if (isset($participants[$member['id']])) $addThese[] = $member; } $event['participants'] = $addThese; } unset($event); print_r($schedules);

Categories : PHP

Finding a specific row by certain criteria? Excel MACRO, VBA
The following will find all rows where the search value is found: Sub getVal() Dim searchRange As range Dim result As range Dim rangeStart As String Set searchRange = Application.ActiveSheet.UsedRange Set result = searchRange.Find(After:=searchRange(1), _ What:="6/28/2013 1:32:23 PM", _ LookIn:=xlFormulas, SearchDirection:=xlNext) If Not result Is Nothing Then rangeStart = result.Address Do MsgBox (" row " & result(0).Row & " " & result.Address) Set result = searchRange.FindNext(After:=result(1)) Loop While Not result Is Nothing And rangeStart <> result.Address Else MsgBox "Not found" End If End Sub

Categories : Excel

Finding a specific file in a folder in java
You dont have to use recursion, but its a good idea. You can use the File object in java to help you along. A couple of the key things you will be using: the isDirectory() function. Fairly self explanatory. If the File object is a directory, you will have to use the listFiles() function. Returns an array of file objects which are files AND directories. You just call your recursive function on this array. You might also want to look into the FilenameFilter interface to help you along. A simple mock up of the code would be something like File findFile(String fileName, File[] files){ for(File file : files){ if(file.isDirectory) File f = findFile(fileName, file.listFiles()); if(f!=null) return f; if(file.getName.equals(fileName)) return file; } retur

Categories : Java

Finding a character at a specific position of a string
Try this simply: $word = "master"; $length = strlen($word); $random = rand(0,$length-1); if($word[$random] == 's'){ echo $word[$random]; } Here I used 0 because $word[0] is m so that we need to subtract one from strlen($word) for getting last character r

Categories : PHP

Finding Specific dates in Date range
This can be accomplished pretty easily using AddDays without over complexing the issue too much. Here's a short snippet I wrote to demonstrate: // Setup DateTime startDate = DateTime.Parse("7/1/2013"); DateTime endDate = DateTime.Parse("7/31/2013"); // Execute while (startDate < endDate) { if (startDate.DayOfWeek == DayOfWeek.Sunday) { yield return startDate; } startDate = startDate.AddDays(1); }

Categories : C#

Finding specific tree node in TreeView
Use strategy of using three four columns in your database table. 1) nodeId 2) nodeText 3) nodeValue 4) parentId When a node is clicked, send request via ajax to find if this id has child, if yes bring its childs and append below it. Else no child found, no need to append.

Categories : C#

XSL pass attributes to child elements if child elements do not already have the same attribute
Try this. <!-- root and static content - container --> <xsl:template match="/"> <section> <xsl:apply-templates select='section/container/*' /> </section> </xsl:template> <!-- iteration content - child nodes --> <xsl:template match='*'> <xsl:element name='{name()}'> <xsl:apply-templates select='@*|parent::*/@*' /> </xsl:element> </xsl:template> <!-- iteration content - attributes --> <xsl:template match='@*'> <xsl:attribute name='{name()}'><xsl:value-of select='.' /></xsl:attribute> </xsl:template> On outputting each child node, we iteratively transfer across its attributes and those of the parent. <xsl:apply-templates select='@*|parent::*/

Categories : Xslt

ShadowRoot not finding elements inside template repeat in Polymer
Try putting the query into a Timer.run. Timer.run(() { print("timer"); var charDivs = this.shadowRoot.queryAll('.char'); print("charsDiv: ${charDivs.length}"); }); Then, when I populate the chars="{{someList}}" attribute with a list, eg: ['d','e','f'], I get the full set (ie, length=6) returned. Here's a gist demonstrating the complete code: https://gist.github.com/chrisbu/6488370

Categories : Dart



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.