我正在尝试使用 Material 提供的 CircularProgress。
我创建了这个组件来改变它的颜色:
import React, { Component } from 'react';
import { withStyles } from '@material-ui/core/styles';
import { CircularProgress } from '@material-ui/core';
class ColoredCircularProgress extends Component {
render() {
const { classes } = this.props;
return <CircularProgress {...this.props} classes={{colorPrimary: classes.colorPrimary}}/>;
}
}
const styles = props => ({
colorPrimary: {
backgroundColor: '#FD8907',
}
});
export default withStyles(styles)(ColoredCircularProgress);
Run Code Online (Sandbox Code Playgroud)
但是在我的网站上它看起来像这样:
我的问题是:
我希望圆圈看起来是橙色的,而圆圈看起来仍然是蓝色的,它在后面添加了一个橙色的方形框。
它也显示在我网站的左上角。我怎样才能把它放在中间?
我正在尝试在我的笔记本电脑上本地运行在 NodeJS 中编程的服务器,并使用 Forest-express-mongoose 包与 Forest Admin 交互。DB 是本地 MongoDB。
所以我运行我的服务器,它能够与我完美制作的应用程序连接。它也正确连接到 mongoDB 数据库。那么我想使用森林管理员。我对 Forest 不太熟悉,但我认为我不必将 Forest admin 安装为 npm 项目,因为这会创建另一个单独的项目,在这种情况下,我在我的服务器内部使用 Forest-express-mongoose。现在我不知道如何获得 Forest 管理面板?
我的服务器运行但它给了我一个错误,因为 env 键没有与任何森林面板相关联:(森林服务器请求错误:未找到)
这确实在意料之中,因为我必须从 Forest 网站内部创建一个项目。但是当我想创建一个时,安装过程要我创建并安装另一个单独的服务器。那不是我想要的,我想将它与我现有的服务器集成。我怎样才能做到这一点?
这是我服务器的代码:
require('dotenv').config()
const express = require('express');
const bodyParser = require('body-parser');
// create express app
const app = express();
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: true }))
// parse application/json
app.use(bodyParser.json())
// Configuring the database
const dbConfig = require('./config/database.config.js');
const mongoose = require('mongoose');
const cors = require('cors');
mongoose.Promise = global.Promise;
// Connecting to …Run Code Online (Sandbox Code Playgroud) 我无法包含在我的任何文件中。编译的时候总是失败。我安装了 lksctp-tools 软件包。
我跑
gcc -Wall -lsctp -o client admin.c deserializer.c input_parser.c main.c receive_response.c send_request.c serializer.c utils.c
Run Code Online (Sandbox Code Playgroud)
我得到:
main.c:2:10: fatal error: netinet/sctp.h: No such file or directory
#include <netinet/sctp.h>
^~~~~~~~~~~~~~~~
compilation terminated.
Run Code Online (Sandbox Code Playgroud)
我正在使用 Fedora,我不知道这是否会改变什么。然而该项目似乎在 CLion 上运行良好。
为什么以下不起作用?显然该功能尚未添加!
function activatetypeinput(event, devtype){
//The function is called but it doesn't set the attribute
var dev_input = document.getElementById("device_input");
dev_input.setAttribute("onclick","add_device_input(event, this);");
}
Run Code Online (Sandbox Code Playgroud)
在我的 HTML 中,我有这样的内容(除其他外):
<select class="text-input" id="device_input">
<option>--</option>
</select>
Run Code Online (Sandbox Code Playgroud) 所以我有以下 AppCompatDialogFragment。我希望我的 PositiveButton 关闭对话框,除非某些条件为真。我不知道如何实现这一目标。
public class ColorPicker extends AppCompatDialogFragment {
private EditText editTextCode;
private ColorPickerListener listener;
/*other stuff*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
final View view = inflater.inflate(R.layout.color_picker, null);
builder.setView(view);
builder.setTitle("Enter HEX code");
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String code = editTextCode.getText().toString();
if(code.length() != 6 && !code.matches("[0-9A-F]+")){
//HERE I WANT …Run Code Online (Sandbox Code Playgroud) 我刚刚使用 npm 安装了 Jest,现在我正在尝试运行一些测试。事实证明我无法这样做,因为我收到以下错误:
\n\n\xe2\x97\x8f Test suite failed to run\n\nC:\\Users\\aleja\\Documents\\FINAL PAW POSTA\\paw-2018b-10\\frontend\\src\\tests\\PublicationService.test.js:3\nimport PublicationService from \'../services/PublicationService\'; // import * as StatusCode from \'../util/StatusCode\'\n ^^^^^^^^^^^^^^^^^^\n\nSyntaxError: Unexpected identifier\n\n at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1059:14)\nRun Code Online (Sandbox Code Playgroud)\n\n这是我的 package.json。我读过有关 babel.rc 文件之类的其他问题,但我什至没有这些文件。
\n\n{\n "name": "frontend",\n "version": "0.1.0",\n "private": true,\n "dependencies": {\n "@babel/preset-react": "^7.7.4",\n "@material-ui/core": "^4.8.2",\n "@material-ui/icons": "^4.5.0",\n "@material/react-linear-progress": "^0.15.0",\n "axios": "^0.19.0",\n "axios-mock-adapter": "^1.17.0",\n "babel-jest": "^25.1.0",\n "bootstrap": "^4.4.1",\n "crypto-js": "^3.1.9-1",\n "enzyme": "^3.11.0",\n "formik": "^1.5.8",\n "i18next": "^17.3.1",\n "i18next-browser-languagedetector": "^3.1.1",\n "i18next-xhr-backend": "^3.2.2",\n "jest": "^25.1.0",\n "mutex-promise": "^0.1.0",\n "query-string": "^6.9.0",\n "react": "^16.12.0",\n …Run Code Online (Sandbox Code Playgroud) 有谁能解释我这是如何工作的?
如果我的代码中有类似的东西
int pids[N];
for(int i = 0; i < N; i++){
pids[i] = fork();
if(pids[i]==0){
//do something
break;
}
}
Run Code Online (Sandbox Code Playgroud)
难道我不会创造N个孩子,然后在每个孩子中再次出现N个孩子并最终成为一个循环吗?
javascript ×2
reactjs ×2
android ×1
babel-jest ×1
c ×1
forestadmin ×1
fork ×1
gcc ×1
java ×1
jestjs ×1
jquery ×1
linux ×1
material-ui ×1
mongodb ×1
node.js ×1
sctp ×1