以前我用X-Editable和Bootstrap 3实现了内联编辑.使用Bootstrap 4它似乎不再起作用.在这里查看JsFiddle.
如果我定义一个这样的简单弹出窗口:
<div style="margin: 150px">
<a href="#" class="comment" data-name="comment" data-type="text" data-pk="@item.Id" data-url="/" data-title="Enter comment">comment</a>
</div>
<script>
$(document).ready(function() {
$('.comment').editable();
});
</script>
Run Code Online (Sandbox Code Playgroud)
它在BS3中工作正常,但是当我切换到BS4时,它不再起作用给出错误:
Uncaught TypeError: Cannot read property 'addClass' of undefined
at Popup.show (bootstrap-editable.js:1091)
at Editable.show (bootstrap-editable.js:1802)
at Editable.toggle (bootstrap-editable.js:1824)
at Editable.<anonymous> (bootstrap-editable.js:1547)
at HTMLAnchorElement.e (jquery-3.2.1.slim.min.js:2)
Run Code Online (Sandbox Code Playgroud)
在控制台中.
我究竟做错了什么?我应该使用不同的库/分叉吗?
我正在开发一个包含大量数据表的项目,并通过ASP.net MVC屏幕显示它们.
我发现自己写了很多简单的数据注释,如下所示:
[Display(Name = "Manager Name")]
public string ManagerName { get; set; }
[Display(Name = "Employee Name")]
public string EmployeeName { get; set; }
[Display(Name = "Employee No")]
public string EmployeeNo { get; set; }
[Display(Name = "Manager Employee No")]
public string ManagerEmployeeNo { get; set; }
Run Code Online (Sandbox Code Playgroud)
这变得非常繁琐,并且想知道是否有一种方法可以添加一个新的属性,说"convertFromCamel"(或其他东西)或者是否有办法覆盖
@Html.DisplayNameFor(m => Model.First().EmployeeNo)
Run Code Online (Sandbox Code Playgroud)
因此,如果没有数据注释,它会从camel case转换现有的字段名称.
提前致谢
我有一个调用 powershell 文件的 jenkins 工作。当我在自由式项目中使用它时,它会在控制台输出中显示 powershell 执行。将其切换到管道作业后,我不再看到输出。
目前我的管道如下所示:
pipeline
{
stages
{
stage ('Deploy To Dev')
{
steps
{
powershell '"%WORKSPACE%\\SpearsLoad\\Scripts\\CIDeployToDev.Ps1"'
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
但我没有记录 powershell 步骤。
根据文档,我尝试将阶段更改为:
pipeline
{
stages
{
stage ('Deploy To Dev')
{
steps
{
node('Deploy the SSIS load')
{
//Deploy the SSIS load
def msg = powershell(returnStdout: true, script: '"%WORKSPACE%\\SpearsLoad\\Scripts\\CIDeployToDev.Ps1"')
println msg
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
但这给出了:
预期为第 123 行第 6 列的步骤。 def msg = powershell(returnStdout: true, script: '"%WORKSPACE%\SpearsLoad\Scripts\CIDeployToDev.Ps1"')
我觉得我错过了一些非常基本的东西。我究竟做错了什么 ?
我们有一个SSIS流程,可以从各种来源导入不同格式的各种文件.这些文件中的每一个都在整个月的不同时间交付.
用户希望能够查看每个文件的修改日期,以检查他们是否定期更新.
目标是在流程结束时生成一个表格,如下所示:

所以我想弄清楚如何获取我读过的每个文件的修改日期.有没有办法在SSIS中执行此操作?
提前致谢
我们曾经有一些网络表单设置允许我们编辑工作。外部应用程序将使用如下 URL 访问它们:
http://server/EditJob.aspx?JobID=1235
Run Code Online (Sandbox Code Playgroud)
用 MVC 替换 Web 表单后,新 URL 为
http://server/MVC/Jobs/Edit/1235
Run Code Online (Sandbox Code Playgroud)
我希望将之前的 URL 的调用路由到新的 URl,因为无法更改客户端。我怎样才能实现这个目标?
我试过:
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute(name: "Job Link", url: "EditJob.aspx?JobID ={JobID}", defaults: new { area = "MVC", controller = "Jobs", action = "Edit" });
routes.MapRoute(name: "Default", url: "{controller}/{action}/{id}", defaults: new { area = "MVC", controller = "Jobs", action = "Index", id = UrlParameter.Optional });
}
Run Code Online (Sandbox Code Playgroud)
但这会给出 (System.ArgumentException: '路由 URL 不能以 '/' 或 '~' 字符开头,并且不能包含 '?' 字符。'
那么,我可以使用路由来做到这一点,还是应该重新创建旧的 Web 表单作为到新页面的重定向。
谢谢
更新
感谢所有聪明的人们,我发现了 …
我正在尝试使用正则表达式在c#中验证Windows路径。基于这个答案,https://stackoverflow.com/a/24703223/4264336我想出了一个正则表达式,它允许驱动器号和unc路径,但似乎阻塞了空格。
功能:
public bool ValidatePath(string path)
{
Regex regex = new Regex(@"^(([a-zA-Z]:\\)|\\\\)(((?![<>:""/\\|? *]).)+((?<![ .])\\)?)*$");
return regex.IsMatch(path);
}
Run Code Online (Sandbox Code Playgroud)
它适用于我所有的测试用例,但文件名中空格除外:
[Test]
[TestCase(@"c:\", true)]
[TestCase(@"\\server\filename", true)]
[TestCase(@"\\server\filename with space", true)] //fails
[TestCase(@"\\server\filename\{token}\file", true)]
[TestCase(@"zzzzz", false)]
public void BadPathTest(string path, bool expected)
{
ValidatePath(path).Should().Be(expected);
}
Run Code Online (Sandbox Code Playgroud)
如何获取文件名中的空格,我一生都看不到在哪里添加它?
希望有人能指出我在这里做错了什么。我有一个读取文件访问规则的进程,我正在尝试并行运行它。
这是我到目前为止的代码:
public List<FolderAccessRule> GetSecurityGroupsForFolder(long importId, string subdirectory, bool includeInherited)
{
ConcurrentQueue<FolderAccessRule> groups = new ConcurrentQueue<FolderAccessRule>();
ConcurrentQueue<Exception> exceptions = new ConcurrentQueue<Exception>();
DirectoryInfo dInfo = new DirectoryInfo(subdirectory);
DirectorySecurity dSecurity = dInfo.GetAccessControl();
AuthorizationRuleCollection authorizationRuleCollection = dSecurity.GetAccessRules(true, includeInherited, typeof(NTAccount));
Parallel.ForEach( authorizationRuleCollection,
fsar =>
{
try
{
FolderAccessRule group = this.GetGroup(fsar);
if (group != null)
{
groups.Enqueue(group);
}
}
catch (Exception e)
{
exceptions.Enqueue(e);
}
});
foreach (Exception e in exceptions)
{
string message = string.Concat(e.GetType(), "Exception getting Directory info for ", subdirectory);
this.RecordException(message, …Run Code Online (Sandbox Code Playgroud) 如果这个问题有点痴迷,我很抱歉,但我确实喜欢我的代码,不要在resharper告诉我的地方下面留下任何扭曲的线条.
我有一个通用列表:
var permissions = new List<Permission>();
Run Code Online (Sandbox Code Playgroud)
在代码中的某些点我需要测试第一个元素:
if (permissions.First().ImportID == this.ImportId)
{
// do stuff
}
Run Code Online (Sandbox Code Playgroud)
Resharper(正确地)抱怨权限可能为null,因此我接受其建议并添加一个签入:
if (permissions != null && permissions.First().ImportID == this.ImportId)
{
// do stuff
}
Run Code Online (Sandbox Code Playgroud)
现在我意识到我需要防止列表为空,所以我也在那里添加一个支票:
if (permissions != null && permissions.Any() && permissions.First().ImportID == this.ImportId)
{
// do stuff
}
Run Code Online (Sandbox Code Playgroud)
生活是美好的,代码工作和resharper是安静的.意识到我将经常使用null + any()检查,我添加了一个扩展方法:
public static bool IsEmpty<T>(this IEnumerable<T> source)
{
if (source == null)
return true;
return !source.Any();
}
Run Code Online (Sandbox Code Playgroud)
现在唯一的问题就是我使用它:
if (!permissions.IsEmpty() && permissions.First().ImportID == this.ImportId)
Run Code Online (Sandbox Code Playgroud)
Resharper再次开始呻吟"可能对指定为"NotNull"属性的实体赋值.
那么,有没有办法让resharper知道在执行IsEmpty()之后权限永远不会为空(以同样的方式理解!= null)或者是忽略该消息的唯一选择.
我是在 Javascript 中使用导入功能的新手,并且对如何安装 filesaver.js的说明感到困惑。
在我的代码中,我有:
<script src="/scripts/FileSaver.js"></script>
<script>
import { saveAs } from 'file-saver/FileSaver';
$("#xmlToFile").click(function() {
var xml = $("#jobXml").val();
var blob = new Blob([xml], { type: 'text/xml' });
var filename = $("#Job_JobID").val();
saveAs(blob, filename + ".txt");
});
</script>
Run Code Online (Sandbox Code Playgroud)
但是 Chrome 用Unexpected Token {在导入线上卡住了
我究竟做错了什么 ?
c# ×5
asp.net-mvc ×2
javascript ×2
.net ×1
access-rules ×1
asp.net ×1
attributes ×1
fileinfo ×1
filesaver.js ×1
jenkins ×1
jquery ×1
powershell ×1
redirect ×1
refactoring ×1
regex ×1
resharper ×1
sql-server ×1
ssis ×1
x-editable ×1