所述firebugx.js文件(如下所示)检查既!window.console和!console.firebug,如果安装萤火其正确检测.但是,该检查不适用于IE开发人员工具中的本机控制台对象 - 它会覆盖IE控制台对象.
例如,如果我包含firebugx.js代码,那么以下异常将不会出现在IE控制台中(它只会被吞下):
function foo() {
try {
throw "exception!!!";
}
catch (e) {
console.error(e);
}
}
Run Code Online (Sandbox Code Playgroud)
问题:适应IE开发人员调试器的最佳方法是什么?也许明显的答案是在IE中调试时简单地注释掉firebugx.js检查.还有其他方法吗?
参考:
if (!window.console || !console.firebug)
{
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i)
window.console[names[i]] = function() {}
}
Run Code Online (Sandbox Code Playgroud) 我在使用带有EF CTP5的SQLite数据库时非常困难.我只是试图用SQLite 执行这个MSDN示例.但是在线
var food = db.Categories.Find("FOOD");
Run Code Online (Sandbox Code Playgroud)
我收到运行时异常:
System.Data.SQLite.SQLiteException(0x80004005):SQLite errorno这样的表:Categories
注意:必须修改app.config文件,如下所示:
App.config中
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>
<runtime>
<generatePublisherEvidence enabled="false" />
</runtime>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite"/>
<add name="SQLite Data Provider" invariant="System.Data.SQLite"
description=".Net Framework Data Provider for SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="ProductContext" connectionString="Data Source=D:\CodeFirst.db;Version=3;New=True;" providerName="System.Data.SQLite" />
</connectionStrings>
</configuration>
Run Code Online (Sandbox Code Playgroud) 我正在开发一个小型应用程序,并且遇到了ruby的OOP模型的问题.我有以下简化的类结构.
class Foo
protected
@bar = []
def self.add_bar(val)
@bar += val
end
def self.get_bar
@bar
end
end
class Baz < Foo
add_bar ["a", "b", "c"]
end
Run Code Online (Sandbox Code Playgroud)
我现在的问题是,当我在Baz的类定义中调用add_bar时,@bar显然没有初始化,我得到一个+运算符不可用的错误nil.调用add_bar上Foo直接不会产生这个问题.为什么这样,我如何@bar正确初始化?
为了弄清楚我想要什么,我将指出我期望从这些类中获得的行为.
Foo.add_bar ["a", "b"]
Baz.add_bar ["1", "2"]
Foo.get_bar # => ["a", "b"]
Baz.get_bar # => ["a", "b", "1", "2"]
Run Code Online (Sandbox Code Playgroud)
我怎么能实现这个目标?
我有以下代码:
class MyClass:
def __private(self):
print "Hey man! This is private!"
def public(self):
__private()
print "I don't care if you see this!"
if __name__ == '__main__':
x = MyClass()
x.public()
Run Code Online (Sandbox Code Playgroud)
但是它给了我以下错误:
NameError: global name '_MyClass__private' is not defined
我究竟做错了什么?
我有2个清单:
filtered_items_list = [src1, scr2, scr3]
filtered_items_url_list = [url1, url2, url3]
Run Code Online (Sandbox Code Playgroud)
我想打印出来
src1, url1
src2, url2
src3, url3
Run Code Online (Sandbox Code Playgroud)
如果我尝试:
>>> for src, url in filtered_items_list, filtered_items_url_list:
print src, url
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
ValueError: too many values to unpack
Run Code Online (Sandbox Code Playgroud)
如果我试试这个:
>>> for src in filtered_items_list:
for url in filtered_items_url_list:
print """"src: %s; url: %s""" % (src, url)
Run Code Online (Sandbox Code Playgroud)
我明白了:
"src: src1; url: url1
"src: src1; url: url2
"src: src1; url: url3
"src: scr2; url: url1
"src: scr2; url: url2
"src: scr2; url: url3
"src: …Run Code Online (Sandbox Code Playgroud) 它尝试过类似的东西,但是没有用.有没有办法获得类似的效果?
class A
{
public:
int foo();
void bar(int b = foo());
};
Run Code Online (Sandbox Code Playgroud) 例如:jQuery的稳定版本在下一个版本之前永远不会改变.发生这种情况时,URL会发生变化.
此外,可以缓存网站徽标等图像,当它更改时,我只需更改用于调用它的URL.
我知道的标题是
Expires: Tue, 01 Feb 2050 00:00:00 GMT
Run Code Online (Sandbox Code Playgroud)
我相信有一个或多个额外的标头我可以用来添加到代理的缓存中,也许还有一些我不知道的东西.
还有其他我应该知道的标题吗?
当然,缓存将被删除,超出我的控制范围.但我想尽可能地缓存.
这也不包括CSS/JavaScript minify/compile,它也不计算图像压缩或内容压缩,如gzip.
我正在渲染RenderTargetBitmap的几十个视觉效果.每个都在它自己的Rect中呈现.我想要做的是将RenderTargetBitmap实例渲染的这些Rect区域之一复制到WriteableBitmap的同一区域...快速复制rect像素或smth.像那样.
那么,有没有办法以快速的方式将Rect从RenderTargetBitmap复制到WriteableBitmap?
由于未知原因,当我使用Google Chrome(版本9.0.597.84)时,开发人员工具未显示"存储"选项卡(例如,在http://www.html5rocks.com/tutorials/developertools中提及/说明)/ part1 /#toc-overview-storage和http://webdevlife.com/getting-started-with-localstorage-in-html5/),我需要检查和修改localStorage.任何想法我要做什么来获得这个选项卡或什么是解决方法?我知道我可以简单地转储localStorage,我可以编写代码来修改它,但这可能是我工作中持续关注的问题,我真的很想拥有一个合适的工具.
我有两个数组(实际上是一个,但我为每列创建了两个).我想用listview的值填充hashmap,但listview的所有元素都是数组的最后一个元素:
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map = new HashMap<String, String>();
for (int i=0; i<13; i++)
{
map.put("left1", date[i]);
map.put("right1", name[i]);
mylist.add(map);
}
SimpleAdapter simpleAdapter = new SimpleAdapter(this, mylist, R.layout.row,
new String[] {"left1", "right1"}, new int[] {R.id.left, R.id.right});
lv1.setAdapter(simpleAdapter);
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?谢谢