脚本

ElasticSearch: Get duration between two fields script syntax error

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've created this script in order to get a date difference between two fields: use(groovy.time.TimeCategory) { def duration = doc[firstDateField].date - doc[secondDateField].date; duration.Hours; } In order to check it I'm requesting this _search request: #docker exec -it es curl -XGET 'http://localhost:9200/living_team/fuas/_search?pretty' -d ' { "script_fields": { "my_script": { "script": { "file": "dayDateDiff", "params": { "firstDateField": "timestamp", "secondDateField": "startTimestamp" } } } } } ' ElasticSearch is telling me: { "error

Chrome extension injecting script get error

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: On injecting the script by using command chrome.tabs.executeScript( null, {file: "dialog.js"}); throwing error Unchecked runtime.lastError while running tabs.executeScript: Cannot access contents of url "chrome-devtools://devtools/bundled/inspector.html?&remoteBase= https://chrom …om/serve_file/@4fc366553993dd1524b47a280fed49d8ec28421e/&dockSide=undocked". Extension manifest must request permission to access this host. at onNativeMessage (chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/background.js:31:5) manifiest.json { "key":

Calling javascript function with php code

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to call the Javascript function declared at the top in my php area. However its not working. Can anyone tell me the reason for it. Everything else is working except for this part. Please help me. <!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title> AES (Rijndael) Encryption Test in JavaScript </title> <script src = "aes-enc.js" type = "text/javascript" language = "JavaScript" ></script> <script src = "aes-dec.js" type = "text/javascript" language = "JavaScript" ></script> <script src =

Cross-domain jQuery.getJSON from a Node.JS (using express) server does not work in Internet Explorer

匿名 (未验证) 提交于 2019-12-03 02:15:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: This is an annoying problem, and I don't suppose that it's only IE that has this problem. Basically I have a Node.js server, from which I am making cross-domain calls to get some JSON data for display. This needs to be a JSONP call and I give a callback in the URL. What I am not sure is, how to do this? So the website (domainA.com) has an HTML page with a JS script like this (all works fine in Firefox 3): <script type = "text/javascript" > var jsonName = 'ABC' var url = 'http://domainB.com:8080/stream/aires/' //The JSON data to get

Shebang line limit in bash and linux kernel

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to execute python scripts automatically generated by zc.buildout so I don't have control over them. My problem is that the shebang line (#!) is too long for either bash (80 character limit) or direct execution (some Linux kernel constant I don't know). This is an example script to help you reproduce my problem: #!/././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././bin/bash echo Hola ! How can

cx-freeze doesn&#039;t find all dependencies

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a python script (2.7) with some "interesting" imports at the top. I initially wanted to use py2exe to compile this into an exe that I can more easily distribute ( py2exe doesn't find all dependencies ). I have given up and am trying to use cx-freeze instead. But, I am having problem there as well. The problems seem to be libraries I have added to Python (jinja2 and restkit). I see them in my python directory ./Lib/site-packages/Jinja2-2.6-py2.7.egg/jinja2 and here ./Lib/site-packages/restkit-4.2.1-py2.7.egg/restkit. Here are the

Jquery events not working on ajax loaded content

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The below code works. If there is some better way please let me know. If i use the script content which is present in test.html in the main page where I am loading test.html through ajax. The script doesn't work. <html> <head> <script src='jquerylocation' type='text/javascript'></script> </head> <body> <div id='ajaxload'></div> <button class='test'>load content via ajax</button> </body> <script> $(function(){ $('.test').on('click',function(){ $('#ajaxload').load('test.html'); }); }); </script> </html> Test.html: <h1 class='heading'>Page via

Open URL in new Safari tab with AppleScript

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is it possible to use AppleScript to open a link in a new tab in Safari? 回答1: This will work: tell application "Safari" tell window 1 set current tab to (make new tab with properties {URL:"http://www.stackoverflow.com"}) end tell end tell 回答2: I think this also does what you asked for, but it is much shorter and is less browser-specific: do shell script "open http://www.webpagehere.com" This will open the specified URL in your default browser. And if you explicitly want to open it in Safari, use this: do shell script "open -a Safari 'http:/

In PowerShell, how do I define a function in a file and call it from the PowerShell commandline?

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a .ps1 file in which I want to define custom functions. Imagine the file is called MyFunctions.ps1, and the content is as follows: Write-Host "Installing functions" function A1 { Write-Host "A1 is running!" } Write-Host "Done" To run this script and theoretically register the A1 function, I navigate to the folder in which the .ps1 file resides and run the file: .\MyFunctions.ps1 This outputs: Installing functions Done Yet, when I try to call A1, I simply get the error stating that there is no command/function by that name: The term

Windows Installer fails on Win 10 but not Win 7 using WIX

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've recently been assigned to update our projects installer to run on Windows 10 and I'm at a bit of a loss on how to get it to work. I have no experience doing installers and am in the process of familiarizing myself not only with the process in general but also how our project handles it. As of now, the installer works perfectly running on our Windows 7 VM, but when running it on our Windows 10 VM it fails near the end and begins to rollback. I've gotten it to spit out some log files and I'm digging through them but am fairly loss. I've