我在我的电脑上安装了wampserver.我将蛋糕php安装文件解压缩到wampserver的"www"文件夹中.现在,当我尝试运行" http:// localhost/cakephp "时,我会得到一个完整的错误列表以及蛋糕php入门页面.以下是一些错误:
Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\cakephp\cake\libs\inflector.php on line 131 Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\cakephp\cake\libs\configure.php on line 136 Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\cakephp\cake\libs\configure.php on line 226 Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\cakephp\cake\libs\configure.php on line 906
我该如何解决?我为codeignite得到了类似的错误.
我正在通过FxCop运行一些代码,目前正在考虑清除所有非破坏性违规.
代码本身有一些try/catch块实例,它们只捕获一般异常;
try
{
// Some code in here that could throw an exception
}
catch(Exception ex)
{
// Exception Thrown ... sort it out!
}
Run Code Online (Sandbox Code Playgroud)
现在我们都知道这是不好的做法,但我认为我知道如何正确地做到这一点 - 但FxCop还有其他想法!
假设try块中的代码可能抛出IO异常 - 并且只有IO异常.这样做应该没有错:
try
{
// Code in here that can only throw an IOException
}
catch (System.IO.IOException ioExp)
{
// Handle the IO exception or throw it
}
catch (System.Exception ex)
{
// Catch otherwise unhandled exception
}
Run Code Online (Sandbox Code Playgroud)
但是FxCop不同意我的观点......它仍然将此标记为违规,因为我正在追赶System.Exception
.
这是非常糟糕的做法还是应该/我能否安全地忽略这种违规行为?
我想创建一个动态代理,用于将WinForms控件绑定到由不同(非GUI)线程更改的对象.这样的代理将拦截PropertyChanged事件并使用适当的SynchronizationContext调度它.
这样我就可以使用辅助类来完成这项工作,而不必每次都手动实现同步(if (control.InvokeRequired) etc.
).
有没有办法使用LinFu,Castle或类似的库?
[编辑]
数据源不一定是列表.它可以是任何业务对象,例如:
interface IConnection : INotifyPropertyChanged
{
ConnectionStatus Status { get; }
}
Run Code Online (Sandbox Code Playgroud)
我可以创建一个可以完成工作的包装器,它看起来像这样:
public class ConnectionWrapper : IConnection
{
private readonly SynchronizationContext _ctx;
private readonly IConnection _actual;
public ConnectionWrapper(IConnection actual)
{
_ctx = SynchronizationContext.Current;
_actual= actual;
_actual.PropertyChanged +=
new PropertyChangedEventHandler(actual_PropertyChanged);
}
// we have to do 2 things:
// 1. wrap each property manually
// 2. handle the source event and fire it on the GUI thread
private void PropertyChanged(object sender, PropertyChangedEvArgs …
Run Code Online (Sandbox Code Playgroud) c# multithreading inotifypropertychanged dynamic-proxy winforms
HasMany
使用无状态会话批量插入包含其他实体集合(映射)的实体的正确方法是什么?
例如父类映射如下:
class ParentMap : ClassMap<Parent>
{
public ParentMap()
{
Id(x => x.Id)
.GeneratedBy.Increment();
HasMany(x => x.ChildNodes)
.KeyColumns.Add("Parent_id")
.Cascade.All();
}
}
Run Code Online (Sandbox Code Playgroud)
无状态会话忽略级联选项,因此子节点不会自动保留.我可以自己遍历集合,但后来我无法设置关系,因为Parent_id
列不存在作为我可以写入的属性.
我错过了什么吗?
正如Eric Lippert在本文中所描述的那样,yield return
不允许在try/catch
条款内.
有没有一种很好的方式我可以得到这样的东西,而不必IEnumerator
手工编写我自己的东西:
public IEnumerable<Data> GetData()
{
var transaction = Session.BeginTransaction());
try
{
IQuery q = CreateQuery(session);
foreach (var result in q.Enumerable())
yield return ProjectResult(result); // <-- doesn't work
session.Commit();
}
catch (Exception ex)
{
transaction.Rollback();
throw;
}
finally
{
transaction.Dispose();
}
}
Run Code Online (Sandbox Code Playgroud) 我想知道是否可以在仅使用O(1)空间的情况下以广度优先打印二叉树?
困难的部分是必须使用额外的空间来记忆下一个级别来遍历,并且随着n的增长而增长.
既然我们没有对时间部分进行任何限制,也许有一些低效(在时间上)可以实现这一目标的方法?
任何的想法?
题
实现一个函数bool chainable(vector<string> v)
,它接受一组字符串作为参数,并返回true
它们是否可以链接.如果第一个字符串以第二个字符串开头的相同字符结尾,则可以链接两个字符串,例如:
ship->petal->lion->nick = true;
ship->petal axe->elf = false;
Run Code Online (Sandbox Code Playgroud)
我的解决方案
我的逻辑是,如果它的可链接只有一个不匹配的开始和结束.所以我创建了一个开始列表和一个结束列表.像这样.
starts:s,p,l,n
ends: p,l,n,k
Run Code Online (Sandbox Code Playgroud)
如果删除公共元素,列表最多应包含一个项目.即s和k.如果是这样,列表是可链接的.如果列表是循环的,则最终列表为空.
但我想我在这里遗漏了一些案例,
编辑: 好的,我的解决方案有问题.我们能否为此得出最佳算法?
我已将Xampp升级到更新版本(1.7.2).但是现在当我运行我的项目(在CakePHP中完成)时,它正在抛出bug说
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\ebayn\cake\libs\debugger.php on line 99 Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\ebayn\cake\libs\debugger.php on line 108 Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\ebayn\cake\libs\file.php on line 96 Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\ebayn\cake\libs\cache\file.php on line 89
任何人都可以帮助我,我怎么能纠正这些东西.... ???
提前致谢
我正在尝试使用Silverlight的ChildWindow
对象进行确认对话.
理想情况下,我希望它能够工作MessageBox.Show()
,整个应用程序停止,直到从用户收到输入.
例如:
for (int i = 0; i < 5; i++)
{
if (i==3 && MessageBox.Show("Exit early?",
"Iterator", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
break;
}
}
Run Code Online (Sandbox Code Playgroud)
如果用户点击OK,将停止迭代3 ...
但是,如果我要按照以下方式做某事:
ChildWindow confirm = new ChildWindow();
confirm.Title = "Iterator";
confirm.HasCloseButton = false;
Grid container = new Grid();
Button closeBtn = new Button();
closeBtn.Content = "Exit early";
closeBtn.Click += delegate { confirm.DialogResult = true; confirm.Close(); };
container.Children.Add(closeBtn);
Button continueBtn = new Button();
continueBtn.Content = "Continue!";
continueBtn.Click += delegate { …
Run Code Online (Sandbox Code Playgroud) 想知道是否可以执行以下操作(我知道代码不会按预期工作,只是试图达到目的):
class Form
{
private $v = array();
function __set($varName, $varValue)
{
... do some treatment on the varValue ...
$this->v[$varName] = $varValue;
}
function &__get($varName)
{
if(!isset($this->v[$varName]))
$this->v[$varName] = NULL;
return $this->v[$varName];
}
};
Run Code Online (Sandbox Code Playgroud)
我希望能够设置一个变量:
$form->Values['whatever'] = 'dirty';
并让它运行setter函数,它将调用一些清理操作,并实际上最终填充其他几个数组,如'HtmlValues'和'SqlValues',所以我可以拉出编码为我想要的格式的值,所以我以后可以调用
echo $form->HtmlValues['whatever'];
问题当然是正常的问题,如果你只是使用_ get,你最终会设置一个返回的值,即使& _get通过引用返回它并做了一些工作,__ set实际上从未被调用,即使你'设置一个私人会员.
所以基本上,我想知道是否有一种方法可以在数组中设置函数时调用一个函数(可能是多个数组深,哪些不喜欢 $form->Values['group']['item'] = 'whatever';
期望的输出将是这样的:
$form->Values['name'] = "&";
echo $form->HtmlValues['name']; = &
Run Code Online (Sandbox Code Playgroud)
(只是为了强化,我不是在寻找实际的编码,只是能够在每个变量上调用它,因为它的设置/更改无需手动编码整个数组)
c# ×4
algorithm ×2
cakephp ×2
php ×2
c++ ×1
cascade ×1
childwindow ×1
confirm ×1
dialog ×1
idisposable ×1
list ×1
nhibernate ×1
silverlight ×1
string ×1
transactions ×1
winforms ×1
yield-return ×1