我在运行时收到弃用警告rails test。该警告如下。任何有助于确定我做错了什么的帮助都会受到赞赏。
(编辑:旁注,渲染必须中断并从当前控制器调用返回。我尝试使用ApplicationController.render(...)代替当前调用render,但没有从控制器调用返回,并且我收到了错误/警告:no_content rendered。)
警告:
DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: actions/action_success.json (called from update at /<path>/app/controllers/table_base_controller.rb:39)
Run Code Online (Sandbox Code Playgroud)
render抛出警告的代码具体是在控制器中调用:
render('/actions/action_success.json', locals: {
view: action.lookup_view('default'),
action: action,
area: current_area,
account: current_account
})
Run Code Online (Sandbox Code Playgroud)
我已经尝试按照指示取消.json(也尝试添加template: <path>、尝试file: <path>),但是,我在测试控制台中收到此错误:
Error:
TableControllerTest#test_Admin_should_update_via_loan_table:
ActionView::MissingTemplate: Missing template actions/action_success with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder]}. Searched in:
* "/<path>/app/views"
app/controllers/table_base_controller.rb:39:in `update'
app/controllers/application_controller.rb:79:in `with_account'
test/controllers/table_controller_test.rb:14:in `block in …Run Code Online (Sandbox Code Playgroud) 目前我有代码Documents在运行时在目录中创建一个文件夹:
using (var context = new Microsoft.SharePoint.Client.ClientContext(sharePointSite))
{
context.Credentials = new Microsoft.SharePoint.Client.SharePointOnlineCredentials(user, password);
Web web = context.Web;
Microsoft.SharePoint.Client.List docs = web.Lists.GetByTitle(<upper level folder>);
docs.EnableFolderCreation = true;
docs.RootFolder.Folders.Add(folderName);
context.ExecuteQuery();
return true;
}
Run Code Online (Sandbox Code Playgroud)
我在使用此代码创建的文件夹中创建子文件夹时遇到了麻烦.因此,如果我想创建一个名为Febunder Documentsthis 的文件夹就可以了.但是,如果我想创建一个Week 2在新文件夹下调用的文件夹Feb.它不会那样做.我收到此错误:
{"List 'Feb' does not exist at site with URL 'https://my.sharepoint.com/sites/labels'."}
我意识到问题可能是docs.RootFolder.Folders.Add(folderName);因为它Feb不是根文件夹,当它查找它时会抛出异常.
所以我希望有人可以帮我解决一些代码,将子文件夹添加到已创建的文件夹中.我使用Visual Stuidos 2010并且无法升级到2012,否则我会.我有Microsoft.Sharepoint.Client可以在VS 2010中引用的2013 dll.
我有一个 Inno Setup 安装程序的组件列表,有 19 个不同的选项,我想OnClick为其中一个组件设置事件。有没有办法做到这一点?OnClick或者如果为所有组件设置了事件,是否有方法检查哪个组件触发了事件?
目前,该OnClick事件设置如下:
Wizardform.ComponentsList.OnClick := @CheckChange;
Run Code Online (Sandbox Code Playgroud)
我想做这样的事情:
Wizardform.ComponentsList.Items[x].OnClick := @DbCheckChange;
Run Code Online (Sandbox Code Playgroud)
被WizardForm.ComponentList声明为:TNewCheckListBox
-----新Jquery回答评论-----
function search2() {
var urlString = 'Controls/LookUp.aspx?zipcode=' + $('#MultiSearch2').val();
window.location = urlString;
return false;
}
jQuery('#MultiSearch2').bind("keypress", function (e) {
if (e.keyCode == 13) {
e.preventDefault();
search2();
}
});
Run Code Online (Sandbox Code Playgroud)
好的,这就是一切都是如何设置的.
我有一个main.master页面,其中包含以下代码.
<asp:Panel ID="PanelMainMaster" runat="server" DefaultButton="searchBTN">
<div id="HomeQuickSearch">
<input id="multiSearchStyle" type="text" placeholder ="search our store" />
<asp:Button OnClientClick="return searchZone()" runat="server" Text="Go" ID="searchBTN" />
</div>
</asp:Panel>
Run Code Online (Sandbox Code Playgroud)
我有另一个母版页(树),其中包含以下代码:
<asp:Panel ID="Panel2" runat="server" DefaultButton="submit">
<form name="ZipCodeForm" action="/Search.cfm" method="get">
<div style="margin-bottom: .25em">Search for a tree:</div>
<input type="text" name="MultiSearch" id="MultiSearch" size="15" maxlength="50" style="margin-bottom: .25em">
<asp:Button Text="Search" runat="server" …Run Code Online (Sandbox Code Playgroud) 我发现了类似的问题,但我仍然遇到麻烦:
- 希望能更好地描述这个问题吗?----
当我调用Web服务时,带回的响应是xml文档.该文档定义了要返回的类,然后通过将xml反序列化为8种不同类型中的1种来设置所有值.
现在,当我这样做时,receipt.Item我得到返回的类型; 但由于使用Web服务调用设置接口的方式,除非我输入强制转换,否则我无法访问任何项成员变量receipt.Item.这是通过开关盒完成的.但我希望在switch case之外创建对象并在switch case中初始化它,以便稍后我可以在代码中访问它.这就是为什么我不在switch case中创建那种类型的新对象并在那里工作(或调用函数).
我有一个来自我正在调用的Web服务的总体返回类型的响应,并且Web服务可以有8种不同的结果类型.我需要创建一个可以返回的8种返回类型中的1种的实例.
所以这是一个更直观的结构
Response
accountUpdaterRespType
endOfDayRespType
flexCacheRespType
Run Code Online (Sandbox Code Playgroud)
响应对象的代码:
public partial class Response {
private object itemField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("AccountUpdaterResp", typeof(accountUpdaterRespType))]
[System.Xml.Serialization.XmlElementAttribute("EndOfDayResp", typeof(endOfDayRespType))]
[System.Xml.Serialization.XmlElementAttribute("FlexCacheResp", typeof(flexCacheRespType))]
public object Item {
get {
return this.itemField;
}
set {
this.itemField = value;
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我得到Response的返回对象时,我可以通过执行来获取类型responseObject.Item并执行GetType()该操作.这就是我可以尝试输入一个新对象的方法.
我必须这样做,因为当我这样responseObject.Item做时,我无法访问不同对象类型中的不同变量.所以我试图在开关盒中输入一个新对象,如下所示:
object newReceipt = Receipt.GetType(); //this is where I would get the type I assume?? I don't know …Run Code Online (Sandbox Code Playgroud) 我有一个由事件处理程序启动的函数。在这个函数中,一个新任务被创建并运行以设置一个我稍后需要的全局变量,在另一个事件处理程序中。
这两个函数之间还有其他几个函数,它们不会更改其中使用的任何变量。但这就是它的样子。
private void EventWhereINeedTheGlobalVariableLater(object sender, Event e)
{
//...work...
need _variableIneed
//....more work...
}
private void EventWhereISetGlobalVariable(object sender, Event e)
{
//....work....
//...make cancellationToken...
//groups, isCommonalityGroup are other global variables already set.
Task.Factory.StartNew(() =>
{
// Clear variable to get new value
_variableIneed = null;
// Execute query to get new value
_variableIneed = _workingManager.GetValue(groups, isCommonalityGroup, cancellationToken);
RefreshView();
}, cancellationToken);
}
Run Code Online (Sandbox Code Playgroud)
我遇到了竞争条件,我需要的变量_variableIneed在第二个事件处理程序中为空,而它不能。如果我没有飞过并试图创建足够的事件来使 wpf 程序崩溃,它就可以正常工作,但是即使我这样做了,我也需要它工作。
我能做些什么来克服这些竞争条件吗?
我试过使用 的.ContinueWith选项OnlyOnRanToCompletion或任何它是。还有什么我可以尝试的吗?
**注意,我无法改变事件的排序/处理/处理方式。这是一个非常固定的石头设计,我只需要解决它并或多或少地保持原样。
**更新
我也试过ParallelExtensionsExtras在OrderedTaskScheduler …
我想向从基类派生的实体中添加元素。该实体扩展了基类,该基类没有我可以设置的自定义错误消息。添加元素时,我收到以下警告:
缺少公开可见的类型或成员的XML注释
当我将,[XmlIgnore]但添加到属性,并重新构建包含所有实体的项目时,我仍然收到此消息。因此,仅添加[XmlIgnore]和忘记该消息就足够了吗,还是我需要做其他事情?

可能重复:
"print"附近的SyntaxError?
我是python的第一次用户.我刚刚在我的计算机上安装了Python 3.3,更新了PATH并尝试运行我刚刚复制的第一个python程序并将其从教程粘贴到新文件中.我收到的错误是:
File "C:\Users\bmahnke\Desktop\python.py", line 23
print 'string1 is: ', string1
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
我不确定问题是什么,因为我是从教程网站得到的,我不确定,但差不多,他们不会在那里放一个不能编译的文件.所以我想知道我做错了什么
这是我正在使用的python代码:
#! C:\Python33\python.exe
string1 = 'In this class,'
string2 = 'I am learning to program in'
string3 = 'PYTHON.'
print 'string1 is: ', string1
print 'string2 is: ', string2
print 'string3 is: ', string3
print 'Put them altogether and you get:'
print string1, string2, string3
print string1 + string2 + string3
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏,谢谢.