custom-error-handling 相关问题


使 arrayList.toArray() 返回更具体的类型

所以,通常 ArrayList.toArray() 会返回一个 Object[] 类型....但假设它是一个 对象 Custom 的 Arraylist,如何使 toArray() 返回 Custom[] 类型而不是 Object[] 类型?


SecurityException:不允许启动服务Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (有额外功能)}

我尝试从 Google 获取我的 GCM 注册 ID。 我的代码: 字符串SENDER_ID =“722*****53”; /** * 向 GCM 服务器异步注册应用程序。 * * 存储注册信息... 我尝试从 Google 获取我的 GCM 注册 ID。 我的代码: String SENDER_ID = "722******53"; /** * Registers the application with GCM servers asynchronously. * <p> * Stores the registration ID and the app versionCode in the application's * shared preferences. */ private void registerInBackground() { new AsyncTask<Void, Void, String>() { @Override protected String doInBackground(Void... params) { String msg = ""; try { if (gcm == null) { gcm = GoogleCloudMessaging.getInstance(context); } regid = gcm.register(SENDER_ID); msg = "Device registered, registration ID=" + regid; // You should send the registration ID to your server over // HTTP, so it // can use GCM/HTTP or CCS to send messages to your app. sendRegistrationIdToBackend(); // For this demo: we don't need to send it because the // device will send // upstream messages to a server that echo back the message // using the // 'from' address in the message. // Persist the regID - no need to register again. storeRegistrationId(context, regid); } catch (IOException ex) { msg = "Error :" + ex.getMessage(); // If there is an error, don't just keep trying to register. // Require the user to click a button again, or perform // exponential back-off. } return msg; } @Override protected void onPostExecute(String msg) { mDisplay.append(msg + "\n"); } }.execute(null, null, null); } 我收到错误: 03-01 19:15:36.261: E/AndroidRuntime(3467): FATAL EXCEPTION: AsyncTask #1 03-01 19:15:36.261: E/AndroidRuntime(3467): java.lang.RuntimeException: An error occured while executing doInBackground() 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$3.done(AsyncTask.java:299) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.run(FutureTask.java:239) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.lang.Thread.run(Thread.java:841) 03-01 19:15:36.261: E/AndroidRuntime(3467): Caused by: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.app.ContextImpl.startServiceAsUser(ContextImpl.java:1800) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.app.ContextImpl.startService(ContextImpl.java:1772) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.content.ContextWrapper.startService(ContextWrapper.java:480) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.google.android.gms.gcm.GoogleCloudMessaging.b(Unknown Source) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.example.gcm.DemoActivity$1.doInBackground(DemoActivity.java:177) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.example.gcm.DemoActivity$1.doInBackground(DemoActivity.java:1) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$2.call(AsyncTask.java:287) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 03-01 19:15:36.261: E/AndroidRuntime(3467): ... 4 more 这是我的清单: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.manyexampleapp" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="com.example.manyexampleapp.c2dm.permission.RECEIVE" /> <uses-permission android:name="com.example.manyexampleapp.gcm.permission.C2D_MESSAGE" /> <permission android:name="com.example.manyexampleapp.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <application android:name="com.zoomer.ifs.BaseApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name="com.zoomer.ifs.MainActivity" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|screenSize" android:launchMode="singleTop"> <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <!-- PUSH --> <!-- WakefulBroadcastReceiver that will receive intents from GCM services and hand them to the custom IntentService. The com.google.android.c2dm.permission.SEND permission is necessary so only GCM services can send data messages for the app. --> <receiver android:name="com.example.gcm.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <!-- Receives the actual messages. --> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="com.example.manyexampleapp" /> </intent-filter> </receiver> <service android:name="com.example.gcm.GcmIntentService" /> <activity android:name="com.example.gcm.DemoActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- DB --> <activity android:name="com.example.db.DbActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.http.RestGetActivity" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > </activity> <activity android:name="com.example.fb.FacebookLoginActivity" android:label="@string/app_name" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.example.http.SendFeedbackActivity" android:label="@string/app_name" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.zoomer.general.SearchNearbyOffersActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.facebook.LoginActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.manyexampleapp.StoresListActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.fb.ShareActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.notifications.NotificationsActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.fb2.no_use.MainActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.zoomer.offers.OffersListActivity" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.example.http.SearchNearbyOffersActivity" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <service android:name="com.example.geo.LocationService" android:enabled="true" /> <receiver android:name="com.example.manyexampleapp.BootReceiver" > <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="com.example.manyexampleapp.LocationService.LOCATION_BROAD_MSG" /> </intent-filter> </receiver> <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id" /> </application> </manifest> 改变 <uses-permission android:name="com.example.manyexampleapp.c2dm.permission.RECEIVE" /> 到 <!-- This app has permission to register and receive data message. --> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 您收到异常是因为您尚未定义所需的权限 如果应用程序开发后安装了播放服务, 可能会发生 com.google.android.c2dm.permission.RECEIVE 权限已被授予但 android 仍在抱怨同样的错误。 在这种情况下,您必须完全重新安装开发的应用程序才能使此权限发挥作用。 我认为你必须检查 Kotlin 版本兼容性。


将 localstack 与 Spring Cloud AWS 2.3 一起使用时出现未知主机

“ResourceLoader”与 AWS S3 可以很好地处理这些属性: 云: 亚马逊: s3: 端点:s3.amazonaws.com <-- custom endpoint added in spring cloud aws 2.3 creden...


如何使用Azure Portal将容器应用程序连接到自定义VNet?

我正在尝试按照此处的说明进行操作: https://learn.microsoft.com/en-us/azure/container-apps/vnet-custom?tabs=bash%2Cazure-cli&pivots=azure-portal 上面的分步页面说明了


Tiptap Lib。如何为 EditorContent 添加边框?

我很难编辑编辑器部分样式 我在 Recat 中使用 https://tiptap.dev/docs/editor/ Lib 现在我用这个渲染编辑器 我很难编辑编辑器部分样式 我正在使用 https://tiptap.dev/docs/editor/ Recat 中的 Lib 现在我用这个渲染编辑器 <EditorContent className='editor' editor={props.editor}/> 我的CSS .editor p{ margin: 1em 0; /* border: 1px solid #000; */ /* border-radius: 2px; */ } 未点击文本框时的结果 单击文本框时的结果 我想为此自定义 css 样式。有这方面的文档吗? Tiptap,Vue.js 的富文本编辑器框架。要向 EditorContent 组件添加边框,您可以使用 CSS 自定义样式。但是,请记住,Tiptap 不提供开箱即用的编辑器内容的直接样式,因此您必须将样式应用于 Tiptap 生成的 HTML 元素。🔥 以下是如何向 EditorContent 添加边框的示例: <template> <EditorContent :editor="editor" class="custom-editor-content" /> </template> <style scoped> /* Add your custom styles for the editor content */ .custom-editor-content { border: 1px solid #000; border-radius: 2px; padding: 10px; /* Optional: Add some padding for better aesthetics */ } /* Customize other elements as needed */ .custom-editor-content p { margin: 1em 0; } </style> 在此示例中,custom-editor-content 类应用于 EditorContent 组件,并且标记内的 CSS 规则的范围将仅影响该组件内的元素。🌟 🟢🟡🟣 您可以探索 Tiptap 文档: https://tiptap.dev/docs/editor/guide/styling


运行时错误:NCCL 错误 2:未处理的系统错误

我最近将cuda从9.0升级到10.2,但是当我成功升级时,我的演示如下,将默认出现“RuntimeError: NCCL Error 2: unhandled system error”。 我不知道为什么,而且...


有没有办法用非标准参数编写自定义 ggplot 主题函数?

我正在尝试编写一个自定义 ggplot 主题,如下所示https://joeystanley.com/blog/custom-themes-in-ggplot2/ 这很简单,但我想增加一些复杂性,我的一些情节......


如何将下拉面板放置在 mat-select 文本框的正下方

我正在使用 Angular Material 14.0.4 和 Angular 15.1.3。 我有一个垫选择下拉菜单,是这样写的...... 我正在使用 Angular Material 14.0.4 和 Angular 15.1.3。 我有一个mat-select下拉菜单,是这样写的... <mat-select value="5" panelClass="custom-panel"> <mat-option value="5">5</mat-option> <mat-option value="10">10</mat-option> <mat-option value="20">20</mat-option> </mat-select> 在此我应用了panelClass及其CSS代码如下... .custom-panel { top: calc(100% + 10px) !important; } 而且仍然如下。下拉列表与其文本框重叠 这是未选中时的下拉菜单 这是选择后的下拉菜单 如何将面板放置在选择文本框的正下方... 您可以使用下面的CSS来做到这一点! 我们使用csstransform将面板移动到底部! .custom-panel { transform: translateY(25px) !important; } 堆栈闪电战


不同资源组中自定义主题的 Azure 事件网格订阅

我正在尝试订阅存在于不同资源组上的自定义事件网格主题。例如,如果我在资源组发布者组中有一个自定义事件网格主题 my-custom-topic....


使用 JS 和 PHP SQL 查询获取 JSON 数据

函数 fetchBooks() { fetch('圣经书.php') .then(响应=> { 如果(!response.ok){ throw new Error('网络响应不正常'); } 返回response.json(); ...


next.js 14 错误:无法读取未定义的属性(读取“get”)”

官方示例https://github.com/vercel/next.js/tree/canary/examples/next-forms在createTodo时出现错误“Error: Cannot readproperties of undefined (reading 'get')”。但是……


我正在使用 laravel livewire 3 获取页面未找到

单击时,我在控制台中找不到页面 错误:POST http://localhost/livewire/update 404(未找到) counter.blade.php {{ $this->count }} 单击时,我在控制台中找不到页面 错误:POST http://localhost/livewire/update 404(未找到) counter.blade.php <div> <h1>{{ $this->count }}</h1> <button wire:click="increment">+</button> <button wire:click="decrement">-</button> </div> 在刀片中我有以下内容: @section('custom-js') @livewireScripts @endsection @section('custom-css') @livewireStyles @endsection <livewire:counter /> 当单击增量或减量时,我找不到页面 如果您使用Livewire3,则无需手动注入livewire资源的css和javascript,因为它们是自动注入的。 检查此文档页面以查看。 您必须先创建 Livewire 组件 php artisan make:livewire CreatePost Livewire 组件的更新功能。 public function update(){...}


存储过程中非法混合排序规则

我的 MySQL 存储过程因 Mysql::Error: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=' 而失败。 在 SELECT 子句中时该过程失败...


在php中通过另一个类常量定义类常量[重复]

如何根据同一类中的另一个常量定义一个类常量? A类{ const BASE_URL = 'http://example.org' 常量 API_URL = BASE_URL 。 '/api'; // < error }


如何测试Box中的错误类型<dyn Error>?

我有一个返回结果的函数<(), Box>。我正在为此函数编写一个测试用例,其中该函数应返回变体VerifyError::LinearCombination 的错误...


Angular 17 中的 NG 块 UI

我尝试在 Angular 17 中使用 NG Block UI 并收到此错误 ng block ui error in Angular 17 知道这个模块在 Angular 17 中如何工作吗? 提前致谢 我使用 npm i ng-


将 Xamarin UWP 应用程序升级到毛伊岛后,新更新拒绝安装

这几乎正是我所发生的事情:https://learn.microsoft.com/en-us/answers/questions/1000760/migrate-uwp-app-to-maui-windows-error-after-更新?评论=问题#最新问题-


为什么在Windows环境下Apache IoTDB中运行`pip install`后出现`failed to build thrift`错误?

pip install apache-iotdb工具不支持Windows环境吗?在Windows中运行pip install apache-iotdb==0.13.0.post1后,出现错误消息:Failed to build thrift, ERROR: Could ...


如何配置验证以对无效输入使用“is-invalid”类

默认情况下,ASP.NET Core 中的输入验证使用类 input-validation-error,但 Bootstrap 5 使用 is-invalid。 我找到了一些解决方案: 创建样式 使用 jQuery.validate.unobtrusi...


如何使用 Result lib 处理 Void 成功案例(成功/失败)

简介: 我在我的应用程序的某些地方引入了结果框架(反典型)。例如,给定这个函数: func findItem(byId: Int, 完成: (Item?,Error?) -> ()); foo.findI...


Javascript 删除堆栈跟踪字符串中的最后一项

我正在创建一个 Javascript 记录器,在错误消息中,我还添加了堆栈跟踪,如下所示: 函数 logMessage(logMessage) { 让 stackTrace = new Error().stack; 日志消息。


如何在 Angular 中导入其他组件的 config.ts 文件

按照本教程,我创建了一个可重用的模态组件。模态本身是从其他组件显示的(带有错误 ERROR TypeError: ctx_r1.modalConfig is undefined),但我不能


Spotify API {'error': 'invalid_client'} 授权代码流程 [400]

这是我向 https://accounts.spotify.com/api/token 发出 POST 请求的多次尝试之一。 范围设置为“播放列表修改公共、播放列表修改私有”。 我正在使用 Python 3.7,Djan...


Netflix dgs springboot UI http://localhost:8080/graphiql 不工作

尝试通过netflix-dgs实现graphql api。 获取资源未找到错误。 下面分享代码片段 出现以下错误 此应用程序没有 /error 的显式映射,因此您...


我在代码中遇到此错误:Swift/ContigeousArrayBuffer.swift:600: Fatal error: Index out of range

我正在构建一个测验应用程序,但收到此错误:Swift/ContigouslyArrayBuffer.swift:600:致命错误:索引超出范围。这是被标记的代码片段: choice2.setTitle(


必须提供 jwt 在 NextJs 13 中出现错误

我得到的错误是:data: { error: '必须提供jwt' } 当用户通过提供正确的电子邮件和密码登录时,用户将被重定向 到“/”页逻辑被写入...


Traefik 卡在重启中,不清楚的错误

我正在尝试在 docker compose 中运行 traefik 图像,它之前可以正常工作,但自从我拉取图像后,我从 docker compose log traefik 获得的唯一日志是 command traefik error: field not


ESLint 错误:带有建议的规则必须将 `meta.hasSuggestions` 属性设置为 `true`(无显式任何规则)

我正在尝试向 .eslintrc.json 添加规则以禁止任何类型。 我将规则 ("@typescript-eslint/no-explicit-any": "error") 添加到我的设置中: { “环境”:{ ...


如何从日期中截断时间并将其传递给组件?

我有这个问题: 从后端我得到格式为的日期:2022-05-20 (LocalDate) 当我想编辑表单上的日期时,出现错误:Internal Server Error Text '2023-04-29T22:00:00.0...


Flutter Firebase 初始化:Android 上的 PlatformException(null-error)

我正在开发适用于 Android 的 Flutter 应用程序,并在初始化 Firebase 时遇到问题。尽管遵循标准设置程序,但我在运行应用程序时不断收到错误。 错误描述:


将连接的字符串发送到函数并仅返回 Result::Error

我有一个带有一些函数的结构,当出现问题时,我调用函数 fn set_error(&self,msg:&str) 来记录错误并可能显示错误消息等。 目前这是 v...


检查结果中选项内的值是否满足 Rust 条件的最佳方法是什么?

我有一个返回 Result、Error> 之类的函数,我想检查是否存在值以及它是否与条件匹配。有两种简单的方法: 如果...


如何编写类型安全的函数签名来接受 amplify-js v6 graphql 订阅通知的回调函数?

使用版本 6.0.9 的 NPM 库 aws-amplify (不是 5.x.x!),我尝试将调用包装到 client.graphql({ query: typedGqlString, Variables}).subscribe({ next, error }),这样我就可以治疗...


Redhat Openshift 部署配置已停止工作并出现“Crashloop backoff error”[已关闭]

我们使用 RedHat Openshift 来托管和部署我们的应用程序。 一切都工作正常,直到最近使用 DeploymentConfig 的部署刚刚开始抛出“崩溃循环退避...


'。'宏参数列表中出现意外,在`#define error(args...)`中

我在 C++ 中使用这个定义来调试我的变量,它在 clion 和 codeblocks 中工作,但在 Visual Studio 22 中不起作用。 错误 C2010 '.':宏参数列表 codeforces 中出现意外 文件名是&


共享在 Rust 中实现 Trait 的对象

我有一个对象特征,可以从某个索引提供字节。这些可能是文件、正在跟踪的进程、其他字节提供程序上的缓存等: 使用 std::结果::结果; 使用 std::io::Error ;


具有多个数据库的 postgresql 上的 Symfony 6 学说问题 SQLSTATE[42P01]:未定义的表:7 ERROR

我的 Symfony 项目(sf v6)使用 postgresql/postgis 和 2 个数据库:主要一个包含特定业务数据,第二个称为 Web 服务数据库,其中多个共享数据


预呈现页面“/”时发生错误。阅读更多:https://nextjs.org/docs/messages/prerender-error 修改请求(不知道如何)

已经四天了,我仍然陷入困境。 关于这个问题我看到有人说使用axios,并设置超时。或者在获取数据时将 http 更改为 https,但这一切都是徒劳的...


Django-channels 实例关闭时间过长而被杀死

谁能告诉我可能是什么问题? 警告应用程序实例 谁能告诉我可能是什么问题? 警告应用程序实例 wait_for=> 连接 关闭时间过长并被终止。 我的阿斯吉 "^subscription", channels_jwt_middleware(MyConsumer.as_asgi(schema=schema)) ) application = ProtocolTypeRouter({ "http": django_asgi_app, "websocket": QueryAuthMiddleware( URLRouter([ subscription_url, ]) ), })``` my custom MyConsumer ```class MyConsumer(GraphQLWSConsumer): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.profile_id = None async def __call__(self, scope, receive, send): user = scope.get("user", None) time_zone = await get_current_timezone(user) self.profile_id = scope.get("active_profile_id", None) self.timezone = time_zone if time_zone else settings.TIME_ZONE await super().__call__(scope, receive, send) async def connect(self): await super().connect() await change_status(True, self.profile_id) async def disconnect(self, close_code, *args, **kwargs): await super().disconnect(close_code) await change_status(False, self.profile_id)``` 解决我的问题 daphne -b 0.0.0.0 -p $SERVER_PORT --application-close-timeout 60 --proxy-headers server.asgi:application


SQLServer 存在哪些会话提供程序类型?

如果您想在 web.config 中实现 SQL 会话,通常会有一些简单的内容,例如: 如果您想在 web.config 中实现 SQL 会话,通常会有一些简单的内容,例如: <sessionState mode="SQLServer" sqlConnectionString="myConnectionString"/> 但是,如果您想要一个自定义提供程序来执行诸如使用配置生成器隐藏连接字符串之类的操作,您可以编写以下内容: <sessionState mode="Custom" customProvider="SQLSessionProvider"> <providers> <add name="SQLSessionProvider" connectionStringName="SQLSessionService" type=""/> </providers> </sessionState> <connectionStrings configBuilders="CS_Environment"> <add name="SQLSessionService" connectionString="Environment_Key_Here" /> </connectionStrings> 问题是我不知道mode=SQLServer存在什么类型。在我的搜索中,我看到了 OBDC 会话的示例,其中 type=ObdcSessionStateStore 以及各种其他会话提供程序,但没有一个适用于 SQLServer。 SQLServer 存在哪些会话提供程序类型? 您可以使用此功能并通过 Nuget Package Manager 安装的 type 是 Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync 还应该安装SessionState.SessionStateModule。如果您是第一次将其安装到项目中,它将在您的 <sessionState> 中为您创建一个 web.config 模板。下面是如何使用它的示例: <connectionStrings configBuilders="CS_Environment"> <add name="SQLSession_Connection" providerName="System.Data.SqlClient" connectionString="SQLSessionProvider-configBuilder_failed" /> </connectionStrings> <sessionState cookieless="false" regenerateExpiredSessionId="true" mode="Custom" customProvider="SqlSessionStateProviderAsync"> <providers> <add name="SqlSessionStateProviderAsync" connectionStringName="SQLSession_Connection" type="Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync, Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </providers> </sessionState> @8protons,您以前有使用过 Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync 的经验吗?我收到“在应用程序配置中找不到或连接字符串为空”错误 lmk 如果您能提供帮助


嵌套 useFetch 导致 Nuxt 3 中的 Hydration 节点不匹配

在 Nuxt 3 页面内,我通过从 pinia 存储调用操作来获取帖子数据: {{ 发布数据 }} {{ 帖子内容... 在 Nuxt 3 页面内,我通过从 pinia 商店调用操作来获取帖子数据: <template> <div v-if="postData && postContent"> {{ postData }} {{ postContent }} </div> </template> <script setup> const config = useRuntimeConfig() const route = useRoute() const slug = route.params.slug const url = config.public.wpApiUrl const contentStore = useContentStore() await contentStore.fetchPostData({ url, slug }) const postData = contentStore.postData const postContent = contentStore.postContent </script> 那是我的商店: import { defineStore } from 'pinia' export const useContentStore = defineStore('content',{ state: () => ({ postData: null, postContent: null }), actions: { async fetchPostData({ url, slug }) { try { const { data: postData, error } = await useFetch(`${url}/wp/v2/posts`, { query: { slug: slug }, transform(data) { return data.map((post) => ({ id: post.id, title: post.title.rendered, content: post.content.rendered, excerpt: post.excerpt.rendered, date: post.date, slug: post.slug, })); } }) this.postData = postData.value; if (postData && postData.value && postData.value.length && postData.value[0].id) { const {data: postContent} = await useFetch(`${url}/rl/v1/get?id=${postData.value[0].id}`, { method: 'POST', }); this.postContent = postContent.value; } } catch (error) { console.error('Error fetching post data:', error) } } } }); 浏览器中的输出正常,但我在浏览器控制台中收到以下错误: entry.js:54 [Vue warn]: Hydration node mismatch: - rendered on server: <!----> - expected on client: div at <[slug] onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > at <Anonymous key="/news/hello-world()" vnode= {__v_isVNode: true, __v_skip: true, type: {…}, props: {…}, key: null, …} route= {fullPath: '/news/hello-world', hash: '', query: {…}, name: 'news-slug', path: '/news/hello-world', …} ... > at <RouterView name=undefined route=undefined > at <NuxtPage> at <Default ref=Ref< undefined > > at <LayoutLoader key="default" layoutProps= {ref: RefImpl} name="default" > at <NuxtLayoutProvider layoutProps= {ref: RefImpl} key="default" name="default" ... > at <NuxtLayout> at <App key=3 > at <NuxtRoot> 如何解决这个问题? 我尝试在 onMounted 中获取帖子数据,但在这种情况下 postData 和 postContent 保持为空 onMounted(async () => { await contentStore.fetchPostData({ url, slug }) }) 您可以使用 ClientOnly 组件来消除该警告。请参阅文档了解更多信息。 该组件仅在客户端渲染其插槽。


我无法用vue.js显示json

我需要使用 v-for 显示 json 中的产品数组,但我无法这样做。 我正在尝试显示产品数组中的 json 数据,但它不起作用。 Vue.js 我需要使用 v-for 显示 json 中的产品数组,但我无法这样做。 我正在尝试显示产品数组中的 json 数据,但它不起作用。 Vue.js <div class="box" v-for="product in products" :key="product.id"> <h2>Produto {{ product.name }}</h2> <h3>Situação {{ product.situation }}</h3> </div> export default { data() { return { products: [], }; }, methods: { async getData() { try { const req = await fetch("http://localhost:3000/products"); const data = await req.json(); this.products = data.products; console.log("data" + data); } catch (error) { console.error("Error fetching data:", error); } }, mounted() { this.getData(); }, }, }; JSON: { "products": [ { "id": "a898", "name": "Claudio Romano", "situation": "Ativo" } ] } 您问错了问题,因为该问题与 JSON 无关。如果您对此进行调试,您会注意到 console.logs 不执行,这意味着问题更为根本,因为该方法本身并未实际运行。 根本问题是mounted()不应该在methods内部。您正在使用 Vue 的选项 API,其中 data()、methods 和 mounted 都是独立的、单独的“选项”。您需要将安装移动到方法之外,它应该是一个“兄弟”选项。 export default { data() { ... }, methods: { ... }, mounted() { this.getData(); }, }; 游乐场演示


如何使用 Bootstrap 5 禁用自定义范围而不更改样式?

我有范围: 我有范围: <!DOCTYPE html> <html lang="en"> <head> <!-- Bootstrap --> <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous" /> </head> <body> <div class="container mb-4 col-sm-5"> <input type="range" class="custom-range" min="0" max="10" value="10" id="range-input" style="width: 100%"> </div> </body> </html> 我想禁用它(它应该仍然看起来一样,但用户不能再与它交互),但是不改变样式。例如: 图中,顶部的启用,底部的禁用;我想禁用它,同时保持顶级范围的样式。 我尝试手动重新创建原始样式,但没有成功: <!DOCTYPE html> <html lang="en"> <head> <!-- Bootstrap --> <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous" /> <style> input[type=range]:disabled { background-color: blue; color: blue; background: blue; } </style> </head> <body> <div class="container mb-4 col-sm-5"> <input type="range" class="custom-range" min="0" max="10" value="10" id="range-input" style="width: 100%" disabled> </div> </body> </html> 除此之外,我在研究中找不到任何其他可能的解决方案。 您实际上需要“如何”禁用它? 设置 pointer-events: none 并添加 tabindex="-1",你会得到一个看起来仍然相同的元素,但用户无法再与之交互(至少通过鼠标单击/点击,并且他们无法通过键盘将其聚焦)控制其中之一 - 不确定是否还有其他什么?) 由于没有设置 name 属性,该字段不会成为表单提交数据集的一部分 - 如果在您的实际用例中有所不同,您也可以删除(并重新设置)名称,当您可以打开和关闭 tabindex。


为什么每次我尝试将应用程序从 Anypoint Studio 部署到 CloudHub 时,我的 pom.xml 文件都会更新?

我的 pom.xml 文件中有以下部分用于我正在执行的虚拟项目: org.mule.tools.maven mule-maven-插件 我正在做的一个虚拟项目的 pom.xml 文件中有以下部分: <plugin> <groupId>org.mule.tools.maven</groupId> <artifactId>mule-maven-plugin</artifactId> <version>${mule.maven.plugin.version}</version> <extensions>true</extensions> <configuration> <classifier>mule-application</classifier> </configuration> </plugin> 每当我尝试直接从 Studio 将应用程序部署到 CloudHub 时,上面的部分就会更改为以下部分: <plugin> <groupId>org.mule.tools.maven</groupId> <artifactId>mule-maven-plugin</artifactId> <version>${mule.maven.plugin.version}</version> <extensions>true</extensions> <configuration> <classifier>---- select project type ----</classifier> </configuration> </plugin> 然后部署失败并出现以下错误: Publication status: error [INFO] ------------------------------------------------------------ [INFO] Steps: [INFO] - Description: Publishing asset [INFO] - Status: error [INFO] - Errors: [The asset is invalid, Error while trying to set type: app. Expected type is: rest-api.] [INFO] ......................................... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:33 min [INFO] Finished at: 2024-01-08T14:11:31+05:30 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.mule.tools.maven:exchange-mule-maven-plugin:0.0.17:exchange-deploy (default-exchange-deploy) on project super-biodata-sapi: Exchange publication failed: Publication ended with errors: [The asset is invalid, Error while trying to set type: app. Expected type is: rest-api.] -> [Help 1] 这可能是什么原因? 以下是一些细节: Anypoint Studio版本:7.16.0 Maven版本:3.8.8 Mule 运行时版本:4.4.0 Mule Maven 插件版本:3.8.0/4.0.0(两者都尝试过) Java版本:OpenJDK 11.0.9 我以前使用过 Anypoint Studio 7.15,在那里完全相同的项目没有任何问题。但更新后,我遇到了很多问题。 我还尝试使用“rest-api”而不是“mule-application”。然后,首先在部署开始时,“rest-api”更改为“mule-application”,然后再次更改为“----选择项目类型----”,最后失败。 我怀疑存在混乱。您提到您正在尝试将 Mule 4 应用程序部署到 CloudHub,但对资产的引用和错误消息与将资产发布到 Any point Exchange 相关。 CloudHub是一个部署和执行Mule应用程序的云平台。 Anypoint Exchange 是资产存储库,包括 REST API 的定义,但不包括 Mule 4 应用程序,也不用于执行任何操作。有关有效资产的详细信息,请参阅文档。 由于 mule-application 不是发布到 Exchange 的有效资产类型(对于 Mule 4),那么 Studio 似乎试图让您更改为有效的资产类型。 如果您尝试部署到 CloudHub,请参阅文档了解不同的方法。


如何在不重新加载页面的情况下发送带有文件的表单?

我尝试在ajax中发送表单而不重新加载页面,但我看到,文件上的链接不存在...... 我有下一个表格: 我尝试在ajax中发送表单而不重新加载页面,但我看到,文件上的链接不存在... 我有下一个表格: <form id="settings" method="POST" enctype="multipart/form-data"> ... <input type="file" id="logo" style="display:none;" name="logo" accept="image/png, image/jpeg, image/gif"> <button type="submit" id="send" class="btn btn-primary">save</button> </form> Ajax 脚本: $('#settings').submit(function(e){ e.preventDefault(); var form = $(this).serialize(); alert(form); // file is not attached... $.ajax({ url : '/settings', type : 'POST', crossDomain : false, data : form, contentType : 'multipart/form-data', dataType : 'json', progressData: false, cache : false, success : function(r){ alert (111); } }).fail(function(){ console.log('Error occured!'); }); }); 在服务器端,我收到错误: org.apache.tomcat.util.http.fileupload.FileUploadException:请求被拒绝,因为未找到多部分边界 我尝试不序列化表单,而是写了 data : form -> data : new FormData(this) 此选项会导致错误“非法调用”。如何在不重新加载页面的情况下发送带有文件的表单? 要使用 AJAX 发送带有文件的表单而不重新加载页面,您需要使用 FormData 来正确处理文件上传。 <form id="settings" method="POST" enctype="multipart/form-data"> <!-- Other form fields --> <input type="file" id="logo" name="logo" accept="image/png, image/jpeg, image/gif"> <button type="submit" id="send" class="btn btn-primary">Save</button> </form> $(document).ready(function() { $('#settings').submit(function(e){ e.preventDefault(); var formData = new FormData(this); $.ajax({ url: '/settings', type: 'POST', data: formData, contentType: false, processData: false, cache: false, success: function(response){ alert('Form submitted successfully!'); // Handle the response from the server }, error: function(){ console.log('Error occurred!'); } }); }); });


表单响应:“无法处理请求 HTTP ERROR 500”。我做错了什么?

我尝试在网站上编写 php 表单,但收到错误 500。我无法弄清楚我做错了什么。你能看一下代码看看我做错了什么吗? PHP: 我尝试在网站上编写 php 表单,但收到错误 500。我无法弄清楚我做错了什么。你能看一下代码看看我做错了什么吗? PHP: <?php // define variables and set to empty values $name = $email = $phone = $enquiry = ""; if ( $_SERVER[ "REQUEST_METHOD" ] == "POST" ) { if ( empty( $_POST[ "name" ] ) ) { $nameErr = "Name is required"; } else { $name = test_input( $_POST[ "name" ] ); // check if name only contains letters and whitespace if ( !preg_match( "/^[a-zA-Z-' ]*$/", $name ) ) { $nameErr = "Only letters and white space allowed"; } } if ( empty( $_POST[ "email" ] ) ) { $emailErr = "Email is required"; } else { $email = test_input( $_POST[ "email" ] ); // check if e-mail address is well-formed if ( !filter_var( $email, FILTER_VALIDATE_EMAIL ) ) { $emailErr = "Invalid email format"; } } if ( empty( $_POST[ "phone" ] ) ) { $comment = ""; } else { $comment = test_input( $_POST[ "phone" ] ); } if ( empty( $_POST[ "enquiry" ] ) ) { $comment = ""; } else { $comment = test_input( $_POST[ "enquiry" ] ); } } // Create the email and send the message $destination = "[email protected]"; $subject = "Website Contact Form Enquiry: $name"; $body = "You have received a new message from your website contact form.\\n\\n"."Here are the details:\\n\\nName: $name\\n\\nEmail: $email\\n\\nPhone: $phone\\n\\nEnquiry:\\n$enquiry"; $header = "From: [email protected]\\n"; $headers = array(); $headers[] = "MIME-Version: 1.0"; $headers[] = "Content-type: text/plain; charset=iso-8859-1"; $headers[] = "From: " . $fromAddress; $headers[] = "Subject: " . $subject; $headers[] = "X-Mailer: PHP/".phpversion(); mail($destination, $subject, $message, implode("\r\n", $headers)); // mail($to,$subject,$msg,$headers); echo "Email successfully sent."; ?> HTML 格式: <form id="contact-form" method="post" action="/contact.php" role="form"> <div class="messages"></div> <div class="controls"> <div class="row"> <div class="col-md-10"> <div class="form-group"> <input id="form_name" type="text" name="name" class="form-control" placeholder="Name*" required="required" data-error="Your name is required." > <div class="help-block with-errors"></div> </div> </div> <div class="col-md-10"> <div class="form-group"> <input id="form_email" type="email" name="email" class="form-control" placeholder="Email*" required="required" data-error="Valid email is required." > <div class="help-block with-errors"></div> </div> </div> <div class="col-md-10"> <div class="form-group"> <input id="form_phone" type="text" name="phone" class="form-control" placeholder="Phone" > <div class="help-block with-errors"></div> </div> </div> </div> <div class="row"> <div class="col-md-10"> <div class="form-group"> <textarea id="form_enquiry" name="enquiry" class="form-control" placeholder="Enquiry*" rows="6" required="required" data-error="Please, leave us a message."></textarea> <div class="help-block with-errors"></div> </div> </div> <div class="col-md-12"> <input class="btn btn-large btn-primary centre mt-10" type="submit" value="Submit" > </div> </div> </div> </form> 我已按照其他人的指示使表单正常工作,但所做的更改仍然会出现错误。 这是一个简单的形式,但我似乎对我做错了什么缺乏了解。 请帮助我。 如果您查看发送邮件的行,这是一个硬行结尾,将 $headers 推到新行上吗?这将调用 500 错误。 查看 /var/log/apache2/error.log(如果您使用的是 Debian)或 /var/log/httpd/error.log(如果使用的是 RHEL 或类似系统)。 您的代码存在许多问题,但首先关注快乐的道路,然后让事情正常运行。


IIS Rewrite 在重写到外部网站时始终返回 502 bad gateway

是一个部署在IIS上的小网站。我正在使用此网站上的重写功能来重写对外部网站的 http 请求。这是 web.config 中的重写设置。 是一个部署在IIS上的小网站。我正在使用此网站上的重写功能来重写对外部网站的 http 请求。这是 web.config 中的重写设置。 <system.webServer> <rewrite> <rules> <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" /> <action type="Rewrite" url="https://about.gitlab.com/" logRewrittenUrl="true" /> </rule> </rules> </rewrite> </system.webServer> 它总是返回HTTP Error 502.2 - Bad Gateway。 HTTP 错误 502.2 - 网关错误 尝试路由请求时出现连接错误。 如果我只是使用指向此网站内页面的内部路径,使用相对路径,以 / 开头,那么它就可以正常工作。改成外部网站后,总是返回HTTP Error 502.2 - Bad Gateway。 有什么地方需要更新吗? 这是我解决问题的方法。它可能不是所有502 bad gateway问题的解决方案,但它解决了我的问题。 在应用程序请求路由 -> 缓存设置 -> 内存缓存持续时间中。我把他的值设置为0。然后它就按预期工作了。


错误 2911:无法删除文件夹 C:\Config.Msi\

我有一个创建桌面快捷方式的安装: 我的安装会创建桌面快捷方式: <Shortcut Id="SC.Desktop" Directory="DesktopFolder" Name="!(bind.Property.ProductName)" WorkingDirectory="INSTALLDIR" Target="[INSTALLDIR]testfile.txt" /> <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="integer" Name="DesktopIcon" Value="1" KeyPath="yes" /> 安装后一切正常,详细日志中没有错误。 在卸载时,我在详细日志中收到错误: DEBUG: Error 2911: Could not remove the folder C:\Config.Msi\. 如何解决这个问题? 这不是真正的错误消息。这只是 Windows 安装程序在自言自语。类似的文件和文件夹通常会在重新启动时清理。


Angular Material 2:修复多行错误消息

我在我的角度应用程序中使用角度材料2。当我的表单输入字段错误消息超过一行时,我遇到了问题。这是照片: 这是代码: 我在我的角度应用程序中使用角度材料 2。当我的表单输入字段错误消息超过一行时,我遇到了问题。这是照片: 这是代码: <md-error *ngIf="password.touched && password.invalid"> <span *ngIf="password.errors.required"> {{'PASSWORD_RECOVERY.FIELD_REQUIRED' | translate}} </span> <span *ngIf="password.errors.minlength || password.errors.maxlength"> {{'PASSWORD_RECOVERY.PASSWORD_LENGTH' | translate}} </span> <span *ngIf="password.errors.pattern"> {{'PASSWORD_RECOVERY.FOR_A_SECURE_PASSWORD' | translate}} </span> </md-error> 我通过阅读 github 了解到,这是 Angular 2 材料中的一个错误。有人通过自定义解决方法成功解决了这个问题吗? 问题是类为 .mat-form-field-subscript-wrapper 的元素是 position: absolute,所以它不占用实际空间。 按照 xumepadismal 在 github 上关于此问题的建议,您可以添加此 scss 作为解决我的问题的解决方法: // Workaround for https://github.com/angular/material2/issues/4580. mat-form-field .mat-form-field { &-underline { position: relative; bottom: auto; } &-subscript-wrapper { position: static; } } 它会转换静态 div 中的 .mat-form-field-subscript-wrapper 节点,并将 .mat-form-field-unterline 重新定位在输入字段之后。 正如材料 15 中在 github 讨论中提到的,可以通过将 subscriptSizing="dynamic" 添加到 mat-form-field 来解决问题。 要更改默认行为,您必须使用以下选项更新 angular.module.ts 提供程序: providers: [ { provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { subscriptSizing: 'dynamic' } } ] 这也可以在材料文档中找到 使用@mattia.corci提出的解决方案会导致错误消息被推到底部太多,从而在顶部留下不必要的空白空间。 使用 Tailwind CSS,这个解决方案对我来说适用于最新的 Angular 17: .mat-mdc-form-field { @apply w-full self-start; .mat-mdc-form-field-subscript-wrapper { @apply flex; .mat-mdc-form-field-error-wrapper { @apply static; } } } mat-form-field.ng-invalid.ng-touched { animation: example; animation-duration: 0.3s; margin-bottom: 20px; } @keyframes example { from { margin-bottom: 0; } to { margin-bottom: 20px; } } 它对我有用。


错误 | prefect.flow_runs.runner - 流程运行进程退出,状态代码:-7

我在运行脚本时收到此完美错误。错误如下: 0%| | 0/2070 [00:00 我在运行脚本时收到此完美错误。错误如下: 0%| | 0/2070 [00:00<?, ?it/s]09:36:01.917 | ERROR | prefect.flow_runs.runner - Process for flow run 'auspicious-butterfly' exited with status code: -7 09:36:02.057 | INFO | prefect.flow_runs.runner - Reported flow run '1f314ccd-1472-4373-bb1b-4b3b6265b29a' as crashed: Flow run process exited with non-zero status code -7. 不知道为什么。任何帮助将不胜感激。 我和 Prefect 也有同样的错误。您有什么版本的 Prefect? Reported flow run 'bbaa6e16-bf5f-44ff-a31b-d68645f74bb1' as crashed: Flow run process exited with non-zero status code -7. Process for flow run 'xi5-zeon' exited with status code: -7


© www.soinside.com 2019 - 2024. All rights reserved.