Search Results

Search found 5157 results on 207 pages for 'node'.

Page 28/207 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • Red-Black trees - Erasing a node with two non-leaf children

    - by SalamiArmi
    Hi all, I've been implementing my own version of a red-black tree, mostly basing my algorithms from Wikipedia (http://en.wikipedia.org/wiki/Red-black_tree). Its fairly concise for the most part, but there's one part that I would like clarification on. When erasing a node from the tree that has 2 non-leaf (non-NULL) children, it says to move either side's children into the deletable node, and remove that child. I'm a little confused as to which side to remove from, based on that. Do I pick the side randomly, do I alternate betweek sides, or do I stick to the same side for every future deletion?

    Read the article

  • How to associate node with products in Drupal/Ubercart

    - by henrijs.seso
    I am looking for a way to allow users to add node reference to each product or whole cart @ checkout. I am making web site where users can buy items and then receive them on board flight. Products are fixed, but user needs to tell for which flight he is buying items. Flights are nodes and users has flagged these nodes so there is no problem making View with users flagged flight nodes. How would I associate one of these nodes with purchase? Nodereference from CCK would be cool, but checkout is probably not node. Any suggestions for approach?

    Read the article

  • How to modify the attributes by putting dynamic node paths

    - by sam
    I have a code that selects all elements and their child nodes DECLARE @x XML DECLARE @node_no int DECLARE @count int DECLARE @max INT, @i INT EXECUTE return_xml '1', NULL, @x output Declare @temp Table ( id int not null identity(1,1), ParentNodeName varchar(max), NodeName varchar(max), NodeText varchar(max) ) INSERT INTO @temp SELECT t.c.value('local-name(..)', 'varchar(max)') AS ParentNodeName, t.c.value('local-name(.)', 'varchar(max)') AS NodeName, t.c.value('text()[1]', 'varchar(max)') AS NodeText FROM @x.nodes('/booking//*') AS t(c) select * from @temp Now I want to modify the attributs by putting dynamic node paths SET @x.modify (' insert attribute MyId {sql:variable("@i")} as first into (ParentNodeName/NodeName::*[position() = sql:variable("@i")])[1] ') where id = id of temp table any Idea how can I modify my whole xml this way as I am having a untyped xml and have to add an attribute in every node

    Read the article

  • Add image gallery to node in Drupal

    - by vian
    I'm using Image module for Drupal 6 and the submodule of Image Gallery. Image gallery is identified by taxonomy term of certain vocabulary. What I need is to attach Image Gallery View supplied with Image Gallery to certain node. I am now trying to use Views Attach to do this. But how can I pass an argument of taxonomy term for gallery to the view? Also I added the taxonomy term for gallery to be defined for both images and my node type. Is it ok?

    Read the article

  • Java Node.cloneNode()

    - by Tom Brito
    Talking about the org.w3c.dom package; When I call Node.cloneNode() method from a Element(extends Node) object, which Document is used to create the new cloned Element? Example: import org.w3c.dom; class MyClass { public static void main(String[] args) throws Exception { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.newDocument(); Element element = doc.createElement("myElement"); Element cloneElement = (Element) element.cloneNode(true); } } Which Document was used to create cloneElement?

    Read the article

  • How to prevent traffic to/from a slow Cassandra node using Python

    - by Sergio Ayestarán
    Intro: I have a Python application using a Cassandra 1.2.4 cluster with a replication factor of 3, all reads and writes are done with a consistency level of 2. To access the cluster I use the CQL library. The Cassandra cluster is running on rackspace's virtual servers. The problem: From time to time one of the nodes can become slower than usual, in this case I want to be able to detect this situation and prevent making requests to the slow node and if possible to stop using it at all (this should theoretically be possible since the RF is 3 and the CL is 2 for every single request). The questions: What's the best way of detecting the slow node from a Python application? Is there a way to stop using one of the Cassandra nodes from Python in this scenario without human intervention? Thanks in advance!

    Read the article

  • Identifying an empty text node with jQuery + Javascript

    - by b. e. hollenbeck
    You'd think this was easy - but I'm having the hardest time with it. Here's what I'm trying to identify: <span class="cw-value-one"></span> Here's what I'm using so far: $('span.cw-value-one').each(function(){ var textNode = $(this).text(); var type = typeof textNode; var len = textNode.length; if($(this).is(':empty')){ $(this).siblings('span.cw-value-two').css({"position": "relative", "left": "1em"}); } }); Ok, so textNode = "", type = string and len = 1 - none of which is helpful in identifying an empty text node, since a has a type of string and length of 1. The jQuery .is(':empty') is not working either. So whow do you identify an empty text node in JQuery or plain ol' Javascript?

    Read the article

  • The node to be inserted is from a different document context

    - by BDotA
    When I am Calling AppendChild, I get this error: The node to be inserted is from a different document context." static public XmlNode XMLNewChildNode(XmlNode oParent, string sName, string sNamespaceURI, string sNodeType) { XmlNode oNode = moDoc.CreateNode(sNodeType, sName, sNamespaceURI); oParent.AppendChild(oNode); return oNode; } this is a code that is converted from its VB 6.0 version which was this: please ignore the optional parametes, I have overloads for them in C# version: Public Function XMLNewChildNode(ByVal oParent As IXMLDOMNode, ByVal sName As String, Optional ByVal sNamespaceURI As String = "", Optional ByVal sNodeType As String = "element") As IXMLDOMNode '**************** DESCRIPTION ******************* 'Create a new Child Node for passed Parent. '***************** VARIABLES ******************** Dim oNode As IXMLDOMNode '************************************************ Set oNode = moDoc.createNode(sNodeType, sName, sNamespaceURI) Call oParent.appendChild(oNode) Set XMLNewChildNode = oNode End Function so anything is different in VB 6.0 and C# for working with XMLs?

    Read the article

  • jquery jstree or dynatree parent node don't get selected

    - by mazhar
    I have used jquery jstree or dynatree using check boxes and found the same logic The thing is that the if for example there is a parent and 4 child. a) i select all the 4 child (parent get auto selected) the 4 child and the parent node id get posted to the controller. b) But if i select less then 4 children (parent get auto selected) only child node ids get posted to the controller. Is there any way even if i select less then 4 children all my selected nodes included the parent get posted to the controller?

    Read the article

  • How to access system.webserver web.config node in .NET 2

    - by JK
    Are there any .NET APis that can read/update the system.webServer node in web.config? I know I can do it via reading/parsing the web.config file as xml but that's awkward. To read/update the system.web node in .NET 2 I can use: HttpModulesSection httpModulesSection = (HttpModulesSection)configuration.GetSection("system.web/httpModules"); But is there any API based way of accessing system.web/modules using .NET 2? I have to reference the .NET 2 version of system.web.configuration because I don't know in advance if my web app will be run on a server with .NET 2 or 3.5. So it is limited to .NET 2 API calls only. Thanks

    Read the article

  • Query for value where a default namespace node exists

    - by Jay
    I have the following XML that is provided to me and I cannot change it: <Parent> <Settings Version="1234" xmlns="urn:schemas-stuff-com"/> </Parent> I am trying to retrieve the "Version" attribute value using XPath. It appears since the xmlns is defined without an alias it automatically assigns that xmlns to the Settings node. When I read this XML into an XMLDocument and view the namespaceURI value for the Settings node it is set to "urn:schemas-stuff-com". I have tried: //Parent/Settings/@Version - returns Null //Parent/urn:schemas-stuff-com:Settings/@Version - invalid syntax

    Read the article

  • PHP DOMElement, replacing text of a node

    - by waitinforatrain
    I have a HTML node like so: <b>Bold text</b> A variable $el contains a DOMElement reference to the text of that HTML node ("Bold text"), got from the XPath expression //b/text() I want to change the element to <b><span>Bold Text</span></b> So I tried: $span = $doc->createElement('span', "Bold Text"); $el->parentNode->replaceChild($span,, $el) which fails because parentNode is null. So, as a test, I tried: $el-insertBefore($span, $el); which throws no errors but produces no change in the output. Any thoughts?

    Read the article

  • Dragging Custom Node in JavaFX

    - by Karussell
    I cannot get it working although I am very close to an acceptable solution. I can drag the Dock if it is only a rectangle. But if I add a node (e.g. an image) to this dock I am not able to get a working solution. Do you have a code snippet, link or other advices for me? Here is my code: public class Dock extends CustomNode { // initialize this with an 64x64 image of your choice // via ImageView { image: Image {..}} public var content: Node[]; public var width = 64; public var height = 64; public var xOffset: Number = 0; public var yOffset: Number = 0; var imgX: Number = 0; var imgY: Number = 0; var distX: Number; var distY: Number; public var rasterX = function (n: Number): Number { var MAX = 4 * 64; if (n < 0) { return 0 } else if (n > MAX) { return MAX } else return n } public var rasterY = rasterX; override protected function create(): Node { Group { // if we place the translate here then the whole dock will flicker //translateX: bind imgX; //translateY: bind imgY; content: [ Rectangle { // ... and here 'content' won't be dragged translateX: bind imgX; translateY: bind imgY; height: bind height width: bind width fill: Color.LIGHTGRAY strokeWidth: 4 stroke: Color.BLACK }, content] onMousePressed: function (e: MouseEvent): Void { xOffset = e.x; yOffset = e.y; // Calculate the distance of the mouse point from the image // top-left corner which will always come out as positive value distX = e.x - imgX; distY = e.y - imgY; } onMouseDragged: function (e: MouseEvent): Void { // Find out the new image postion by subtracting the distance // part from the mouse point. imgX = rasterX(e.x - distX); imgY = rasterY(e.y - distY); } } }

    Read the article

  • Drupal 6 CCK node form redirect issue

    - by swdv
    Hi, I am having trouble with a multi-step node form for a CCK content type. I set $form_state['redirect'] to a thank you page path, but it does not get redirected upon successful submission. Here is the code following documentation on the Drupal 5.x to 6.x form API at http://drupal.org/node/144132 function rnf_form_alter(&$form, &$form_state, $form_id) { // ... $form['#submit'][] = 'rnf_regret_form_submit'; } function rnf_regret_form_submit($form, &$form_state) { $form_state['redirect'] = 'content/forget-thank-you'; } Any help would be appreciated. Thanks.

    Read the article

  • How to determine the inner context node within an XSLT select

    - by Marcus Rickert
    Hi there! I'm trying to determine a subset of nodes stored in the variable objs by using a user defined function cube:is_active: <xsl:variable name="active_cubes" select="$objs[cube:is_active(XXX) = 'TRUE']"/ Since the function does not allow a local context I'm required to pass it as a parameter (denoted by XXX). However, the usual suspects "." or "current()" do not work since they refer to context node of the surrounding block and NOT to the current element of objs which is evaluated. The only solution so far which DOES work is: XXX=SOME_CHILD_TAG/.. But this is really ugly since it depends on the existence of the child tag for the parent node to work correctly. Is there any other way? Thanks!

    Read the article

  • C# Getting a node with attributes from SelectSingleNode

    - by bdefreese
    Hi folks, I am quite the n00b but lately I have been playing with parsing some XML data. I actually found a nice feature on this site where I can get to a specific node with a specific attribute by doing: docFoo.SelectSingleNode("foo/bar/baz[@name='qux']); However, the data looks like this: <saving-throws> <saving-throw> <name>Fortitude</name> <abbr>Fort</abbr> <ability>Con</ability> <modifiers> <modifier name="base" value="2"/> <modifier name="ability" value="5"/> <modifier name="magic" value="0"/> <modifier name="feat" value="0"/> <modifier name="race" value="0"/> <modifier name="familar" value="0"/> <modifier name="feature" value="0"/> <modifier name="user" value="0"/> <modifier name="misc" value="0"/> </modifiers> </saving-throw> <saving-throw> <name>Reflex</name> <abbr>Ref</abbr> <ability>Dex</ability> <modifiers> <modifier name="base" value="6"/> <modifier name="ability" value="1"/> <modifier name="magic" value="0"/> <modifier name="feat" value="0"/> <modifier name="race" value="0"/> <modifier name="familar" value="0"/> <modifier name="feature" value="0"/> <modifier name="user" value="0"/> <modifier name="misc" value="0"/> </modifiers> </saving-throw> And I want to be able to get the node with name=base but for each saving-throw node where childnode "abbr" = xx. Can I somehow do that in a single SelectSingleNode or am I going to have to stop at saving throw and walk through the rest of the tree? Thanks!

    Read the article

  • XPath : finding an attribute node (and only one)

    - by subtenante
    What is the XPath to find only ONE node (whichever) having a certain attribute (actually I'm interested in the attribute, not the node). For example, in my XML, I have several tags having a lang attribute. I know all of them must have the same value. I just want to get any of them. Right now, I do this : //*[1][@lang]/@lang, but it seems not to work properly, for an unknown reason. My tries have led me to things ranging from concatenation of all the @lang values ('en en en en...') to nothing, with sometimes inbetween what I want but not on all XML. EDIT : Actually //@lang[1] can not work, because the function position() is called before the test on a lang attribute presence. So it always takes the very first element found in the XML. It worked best at the time because many many times, the lang attribute was on root element.

    Read the article

  • Drupal node_save and special characters.

    - by Pierre
    Hello, i'm trying to create nodes and taxonomy terms through a custom php script by using the node_save() function. I'm working on drupal 6. It's working well (thanks to previous questions on stackoverflow) except for accented letters. Indeed, when a title or a taxonomy term contain "é", "è" or "à", the sentence is cut before those special characters. For example, a title like that: "Bonjour les éléphants" will create a node with "Bonjour les " as title. I don't know if it's linked to my database or if i have to use a special encoding in php (iconv() blabla) The fact is, for drupal titles, i can not use html encoding (for example: é is é in html) because drupal will render &eacute and not é... When i create a taxonomy or a title manually, i have no problems and the accented letter is saved in the database as "é". Soo if you can help me to create terms and title with accented letters, that will be great : ) Thank you !

    Read the article

  • Getting started with Express - Error: Cannot find module './routes'

    - by Enrico Tuttobene
    I am just getting started in the world of Node.JS, and I tried using the command line "express" command to install a basic application (with jade support) Now, I was playing around with it a bit to see how it works and I am coming across a strange error: In the /routes directory there is a file called index which contains exports.index = function(req, res){ res.render('index', { title: "Express" }); }; that, as you all know, renders the index page. Well, all I did was renaming that file from index.js to router.js, so that I can easily refer to it as I would like to have more than just an index page. The renaming doesn't work, I get the error Error: Cannot find module './routes' Which is weird, as I though that var express = require('express'), routes = require('./routes'); would require ALL the files in the directory. There must be something small there I'm missing, and please bare with me as I am pretty new to this. Thanks in advance.

    Read the article

  • NodeJS vm.runInThisContext() and lack of __filename

    - by rFactor
    Whenever I run vm.runInThisContext(code, filename), the ran code reports __filename and __dirname as undefined. This also leads to the situation that any fs.readFile and such calls will not work with relative paths. For example this does not work: fs.readFile('../file', fn); because it does not know where to relate the path to. Specifying the filename as /home/full/path/to/file.js for vm.runInThisContext function does not seem to matter at all. How can I make Node to understand the path to the file?

    Read the article

  • HTTP request stream not readable outside of request handler

    - by Jason Young
    I'm writing a fairly complicated multi-node proxy, and at one point I need to handle an HTTP request, but read from that request outside of the "http.Server" callback (I need to read from the request data and line it up with a different response at a different time). The problem is, the stream is no longer readable. Below is some simple code to reproduce the issue. Is this normal, or a bug? function startServer() { http.Server(function (req, res) { req.pause(); checkRequestReadable(req); setTimeout(function() { checkRequestReadable(req); }, 1000); setTimeout(function() { res.end(); }, 1100); }).listen(1337); console.log('Server running on port 1337'); } function checkRequestReadable(req) { //The request is not readable here! console.log('Request writable? ' + req.readable); } startServer();

    Read the article

  • facebook api getting full posts with > 2 comments or > 4 likes

    - by ejang
    when I make the user/feed request on the Facebook Open Graph API, I get a feed object where posts with 2 comments or 4 likes don't reveal the detailed information for those specific comments. I am using https://github.com/Thuzi/facebook-node-sdk to make requests but it is very similar to the 'request' NodeJS library. I can get the full posts individually by making a separate request for that post's Open Graph ID, but this doesn't lend itself to fun code because requests are asynchronous and nesting more asynchronous calls within asynchronous calls doesn't lend itself to fun code. Any way I can obtain the full posts?

    Read the article

  • Mongoose Not Creating Indexes

    - by wintzer
    I have been trying all afternoon to get my node.js application to create MongoDB indexes properly. I am using the Mongoose ODM and in my schema definition below I have the username field set to a unique index. The collection and document all get created properly, it's just the indexes that aren't working. All the documentation says that the ensureIndex command should be run at startup to create any indexes, but none are being made. I'm using MongoLab for hosting if that matters. I have also repeatedly dropped the collection. Please tell me what I'm doing wrong. var schemaUser = new mongoose.Schema({ username: {type: String, index: { unique: true }, required: true}, hash: String, created: {type: Date, default: Date.now} }, { collection:'Users' }); var User = mongoose.model('Users', schemaUser); var newUser = new Users({username:'wintzer'}) newUser.save(function(err) { if (err) console.log(err); });

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >