脚本

WKWebView Evaluate Javascript without reloading page

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Currently I can only figure out how to evaluate javascript by adding it to the webview's configuration's userContentController and reloading the page like so: WKUserScript * script = [[ WKUserScript alloc ] initWithSource : source injectionTime : WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly : YES ]; [ self . webView . configuration . userContentController addUserScript : script ]; [ self . webView reload ]; How can I execute javascript on my WKWebView similarly to the old WebView's stringByEvaluatingJavaScriptFromString:

PHP 5.4.16 DOMDocument removes parts of Javascript

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I try to load an HTML page from a remote server into a PHP script, which should manipulate the HTML with the DOMDocument class. But I have seen, that the DOMDocument class removes some parts of the Javascript, which comes with the HTML page. There are some things like: <script type="text/javascript"> //... function printJSPage() { var printwin=window.open('','haha','top=100,left=100,width=800,height=600'); printwin.document.writeln(' <table border="0" cellspacing="5" cellpadding="0" width="100%">'); printwin.document.writeln(' <tr>');

How to type ^A in unix shell script/VI

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am new to unix and writing script to extract data in delimited file format. want to use ^A as delimiter , can you please suggest how to type/insert it 回答1: Type Ctrl + V , then Ctrl + A . According to your system configuration, you may need to type other key sequence. Check the output of stty -a , especially lnext : $ stty - a | grep lnext lnext = ^ V ; flush = ^ O ; min = 1 ; time = 0 ; ^^^^^^^^^^ 回答2: In vi , you can generally type CTRL-V in insert mode, followed by another control character. That's also true in the bash shell

PHP script executes twice when longer than 60 seconds

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Alright, so I've been wracking my brain about this for the past 3 hours now and been googling like crazy with no resolution to the problem. So, I wrote an example script that reproduces this since my original script is around 800 lines. <?php set_time_limit(0); ini_set('max_input_time', '-1'); ini_set('max_execution_time', '0'); error_log("executing script... "); $time = time(); for ($t = 0; $t <= 15; $t++) { error_log("Logging: $t (".(time()-$time)." seconds)"); sleep(5); } error_log("execution done (".(time()-$time)." seconds)"); ?> Now,

Gitlab CI does not execute npm scripts

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I try to make a CI script running on a gitlab runner. What I want is simple: First the npm install command should be executed to fetch all the required npm packages. After that the npm test and npm run build should be executed. The .gitblab-ci.yml script looks as follow: before_script: - cd my/folder/ - npm install --silent stages: - test - build run_tests: script: - npm test stage: test build: script: - npm run build stage: build Unfortunatly only the npm install gets executed twice. And this not silent. npm test and npm run build get never

Gradle Exec task and process output

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a python script which prints some strings and updates it's execution progress in console: if __name__ == '__main__': ... print 'Hello, world!' while page <= pages: ... done = float(page) / pages sys.stdout.write('\r[{0:50s}] {1:.2f}%'.format('#' * int(done * 50), done * 100)) page += 1 print '' When I run it from console like python script.py everything is ok and I can see output and progressbar. I need to run this script as a part of Gradle build, so, I've created a task: task process(type: Exec) { workingDir file('src/main/python')

Javascript in HTMLPanel

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to include Javascript code in a HTMLPanel element, but it is not working. Could you please help me? Thanks in advance. Scripts/pro.js alert('hello'); WITH HTMLPANEL DOES NOT WORK (no alert is displayed) MyPage.java (which is EntryPoint for MyPage.html) String preHtml="<script type=\"text/javascript\" src=\"Scripts/pro.js\"></script>"; HTMLPanel prePanel=new HTMLPanel(preHtml); RootPanel.get("scriptContainer").add(prePanel); MyPage.html <td align="left" valign="top" id="scriptContainer"></td> WITHOUT HTMLPANEL DOES WORK (alert is

how to call javascript function from vb.net code?

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have written VB.NET code for calling my Javascript function showDisplay() . vb.net code: System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "Script", "showDisplay();", True) javascript code: function showDisplay(){ alert('success');} but this is not working, can you help? 回答1: Perhaps you are looking for RegisterStartupScript: ScriptManager.RegisterStartupScript(Me, Page.GetType, "Script", "showDisplay();", True) Depending on where your showDisplay() javascript function exists in your code, using

[Vue warn]: Cannot find element

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using Vuejs . This is my markup: This is my code: var main = new Vue({ el: '#main', data: { currentActivity: 'home' } }) ; When I load the page I get this warning: [Vue warn]: Cannot find element: #main What am I doing wrong? 回答1: I think the problem is your script is executed before the target dom element is loaded in the dom... one reason could be that you have placed your script in the head of the page or in a script tag that is placed before the div element #main . So when the script is executed it won't be able to find the target

bash text search: find if the content of one file exists in another file [closed]

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Say we have two files: a.txt and b.txt. Each file has multiple lines of text. How do I write a shell script to check if all of the content of a.txt exists in b.txt? Thx for the hints guys, i didn't noticed -q will output 0 if successfully matched. I end up with: if grep a.txt -q -f b.txt ; then else fi 回答1: try grep cat b.txt|grep -f a.txt 回答2: Here is a script that will do what what you are describing: run: sh SCRIPT.sh a.txt b.txt # USAGE: sh SCRIPT.sh TEST_FILE CHECK_FILE TEST_FILE=$1 CHECK_FILE=$2 ## for each line in TEST_FILE while read