namespaces

How to javascript submit in the presence of an input id equal to 'submit'

a 夏天 提交于 2020-01-22 15:16:11
问题 I've been binding submit events to forms, and ensuring that they do not break the form, using jQuery like this: jQuery('form').submit(function(e){ var form = this; e.preventDefault(); alert('1'); setTimeout(function() { alert('2'); form.submit(); }, 1000); }); This is all good and well, except, if for some reason a front end developer gave a child input of this form an id of ="submit", this breaks, as form.submit() throws a JavaScript error (In Chrome, 'Uncaught TypeError: Property 'submit'

From [package] import [function] in R

拜拜、爱过 提交于 2020-01-21 11:00:25
问题 Working with data in Python or R, we often load several packages. In some cases, two packages (e.g. foo and bar ) might each contain some function (e.g. do_stuff ). The way this is managed in Python to prevent ambiguity or surprises is like: from foo import do_stuff from bar import other_function # (does not load/import do_stuff() from bar) In R, all the code I see just imports whole packages with multiple library(package_name) statements. I would think this would lead to very difficult-to

From [package] import [function] in R

时光怂恿深爱的人放手 提交于 2020-01-21 10:59:04
问题 Working with data in Python or R, we often load several packages. In some cases, two packages (e.g. foo and bar ) might each contain some function (e.g. do_stuff ). The way this is managed in Python to prevent ambiguity or surprises is like: from foo import do_stuff from bar import other_function # (does not load/import do_stuff() from bar) In R, all the code I see just imports whole packages with multiple library(package_name) statements. I would think this would lead to very difficult-to

In DTDs, why are namespaces given as a URL?

半世苍凉 提交于 2020-01-20 08:30:50
问题 Apparently, the namespace URL that follows xmlns in HMTL and XML pages are meaningless. And all this time I though there actually were namespaces at those addresses... When I first read/heard about namespaces, I imagined there some large files at the URLs provided that contained a list of all the valid 'names' that could be used in instances of the document. I've come to learn I imagined wrong. But if the URL is totally useless, what exactly is the point of a namespace? How do you know if

In DTDs, why are namespaces given as a URL?

送分小仙女□ 提交于 2020-01-20 08:30:13
问题 Apparently, the namespace URL that follows xmlns in HMTL and XML pages are meaningless. And all this time I though there actually were namespaces at those addresses... When I first read/heard about namespaces, I imagined there some large files at the URLs provided that contained a list of all the valid 'names' that could be used in instances of the document. I've come to learn I imagined wrong. But if the URL is totally useless, what exactly is the point of a namespace? How do you know if

C#: How to remove namespace information from XML elements

a 夏天 提交于 2020-01-20 03:24:28
问题 How can I remove the "xmlns:..." namespace information from each XML element in C#? 回答1: Zombiesheep's cautionary answer notwithstanding, my solution is to wash the xml with an xslt transform to do this. wash.xsl: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="no" encoding="UTF-8"/> <xsl:template match="/|comment()|processing-instruction()"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="*">

Creating a specific XML document using namespaces in C#

我们两清 提交于 2020-01-19 03:38:20
问题 We were given a sample document, and need to be able to reproduce the structure of the document exactly for a vendor. However, I'm a little lost with how C# handles namespaces. Here's a sample of the document: <?xml version="1.0" encoding="UTF-8"?> <Doc1 xmlns="http://www.sample.com/file" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sample.com/file/long/path.xsd"> <header> <stuff>data</stuff> <morestuff>data</morestuff> </header> </Doc1> How I'd usually

CakePHP 3.0 not running on other machines

主宰稳场 提交于 2020-01-17 06:12:07
问题 I've developed a small project on a machine, using CakePHP 3.0, and I need it to run on another machine. I've tried to install it on several other machines. If I run the composer to install the CakePHP 3.0, then I copy my stuff to overwrite it, the project works. I've tried this on two machines and had no problem so far. If I don't run the composer , and just copy the stuff to the target machine, it gives me the following error. I've tried this on 3 machines, and every machine gives me this:

What if an argument has the same name as that of a data member?

偶尔善良 提交于 2020-01-16 09:59:38
问题 #include <iostream> struct A { A(int n) { std::cout << n; } int n{2}; }; int main() { A a{1}; } The output is 1 rather than 2 . Does the C++ standard define that the argument name is preferred if it is the same as that of a data member? 回答1: The argument is in a "closer" scope than the member variable, so the argument shadows the member variable. The obvious solution is to rename the argument (or the member variable), so they are not the same anymore. You can also use this->n to explicitly

How to create XML with declared namespace?

左心房为你撑大大i 提交于 2020-01-16 03:25:29
问题 I am creating a xml request using java. I am new in creating xmls using java. Here is code: Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("UserRequest"); rootElement.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:ns0", "https://com.user.req"); rootElement.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); doc.appendChild(rootElement); // user element Element user = doc.createElement("User");