document

How do I execute a page-defined JavaScript function from a Firefox extension?

て烟熏妆下的殇ゞ 提交于 2019-12-18 21:28:12
问题 I'm creating a Firefox extension for demo purposes. I to call a specific JavaScript function in the document from the extension. I wrote this in my HTML document (not inside extension, but a page that is loaded by Firefox): document.funcToBeCalled = function() { // function body }; Then, the extension will run this on some event: var document = Application.activeWindow.activeTab.document; document.funcToBeCalled(); However it raises an error saying that funcToBeCalled is not defined. Note: I

Relative and absolute tolerance definitions in Matlab solver

主宰稳场 提交于 2019-12-18 21:16:51
问题 I am trying to understand the following Matlab definitions for RelTol and AbsTol parameters: RelTol — This tolerance is a measure of the error relative to the size of each solution component. Roughly, it controls the number of correct digits in all solution components, except those smaller than thresholds AbsTol(i).The default, 1e-3, corresponds to 0.1% accuracy. AbsTol — AbsTol(i) is a threshold below which the value of the ith solution component is unimportant. The absolute error tolerances

Document Size in MongoDb

感情迁移 提交于 2019-12-18 13:38:06
问题 Thinking of switching to DynamoDB in future, but want to make sure my documents are under the 1KB, as they charge per KB. Is there a quick way to know how large a document is in a collection? 回答1: As a general guide you can check the average size of documents in a collection collname using the avgObjSize value reported by collection stats() : db.collname.stats() To find and count large documents you can use something similar to: var maxSize = 1024; var bigDocs = 0; db.collname.find().forEach(

Update or replace an embedded document in MongoDB collection

半世苍凉 提交于 2019-12-18 09:51:32
问题 I have following data structure: db.objects { "_id" : 1, "name" : "object name", "type" : "rectangle", "area" : { "position_x1" : 0, "position_y1" : 0, "position_x2" : 0, "position_y2" : 0 }, "dimension" : { "width" : 0, "height" : 0 } } I want to replace/update "area" and "dimension" separately for a document in objects collection with "_id" = 1. [?] Please let me know how can i achieve using MongoDB C# driver. 回答1: This is a very simple use of the $set operator. So essentially the update

How to limit the number of nested documents shown in MongoDB [duplicate]

邮差的信 提交于 2019-12-18 09:34:45
问题 This question already has answers here : How to get paginated/sliced data of subdocument array in mongo collection? (2 answers) Closed 2 years ago . I have array of parent documents consisting of nested documents ranging between 20 to 500. How can I limit the number of nested documents shown for each parent document. below is the structure of my Document and nested document. [{ id title users: [{ user_id: 1, timestamp: 2354218, field3: 4 }, { user_id: 1, timestamp: 2354218, field3: 4 }, {

create a javascript document Object [duplicate]

三世轮回 提交于 2019-12-18 04:42:18
问题 This question already has answers here : How to create Document objects with JavaScript (5 answers) Closed 3 years ago . Is there any way to create or recreate a javascript document Object by calling a function. Something like <script type="javascript/text"> var document = createDocument("some html"); </script> I want to do this so I can solve the issue in this question client side xslt with javascript in firefox 回答1: Webkit was the first to include/expose the following method for that task:

iPhone App Update and Documents Directory

╄→尐↘猪︶ㄣ 提交于 2019-12-17 21:28:39
问题 When i update my app I'd like the user to still be able to access their old files. What will the contents of the Documents directory be after updating? Any tricks or tips shared would be most appreciated on this process. 回答1: The content inside ~/Documents will be same as the old one. See the iPhone Application Programming Guide on what folders will be kept. 来源: https://stackoverflow.com/questions/2778597/iphone-app-update-and-documents-directory

jquery - function inside $(document).ready function

丶灬走出姿态 提交于 2019-12-17 17:45:10
问题 Is it correct to create functions inside of $(document).ready(function() { like so : $(document).ready(function() { function callMe() { } }); The function inside of the .ready() does not have to call before dom is ready and event inside of the ready() is triggered. Just to clarify a little bit - here's the code which would illustrate the problem: $(function() { var ind = 0; // some event is executed and changes the value of the ind // another event which affects the ind variable // and

How can I determine if the document.referrer is from my own site?

爷,独闯天下 提交于 2019-12-17 16:34:37
问题 Each time a page is requested I get the referrer of the page it came from. I need to track just referrer from other sites, I don't want to track going from one page to another within my site. How can I do that? 回答1: document.referrer.indexOf(location.protocol + "//" + location.host) === 0; 回答2: Originally posted at JavaScript - Am I the Referrer? When someone comes to our website for the first time, we store the referrer in a cookie. This way, if they download our demo, we can get the

How do I convert a org.w3c.dom.Document object to a String?

非 Y 不嫁゛ 提交于 2019-12-17 10:33:28
问题 I want to convert a org.w3c.dom.Document object to a String. I'm using Java 6 and am open to using any (completely free) technology that is up to the task. I tried the solution from this thread -- Is there a more elegant way to convert an XML Document to a String in Java than this code?, where they have DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation(); LSSerializer lsSerializer = domImplementation.createLSSerializer(); String html = lsSerializer