我想做的事情可归纳为以下代码:
struct A{};
struct B{
A& a;
B(A& a) noexcept : a(a){}
int operator()(int) {}
};
int main(){
A a;
B(a)(2);
}
Run Code Online (Sandbox Code Playgroud)
我的编译器(g++ 6)拒绝了代码抱怨a阴影参数.但是,如果我尝试显式调用operator(),它会按预期工作.
似乎g++忽略括号并将声明视为声明.
这是指定的还是预期的行为?
我希望从一个商店状态传递一个参数到产品状态的显示产品信息:
我的应用程序 - storeApp
.config(['$stateProvider', function($stateProvider) {
$stateProvider
.state('store', {
url: '/store',
templateUrl: 'store/store',
controller: 'storeCtrl'
})
.state('products', {
url: '/products/:productSku',
templateUrl: 'store/product',
controller: 'productCtrl',
resolve: {
productResource: 'productFactory',
_product: function(productResource, $stateParams){
return productResource.getProduct($stateParams.productSku);
}
}
Run Code Online (Sandbox Code Playgroud)
Store.jade
a(href='/products/{{product.sku}}')
Run Code Online (Sandbox Code Playgroud)
产品控制器
.controller("productCtrl", function ($rootScope, $http, $stateParams, productFactory, storeFactory) {
//.controller('productCtrl', ['_product', function ($scope, $rootScope, storeFactory, _product) {
console.log($stateParams.productSku);
Run Code Online (Sandbox Code Playgroud)
产品工厂
function getProduct(sku) {
return $http.get('http://localhost:3000/api/products/' + sku );
}
Run Code Online (Sandbox Code Playgroud)
由于我使用的是MEAN Stack,所以节点附有路由器来表示:
Server.js
const storeController = require('./controllers/store');
server.get('/store/product', passportConfig.isAuthenticated, storeController.getProductPage);
Run Code Online (Sandbox Code Playgroud)
Store.js
exports.getProductPage = (req, …Run Code Online (Sandbox Code Playgroud) 我正在尝试将echo视觉作曲家shortcodes放到页面上.
我已尝试过以下两种方法,但它们不起作用:
的functions.php:
方法1
/*
* add shortcode file
*/
function include_file($atts) {
$a = shortcode_atts( array(
'slug' => 'NULL',
), $atts );
if($slug != 'NULL'){
ob_start();
get_template_part($a['slug']);
return ob_get_clean();
}
}
add_shortcode('include', 'include_file');
Run Code Online (Sandbox Code Playgroud)
方法2
function someshortocode_callback( $atts = array(), $content = null ) {
$output = "[vc_section full_width=\"stretch_row\" css=\".vc_custom_1499155244783{padding-top: 8vh !important;padding-bottom: 5vh !important;background-color: #f7f7f7 !important;}\"][vc_row 0=\"\"][vc_column offset=\"vc_col-lg-offset-3 vc_col-lg-6 vc_col-md-offset-3 vc_col-md-6\"][/vc_column][/vc_row][/vc_section]";
return $output;
}
add_shortcode('someshortocode', 'someshortocode_callback');
Run Code Online (Sandbox Code Playgroud)
file_rendering_vc_shortcodes.php:
方法1
<?php if ( is_plugin_active( 'js_composer/js_composer.php' ) ) { …Run Code Online (Sandbox Code Playgroud) 我在使用以下命令设置一个简单的应用程序后遇到了这个问题:
代码是:
const parse = require('csv-parse');
const fs = require('fs');
const results = [];
fs.createReadStream('kepler_data.csv')
.pipe(parse({
comment: "#",
columns: true,
}))
.on('data', (data) => {
results.push(data);
})
.on('error', (err) => {
console.log(err);
})
.on('end', () => {
console.log(results);
console.log('Done!');
});
Run Code Online (Sandbox Code Playgroud)
运行它的结果是:
index.js:7
.pipe(parse({
^
TypeError: parse is not a function
at Object.<anonymous> (/home/jadeye/node.js_workspace/PLANETS-PROJECT/index.js:7:11)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
Run Code Online (Sandbox Code Playgroud)
搜索 …
我正在开发一个我想使用Fused Location Provider的应用程序.但我有一些疑问,还有几个问题.
你有什么意见?提前致谢.
我真的希望来自emberjs团队的人能够读到这一点.
我是一位经验丰富的程序员,使用多种语言.
&AFA ember关注的是,它不是学习曲线,也不是缺乏知识和教程,而是我认为它的框架和开发环境的来源不断变化,消耗了大量的时间,精力和精力,试图当各种SO问题和谷歌引用框架的不同/旧版本时,弄清楚出了什么问题.
我发现需要某种配置图表,其中包含什么以及如何配置您的开发环境是必要的.
有很多答案并不一定指向正确的方向,很难描述,但我觉得文档在框架向前运行时落后了.
我浏览了所有JoséMota的精彩教程,在构建实际书签应用程序的最后阶段,我遇到了很多问题,学习emberjs不是主要问题,而是大部分时间消耗的基础设施.
它从ruby版本开始,在ubuntu 12.04上管理这些,ruby的ember-data依赖项(仅用ruby 1.9编译),localstorage_adapter.js以及如何在ember中使用它... github页面上给出的示例不起作用.
配置:
ubuntu 12.04.4 ember 1.4.1 + pre.af87bd20 jquery-1.9.1 handlebars-v1.3.0 ember-data 1.0.0-beta.7.f87cba88 ruby 1.9.2p290
继何塞·莫塔的伟大tutsplus当然 因此,这里是我的问题:
Error while loading route: TypeError: undefined is not a function
at App.BookmarksNewRoute.Ember.Route.extend.model (http://localhost:8000/js/app/routes/bookmarks_new.js:3:23)
at superWrapper [as model] (http://localhost:8000/js/vendor/ember.js:1239:16)
Run Code Online (Sandbox Code Playgroud)
应用程序代码(我会尽量明确):
路线
filename:bookmarks_new.js
App.BookmarksNewRoute = Ember.Route.extend({
model: function() {
return App.Bookmark.createRecord();
}
Run Code Online (Sandbox Code Playgroud)
})
楷模
filename:bookmark.js
App.Bookmark = DS.Model.extend({
title: DS.attr("string"),
url: DS.attr("string")
Run Code Online (Sandbox Code Playgroud)
})
filename:router.js
App.Router.map(function () {
this.resource("bookmarks", function(){ …Run Code Online (Sandbox Code Playgroud) 全貌:
示例
或
CSS:
html,body {
width: 100%;
height: 100%;
left: 0;
top: 0;
bottom:0;
margin: auto;
font-family: "Alef";
background: #767E58;
background-size: contain;
background-image: url("../img/back1024.jpg");
overflow-y: auto;
overflow: auto;
}
.container {
height: 100%;
width: 900px;
background-color: #000;
/* overflow: auto; */
}
Run Code Online (Sandbox Code Playgroud)
如果放大到 110% 以上,则容器小于全高。
我不知道为什么......
有什么想法我在那里做错了吗?
尝试添加:
.container:after{
clear: both;
content: "";
display: block;
}
Run Code Online (Sandbox Code Playgroud)
和:
<div style="clear: both; line-height: 0;"> </div>
Run Code Online (Sandbox Code Playgroud)
在这里建议:
SOW
两者都不起作用。
它确实适用于
overflow: auto;容器 DIV
但这会在该 div 上产生一个垂直滚动条,这是我不希望的。我希望在背景图像/浏览器上使用它。
我该如何解决?
我正在为WordPress创建自定义注册表单.
我的问题是添加自定义用户元.我相信该功能wp_insert_user只允许您在WordPress用户表中添加默认字段.
这是我目前的测试代码:
$username = '12344';
$password = '1111';
$user_data = array(
'ID' => '',
'user_pass' => $password,
'user_login' => $username,
'display_name' => $loginName,
'first_name' => $firstName,
'last_name' => $lastName,
'role' => get_option('default_role') ,
'user_secondry_email' => 'test@tst.com'// Use default role or another role, e.g. 'editor'
);
$user_id = wp_insert_user( $user_data );
wp_hash_password( $password );
Run Code Online (Sandbox Code Playgroud)
我找到了该add_user_meta函数,但这需要一个ID来添加元数据.显然用户尚未创建,因此他们没有ID.关于如何解决这个问题的任何想法?
谢谢,丹
遵循 Linode 的指南Copy a Disk Over SSH:
ssh root@xx.xx.xxx.xx "dd if=/dev/sdX " | dd of=/PathToLocalLocation/server.img
Run Code Online (Sandbox Code Playgroud)
xx.xx.xxx.xx您服务器的 IP在哪里,sdX-X代表您的驱动器分配的字母,并且您必须说明image's 的名称 =server.img
我遇到了这个问题(在我的本地计算机上):
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Run Code Online (Sandbox Code Playgroud)
我进行了长时间的搜索,得到了很多结果,但都没有奏效,Lish也不是完整的解决方案。
我不能设置locales上Lish command line,无论我做什么....一切答案了有关于command-line在本地或服务器,而不是rescue-mode....想法?