小编Mar*_*way的帖子

Jquery每个Json对象

我有一个从服务返回的结果集,它给了我以下json

{
    "ThreadCount":61,
    "GroupList":[
        {"userName":"KLT","count":2687},
        {"userName":"KCameron","count":718},
        {"userName":"IRG","count":156},{"userName":"JLB","count":123},{"userName":"HML","count":121},{"userName":"SMN","count":99},{"userName":"TBridges","count":68},{"userName":"ARF","count":65},{"userName":"MarkGreenway","count":61},{"userName":"SMC","count":55},{"userName":"EMD","count":52},{"userName":"PKP","count":41},{"userName":"KBounds","count":36},{"userName":"MAN","count":33},{"userName":"LAC","count":17},{"userName":"EPS","count":17},{"userName":"CAN","count":7},{"userName":"MAJ","count":3},{"userName":"CPC","count":2}]
}
Run Code Online (Sandbox Code Playgroud)

我想使用Jquery(或javascript将threadCount放在一个div中,并将用户名和counds添加到表中

success: function(result) {
    $("#Unfiled").html(result.ThreadCount);
    $.each(result.GroupList, function(user) {
        $('#myTable > tbody').append(
            '<tr><td>'
            + user.userName
            + '</td><td>'
            + user.count +
            '</td></tr>'
        );
    });
}
Run Code Online (Sandbox Code Playgroud)

出于某种原因,我在桌子上没有得到任何东西......

顺便说一句,我的HTML在这里:

 <table>
    <tr>
        <td>
            Unfiled Emails:
        </td>
        <td id="Unfiled">
            -1
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <table id="myTable" border="2" cellpadding="3" cellspacing="3">
            </table>
        </td>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

我知道我错过了一些简单的事......

感谢您的帮助

jquery json

20
推荐指数
1
解决办法
8万
查看次数

SSH-Keygen"没有这样的文件或目录"

试图为我的git生成一个公钥.使用Powershell.

PS>ssh-keygen -t rsa -b 4096 -C "my@emailaddress.com"
Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa):
Could not create directory '//.ssh': Read-only file system
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Saving key "//.ssh/id_rsa" failed: No such file or directory
Run Code Online (Sandbox Code Playgroud)

如果我给文件的位置并运行

ssh -vT git@github.com
Run Code Online (Sandbox Code Playgroud)

它不检查要使用的公钥的自定义位置

OpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [<<ANIPADDRESS>>] port 22.
debug1: Connection established.
debug1: key_load_public: No such file …
Run Code Online (Sandbox Code Playgroud)

git ssh powershell

16
推荐指数
3
解决办法
6万
查看次数

测试EF保存更改修改器.传入DbPropertyValues

尝试通过覆盖EF SaveChanges方法在C#中执行一些业务逻辑.
我们的想法是对事情进行一些高级计算,例如,如果此字段已更改,请更新此字段.而且这个字段是子类减去其他一些字段的总和,你知道高级商业垃圾.

由于它真的很复杂,我们想测试它的填充物.添加测试工作得很好,但我们似乎无法测试更新的测试,因为我们已经编写了一个接口,其中有问题的方法被传递Signature看起来像这样

void Update(object entity, DbPropertyValues currentValues, DbPropertyValues originalValues);
Run Code Online (Sandbox Code Playgroud)

在完整EF中调用它时,它的工作效果非常好

    public override int SaveChanges()
    {
        var added = ChangeTracker.Entries().Where(p => p.State == EntityState.Added).Select(p => p.Entity);
        var updated = ChangeTracker.Entries().Where(p => p.State == EntityState.Modified).Select(p => p);

        var context = new ChangeAndValidationContext();

        foreach (var item in added)
        {
            var strategy = context.SelectStrategy(item);
            strategy.Add(item);
        }

        foreach (var item in updated)
        {
            var strategy = context.SelectStrategy(item);
            strategy.Update(item.Entity, item.CurrentValues, item.OriginalValues);
        }
        return base.SaveChanges();
   }
Run Code Online (Sandbox Code Playgroud)

我们无法弄清楚如何传入DbPropertyValues原始或更新我们的测试.请帮助我们弄清楚如何测试该方法.

c# tdd entity-framework-6

14
推荐指数
2
解决办法
547
查看次数

通用列表.首先不工作LINQ

        var stuff = ctx.spReport();
        var StuffAssembled = new List<ReportCLS>();
        var val = new List<ReportCLS>();
        foreach (var item in stuff)
        {
            StuffAssembled.Add(new ReportCLS(item));

        }

        val.Add(StuffAssembled.First());
Run Code Online (Sandbox Code Playgroud)

继续投掷

System.Collections.Generic.List'不包含'First'的定义,也没有扩展方法'First'接受类型为'System.Collections.Generic.List'的第一个参数'(你是否缺少using指令或装配参考?)

出了什么问题?

而且我该如何修复它?

谢谢

c# linq

13
推荐指数
2
解决办法
1万
查看次数

有没有人能够在azure网站上获得ABCPDF(HTML转换)

Webforms页面代码背后

        XSettings.InstallRedistributionLicense("REDACTED");
        var theDoc = new Doc();
        theDoc.HtmlOptions.Engine = EngineType.Gecko;
        theDoc.Rect.Inset(72, 144);
        theDoc.Page = theDoc.AddPage();
        int theID = theDoc.AddImageUrl("http://www.woot.com/");
        while (true)
        {
            theDoc.FrameRect(); // add a black border
            if (!theDoc.Chainable(theID))
                break;
            theDoc.Page = theDoc.AddPage();
            theID = theDoc.AddImageToChain(theID);
        }
        for (int i = 1; i <= theDoc.PageCount; i++)
        {
            theDoc.PageNumber = i;
            theDoc.Flatten();
        }
        Response.Buffer = false;
        Response.AddHeader("Content-Disposition", "inline; filename=\"rept.pdf\"");
        Response.ContentType = "application/pdf";
        theDoc.Save(Response.OutputStream);
        Response.Flush();
Run Code Online (Sandbox Code Playgroud)

应该工作得很好..但得到

      Failed to add HTML: RPC to Gecko engine process failed.Remote process terminated unexpectedly.
Run Code Online (Sandbox Code Playgroud)

在bin文件夹中运行完全信任

  • XULRunner文件夹和C:\ …

abcpdf azure-web-sites

10
推荐指数
1
解决办法
2077
查看次数

ASP.NET EditorTemplate DropdownList

每次我添加一个新的App它会创建一个新的AppCategory.我正在以某种方式严重搞砸了

代码第一个实体框架对象

public class AppCategory
{
    public int ID { get; set; }
    public string Name { get; set; }
    public ICollection<App> apps { get; set; }
}

public class App 
{
    public int ID { get; set; }
    public string Name { get; set; }
    public AppCategory Category { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

编辑模板(我想只做一个外键编辑器模板)

@inherits System.Web.Mvc.WebViewPage
@Html.DropDownList("Category", LIG2010RedesignMVC3.Models.Repo.GetAppCategoriesSelect())
Run Code Online (Sandbox Code Playgroud)

当然还有存储库

    public static IEnumerable<SelectListItem> GetAppCategoriesSelect()
    {
        return (from p in GetAppCategories()
                select new SelectListItem
                {
                    Text = p.Name,
                    Value = …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc editortemplates asp.net-mvc-2

9
推荐指数
1
解决办法
1086
查看次数

来自Asp.net的WebClient给出"现有连接被远程主机强行关闭"错误

我想发布到我们的星号框来解析电话列表

从控制台应用程序这工作:

 class Program
  {
    static void Main(string[] args)
    {


        Console.WriteLine( HttpPost());
        System.Threading.Thread.Sleep(10000);
    }

    public static string HttpPost()
    {
        var URI = @"http://sip.ligmarine.com/admin/config.php?quietmode=on&type=tool&display=printextensions";
        var Parameters = "display=printextensions&quietmode=on&type=tool&core=core&featurecodeadmin=featurecodeadmin&paging=paging";
        var retVal = "";
        WebClient wc = new WebClient();

        wc.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes("maint:password")));
        wc.Headers.Add("referer", @"http://sip.ligmarine.com/admin/config.php?type=tool&display=printextensions");
        wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");

        retVal = Convert.ToBase64String(Encoding.ASCII.GetBytes("maint:password"));
        //Console.Write("Resulting Request Headers: ");
        //Console.WriteLine(wc.Headers.ToString());
        byte[] byteArray = Encoding.ASCII.GetBytes(Parameters);
        //Console.WriteLine("Uploading to {0} ...", URI);
        // Upload the input string using the HTTP 1.0 POST method.
        byte[] responseArray = wc.UploadData(URI, "POST", byteArray);
       // …
Run Code Online (Sandbox Code Playgroud)

c# asp.net webclient

8
推荐指数
2
解决办法
4573
查看次数

有没有办法减少这两个linq查询中的重复

构建一堆报告,必须在不同的字段中反复做同样的事情

    public List<ReportSummary> ListProducer()
    {
        return (from p in Context.stdReports                    
                group p by new { p.txt_company, p.int_agencyId }
                    into g
                    select new ReportSummary
                    {
                        PKi = g.Key.int_agencyId,
                        Name = g.Key.txt_company,
                        Sum = g.Sum(foo => foo.lng_premium),
                        Count = g.Count()
                    }).OrderBy(q => q.Name).ToList();
    }

    public List<ReportSummary> ListCarrier()
    {
        return (from p in Context.stdReports
                group p by new { p.txt_carrier, p.int_carrierId }
                    into g
                    select new ReportSummary
                    {
                        PKi = g.Key.int_carrierId,
                        Name = g.Key.txt_carrier,
                        Sum = g.Sum(foo => foo.lng_premium),
                        Count = g.Count()
                    }).OrderBy(q …
Run Code Online (Sandbox Code Playgroud)

c# linq entity-framework

6
推荐指数
1
解决办法
153
查看次数

Razor语法不按我预期的方式工作

我的剃刀语法有些麻烦

给出了一个Parsor错误,指出foreach块缺少一个结束"}"字符

<ul>
@{var client = "null";}
@foreach (var instance in Model)
{
   if (instance.tbl_Policy.tbl_Client.txt_clientName != client)
   {
       client = instance.tbl_Policy.tbl_Client.txt_clientName;
      </ul><h1>@client</h1>   
      <ul>
   }
   <li>
    @instance.tbl_Policy.txt_policyNumber - 
    Assigned to : @instance.aspnet_Membership.aspnet_User.UserName
    @instance.ATLCheckType.Question
   <button type="button" rel="<%:instance.ATLCheckInstanceId.ToString()%>">DelFiled</button>
   <button type="button" rel="<%:instance.ATLCheckInstanceId.ToString()%>">DelLineItem</button>
   </li>  
}
</ul>
Run Code Online (Sandbox Code Playgroud)

razor asp.net-mvc-3

4
推荐指数
2
解决办法
2468
查看次数

额外的如果C#中的语句或重复代码

试图弄清楚哪个更有意义

<%foreach (var item in Model.items)
   {
%>
<tr>
    <td>
        <% if (!item.isMgmt)
           {  %>
        <a href="/MVC/AzureMail/Unfiled/<%:item.uName %>">
            <%:item.uName%></a>
        <% }
           else
           { %>
        <%:item.uName %>
        <% } %>
    </td>
</tr>
<% } %>
Run Code Online (Sandbox Code Playgroud)

要么

 <%foreach (var item in Model.items)
   {
%>
<tr>
    <td>
        <% if (!item.isMgmt)
           {  %>
        <a href="/MVC/AzureMail/Unfiled/<%:item.uName %>">
        <% } %>
              <%:item.uName%>
        <% if (!item.isMgmt)
           {  %>
              </a>
        <% } %>
    </td>
</tr>
<% } %>
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc asp.net-mvc-2

3
推荐指数
1
解决办法
253
查看次数

正确配置主干Marionette中父子关系的路由器

尝试创建一个允许用户添加编辑和查看父子组合的页面.

UI有3列父母:父母列表儿童:儿童

我想配置控制器,以便用户可以回到他们原来的位置,但是看不需要它,所以父和子都可以编辑.

//使用骨干牵线木偶越来越近但仍然有一些小问题

    MyRouter = Backbone.Marionette.AppRouter.extend({
        appRoutes: {
            '': 'AddClient',
            'View/:clientid': 'ViewClient',
            'Edit/:clientid': 'EditClient',
            'View/:clientid/Add': 'PolicyAdd',
            'View/:clientid/View/:policyid': 'PolicyView',
            'View/:clientid/Edit/:policyid': 'PolicyEdit'
        }
    });

    someController = {
        AddClient: function () {
            var someView = new ClientAdd();
            MyApp.clientPane.show(someView);
        },
        ViewClient: function (clientid) {
            var someView = new ClientView();
            MyApp.clientPane.show(someView);
        },
        EditClient: function (clientid) {
            var someView = new ClientEdit();
            MyApp.clientPane.show(someView);
        },
        PolicyAdd: function (clientid) {
            this.ViewClient(clientid);
            var someView = new PolicyAdd();
            MyApp.policyPane.show(someView);
        },
        PolicyView: function (clientid, policyid) {
            this.ViewClient(clientid);
            var someView = …
Run Code Online (Sandbox Code Playgroud)

backbone.js marionette

1
推荐指数
1
解决办法
1757
查看次数

正确的方法是将A或B的布尔值命名为True False

我有一个字段,表明某人是否有佣金或费用.

在sql中它会变成一个字段.

我该怎么命名呢?

c# sql variables

0
推荐指数
1
解决办法
163
查看次数