我使用bootstrap并尝试将div(span7)置于中心位置:
<div class="row-fluid">
<div id="main" class="span7">
Lorem ipsum dolor sit amet
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的css代码是:
#main{
margin:0px auto;
}
Run Code Online (Sandbox Code Playgroud)
但它不是设在中心.我怎样才能设置中心?
我正在尝试使用这样的 useEffect 函数:
const [data, setData] = useState({ courses: [] });
useEffect(async () => {
const result = await axios.get(
"http://example.com/api/v1/categories/"
);
await setData(result.data);
}, []);
console.log(data);
return (
<div>
<div>{data.info1}</div>
<div>{data.info2}</div>
<div>{data.info3}</div>
<div>{data.info4}</div>
</div>
);
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用data
变量时,它有时会引发此错误:
TypeError: func.apply is not a function
HTMLUnknownElement.callCallback
C:/asdasd/node_modules/react-dom/cjs/react-dom.development.js:188
185 | window.event = windowEvent;
186 | }
187 |
> 188 | func.apply(context, funcArgs);
| ^ 189 | didError = false;
190 | } // Create a global error event handler. We …
Run Code Online (Sandbox Code Playgroud) 我正在准备一些代码:
for(int a = 1; a <= 100; a++) //loop a (main loop)
{
for(int b = 1000; b <= 2000; b++) //loop b
{
if(b == 1555)
break;
}
for(int c = 2001; c <= 3000; c++) //loop c
{
.
.
.
}
}
Run Code Online (Sandbox Code Playgroud)
我想int a
通过break;
在b循环(循环变量int b
)中使用语句来打破主循环(循环变量).
我该怎么做?
PHP函数可以返回很多没有数组的变量吗?
我想这样:
<?php
public function a()
{
$a = "a";
$b = "b";
$c = "c";
}
echo a()->a;
echo a()->b;
echo a()->c;
?>
Run Code Online (Sandbox Code Playgroud)
如何访问$ a,$ b,$ c变量?
正如前面提到的Node.js - Find home directory in platform agnostic way问题,我们可以通过以下代码找到主文件夹:
const homedir = require('os').homedir();
Run Code Online (Sandbox Code Playgroud)
但是如何在 Windows 中找到桌面文件夹,无论它是什么语言?因为在 Windows 桌面文件夹名称与语言不同。
我已经训练了我自己的图形模型。我想在浏览器上使用它。这是我的代码:
async function predict() {
const model = await tf.loadGraphModel('./model/model.json');
let img = document.getElementById('test');
var example = tf.browser.fromPixels(img);
example = example.expandDims(0);
const output = await model.predict(example).data();
console.log(output);
}
Run Code Online (Sandbox Code Playgroud)
当我运行它时,它在控制台上出现此错误:
Uncaught (in promise) Error: This execution contains the node 'SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/while/Exit_4', which has the dynamic op 'Exit'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack_2/TensorArrayGatherV3]
at t.compile (tfjs:2)
at t.execute (tfjs:2)
at t.execute (tfjs:2)
at predict ((index):85)
at /websites/optik2/async http://localhost/websites/optik2/:96
Run Code Online (Sandbox Code Playgroud)
我需要predict()
功能,executeAsync()
不是很好。
编辑 …
我正在使用 VueJS 版本 2.6.12。
我本地的一切都很好。效果很好。另一方面,在远程存储库(由管道检查)上,它给出了以下错误:
> vue-cli-service serve
internal/modules/cjs/loader.js:834
throw err;
^
Error: Cannot find module 'vue-cli-plugin-vuetify'
Require stack:
- /app/node_modules/@vue/cli-service/lib/Service.js
- /app/node_modules/@vue/cli-service/bin/vue-cli-service.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at idToPlugin (/app/node_modules/@vue/cli-service/lib/Service.js:145:14)
at /app/node_modules/@vue/cli-service/lib/Service.js:184:20
at Array.map (<anonymous>)
at Service.resolvePlugins (/app/node_modules/@vue/cli-service/lib/Service.js:170:10)
at new Service (/app/node_modules/@vue/cli-service/lib/Service.js:32:25)
at Object.<anonymous> (/app/node_modules/@vue/cli-service/bin/vue-cli-service.js:15:17) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/app/node_modules/@vue/cli-service/lib/Service.js',
'/app/node_modules/@vue/cli-service/bin/vue-cli-service.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! metronic-vue-demo1@7.2.0 start: `vue-cli-service serve`
npm ERR! Exit status …
Run Code Online (Sandbox Code Playgroud) 我正在尝试filepreview
使用npm
. 但它总是给出错误。这是错误:
D:\Program Files\nodejs\PalettenzettelGenerator>npm install filepreview
> fibers@1.0.15 install D:\Program Files\nodejs\PalettenzettelGenerator\node_modules\synchronize\node_modules\fibers
> node build.js || nodejs build.js
D:\Program Files\nodejs\PalettenzettelGenerator\node_modules\synchronize\node_modules\fibers>if not defined npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release ) else (node "D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:415:16)
gyp ERR! stack at process._tickCallback (internal/process/next_tick.js:63:19)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command …
Run Code Online (Sandbox Code Playgroud) 我正在尝试生成 mnist 数据集图像。这是我的代码:
fns.py:
import math
import numpy as np
def combine_images(generated_images):
total,width,height = generated_images.shape[:-1]
cols = int(math.sqrt(total))
rows = math.ceil(float(total)/cols)
combined_image = np.zeros((height*rows, width*cols),
dtype=generated_images.dtype)
for index, image in enumerate(generated_images):
i = int(index/cols)
j = index % cols
combined_image[width*i:width*(i+1), height*j:height*(j+1)] = image[:, :, 0]
return combined_image
def show_progress(epoch, batch, g_loss, d_loss, g_acc, d_acc):
msg = "epoch: {}, batch: {}, g_loss: {}, d_loss: {}, g_accuracy: {}, d_accuracy: {}"
print(msg.format(epoch, batch, g_loss, d_loss, g_acc, d_acc))
Run Code Online (Sandbox Code Playgroud)
主要.py:
from tensorflow.python.keras.models import Sequential
from …
Run Code Online (Sandbox Code Playgroud) javascript ×4
c++ ×2
node.js ×2
tensorflow ×2
axios ×1
break ×1
css ×1
generative-adversarial-network ×1
keras ×1
loops ×1
php ×1
reactjs ×1
use-effect ×1
vue.js ×1