我有2个班级:DataObject和DataElement.DataObject保持指针(只)DataElementS,和一个DataElement包含指向几种类型,其中一个DataObject.
这曾经没有问题,因为我只使用指针DataObject输入DataElement,所以DataObject在标题中的前向声明DataElement就足够了.
但是,现在,我尝试添加一个析构函数DataElement,我需要删除一个DataObject.在这方面,编译器说:
dataelement/destructor.cc: In destructor ‘DataElement::~DataElement()’:
dataelement/destructor.cc:8: warning: possible problem detected in invocation of delete operator:
dataelement/destructor.cc:8: warning: invalid use of incomplete type ‘struct DataObject’
dataelement/dataelement.h:7: warning: forward declaration of ‘struct DataObject’
dataelement/destructor.cc:8: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined. …Run Code Online (Sandbox Code Playgroud) c++ destructor class-design circular-dependency forward-declaration
我有一个VS 2008 C#Web应用程序,其中包含一系列对自定义dll的项目引用.这些都是来自Web项目的相对路径.最近我注意到Clean Solution从web应用程序的bin\debug文件夹中删除了一些但不是全部的dll.例如:
<Reference Include="TowerCo.Utilities, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Components\TowerCo.Utilities\bin\Debug\TowerCo.Utilities.dll</HintPath>
</Reference>
<Reference Include="TowerCo.WebControls, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Components\TowerCo.WebControls\bin\Debug\TowerCo.WebControls.dll</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)
第一个正常工作(干净清理它,新版本在重建时复制到web项目)但第二个没有.副作用是我不会自动获取依赖项的更改.
谢谢你的帮助.
我正在制作一个程序,我需要在几毫秒内获得时间.到时候,我的意思是一个永远不会与自己相等的数字,并且总是比一秒钟前更大的1000个数字.我已经尝试过转换DateTime.Now为a TimeSpan并TotalMilliseconds从中得到...但我听说它并不完全准确.
有更简单的方法吗?
我知道我需要使用模板列,但我不清楚如何使用它.
我有一个返回集合的数据源,我可以将集合中的每个属性分配给一个列.
但我该怎么做:
col.prop1 +' '+ col.prop2?col.prop1.ToString(overloaded)一个简单的代码隐藏示例将有所帮助.我能找到的只是非常复杂的控件和例子.
谢谢.
我有一个自定义CALayer(比如CircleLayer),包含自定义属性(半径和色调).该图层在其drawInContext:方法中呈现自身.
- (void)drawInContext:(CGContextRef)ctx {
NSLog(@"Drawing layer, tint is %@, radius is %@", self.tint, self.radius);
CGPoint centerPoint = CGPointMake(CGRectGetWidth(self.bounds)/2, CGRectGetHeight(self.bounds)/2);
CGContextMoveToPoint(ctx, centerPoint.x, centerPoint.y);
CGContextAddArc(ctx, centerPoint.x, centerPoint.y, [self.radius doubleValue], radians(0), radians(360), 0);
CGContextClosePath(ctx);
/* Filling it */
CGContextSetFillColorWithColor(ctx, self.tint.CGColor);
CGContextFillPath(ctx);
}
Run Code Online (Sandbox Code Playgroud)
我希望半径可以动画,所以我已经实现了
+ (BOOL)needsDisplayForKey:(NSString *)key {
if ([key isEqualToString:@"radius"]) {
return YES;
}
return [super needsDisplayForKey:key];
}
Run Code Online (Sandbox Code Playgroud)
动画的执行方式如下:
CABasicAnimation *theAnimation=[CABasicAnimation animationWithKeyPath:@"radius"];
theAnimation.duration=2.0;
theAnimation.fromValue=[NSNumber numberWithDouble:100.0];
theAnimation.toValue=[NSNumber numberWithDouble:50.0];
theAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[circleLayer addAnimation:theAnimation forKey:@"animateRadius"];
circleLayer.radius = [NSNumber numberWithDouble:50.0];
Run Code Online (Sandbox Code Playgroud)
drawInContext:在动画期间按预期调用以重绘圆圈,但是一旦动画开始,色调就会设置为nil,并在动画结束时恢复到原始值.
我得出结论,如果我想动画一个自定义属性并希望其他属性在动画期间保持其值,我也必须为它们设置动画,我发现它根本不方便.
目的不是增长/缩小一个圆圈,我知道我可以使用转换.它只是用一个简单的例子来说明动画单个自定义属性的问题,而不必为所有其他属性设置动画.
我做了一个简单的项目来说明这个问题,你可以在这里找到: 说明问题的示例项目 …
除了Zend Optimizer之外,Zend-Framwork运行得更快的最佳方法是什么?
如果我没记错的话,在PHP中解析.ini文件需要很长时间.因此我将其缓存(文件在请求期间不会更改)
还有其他方法可以改善ZF的表现吗?
似乎.NET 4.0中有很多与并发相关的改进可能依赖于并发优先级队列.框架内是否有可靠的优先级队列实现可供重用?
我正在尝试维护一些Wix代码,并收到以下警告:
warning LGHT1076 : ICE57: Component 'FILE_MY_ASSOCIATION' has both per-user and per-machine data with an HKCU Registry KeyPath.
Run Code Online (Sandbox Code Playgroud)
从以下代码:
<Component Id="FILE_MY_ASSOCIATION" Guid="E1DF42A5-BD00-4a80-9BE5-B66A3EF0576E" Win64="$(var.Variables_Win64)">
<RegistryKey Root="HKCU" Key="Software\MyComany\MyProduct">
<RegistryValue Value="" Type="string" KeyPath="yes" />
</RegistryKey>
<ProgId Icon="FILE_MY_FILETYPE_ICON" Id="MY_FILE_EXTENSION" Description="My Product File" >
<Extension Id="myext" Advertise="no" >
<Verb Id="Open" Argument=""%1"" TargetFile="MYUI_EXE_FILE"/>
</Extension>
</ProgId>
</Component>
Run Code Online (Sandbox Code Playgroud)
我无法解决什么是错的,或者这是一个警告,我真的需要担心.
谢谢.
我有一个SQL查询的int参数的大列表:
update mytable set col='xyz'
where id in (/* thousands of ints */)
Run Code Online (Sandbox Code Playgroud)
我的问题是在SQL Server 2000中有参数限制.我也可以在SQL Server 2008上运行此查询.
有什么更好的方法来做到这一点.
编辑:
Ids列表来自C#程序.不是从另一张桌子.
我有一个搜索和结果列表的抽象控制器支持类:
@Controller
@SessionAttributes("query")
public abstract class SearchController<Q extends SearchQuery> {
@RequestMapping
public String performSearch(@ModelAttribute("query") Q query) {
....
}
@ModelAttribute("query")
public abstract Q createDefaultSearchQuery();
}
Run Code Online (Sandbox Code Playgroud)
几个实际的搜索控制器扩展了这个基类.
在访问其中一个控制器(比如/searchBooks.html使用BookSearchQuery implements SearchQuery)之后,查询被正确地存储在会话中,可用于后续请求.
但是,当我访问另一个控制器(比如/searchAuthors.html使用AuthorSearchQuery implements SearchQuery)时,来自最后一个请求()的查询BookSearchQuery仍在用于新控制器,从而导致ClassCastException稍后的操作.
我已经尝试将@SessionAttribute注释从支持类移动到实现类,但无济于事.
有什么我做错了还是这个设计?我能做什么?
非常感谢!
c# ×4
.net ×1
animation ×1
build ×1
c++ ×1
caching ×1
calayer ×1
class-design ×1
concurrency ×1
datetime ×1
dependencies ×1
destructor ×1
iphone ×1
milliseconds ×1
null ×1
optimization ×1
php ×1
properties ×1
radgrid ×1
spring ×1
spring-mvc ×1
sql-server ×1
telerik ×1
telerik-grid ×1
wix ×1