我在Amazon AWS EC2上运行ubuntu 16.04,并且刚刚运行来更新控制台中建议的软件包。sudo apt-get dist-upgrade
在此期间,我一直提示A new version of /boot/grub/menu.lst is available, but the version installed currently has been locally modified.
在程序包配置的menu.lst
我们尚未进行任何更改,因此我假设这是Amazon AWS EC2的设置。
我应该如何进行?
Line by line differences between versions
--- /run/grub/menu.lst root.root 0644 2018-01-25 22:33:02
+++ /tmp/fileeCfBYY root.root 0600 2018-01-25 22:33:02
@@ -3,11 +3,9 @@
title Ubuntu 16.04.3 LTS, kernel 4.4.0-97-generic
root (hd0)
kernel /boot/vmlinuz-4.4.0-97-generic root=LABEL=cloudimg-rootfs ro console=hvc0
-initrd /boot/initrd.img-4.4.0-97-generic
title Ubuntu 16.04.3 LTS, kernel …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 来获取多个元素的top
和测量值。然而,一旦我有了测量结果,我该如何测量元素呢?bottom
IntersectionObserver
unobserve
问题是每个元素都是,position: sticky
并且当滚动时附加值被添加到,array
并且我只想要初始渲染的测量值。
const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
const measurement = {
top: entry.boundingClientRect.top,
bottom: entry.boundingClientRect.bottom,
};
console.log(measurement);
});
});
useEffect(() => {
const sections = document.querySelectorAll(`section#dark`)
sections.forEach((section) => observer.observe(section));
return () => {
// observer.disconnect(); removed in Stackoverflow edit
sections.forEach(section => observer.observe(section)); // Added in Stackoverflow edit
};
}, []);
Run Code Online (Sandbox Code Playgroud)
我尝试过使用observer.unobserve()
,但无法弄清楚它需要什么值,因为它返回一个错误Argument of type 'NodeListOf<Element>' is not assignable to parameter of type …
尝试用于<?php echo $current_user->billing_country; ?>
显示WooCommerce用户结算国家/地区.例如,如果客户具有澳大利亚帐单地址,则回显为AU.但是,我想用全名取代国家代码.
这同样适用于billing_state.而不是南澳大利亚州,我得到了SA.已经通过functions.php进行了工作,但是只有我添加每个州和国家.这显然是将世界各州映射到州代码的一项伟大任务.
我相信我之前已经以一种非常简单的方式做到了这一点,但无论出于何种原因,此刻都无法弄明白.
正在使用禁用输入字段中的国家/地区和州作为值
<input type="text" class="form-control" value="<?php echo $current_user->billing_country; ?>" disabled="">
Run Code Online (Sandbox Code Playgroud)
我们目前得到的图像
我们想要的形象
我在使用Wordpress会员网站时遇到问题.安装是带有子域的多站点.
我要求用户登录以查看子域站点的所有页面.要做到这一点,我已经选择对任何功能,并放置<?php wp_login_form(); ?>
内的page-template
位置如图所示...
<?php if ( is_user_logged_in() ) {
get_header(); ?>
<div class="page-content-wrapper ">
</div>
<?php get_footer();?>
<?php } else {?>
<?php get_header('login'); ?>
<?php wp_login_form(); ?>
<?php get_footer('login');?>
<?php }?>
Run Code Online (Sandbox Code Playgroud)
这是一种魅力 - 当is_user_logged_in()
他们获得页面时,他们何时获得wp_login_form();
.离开这个页面时出现了我的问题.用户已注销,返回页面后必须再次登录,如此处所示.
当我添加if ( is_user_logged_in() )
到其他页面时也会发生这种情况.
我还尝试了一个重定向,wp-login.php
当用户需要登录时,这会回到正常循环wp-login.php
,向我建议我记录登录凭据时遇到cookie问题.
我注意到在登录之前,cookie如图所示
登录后,如图所示
在重新访问需要登录的页面时,cookie将恢复为原始页面.但是,永远不会存储用户凭据.
任何帮助,将不胜感激.
更新
似乎如果我第一次登录wp-admin
我可以访问该页面并显示用户信息.如果我离开页面,用户将被注销并需要登录.
无法弄清楚为什么下面的脚本无法运行。该脚本可能不会执行我想要的操作,而是使用
node ./contentful/contentful-assets.js
Run Code Online (Sandbox Code Playgroud)
在终端中,它什么也没做 - 没有错误,没有记录任何内容让我开始调试。但是,如果我删除它,async
它将尝试该脚本并返回错误。
./contentful/contentful-assets.js
const contentful = require('contentful-management');
const iterator = require('make-iterator');
const assets = require('./assetObject.js');
async resolve => {
console.log('Creating Contentful client');
const client = contentful.createClient({
accessToken: 'token',
logHandler: (level, data) => console.log(`${level} | ${data}`)
});
const iterableAssets = iterator(assets);
const space = await client.getSpace('space');
const environment = await space.getEnvironment('enviroment');
const cmsAssets = [];
const assetProcessingTimes = [];
const inProcess = new Map();
let processedAssetsCounter = 0;
const createAndPublishSingleAsset = async ({ asset, done, …
Run Code Online (Sandbox Code Playgroud) 我有两个函数,触发器onCreate
和onUpdate
但是,{uid}
在onUpdate
正在恢复undefined
,而onCreate
回报{uid}
。
我怎样才能得到{uid}
工作onUpdate
?
onUpdate.f.js -{uid}
是undefined
exports = module.exports = functions.firestore
.document('users/{uid}/alerts/{name}') //UID is the User ID value stored in alerts
.onUpdate(snap => {
const user = snap.data();
console.log(user);
const msg = {
to: user.email,
from: 'notifications@example.com',
templateId: user.template,
dynamic_template_data: {
firstName: user.firstName,
email: user.email,
id: user.uid
}
};
return sgMail.send(msg).catch(err => console.log(`${user.email} - ${err}`));
});
Run Code Online (Sandbox Code Playgroud)
onCreate.f.js -{uid}
是正确的
exports …
Run Code Online (Sandbox Code Playgroud) javascript firebase google-cloud-functions google-cloud-firestore
我正在寻找一种解决方案来阻止 Google Translate 在我的 WordPress 网站上激活。有谁知道PHP
或function
可以将其放置在主题functions.php
上来阻止这种情况。
更喜欢一个可以放置在整个主题中的解决方案,而不是通过single-page.php
感谢您的宝贵时间,也感谢您的帮助。
我正在寻找一种解决方案来使下面的代码触发onUpdate
字段值,而不是整个文档。
是否可以使用该firebase-functions
包来监听字段值,比如说一个带有时间戳的字段lastUpdate
?或者,我倾向于HTTP
通过onClick
using调用触发器,axios
但找不到任何有助于我理解的资源、文档或教程。如果你知道任何,我很乐意阅读它们。
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const sgMail = require('@sendgrid/mail');
try {
admin.initializeApp();
} catch (e) {
console.log(e);
}
var SENDGRID_API_KEY = functions.config().sendgrid.key;
sgMail.setApiKey(SENDGRID_API_KEY);
exports = module.exports = functions.firestore
.document('users/{id}')
.onUpdate(snap => {
const user = snap.data();
const msg = {
to: user.email,
from: 'example@example.com',
templateId: 'd-6c0e0385808c480ab475748a6eeed773',
dynamic_template_data: {
firstName: user.firstName,
email: user.email,
id: user.id
}
};
return sgMail.send(msg).catch(err => console.log(`${user.email} - ${err}`));
});
Run Code Online (Sandbox Code Playgroud) javascript sendgrid firebase google-cloud-functions google-cloud-firestore
我在以正确的顺序加载多个函数时遇到了一些麻烦。从我下面的代码中,第一个和第二个函数是获取companyID
companyReference
而不依赖于一个和另一个。
第三个函数需要state
第一个和第二个函数的集合,以实现获取 的目标companyName
。
async componentDidMount() {
const a = await this.companyIdParams();
const b = await this.getCompanyReference();
const c = await this.getCompanyName();
a;
b;
c;
}
componentWillUnmount() {
this.isCancelled = true;
}
companyIdParams = () => {
const urlString = location.href;
const company = urlString
.split('/')
.filter(Boolean)
.pop();
!this.isCancelled &&
this.setState({
companyID: company
});
};
getCompanyReference = () => {
const { firebase, authUser } = this.props;
const uid = authUser.uid;
const getUser = …
Run Code Online (Sandbox Code Playgroud) 我正在向 React/Typescript 项目添加光标动画,并在研究中发现了一个运行良好的CodePen(动画光标 React 组件)。
但是,当转换为 Typescript 文件时,我遇到了Property 'current' does not exist on type '[boolean, Dispatch<SetStateAction<boolean>>]'.ts(2339)
错误cursorVisible.current
const onMouseEnter = () => {
cursorVisible.current = true;
toggleCursorVisibility();
};
Run Code Online (Sandbox Code Playgroud)
房产cursorVisible
来自const cursorVisible = useState(false);
Typescript 需要我做什么才能current
在 Typescript 中工作?阅读 React Hooks 文档,我看不到对current
on 的引用useState
,有趣的是,它作为一个js
文件工作,只是不在ts
.
过去我使用过current
withref
但从未使用过cross useState
hook。
完整文件是
import React, { useEffect, useRef, useState } from 'react';
import MobileDetect from './MobileDetect';
interface CursorProps { …
Run Code Online (Sandbox Code Playgroud) javascript ×6
php ×3
reactjs ×3
wordpress ×3
firebase ×2
amazon-ec2 ×1
country ×1
node.js ×1
observable ×1
sendgrid ×1
typescript ×1
ubuntu ×1
woocommerce ×1