问题列表 - 第17653页

是否可以在不使用"if"(asp.net mvc post action方法)的情况下执行此操作

根据反if运动 ,最好不要在我们的代码中使用ifs.任何人都可以告诉我是否有可能摆脱这段代码中的if?

 [AcceptVerbs(HttpVerbs.Post)]
 public ActionResult Create(OrganisationInput organisationInput)
 {
    if (!this.ModelState.IsValid)
    {
       return View(organisationInput.RebuildInput<Organisation, OrganisationInput>());
    }

   var organisation = organisationInput.BuildEntity<Organisation, OrganisationInput>();
   this.organisationService.Create(organisation);

   return this.RedirectToAction("Index");
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc

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

在php上需要一个好的HTML解析器

找到这个http://simplehtmldom.sourceforge.net/但它无法工作

extracting this page http://php.net/manual/en/function.curl-setopt.php
and parse it to plain html, it failed and returned a partial html page
Run Code Online (Sandbox Code Playgroud)

这就是我想要做的事情,转到一个html页面并获得单独的组件(层次结构中所有div和p的内容)我喜欢simplehtmldom的功能,任何这样的解析器都是必需的,这对所有代码都很好(最好的和最差).

html parsing

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

Html Agility Pack 结尾为不起作用

ends-with我尝试在 Html Agility Pack 中以以下模式使用://span[ends-with(@id, 'Label2')]//span[ends-with(., 'test')],但它不起作用。

所有其他功能都一样starts-with并且contains运行良好。

谁能帮我?

html c# html-agility-pack

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

C中的位操作

所以,如果我有一个32位的整数.前28位(左起)用于存储内存块的大小,接下来的两个是0,后两个是:

  • 存储它是否是最后一个节点然后
  • 存储是否使用(分别).

我想要做的是知道如何在isLast操作和isUsed操作上打开和关闭标志.

(如果我们只考虑最后两个整数(再次,我们从左开始)那么01将不是最后一个并且例如用于,例如,另一个例子是11是最后一个并且被使用,00不是最后一个并且没有被使用.)

我希望能够以一种简单的方式打开和关闭标志.我知道我需要使用包括&和|的位操作 但我不知道怎么做.

如果您需要更多问题描述,请向我提问.

c bit-manipulation

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

IIS中托管的WCF服务中的定期任务

我们希望由IIS中托管的WCF服务执行一些定期操作.做这个的最好方式是什么?创建计时器看起来不是一个好的解决方案.创建一个像某种心跳一样的Windows服务看起来像一个问题解决方案,但它仍然闻起来不好.什么方法可以很好地解决这个问题?

wcf timer

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

Windows 7边栏小工具

您是否需要在C#中编写Windows边栏小工具,或者我是否应该用其他语言编写它们,例如Delphi?

谢谢

c# delphi windows-desktop-gadgets windows-7

6
推荐指数
2
解决办法
2204
查看次数

基于子查询的更新失败

我试图在Oracle 10gR2中进行以下更新:

update
  (select voyage_port_id, voyage_id, arrival_date, port_seq,
    row_number() over (partition by voyage_id order by arrival_date) as new_seq
   from voyage_port) t
set t.port_seq = t.new_seq
Run Code Online (Sandbox Code Playgroud)

Voyage_port_id是主键,voyage_id是外键.我正在尝试根据每次航行中的日期分配序列号.

但是,上述操作因ORA-01732而失败:数据操作操作在此视图中不合法

有什么问题,如何避免呢?

sql oracle analytics

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

System.Exception:语法不正确我找不到问题

所以我有一个带有复选框的网格视图.这是页面背后的代码.

protected void BtnApproveUsers_Click(object sender, EventArgs e)
    {

        var num = new List<int>();

        try
        {
            for (var i = 0; i< GvApproveUser.Rows.Count; i++)
            {
                var row = GvApproveUser.Rows[i];
                var isChecked = ((CheckBox) row.FindControl("ChbSelect")).Checked;

                if (isChecked)
                {
                    num.Add(System.Convert.ToInt32(GvApproveUser.Rows[i].Cells[1].Text));
                    Authentication.ApproveUser(num, GvApproveUser.Rows.Count);
                }
            }
           throw new Exception("The registration forms were approved.");
        }
        catch (Exception exception)
        {

           throw new Exception(exception.Message);
        }

    }
Run Code Online (Sandbox Code Playgroud)

这就是方法.

public static void ApproveUser(List<int> userIds, int rowCount)
    {
        using (var connection = Utils.Database.GetConnection())
            try
            {
                for (var i = 0; i …
Run Code Online (Sandbox Code Playgroud)

c# asp.net

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

我怎么能在Tkinter中使用滚动条获得一个Frame?

我希望有一个Frame,用户可以根据应用程序的需要添加任意数量的文本字段.

应用程序以文本字段和该文本字段下方的按钮开始.当用户按下按钮时,将在第一个下方添加新的文本条目(这可以重复无数次).在窗口中间,会有一个Text小部件,用于显示文本:)

但是,我在文档中注意到了这一点:

This widget is used to implement scrolled listboxes, canvases, and text fields.

有没有办法使用的一种方法ScrollbarFrame

python tkinter scrollbar frame

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

如何在不阻塞shell的情况下在cygwin中运行应用程序

我想在没有shell阻塞的情况下在cygwin中打开应用程序,例如记事本等.有办法做到这一点吗?

例如,输入notepad myfile.txt将打开记事本,并且在记事本关闭之前,cygwin shell将不可用.我希望cygwin保持响应,同时记事本是开放的.

cygwin

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