和stl容器一样,为什么我们不能从类实例中访问类中的typedef?对此有特别的了解吗?
当value_type是模板参数时,如果不需要像vector :: value_type那样指定模板参数,它可以帮助制作更通用的代码
例:
class T {
public:
typedef int value_type;
value_type i;
};
T t;
T::value_type i; // ok
t.value_type i; // won't work
Run Code Online (Sandbox Code Playgroud) 我试图模拟ASP.Net MVC的Ajax.IsRequest()方法.我发现了如何做以使它返回true:
Expect.Call(_myController.Request.Headers["X-Requested-With"]).Return("XMLHttpRequest").Repeat.Any();
Run Code Online (Sandbox Code Playgroud)
这工作并返回true.现在我需要测试代码的另一个分支.我如何模仿它返回虚假?我试图完全删除模拟,它失败了:
System.NullReferenceException:对象引用未设置为对象的实例.]
如果我做:
Expect.Call(_templateReportController.Request["X-Requested-With"]).Return(null).Repeat.Any();
Run Code Online (Sandbox Code Playgroud)
它失败并出现同样的错误.
整个测试:
/// <summary>
/// Tests the Edit Action when calling via Ajax
/// </summary>
[Test]
public void Test_Edit_AjaxRequest()
{
Group group = new Group();
group.ID = 1;
group.Name = "Admin";
IList<Group> groupList = new List<Group>() { group };
Definition def = new Definition();
def.ID = 1;
def.Name = "Report";
def.LastModified = DateTime.UtcNow;
def.Groups.Add(group);
using (_mocks.Record())
{
Expect.Call(_myController.Request["X-Requested-With"]).Return("XMLHttpRequest").Repeat.Any();
Expect.Call(_DefBiz.GetAll<Group>()).Return(groupList);
Expect.Call(_DefBiz.Get<Definition>(1)).Return(def);
}
myController.DefAccess = _DefBiz;
PartialViewResult actual;
using (_mocks.Playback())
{
actual = (PartialViewResult)myController.Edit(1);
} …Run Code Online (Sandbox Code Playgroud) .OrderBy(y => y.Year).ThenBy(m => m.Month);
Run Code Online (Sandbox Code Playgroud)
如何设定descending订单?
编辑:
我试过这个:
var result = (from dn in db.DealNotes
where dn.DealID == dealID
group dn by new { month = dn.Date.Month, year = dn.Date.Year } into date
orderby date.Key.year descending
orderby date.Key.month descending
select new DealNoteDateListView {
DisplayDate = date.Key.month + "-" + date.Key.year,
Month = date.Key.month,
Year = date.Key.year,
Count = date.Count()
})
//.OrderBy(y => y.Year).ThenBy(m => m.Month)
;
Run Code Online (Sandbox Code Playgroud)
它似乎有效.orderby像我在这里使用它一样使用两次是错误的吗?
HI:
我有很多年前写过的Delphi 7程序,但是我丢失了源代码.这是一个小程序,但对我来说非常有用.
我试图在新的Windows XP计算机中再次"安装"它,只是用de data(.db paradox文件)复制文件夹,并配置了BDE连接.
当程序启动时,我收到"未知异常"并停止.我不知道为什么会这样,并且无法调试导致丢失的源代码.我在另一台计算机上尝试过相同的结果.
有什么建议或想法吗?在这样的情况下你做了什么?
提前致谢.
编辑:当我在新的XP计算机中安装Delphi 7时,异常来自未知的已知.这是与Paradox.net文件的文件夹相关的东西.谢谢你们.
我们的Hudson安装显示了Selenium报告的非常简洁的版本:
Selenium Report Result
numTestPasses 2
numTestFailures 0
Run Code Online (Sandbox Code Playgroud)
我知道应该可以通过Hudson查看完整的报告,并跟踪测试的开发.但是怎么样?
19/06/10更新:更多证据问题是服务器端问题.在Windows 7命令行上接收此错误(请参阅下面的完整回溯):
URLError: <urlopen error [Errno 10054] An existing connection was forcibly closed by the remote host>
abort: error: An existing connection was forcibly closed by the remote host
Run Code Online (Sandbox Code Playgroud)
当试图将包含6个大文件(.exe,.dmg等)的变更集推送到我的远程服务器时,我的客户端(MacHG)报告错误:
"推送期间出错.Mercurial报告错误号255:中止:HTTP错误404:未找到"
这个错误甚至意味着什么?!关于此提交,唯一唯一的(我可以告诉)是文件的大小,类型和文件名.如何确定变更集中的哪个确切文件失败?如何从存储库中删除损坏的变更集?在另一篇文章中,有人报告使用"mq"扩展来有效地从存储库中的历史记录中删除错误的变更集,但是对于我正在尝试解决的问题,mq看起来过于复杂.
我可以使用MacHG和toirtoise HG推送和提取以下内容:源文件,目录,.class文件和.jar文件进出服务器.
我成功地向我的本地存储库添加了第一次添加6个大型.exe,.dmg等安装程序文件(总共约130Mb).
在我对本地存储库的以下提交中,我删除了("未跟踪"/忘记)导致问题的6个文件,但是先前(失败的)更改集仍然排队等待推送到服务器(即我的本地主机正在尝试推送"添加"然后"移除"到远程服务器 - 并与源控制系统中的"保持历史中的一切"理念保持一致.
我可以使用Windows PC上的TortoiseHG提交.txt .java文件等.我实际上没有使用TortoiseHG测试提交或推送相同的大文件.
请帮忙!
客户端应用程序= MacHG v0.9.7(SCM 1.5.4)和TortoiseHG v1.0.4(SCM 1.5.4)
Server = HTTPS,IIS7.5,Mercurial 1.5.4,Python 2.6.5,使用以下说明进行设置:
http://www.jeremyskinner.co.uk/mercurial-on-iis7/
在IIS7.5中,CGI处理程序配置为处理所有动词(不仅仅是GET,POST和HEAD).
我在服务器上的hgweb.cgi文件如下:
#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# Path to repo or hgweb config to serve …Run Code Online (Sandbox Code Playgroud) 我在项目模板中使用列表视图我正在使用标签和复选框.我希望每当用户点击复选框时,值应该在table.i中使用listview中的数据键更新.在datakey值的基础上应该在表中更新.查询是:
string updateQuery = "UPDATE [TABLE] SET [COLUMN] = " + Convert.ToInt32(chk.Checked) + " WHERE PK_ID =" + dataKey + " ";`
Run Code Online (Sandbox Code Playgroud)
我也希望在显示结果时提供一些帮助,因为它在table.means中,如果特定pkid的表中列的值为1,则应检查该复选框.
这是代码片段:
<asp:ListView ID="lvFocusArea" runat="server" DataKeyNames="PK_ID" OnItemDataBound="lvFocusArea_ItemDataBound">
<LayoutTemplate>
<table border="0" cellpadding="1" width="400px">
<tr style="background-color: #E5E5FE">
<th align="left">
Focus Area
</th>
<th>
Is Current Focused
</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td width="80%">
<asp:Label ID="lblFocusArea" runat="server" Text=""><%#Eval("FOCUS_AREA_NAME") %></asp:Label>
</td>
<td align="center" width="20%">
<asp:CheckBox ID="chkFocusArea" runat="server" OnCheckedChanged="chkFocusArea_CheckedChanged" AutoPostBack="true" />
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="background-color: #EFEFEF"> …Run Code Online (Sandbox Code Playgroud) 我在Spring框架中登出时遇到了问题.
首先,当我希望j_spring_security_logout为我处理它时,我得到404找不到j_spring_security_logout:sample-security.xml:
<http>
<intercept-url pattern="/messageList.htm*" access="ROLE_USER,ROLE_GUEST" />
<intercept-url pattern="/messagePost.htm*" access="ROLE_USER" />
<intercept-url pattern="/messageDelete.htm*" access="ROLE_ADMIN" />
<form-login login-page="/login.jsp" default-target-url="/messageList.htm"
authentication-failure-url="/login.jsp?error=true" />
<logout/>
</http>
Run Code Online (Sandbox Code Playgroud)
示例url链接到JSP页面中的注销:
<a href="<c:url value="/j_spring_security_logout" />">Logout</a>
Run Code Online (Sandbox Code Playgroud)
当我尝试使用自定义JSP页面,即我使用登录表单为此目的,然后我得到更好的结果,至少它到达登录页面,但另一个问题是,你不能被注销,因为你可以直接键入url应该保持警惕,无论如何都要过去.
从以前的列表略有修改:
<http>
<intercept-url pattern="/messageList.htm*" access="ROLE_USER,ROLE_GUEST" />
<intercept-url pattern="/messagePost.htm*" access="ROLE_USER" />
<intercept-url pattern="/messageDelete.htm*" access="ROLE_ADMIN" />
<form-login login-page="/login.jsp" default-target-url="/messageList.htm"
authentication-failure-url="/login.jsp?error=true" />
<logout logout-success-url="/login.jsp" />
</http>
Run Code Online (Sandbox Code Playgroud)
<a href="<c:url value="/login.jsp" />">Logout</a>
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助
我正在编写一个软件代理来控制模拟足球比赛中的机器人玩家.最终我希望参加RoboCup比赛.
在创造这样一个特工所涉及的各种挑战中,它的身体运动是我面对的第一个.我瞄准的模拟使用了一个带有22个铰链的Nao机器人体来控制.每条腿六条,每条手臂四条,颈部两条:
http://simspark.sourceforge.net/wiki/images/b/b4/Models_NaoVirtual.png
我对机器学习很感兴趣,并且相信必须有一些技术可以控制这个人.
在任何时候,它是众所周知的:
我想要实现的任务类型是:
对于这些任务中的每一项,我相信我可以提出一个合适的健身功能,但不是一组具有预期输出的训练输入.也就是说,任何机器学习方法都需要提供无监督学习.
我已经在圆形功能(正弦波)的开源项目中看到了一些例子,它们连接到每个铰链的角度,具有不同的幅度和相位.这些看起来好像是直线行走,但它们看起来都很笨重.这不是一种适用于我上面提到的所有任务的方法.
有些团队显然使用反向运动学,但我对此并不了解.
那么,机器人两足动作/行走的方法是什么?
顺便说一句,我编写并发布了一个名为TinMan的.NET库,它提供了与足球模拟服务器的基本交互.它有一个简单的编程模型,用于机器人22铰链的传感器和执行器.
您可以阅读更多关于RoboCup的3D模拟足球联赛的信息: