我在Mac上使用React-Native,Android和Genymotion.当我运行时,react-native run-android我在启动操作结束时得到这些行:
...
04:54:40 E/adb: error: could not install *smartsocket* listener: Address already in use
04:54:40 E/adb: ADB server didn't ACK
04:54:40 E/ddms: '/Users/paulbrie/Library/Android/sdk/platform-tools/adb,start-server' failed -- run manually if necessary
04:54:40 E/adb: * failed to start daemon *
04:54:40 E/adb: error: cannot connect to daemon
:app:installDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: Timeout getting device list.
...
Run Code Online (Sandbox Code Playgroud)
但是,adb devices返回此信息:
List of devices attached
192.168.59.101:5555 …Run Code Online (Sandbox Code Playgroud) 我尝试使用这种语法的fetch:
fetch("https://user:password@url", {
...
}).then((response) => {
...
}).done();
Run Code Online (Sandbox Code Playgroud)
相同的URL在CURL中起作用,但在React Native中返回401.
有任何想法吗?
谢谢,保罗
我想要更漂亮地递归解析我的JavaScript文件,而不是指定它应该检查文件的每个文件夹.
我想做点什么:
prettier --write "all_js_files_except_node_modules_folder"
我对他们的文档没有太多了解.有什么建议?
谢谢,保罗
我正在使用 React 16.2.0、TypeScript 2.7.1,并且任何类型都不允许。
主要成分:
// index.js
import * as React from 'react'
import Page from './page'
import i18n from '../i18n'
import PageContent from '../components/pageContent'
import withMoreInfo from '../hoc/withMoreInfo'
class Home extends React.Component {
render () {
return <Page title={ i18n.t('home.title') }>
<PageContent />
</Page>
}
}
export default withMoreInfo(Home)
Run Code Online (Sandbox Code Playgroud)
临时文件:
import * as React from 'react'
export default function withMoreInfo<T> (Wrapped: T) {
return class WithMoreInfo extends React.Component<{ asPath: string }> {
static async getInitialProps ({ asPath …Run Code Online (Sandbox Code Playgroud) 我在我的申请中有2个观点:
一个.res/layout/main.xml - 带有1个按钮的标准视图
湾 RES /布局/ web_view.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView android:id="@+id/webview"
android:layout_height="fill_parent"
android:layout_width="fill_parent" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
当我单击第一个视图(a)上的按钮时,它会加载webview(b)并加载一个url:
// click on the "Browser" button in view a
public void goToWebView(View view) {
setContentView(R.layout.web_view);
WebView mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
}
Run Code Online (Sandbox Code Playgroud)
所有工作正常,网址加载良好,但浏览器实例化为自己的视图(第三个,而不是b本身),我的目标是使用Webview将一些HTML代码显示到我的应用程序中,而不是在其外部,在单独的浏览器中.
Anyboyd有什么想法吗?
这是使用API level8/Android 2.2完成的.
谢谢你的帮助.保罗
我在 Debian 7 x64 上运行节点 v0.12.7,我想在具有 4GB 内存的 16 核虚拟专用服务器上对其性能进行基准测试。
我正在运行以下简约代码:
// server.js
var http = require('http');
http.createServer(function (request, response) {
res.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World');
}).listen(80,"0.0.0.0");
Run Code Online (Sandbox Code Playgroud)
我在另一个终端中使用此命令启动它):
node server.js
Run Code Online (Sandbox Code Playgroud)
此时节点正在一个核心上运行。然后我使用 ab 通过以下命令测试其性能:
ab -n 10000 -c 100 -k http://127.0.0.1/
Run Code Online (Sandbox Code Playgroud)
...并得到这些结果:
...
Requests per second: 3925.81 [#/sec] (mean)
...
Percentage of the requests served within a certain time (ms)
50% 35
...
Run Code Online (Sandbox Code Playgroud)
我想知道你们中是否有人做过类似的测试,并且您是否:
我必须提到的是,在具有 15 个核心的集群模式下使用 pm2 运行它使我达到每秒 4500 个请求,这让我认为在某个地方还有另一个我错过的瓶颈。
感谢您对此主题的任何想法。保罗
我正在测试的UI正在使用iframe.我试图通过".frame(0)"调用切换到iframe.
module.exports = {
"test" : function (browser) {
browser
.url("my_url")
.waitForElementVisible(".frame-application-scroll-wrapper", 30000)
.frame(0)
.waitForElementPresent("#page-content", 30000)
.end();
}
};
Run Code Online (Sandbox Code Playgroud)
但是,#page-content永远不会被看到,这让我觉得更改帧命令不起作用(但是也没有返回错误).
有任何想法吗?
谢谢,保罗
android ×2
javascript ×2
react-native ×2
benchmarking ×1
genymotion ×1
iframe ×1
node.js ×1
performance ×1
prettier ×1
reactjs ×1
typescript ×1