我正在使用ACRA for Android,我想将崩溃报告发送到我自己的服务器.我把它设置得很好,一切正常.但是,我想将报告发送的URL设置为可配置.但我不知道该怎么做.
这是我用来设置URL的代码
@ReportsCrashes(formKey = "", // will not be used
formUri = "http://yourserver.com/yourscript",
formUriBasicAuthLogin = "yourlogin", // optional
formUriBasicAuthPassword = "y0uRpa$$w0rd", // optional
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
public class MyApplication extends Application {
...
Run Code Online (Sandbox Code Playgroud)
所以基本上,我不能formUri在应用程序中进行配置.可能吗?
我有一个用Java编写的GAE项目,我对HRD和一个我不确定如何解决的问题有一些想法.
基本上我的系统中有用户.用户由用户标识,用户名,电子邮件和密码组成.每次我创建一个新用户时,我想检查是否已经有一个用户具有相同的用户ID(应该永远不会发生),用户名或电子邮件.
用户标识是关键,因此我认为使用此标准将是一致的.但是,当我进行查询(并使用过滤器)查找具有相同用户名或电子邮件的可能用户时,我无法确定结果是否一致.因此,如果有人在几秒钟之前创建了具有相同用户名或电子邮件的用户,我可能无法通过查询找到它.我知道祖先习惯于解决这个问题,但如果我没有用于查询的祖先呢?用户没有父母.
我很高兴听到您对此的看法,以及在这些情况下被认为是最佳做法.如果改变了什么,我正在使用Objectify for GAE.
我DataGrid绑定了一组项目(规则)。如果我在 DataGrid 中手动编辑这些项目之一,似乎SelectedItem网格上的绑定停止工作(RuleListViewModelPropertyChanged在控制器中不再被调用)。但只有当我实际更改单元格中项目的值时,否则SelectedItem会继续像它应该的那样工作。
我已经剥离了一些不相关的代码,所以这基本上是我所拥有的。首先,我有以下几点DataGrid:
<DataGrid x:Name="RuleTable" Grid.Row="1" Grid.ColumnSpan="2" ItemsSource="{Binding Rules}" SelectedItem="{Binding SelectedRule, Mode=TwoWay}"
BorderThickness="0" >
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding TargetValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True,
ValidatesOnExceptions=True, NotifyOnValidationError=True}"
Header="{x:Static p:Resources.TargetValue}" Width="*" ElementStyle="{StaticResource TextCellElementStyle}"
EditingElementStyle="{StaticResource TextCellEditingStyle}"/>
</DataGrid.Columns>
</DataGrid>
Run Code Online (Sandbox Code Playgroud)
随着ViewModel看起来像这样:
public class RuleListViewModel : ViewModel<IRuleListView>
{
private IEnumerable<Rule> rules;
private Rule selectedRule;
public RuleListViewModel(IRuleListView view)
: base(view)
{
}
public RuleListViewModel() : base(null) {}
public IEnumerable<Rule> Rules
{
get
{
return rules;
}
set
{ …Run Code Online (Sandbox Code Playgroud) 我正在使用Asp.NET Identity 2.1.0,我存储了Accounts一个User可以访问的列表,作为声明.该ClaimsIdentity时生成User迹象:
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add Claims concerning Account
userIdentity.AddClaim(new Claim("AccountList", SerializedListOfAccounts));
return userIdentity;
}
Run Code Online (Sandbox Code Playgroud)
假设管理员撤销User A对特定帐户的访问权限.我User A该如何强制再生ClaimsIdentity呢?请记住,它不是在上下文中User A.我不想等到cookie过期(并ClaimsIdentity自动生成一个新的.
可能吗?有没有办法告诉服务器将User Acookie视为无效并强制它重新生成?
我想要这种行为的原因是创建一个自定义AuthorizeAttribute,我可以放在我的控制器上,检查Claims是否User有访问权限,以避免额外的数据库往返.
我在主/详细视图中遇到路由问题。如果我去的路线/master中InfoComponent应该表现出一些基本信息。如果我去/master/1了DetailsComponent应显示为ID 1.在这两种情况下,该项目的一些数据,MasterComponent应该显示无论是选择的ID或没有。
我可以很好地完成这项工作。但问题是我想订阅:idinOnInit中的选定内容,MasterComponent以便我可以在那里突出显示它,如下所示:
this.selectedId = this.route.params.map((params: Params) => params["id"])
Run Code Online (Sandbox Code Playgroud)
但这不起作用,因为它:id是一个子路由参数。而且我无法使用,this.route.firstChild因为 firstChild 将是另一条路线,具体取决于是否显示InfoComponent或DetailsComponent正在显示。
:id当MasterComponent显示两个子组件之间发生变化时,我可以获得一个可观察的(of )吗?
这是我的路由模块:
@NgModule({
imports: [
RouterModule.forChild([
{
path: "master",
canActivate: [AuthenticationGuardService],
children: [
{
path: "",
component: MasterComponent,
children: [
{
path: "",
component: InfoComponent
},
{
path: ":id",
component: DetailsComponent
}
]
}
]
}
])
],
exports: [ …Run Code Online (Sandbox Code Playgroud) 我使用 Hangfire 进行后台作业,使用 Serilog 进行日志记录。我正在尝试用 a 来丰富我的 serilogs,TrackingId以便来自特定 Hangfire 作业的所有日志都具有TrackingId我可以过滤的相同内容。
我在以下配置 Serilog Startup.cs:
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(Configuration)
.WriteTo.Seq(serverUrl: serverUrl, apiKey: apiKey)
// Enrich the logs with a tracking id. Will be a new value per request
.Enrich.WithProperty("TrackingId", Guid.NewGuid())
.CreateLogger();
Run Code Online (Sandbox Code Playgroud)
我将这样的工作排入队列:
BackgroundJob.Enqueue<MyService>(myService => myService.DoIt(someParameter));
Run Code Online (Sandbox Code Playgroud)
但是这样做不会为TrackingId每个 Hangfire 作业单独设置。有什么办法可以实现吗?
我正在使用COPY从 CSV 将大量数据插入到我们的数据库中。插入看起来像这样:
-- This tmp table will contain all the items that we want to try to insert
CREATE TEMP TABLE tmp_items
(
field1 INTEGER NULL,
field2 INTEGER NULL,
...
) ON COMMIT DROP;
COPY tmp_items(
field1,
field2,
...
) FROM 'path\to\data.csv' WITH (FORMAT csv);
-- Start inserting some items
WITH newitems AS (
INSERT INTO items (field1, field2)
SELECT tmpi.field1, tmpi,field2
FROM tmp_items tmpi
WHERE some condition
-- Return the new id and other fields to …Run Code Online (Sandbox Code Playgroud) 我有一个 .NET Core 2.0 项目,针对完整的 .NET Framework:
<TargetFramework>net461</TargetFramework>
...
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
Run Code Online (Sandbox Code Playgroud)
在 Windows 10 的本地主机上运行,使用 Visual Studio Community 2017 (15.7.4) 和 IIS Express (10.0.14358.1000)。
很多时候,ajax 请求会卡在该OPTIONS请求上(参见图片),从而阻止所有后续请求(它们也会卡在 上OPTIONS (pending))。
这可能发生在第一个请求时,或者发生在调试会话期间,直到那时为止都很好。
唯一的解决方案是停止在 VS 中调试项目,停止 IIS Express 并再次构建项目,然后再次启动调试器。
我不知道如何调试这个问题,或者如何找出导致它的原因。是 VS、Kestrel、IIS Express 等吗?
如果这Program.cs有帮助的话,看起来是这样的:
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
Run Code Online (Sandbox Code Playgroud)
编辑
这些是典型 OPTIONS 请求的请求/响应标头(这个效果很好)
请求标头
OPTIONS /api/items/2450 …Run Code Online (Sandbox Code Playgroud) iis-express kestrel-http-server asp.net-core visual-studio-2017 iis-express-10
如果我需要在循环中执行 IO 操作,我可以创建 sTask并且它们等待它们全部。像这样的东西:
var tasks = new List<Task>();
for (var dataToProcess in listOfData) {
tasks.Add(DoSomeIOAsync(dataToProcess));
}
await Task.WhenAll(tasks);
Run Code Online (Sandbox Code Playgroud)
我如何推断合理的dataToProcessin数量listOfData是多少?
如果DoSomeIOAsync是异步的,那么所使用的线程将在等待 IO 时返回。所以我想没有线程池饥饿的风险?
内存中存在大量Task状态机的开销是否可能成为问题?
我可以使用一些指导方针来推理这个问题吗?
我按照本指南将 opentelemetry 跟踪发送到 Azure Monitor(通过 Application Insights) 。
Application Insights 是否具有类似于 Jaeger、Zipkin 和 Tempo 提供的视图,或者我只能将跟踪作为日志条目查看在表中吗?
azure azure-application-insights open-telemetry azure-monitor
.net-core ×2
asp.net-core ×2
c# ×2
.net ×1
.net-6.0 ×1
android ×1
angular ×1
asp.net ×1
async-await ×1
azure ×1
hangfire ×1
iis-express ×1
java ×1
objectify ×1
postgresql ×1
serilog ×1
wpf ×1
wpfdatagrid ×1