我在 Windows 10 上,我用 Capacitor 2.0.0 创建了一个 Ionic 5.0.7 应用程序。
我使用这个命令来构建应用程序:
ionic build
Run Code Online (Sandbox Code Playgroud)
之后,我使用这个命令:
npx cap sync
Run Code Online (Sandbox Code Playgroud)
最后,我使用这个命令打开 Android Studio:
npx cap open android
Run Code Online (Sandbox Code Playgroud)
在 Android Studio 上构建时遇到的第一个问题是:
org.gradle.api.reflect.ObjectInstantiationException:无法创建 com.novoda.release.internal.compat.gradle5_3.AndroidSoftwareComponentCompat_Gradle_5_3 类型的实例。
引起:org.gradle.api.reflect.ObjectInstantiationException:无法创建类型为 com.novoda.release.internal.compat.gradle5_3.AndroidSoftwareComponentCompat_Gradle_5_3 的实例。
和...
java.lang.NoClassDefFoundError: org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext
引起:java.lang.NoClassDefFoundError: org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext
我还有其他随机错误......这很奇怪......
我想对VueJS使用来自Vuetify框架的分页。
来自Vuetify的分页组件:
<v-pagination
v-model="pagination.page"
:length="pagination.total / 5"
:total-visible="pagination.visible"
></v-pagination>
Run Code Online (Sandbox Code Playgroud)
我想在用户单击按钮时执行一个功能。我想获取页码,然后使用该页码在参数中执行功能。
来自方法的getItems的代码:
this.pagination.page = response.body.page
this.pagination.total = response.body.total
this.pagination.perPage = response.body.perPage
Run Code Online (Sandbox Code Playgroud)
数据:
data () {
return {
items: [],
pagination: {
page: 1,
total: 0,
perPage: 0,
visible: 7
}
}
}
Run Code Online (Sandbox Code Playgroud)
我想用 Sequelize 创建迁移,用camelCase 重命名列,以便在snake_case 中拥有一个包含列的数据库。
我使用 Sequelize 创建迁移并使用迁移。
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.renameColumn('my_some_table', 'totoId', 'toto_id');
},
down: function(queryInterface, Sequelize) {
//
}
};
Run Code Online (Sandbox Code Playgroud)
但是...我在此列 (totoId) 和 name 列上有一个唯一约束,名为my_some_table_name_totoId_uindex,并且我在此列 (totoId) 上也有一个索引。
如何强制重命名具有唯一约束和一个索引的列?
我尝试从 Android Studio 构建 Android 应用程序。
我尝试从 Android Studio 安装程序安装 HAXM,但出现错误:
我的 BIOS 中已启用英特尔虚拟化技术。并且 Hyper-V 已经在 Windows 10 上被禁用。
我遇到了 CORS 问题,问题是我的代码已执行(状态 200),但 Google Chrome 开发者控制台中出现错误。
我的代码:
function callUrl(url) {
var xmlhttp = null;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp !== null) {
xmlhttp.open("POST", url, true);
xmlhttp.withCredentials = true;
xmlhttp.send(JSON.stringify({
}));
} else {
console.error("Your browser does not support XMLHTTP.");
}
}
callUrl('https://www.website.com/tracking?etc...');
Run Code Online (Sandbox Code Playgroud)
XMLHttpRequest 无法加载https://www.website.com/tracking?。当请求的凭据模式为“include”时,响应中“Access-Control-Allow-Origin”标头的值不能是通配符“*”。因此,不允许访问来源“ http://localhost:8888 ”。XMLHttpRequest 发起的请求的凭据模式由 withCredentials 属性控制。
服务器配置:
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": true,
Run Code Online (Sandbox Code Playgroud) javascript xmlhttprequest cors serverless serverless-framework-offline
我使用VueJS 2,VueX,NuxtJS和Vue-Snotify(artemsky / vue-snotify)用于Flash通知。
这可能不是VueX的正确用法,但我想分派 try / catch中捕获的错误。
try {
throw new Error('test')
} catch (error) {
this.$store.dispatch('errorHandler', error)
}
Run Code Online (Sandbox Code Playgroud)
然后,如果有多个错误,则使用VueX进行的分派应使用Snotify-View循环显示通知。
actions: {
async errorHandler (error) {
this.$snotify.error(error)
// and if multiple errors, then while on error
}
}
Run Code Online (Sandbox Code Playgroud)
您如何看待以及如何在VueX中恢复$ snotify实例?
我使用 Laravel 5.7 和 3 个队列作业,作业之间的时间太长/太慢。
我在第一份工作中 foreach RSS 提要项目,然后在第二份工作中调度该项目,等等...我没有输入详细信息,但有一些可笑的小计算,一定不需要花时间。
问题是每次派遣工作都需要花费大量时间。地平线和望远镜不允许我调试。
我使用的机器有 32 GB RAM,并且有多个进程(每个进程 15 个)可以转动尾巴。
[program:mywebsite_feeder]
command=/RunCloud/Packages/php72rc/bin/php artisan queue:work redis --queue=feeder --tries=3 --sleep=0
directory=/home/runcloud/webapps/mywebsite
redirect_stderr=true
autostart=true
autorestart=true
user=runcloud
numprocs=15
process_name=%(program_name)s_%(process_num)s
Run Code Online (Sandbox Code Playgroud)
我在 laravel.log 中遇到此错误:
Production.ERROR:App\Jobs\FeederJob 尝试次数过多或运行时间过长。该作业之前可能已超时。
Dokku是Heroku的替代品,具有自托管版本。
我尝试通过以下代码使用 Puppeteer Chrome headless :
const browser = await puppeteer.launch({
headless: true,
args: [
'--no-sandbox',
'--disable-setuid-sandbox'
]
});
const page = await browser.newPage();
Run Code Online (Sandbox Code Playgroud)
当Dokku构建并启动应用程序时,我收到以下错误:
错误:无法启动 chrome!/app/node_modules/puppeteer/.local-chromium/linux-641577/chrome-linux/chrome:加载共享库时出错:libX11-xcb.so.1:无法打开共享对象文件:没有这样的文件或目录故障排除: https ://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
故障排除页面说要安装软件包。但Dokku无法访问这个已安装的软件包,因为他使用 Docker。
另外,我已经使用以下命令安装了 buildpack:
dokku buildpacks:add <app_name> jontewks/puppeteer
Run Code Online (Sandbox Code Playgroud)
或者这个 git 存储库
dokku buildpacks:add <app_name> https://github.com/jontewks/puppeteer-heroku-buildpack.git
Run Code Online (Sandbox Code Playgroud)
我再次执行部署命令dokku deploy <app_name>
,日志中总是出现错误。
我使用 vuex-persistedstate 包(https://github.com/robinvdvleuten/vuex-persistedstate)在浏览器上持久化数据状态。
我使用 Adonuxt(NuxtJS 和 AdonisJS 之间的混合)。
在 VueX 动作中,我有这个动作:
nuxtClientInit ({commit}) {
// I want get here state auth saved by persistedstate package
}
Run Code Online (Sandbox Code Playgroud)
此操作由插件调用:
本地存储.js
export default async (context) => {
await context.store.dispatch('nuxtClientInit', context)
}
Run Code Online (Sandbox Code Playgroud)
nuxt.js 插件(配置)
{
src: '~/plugins/localstorage.js',
ssr: false
}
Run Code Online (Sandbox Code Playgroud)
我想要获取状态来使用用户令牌配置 Axios:
this.$axios.setToken(auth.jwt.token, 'Bearer')
Run Code Online (Sandbox Code Playgroud)
我的印象是 nuxtClientInit() 在 persistedstate 包之前被调用,所以state.auth
为 null 但它可以在控制台中观察到:
我使用Laravel 8(最后一个版本),我希望将用户重定向到 Twitter 以记录他们。
我意识到以前版本的 Laravel 上也有这个显示。
我使用这一行代码:
return redirect()->away($url);
// or
return redirect($url);
Run Code Online (Sandbox Code Playgroud)
为什么,当我使用此行代码通过 Twitter 登录用户时,我在登录页面和 Twitter 登录页面之间的页面上显示了此内容?
use Abraham\TwitterOAuth\TwitterOAuth;
public function login(Request $request): string
{
$connection = new TwitterOAuth(
config('services.twitter.client_id'),
config('services.twitter.client_secret')
);
$requestToken = $connection->oauth('oauth/request_token', [
'oauth_callback' => config('services.twitter.redirect'),
]);
$request->session()->put('oauth_token', $requestToken['oauth_token']);
$request->session()->put('oauth_token_secret', $requestToken['oauth_token_secret']);
$url = $connection->url('oauth/authorize', [
'oauth_token' => $requestToken['oauth_token'],
]);
return redirect()->away($url);
}
Run Code Online (Sandbox Code Playgroud)
重定向是可见的,而且很难看。
laravel ×2
nuxt.js ×2
vue.js ×2
vuex ×2
adonis.js ×1
cors ×1
dokku ×1
gradle ×1
haxm ×1
hyper-v ×1
javascript ×1
laravel-8 ×1
migration ×1
pagination ×1
php ×1
puppeteer ×1
queue ×1
redis ×1
sequelize.js ×1
serverless ×1
serverless-framework-offline ×1
supervisord ×1
vuejs2 ×1
vuetify.js ×1