我可以看到我们可以在Visual Studio Team Systems中启用代码分析.但我使用的是Visual Studio 2010 Professional.
我们是否有任何选项可以在此版本中启用代码分析,或者我们是否可以将任何工具(如FxCop和StyleCop)与此版本集成以验证代码.
我期待我的代码应该在我构建解决方案的那一刻进行分析.
如果有人意识到这一点,请与我分享一些解决方案.
在过去的几天里,我看了一下密码学和相关问题,现在我很困惑.我有一个关于密码强度的问题,我希望有人可以通过分享他们如何思考以下问题来消除我的困惑.我对这些事情很着迷,但需要花费我的时间,否则:-)
假设我们有一个八位数的密码,包括大写和小写字母,数字和常用符号.这意味着我们有96 ^ 8~ = 7.2千万种不同的可能密码.
据我所知,至少有两种方法可以破解这个密码.一种是尝试蛮力攻击,我们试图猜测每种可能的角色组合.现代处理器(2010年,Core i7 Extreme)每秒猜测多少密码(单个密码猜测需要多少指令以及为什么)?我的猜测是需要多年的现代处理器来破解这样的密码.
另一种方法包括获取操作系统存储的密码哈希值,然后搜索冲突.根据所使用的哈希类型,我们可能会比暴力攻击更快地获得密码.关于这一点的一些问题:
最后,无论使用AES-128/256的文件加密强度如何,弱链接仍然是我使用的加密/解密密码.即使打破加密的文本需要比宇宙的生命周期更长的时间,对我的de /加密密码的蛮力攻击(猜测密码,然后尝试解密文件,尝试下一个密码......),可能会提前很多成功而不是宇宙的尽头.那是对的吗?
如果人们可以怜悯我并帮助我思考这些可能简单的问题,我会非常感激,这样我才能重新开始工作.
如果我有这个代码
local f = io.open("../web/", "r")
print(io.type(f))
-- output: file
Run Code Online (Sandbox Code Playgroud)
我如何知道是否f指向某个目录?
我在Eclipse中有一个方法如下.
public String toString() {
return "HouseVo [ "
+ "Name : " + this.name == null ? "" : this.name
+ "Address : " + this.address == null ? "" : this.address;
}
Run Code Online (Sandbox Code Playgroud)
当我格式化它变成:
return "HouseVo [ " + "Name : " + this.name == null ? ""
: this.name + "Address : " + this.address == null ? ""
: this.address;
Run Code Online (Sandbox Code Playgroud)
有什么方法可以解决它,以便正确格式化吗?
为什么我ab使用Relucutant量词获得以下正则表达式代码的输出?
Pattern p = Pattern.compile("abc*?");
Matcher m = p.matcher("abcfoo");
while(m.find())
System.out.println(m.group()); // ab
Run Code Online (Sandbox Code Playgroud)
同样,为什么我得到以下代码的空索引?
Pattern p = Pattern.compile(".*?");
Matcher m = p.matcher("abcfoo");
while(m.find())
System.out.println(m.group());
Run Code Online (Sandbox Code Playgroud) 我使用C#winforms有一段时间的项目.我在Windows 7发布之前实现了拖放功能.工作就像一个魅力.但是,使用Windows 7时它不起作用.该事件甚至没有被触发.
AllowDrop设置为true.订阅DragEnter它时,不会在Windows 7中调用(不确定vista).但是在XP上它一直都有效.该程序使用administritave priviliges运行.
Windows 7与xp的拖拽有什么不同吗?不知道它是否相关,但我使用的是x64
OfType()如何工作?
我读了这个链接,了解发生了什么,但LINQ提供程序究竟如何知道如何获得与指定类型匹配的所有对象.我知道IQueryable<T>"链"提出请求然后评估何时GetEnumerator()被调用(对吗?).
具体来说,我想知道框架如何快速进行类型比较?我在.NET 2.0项目中编写了一个类似的方法(因为2.0不支持这些功能):
public IEnumerable<TResult> OfType<TResult>()
where TResult : class
{
foreach (TItem item in this.InnerList)
{
TResult matchItem = item as TResult;
if (matchItem != null)
{
yield return matchItem;
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是最好的实施吗?
编辑:我主要担心的OfType<T>()是它很快.
是否可以在尺寸为(320 x 20)的staus条上添加UIView?我不想隐藏状态栏,我只想将其添加到状态栏的顶部.
如果我有一个函数模板typename T,编译器可以自己设置类型,我在调用函数时不必显式写入类型:
template < typename T >
T min( T v1, T v2 ) {
return ( v1 < v2 ) ? v1: v2;
}
int i1 = 1, i2 = 2; int i3 = min( i1, i2 ); //no explicit <type>
Run Code Online (Sandbox Code Playgroud)
但是,如果我有一个包含两个不同类型名称的函数模板,例如:
template < typename TOut, typename TIn >
TOut round( TIn v ) {
return (TOut)( v + 0.5 );
}
double d = 1.54;
int i = round<int>(d); //explicit <int>
Run Code Online (Sandbox Code Playgroud)
我总是必须指定至少1个typename吗?我假设原因是因为C++无法区分不同返回类型之间的函数.
但是,如果我使用void函数并移交引用,我再次不能明确指定返回类型名称:
template < typename …Run Code Online (Sandbox Code Playgroud) 如果我的iPad处于横向模式并调用presentModalViewController,则视图将自动变为纵向模式.有解决方案吗
UIViewController * start = [[UIViewController alloc]initWithNibName:@"SecondView" bundle:nil];
start.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
start.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:start animated:YES];
Run Code Online (Sandbox Code Playgroud)
在SecondView中我已添加:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
Run Code Online (Sandbox Code Playgroud)