当jSLint运行时,javascript 对我大喊大叫,我不知道为什么.
/*jslint browser: true, devel: true, evil: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, newcap: true, immed: true */
var foo = function() {
try {
console.log('foo');
} catch(e) {
alert(e);
}
try {
console.log('bar');
} catch(e) {
alert(e);
}
};
foo();
Run Code Online (Sandbox Code Playgroud)
它告诉我:
第12行字符11的问题:'e'已经定义.
} catch(e) {
我有一秒钟似乎很不高兴catch(e).为什么这会成为问题?它不是简单地将e设置为catch块内的局部变量吗?我是否需要为函数中所有陷阱错误唯一命名局部变量?
javascript error-handling exception-handling jslint try-catch
我的模型看起来像这样:
public class Product
{
public string Name {get; set;}
public string Description {get; set;}
public double Price {get; set;}
public List<string> Features {get; set;}
}
Run Code Online (Sandbox Code Playgroud)
我希望我的数据库表是平的 - 列表应该存储为分隔字符串:功能一|功能二|功能三例如.
从db中检索时,它应将每个项目放回List中
这可能吗?
我从XML文件中获取文本数据,并希望它UIWebView在iPad上以书页式格式显示.XML文件来自a .epub,每个文件包含一本书的单个章节,仅由p标签划分.
我想根据它的大小UIWebView(一个完整的iPad屏幕)以及用户选择的字体大小动态地将这些文件分页为类似书的页面.我目前正在将一个带有相关css的空白html页面加载到a中UIWebView,根据XML中的字符串数量抓取段落,并将这些段落打印到html using StringByEvaluatingJavaScriptFromString和innerHTML属性中.
显然,通过字符数来执行此操作会产生间隔不当,格式错误的页面,但我不确定如何"分页"文本.
我想要做的是类似于iPad上的应用程序"eReader":http://www.ereader.com/.它们似乎是将一个文件动态分解为页面并将其加载到UIWebViews中.这是怎么做到的?
当我研究如何在C#中为ASP.NET项目创建子类时,我感觉非常聪明,然后我发现了一个问题 - 我不知道如何根据SQL查询的结果创建正确子类的对象.
假设您有一个名为Animal的类和两个名为Zebra和Elephant的子类.你明白了吗?
我想要做的是执行一个SQL查询,如果返回的行有行["Type"] ="Zebra"然后加载一个Zebra对象(或者如果它是一个大象然后..).
所以,原则上,Animal类将有一个静态方法:
class Animal{
public static Animal Load(DataRow row){
if (row["Type"]=="Zebra"){
return new Zebra();
}
}
class Zebra : Animal{
//some code here
}
Run Code Online (Sandbox Code Playgroud)
这是完全可能的还是我只是明白了子类的想法是错误的.很明显,我不是OO专家.
先谢谢你,杰克
这可能是一个基本问题,但写char*[]和char**有什么区别?例如,在main中,我可以有一个char*argv [].或者我可以使用char**argv.我假设两种符号之间必须存在某种差异.
我有这样的代码:
DECLARE
e_not_exist EXCEPTION;
PRAGMA EXCEPTION_INIT(e_not_exist, -942);
car_name VARCHAR2(20);
BEGIN
select name_of_factory into car_name from car where car_id = 1;
dbms_output.put_line(car_name);
EXCEPTION
when e_not_exist then
dbms_output.put_line('Table or view does not exist');
when OTHERS then
dbms_output.put_line(to_char(SQLCODE));
END;
Run Code Online (Sandbox Code Playgroud)
实际上,我的表名是CARS但不是CAR.但oracle不处理此异常并给我一个错误ORA-00942:表或视图不存在.我该如何处理这个异常?
我在SSRS 2005中有报告。我正在使用远程报告。在IE中,显示“打印”按钮,但在Firefox和Chrome中,不显示“打印”按钮。
我的报告显示在jquery UI对话框中,所以我不能只执行window.print。我的报告在模态中很好地呈现。
我需要能够以与在控件内相同的方式向reportviewer发出打印命令,但只能在Firefox和chrome中使用。
我研究了报表查看器的标记,并找到了此代码。我尝试将其手动注入到reportviewer中,但没有成功。
<table id="reportViewer_ctl01_ctl07_ctl00_ctl00" onclick="document.getElementById('reportViewer').ClientController.LoadPrintControl();return false;" onmouseover="this.Controller.OnHover();" onmouseout="this.Controller.OnNormal();" title="Print" style="display:none;">
<script type="text/javascript">
document.getElementById('reportViewer_ctl01_ctl07_ctl00_ctl00').Controller = new ReportViewerHoverButton("reportViewer_ctl01_ctl07_ctl00_ctl00", false, "", "", "", "#ECE9D8", "#DDEEF7", "#99BBE2", "1px #ECE9D8 Solid", "1px #336699 Solid", "1px #336699 Solid");
</script><tr>
<td><input type="image" name="reportViewer$ctl01$ctl07$ctl00$ctl00$ctl00" title="Print" src="/Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=9.0.30729.4402&Name=Microsoft.Reporting.WebForms.Icons.Print.gif" alt="Print" style="height:16px;width:16px;padding:2px;" /></td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我正在查看是否有系统通知我可以收听以查看屏幕何时关闭/打开.有什么想法吗?与网络连接/断开连接时类似的东西.