警告:这是我发布的一个不太严肃的问题/讨论......但我愿意打赌,大多数开发人员都在考虑这个"问题"......
一直想得到关于从某个地方获取数据并返回它的方法的命名约定的其他意见......
大多数方法名称都有点简单明了...... SaveEmployee(),DeleteOrder(),UploadDocument().当然,对于类,你最有可能使用短格式...分别保存(),删除(),上传().
但是,我一直在努力采取初步行动......如何获取数据.似乎对于每个项目,我最终都会在不同的命名约定之间跳跃,因为我对我使用的最后一个项目感到非常满意.据我所知,这些是可能性 - >
你有什么想法?
我配置了Solr 4.4.0核心,其中包含大约630k文档,原始大小约为10 GB.为了查询和突出显示,每个字段都被复制到文本字段.当我执行没有突出显示的搜索时,结果会在大约100毫秒内返回,但是当启用突出显示时,相同的查询需要10-11秒.我还注意到,对相同术语的后续查询持续大约需要10-11秒.
我对该领域的初始配置如下
<field name="text" type="text_general" indexed="true" stored="true"
multiValued="true"
omitNorms="true"
termPositions="true"
termVectors="true"
termOffsets="true" />
Run Code Online (Sandbox Code Playgroud)
发送的查询类似于以下内容
http://solrtest:8983/solr/Incidents/select?q=error+code&fl=id&wt=json&indent=true&hl=true&hl.useFastVectorHighlighter=true
Run Code Online (Sandbox Code Playgroud)
我的所有研究似乎都没有提供为什么突出表现如此糟糕的线索.一时兴起,我决定看看omitNorms = true属性是否有效,我修改了文本字段,清除了数据,并从头开始重新加载.
<field name="text" type="text_general" indexed="true" stored="true"
multiValued="true"
termPositions="true"
termVectors="true"
termOffsets="true" />
Run Code Online (Sandbox Code Playgroud)
奇怪的是,这似乎解决了问题.突出显示的初始查询花费2-3秒,后续查询花费不到100毫秒.
但是,因为我们想要omitNorms = true,我的永久解决方案是拥有两个 "text"字段的副本,一个具有属性,另一个没有.这个想法是针对一个字段执行查询并突出显示另一个字段.所以现在架构看起来像
<field name="text" type="text_general" indexed="true" stored="true"
multiValued="true"
omitNorms="true"
termPositions="true"
termVectors="true"
termOffsets="true" />
<field name="text2" type="text_general" indexed="true" stored="true"
multiValued="true"
termPositions="true"
termVectors="true"
termOffsets="true" />
Run Code Online (Sandbox Code Playgroud)
查询如下
http://solrtest:8983/solr/Incidents/select?q=error+code&fl=id&wt=json&indent=true&hl=true&hl.fl=text2&hl.useFastVectorHighlighter=true
Run Code Online (Sandbox Code Playgroud)
同样,数据被清除并重新加载相同的630k文档,但这次索引大小约为17 GB.(正如预期的那样,因为"text"字段中的内容是重复的.)
问题是性能数字恢复到每次运行的最初10-11秒.无论是第一次删除omitNorms都是侥幸还是还有其他事情正在发生.我不知道是什么...... …
我看到jquery UI发行版包含15个css文件.jquery.ui.all.css文件包含两个@import语句 - 一个用于jquery.ui.base.css,另一个用于jquery.ui.theme.css.
jquery.ui.base.css本身包含11个jquery.ui.core.css的import语句,然后是每个小部件.
我还看到一个名为jquery-ui.css的文件(比文件夹中的其他文件大).
我想,如果我想要给定主题的所有CSS然后链接单个jquery-ui.css,但是如果我想自定义我下载的部分然后导入jquery.ui.all.css并自定义jquery. ui.base.css是要走的路吗?
我不明白吗?
我很有棱角......所以我确信我做错了.花了好几个小时试图寻找一个解决方案,但angularjs文档旁边是无用的......几乎所有的例子都试图在全球范围内设置它.
我试图传递一个复杂的javascript对象作为查询参数.该对象有一个属性是一个数组,因此我需要展平(正确的术语??)这个对象,以便MVC绑定可以正确地实例化模型.
我试图传递的对象是沿袭的
newRequest = {
SearchTerms: 'error',
PageSize: 25,
...
Facets: [
{ Field: 'createdBy', Value: 'Joe' },
{ Field: 'createdBy', Value: 'Mary' }
]
}
Run Code Online (Sandbox Code Playgroud)
我宣布我的资源如下
(function () {
"use strict";
angular
.module('common.services')
.factory('searchResource', ['$resource', 'appSettings', searchResource]);
function searchResource($resource, appSettings) {
return $resource(appSettings.searchPath, null, {
query: {
method: 'GET',
transformRequest: function (data, headersGetter) {
if (data === undefined) { // this is always true
return data;
}
return $.param(data);
}
}
});
}
}());
Run Code Online (Sandbox Code Playgroud)
我正在使用它
vm.executeSearch = function …Run Code Online (Sandbox Code Playgroud) 如果我使用一些错误或模糊的术语,我会道歉.如果我这样做,请纠正我.
我有一个相当新的ASP.NET 4.6 MVC 5应用程序,它通过WsFederation和Microsoft ADFS服务器使用声明身份验证.这意味着我不公开LogIn操作控制器,也不管理webapp中的用户和密码.当用户导航到我的站点时,如果他们未经过身份验证,则会将他们重定向到他们登录的ADFS服务器,然后重定向回来.
我需要存储一些提交的离线使用声明 - 他们的显示名称和电子邮件地址.我的想法是利用创建该集合os AspNet*表的ASP.NET Identity包.据我了解,它旨在支持本地用户(使用密码)和外部用户(使用外部密码管理)来自Facebook,Google,Github等提供商.我是否认为ADFS属于该类别?
成功验证后重定向回我的网站,我究竟在哪里放置检查用户是否在AspNet*表中输入的逻辑?cookie验证和WsFederation的配置和连线目前在该Startup.ConfigureAuth(IAppBuilder app)方法中发生.我想我应该使用从继承的类IdentityUser和IdentityDbContext<ApplicationUser>然后调用方法UserManager或UserStore.
我花了几个小时搜索如何将外部登录与应用程序"配置文件"表关联起来的示例无济于事.我很可能刚刚使用了错误的术语.到目前为止,我发现的每个示例都涉及模拟或修改登录和注册操作方法附带的默认VS模板,或者只是连接FB和Google.没有任何东西可以处理ADFS 和/或从外部源绑定到配置文件表.
任何代码示例或至少链接到文章/资源将不胜感激.
asp.net-mvc adfs claims-based-identity ws-federation asp.net-identity
我原以为通过 Angular2 的所有工作找到这些信息会很简单,但显然不是......
1) 如何获取Angular2 中激活路由的完整url?我知道我可以打电话,window.location.href但想知道是否有 Angular 方式。
2)有没有办法“建立”一个网址?如果我知道我想要的路线和所述路线的参数,我可以构建完整的url 吗?
我尝试构建一个由ASP.NET Web API后端支持的Angular 6应用程序。该应用程序根据联合 Azure AD 的单独Identity Server 4对用户进行身份验证,最终返回不记名引用令牌。
从登录然后验证(令牌)的角度来看,一切正常。用户访问该站点,被重定向到 Azure AD,登录,然后被重定向回 Angular 6 应用程序。对于 API 调用,令牌被注入标头,ASP.NET Core 身份验证中间件验证令牌并返回数据。
services
.AddAuthentication(options => {
options.DefaultScheme = IdentityServerAuthenticationDefaults.AuthenticationScheme;
options.DefaultAuthenticateScheme = IdentityServerAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = IdentityServerAuthenticationDefaults.AuthenticationScheme;
options.DefaultSignInScheme = IdentityServerAuthenticationDefaults.AuthenticationScheme;
})
.AddIdentityServerAuthentication(options => {
options.Authority = AuthClient.SsoBaseUrl;
options.RequireHttpsMetadata = false;
options.ApiName = AuthClient.SsoClientName;
options.ApiSecret = AuthClient.SsoClientSecret;
});
Run Code Online (Sandbox Code Playgroud)
我的问题是,我正在尝试合并 ASP.NET Core Identity,但我不确定在哪里/如何将claims principal通过AddIdentityServerAuthentication.
在此应用程序的早期版本 (ASP.NET Framework 4.7) 中,我们使用了Ws-Federationwhich 重定向回ExternalCallbackLogin()其中AccountController …
asp.net-web-api asp.net-identity bearer-token identityserver4 asp.net-core-2.0
我遇到了 OData 8.x 和属性路由的问题,其中同一控制器操作生成重复路由。此重复路线导致 Swagger / Swashbuckle 抛出“方法/路径组合冲突”错误。
我已经能够将其简化为Visual Studio 2019 中稍微调整的默认天气预报模板。
// Change name of controller to plural
// Added Route() attribute
// Changed ControllerBase to ODataController (issue happens with ControllerBase too)
[Route("api/[controller]")]
public class WeatherForecastsController : ODataController{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
[HttpGet()]
public IEnumerable<WeatherForecast> Get() {
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast …Run Code Online (Sandbox Code Playgroud) asp.net-core-webapi swashbuckle.aspnetcore asp.net-core-odata
我需要在远程计算机上运行ps1脚本.该脚本将传递一个表示文件名的参数.我已经尝试了很多很多不同的组合和方法来将参数传递给脚本块,但是在尝试支持脚本名称和/或文件名中的空格时,我总是遇到一个或另一个错误.
注意:最终结果将使用Invoke-Command参数在REMOTE计算机上运行脚本,但为了简单起见,测试所有示例都在本地运行.-ComputerName
给出样本"远程"脚本
#processFile.ps1
$args[0] # Just outputs the first parameter passed
Run Code Online (Sandbox Code Playgroud)
当名称中没有空格时,以下工作
$cmd = ".\processFile.ps1"
$fn = "someFile.csv"
$sb = [ScriptBlock]::Create("$cmd $fn")
Invoke-Command -ScriptBlock $sb
# Outputs the correct
someFile.csv
Run Code Online (Sandbox Code Playgroud)
但是,以下不起作用
$cmd = ".\processFile.ps1"
$fn = "some File.csv"
$sb = [ScriptBlock]::Create("$cmd $fn")
Invoke-Command -ScriptBlock $sb
# Outputs the incorrect
some
Run Code Online (Sandbox Code Playgroud)
显然,文件名参数需要进行转义并作为"some File.csv"传递.这可以通过以下方式完成:
$cmd = ".\processFile.ps1"
$fn = "some File.csv"
$sb = [ScriptBlock]::Create("$cmd `"$fn`"") # Notice the escape $fn parameter
Invoke-Command -ScriptBlock $sb …Run Code Online (Sandbox Code Playgroud) adfs ×1
angular ×1
angularjs ×1
asp.net-mvc ×1
bearer-token ×1
css ×1
jquery-ui ×1
lucene ×1
methods ×1
powershell ×1
solr ×1