嗨,大家好我正在研究Google oauthorization2,我遇到"SQL方言未配置"的问题,这就是为什么我的查询没有执行,数据要去表请帮助我.
下面我列出了我遇到问题的两个查询!
工具:PhpStorm 8+ MySQL Localhost
$user_exist = $mysqli->query("SELECT COUNT(google_id) as usercount FROM google_users WHERE google_id=$user_id")->fetch_object()->usercount;
$mysqli->query("INSERT INTO google_users (google_id, google_name, google_email, google_link, google_picture_link)
VALUES ($user_id, '$user_name','$email','$profile_url','$profile_image_url')");
Run Code Online (Sandbox Code Playgroud) 注意:此查询适用于react-navigation 5。
在 React Navigation 4 中,我们可以在导航时将函数作为参数传递,但在 React Navigation 5 中,它会抛出有关序列化参数的警告。
基本上,我想做的是,从父屏幕导航到子屏幕,获取新值并更新父屏幕的状态。
以下是我目前实施的方式:
家长屏幕
_onSelectCountry = (data) => {
this.setState(data);
};
.
.
.
<TouchableOpacity
style={ styles.countrySelector }
activeOpacity={ 0.7 }
onPress={ () => Navigation.navigate("CountrySelect",
{
onSelect: this._onSelectCountry,
countryCode: this.state.country_code,
})
}
>
.
.
.
</TouchableOpacity>
Run Code Online (Sandbox Code Playgroud)
儿童屏幕
_onPress = (country, country_code, calling_code) => {
const { navigation, route } = this.props;
navigation.goBack();
route.params.onSelect({
country_name: country,
country_code: country_code,
calling_code: calling_code
});
};
Run Code Online (Sandbox Code Playgroud) 我有一个简单的活动,文本视图后跟两个编辑文本.当我开始输入时,软键盘会向上推动布局并隐藏操作栏,我将无法选择/复制/粘贴文本.
我的活动如下:
当我开始输入时,操作栏会被隐藏,就像这样 - 更重要的是,请注意,即使文本突出显示,也会丢失正常的复制粘贴栏:
我该怎么做才能确保操作栏不隐藏?
在我的活动清单中,我使用的是adjustPan.我不想使用adjustResize.
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
我的活动在这里:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/navigation_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/app_theme.app_bar_overlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/app_theme.popup_overlay" />
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/activity_margin"
android:fillViewport="true"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="@android:color/darker_gray"
android:text="My holiday story here." />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/activity_margin" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/gap_normal"
android:gravity="top"
android:text="My Holiday in Europe" />
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:gravity="top"
android:text="My holiday …Run Code Online (Sandbox Code Playgroud) android android-softkeyboard android-activity android-actionbar android-appbarlayout
我正在尝试使用Ajax下载文件并显示自定义下载进度条.
问题是我无法理解如何这样做.我编写了代码来记录进度,但不知道如何启动下载.
注意:文件类型不同.
提前致谢.
JS
// Downloading of files
filelist.on('click', '.download_link', function(e){
e.preventDefault();
var id = $(this).data('id');
$(this).parent().addClass("download_start");
$.ajax({
xhr: function () {
var xhr = new window.XMLHttpRequest();
// Handle Download Progress
xhr.addEventListener("progress", function (evt) {
if(evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total;
console.log(percentComplete);
}
}, false);
return xhr;
},
complete: function () {
console.log("Request finished");
}
})
});
Run Code Online (Sandbox Code Playgroud)
HTML和PHP
<li>
<div class="f_icon"><img src="' . $ico_path . '"></div>
<div class="left_wing">
<div class="progressbar"></div>
<a class="download_link" href="#" id="'.$file_id.'"><div class="f_name">' …Run Code Online (Sandbox Code Playgroud) 我有一个实用程序文件,它基本上有两个功能(一个用于检测用户位置,另一个用于获取用户设备详细信息)充当中间件。现在我想知道是否可以将两个中间件组合在一起,以便它可以与路线上的其他中间件一起使用。我还希望在需要时可以自由地单独使用实用程序文件中的功能。
实用程序文件
const axios = require("axios");
const requestIp = require("request-ip");
const getDeviceLocation = async (req, res, next) => {
try {
// ToDO: Check if it works on production
const clientIp = requestIp.getClientIp(req);
const ipToCheck = clientIp === "::1" || "127.0.0.1" ? "" : clientIp;
const details = await axios.get("https://geoip-db.com/json/" + ipToCheck);
// Attach returned results to the request body
req.body.country = details.data.country_name;
req.body.state = details.data.state;
req.body.city = details.data.city;
// Run next middleware
next();
}
catch(error) {
return res.status(500).json({ message: …Run Code Online (Sandbox Code Playgroud) 我正在使用摩根记录请求和响应,一切正常。我想知道是否有任何方法可以记录错误消息?例如:如果try catch我的应用程序中的某个块失败,我将向500用户返回错误和自定义消息。但有什么方法可以记录实际情况吗error.message?
我的应用程序的片段
try {
// Resend OTP
let otp_server_response = await sms.resendOTP(mobile_number, resend_mode);
if(otp_server_response.type === "success") {
return res.status(200).json({ message: "OTP_RESENT" });
} else {
console.log(otp_server_response.message); // <= Log this message in morgan logs if request reaches here
return res.status(400).json({ message: "OTP_RESENDING_FAILED" });
}
}
catch (error) {
console.log(error.message); // <= Log this message in morgan logs if request reaches here
return res.status(500).json({ message: "SOME_ERROR_OCCURRED" });
}
Run Code Online (Sandbox Code Playgroud)
我的记录器文件的片段
const errorLogFormat = ":requestId :status …Run Code Online (Sandbox Code Playgroud) 我正在尝试准备一个临时发布版本,但我的构建失败了。它给了我一大堆错误。我已经修改了我的 build.gradle 以添加一个临时环境。我不确定为什么会发生这种情况,因为我的调试和发布版本工作正常。
我曾经yarn android --variant=stagingrelease生成构建并在我的物理 android 设备上运行。使用React-Native: 0.61.5.
部分错误如下
FAILURE: Build failed with an exception.
* What went wrong: Could not determine the dependencies of task ':app:preStagingreleaseBuild'.
> Could not resolve all task dependencies for configuration ':app:stagingreleaseRuntimeClasspath'.
> Could not resolve project :@react-native-community_masked-view.
Required by:
project :app
> Unable to find a matching variant of project :@react-native-community_masked-view:
- Variant 'debugApiElements' capability Furry:@react-native-community_masked-view:unspecified:
- Incompatible attributes:
- Required com.android.build.api.attributes.BuildTypeAttr 'stagingrelease' and found incompatible value 'debug'.
- …Run Code Online (Sandbox Code Playgroud) 我试图在启动和重新启动时使用 nodemon 执行两个不同的脚本。问题在于,每当检测到文件发生更改时, nodemon 都会调用start和事件。restart
那么如何在启动和重新启动时执行两个不同的脚本。我这样做的目的是因为每当 nodemon 检测到文件中的任何更改时,它都会重新启动webpack-dev-server并在浏览器中打开一个新选项卡,而不是重用现有选项卡。
包.json
"start": "nodemon --watch app.js",
Run Code Online (Sandbox Code Playgroud)
Nodemon.json
{
"events": {
"start": "webpack-dev-server --config=webpack.dev.config.js --open",
"restart": "webpack-dev-server --config=webpack.dev.config.js"
}
}
Run Code Online (Sandbox Code Playgroud)
webpack.dev.config.js
.
.
devServer: {
contentBase: "src",
compress: true,
stats: "minimal",
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个像网格一样的视频会议。我正在尝试使用 css-grid 但不知何故我无法完成我正在寻找的东西。这个想法很简单,在屏幕上有一个视频网格,并将视频分页到不适合第一页的下一页。
我尝试使用以下方法:
<div className="videoContainer">
<div className="videoWrapper">Cam 1</div>
<div className="videoWrapper">Cam 2</div>
<div className="videoWrapper">Cam 3</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.videoContainer {
display: grid;
width: 100%;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
border: 2px solid blue;
}
.videoWrapper {
display: flex;
align-items: center;
justify-content: center;
min-height: 250px;
border: 1px solid green;
}
Run Code Online (Sandbox Code Playgroud)
我正在寻找的是一些指向我想去的方向的指针/提示/任何文章(没有找到任何有用的东西)。
我有一个简单的布局解释如下(大屏设备左栏,移动设备右栏):
我正在我的一个节点应用程序中实现 JWT。我想知道,是否有任何明确的格式/结构可以生成刷新令牌?
通过明确的格式,我的意思是刷新令牌是否包含任何像 JWT 这样的声明?
更新
让我们假设刷新令牌是:(fdb8fdbecf1d03ce5e6125c067733c0d51de209c取自Auth0)。现在,我应该从中了解什么?
我正在尝试将使用draft.js的富文本编辑器添加到react项目中。我已经能够添加它,并通过遵循他们的文档来处理键盘命令。我还添加了两个按钮来执行粗体和斜体,但是问题是,当单击按钮时,编辑器状态不会更改,并且不会添加内联样式,但是如果我选择文本并单击按钮,则样式为添加到该文本。我不明白我在哪里做错了。
import React, { Component } from 'react';
import {Editor, EditorState, RichUtils} from 'draft-js';
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {editorState: EditorState.createEmpty()};
this.onChange = (editorState) => this.setState({editorState});
this.handleKeyCommand = this.handleKeyCommand.bind(this);
}
handleKeyCommand(command, editorState) {
const newState = RichUtils.handleKeyCommand(editorState, command);
if (newState) {
this.onChange(newState);
return 'handled';
}
return 'not-handled';
}
_onBoldClick() {
this.onChange(RichUtils.toggleInlineStyle(
this.state.editorState, 'BOLD'));
}
_onItalicClick() {
this.onChange(RichUtils.toggleInlineStyle(
this.state.editorState, 'ITALIC'));
}
render() {
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">Text formatting using Draft.js</h1> …Run Code Online (Sandbox Code Playgroud) 我有一个网络图库,我在其中显示用户上传的文件大小和分辨率不同的图像.目前所有图像都是基线.所以我想知道如果我将它们转换为渐进式图像是否会产生任何重大影响.使用渐进式图像有哪些优点和权衡.
我有一个要求,我需要为父 div 内的所有 div 块设置一个重复的 CSS。是否可以仅使用 CSS 选择所有 DIV 元素?
例子
<div id="root">
<div class="App">
<div class="layout">
<div>...</div>
<div>...</div>
<div>
<div>...</div>
</div>
</div>
</div>
</div>
<div class="something-else">...</div>
Run Code Online (Sandbox Code Playgroud)
现在,我需要为#root仅在内部的所有 DIV 设置一些 CSS 。