程序设计

专业和发烧友程序员的问答

7
如何检查“ lateinit”变量是否已初始化?
我想知道是否有一种方法可以检查lateinit变量是否已初始化。例如: class Foo() { private lateinit var myFile: File fun bar(path: String?) { path?.let { myFile = File(it) } } fun bar2() { myFile.whateverMethod() // May crash since I don't know whether myFile has been initialized } }
428 kotlin 


11
在不使用mysqldump的情况下复制/复制数据库
如果没有对服务器的本地访问权,有没有办法在不使用MySQL数据库的情况下将MySQL数据库(包含内容和不包含内容)复制/克隆到另一个数据库中mysqldump? 我目前正在使用MySQL 4.0。
427 mysql 

17
每个程序员应该对安全性了解什么?[关闭]
已关闭。这个问题是基于观点的。它当前不接受答案。 想改善这个问题吗?更新问题,以便通过编辑此帖子以事实和引用的形式回答。 3年前关闭。 我是一名IT专业学生,现在已经大学三年级了。到目前为止,我们一直在研究很多与计算机相关的主题(编程,算法,计算机体系结构,数学等)。 我非常确定没有人可以学习有关安全性的所有知识,但可以确保每个程序员或IT学生都应该了解“最小”知识,而我的问题是,这是最低知识? 您能否建议一些电子书或课程,或者有什么可以帮助您开始这条路的?
427 security 

16
解决MSB3247-发现相同从属程序集的不同版本之间存在冲突
使用msbuild进行编译时,.NET 3.5解决方案最终出现此警告。 有时NDepend可能会有所帮助,但在这种情况下,它没有提供任何更多详细信息。像鲍勃一样,我最终不得不诉诸于ILDASM中的每个程序集,直到我找到一个引用较旧版本的从属程序集的程序。 我确实尝试使用VS 2010 Beta 2中的MSBUILD(因为Connect文章指出此问题已在CLR的下一版本中修复),但也没有提供任何更多详细信息(也许在Beta 2之后已修复) 有没有更好(更自动化)的方法?
427 .net  msbuild  clr  ndepend 

14
用jQuery在“ Enter”上提交表单?
我有一个标准的登录表单-使用HTML / jQuery的AIR项目上的电子邮件文本字段,密码字段和提交按钮。当我在表单上按Enter键时,整个表单的内容消失了,但是表单没有提交。有谁知道这是Webkit的问题(Adobe AIR使用Webkit的HTML)还是我捆绑了东西? 我试过了: $('.input').keypress(function (e) { if (e.which == 13) { $('form#login').submit(); } }); 但这既没有停止清算行为,也没有提交表格。没有与表单相关的操作-可能是问题吗?我可以在动作中添加JavaScript函数吗?




11
滚动时背景ListView变为黑色
我创建了一个特定的列表,该列表存在于以下元素之外,以创建可滚动列表,每行的左侧包含一个图像,右侧包含一些文本: 首先使用“根”布局: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#C8C8C8" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content"/> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:drawSelectorOnTop="false" android:divider="#C8C8C8" android:background="#C8C8C8"/> </LinearLayout> 然后在ListView中放置以下“行”项: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="@drawable/bg_row" > <ImageView android:layout_width="wrap_content" android:paddingLeft="10px" android:paddingRight="15px" android:paddingTop="5px" android:paddingBottom="5px" android:layout_height="wrap_content" android:src="@drawable/bg_image" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingTop="5px" android:paddingBottom="5px" android:textSize="16sp" android:textColor="#000000" android:layout_gravity="center" android:maxHeight="50px"/> </LinearLayout> …
427 android  listview 

6
我可以将JSON加载到OrderedDict吗?
好的,所以我可以在中使用OrderedDict json.dump。也就是说,OrderedDict可以用作JSON的输入。 但是可以用作输出吗?如果可以,怎么办?就我而言,我想load放入OrderedDict,以便可以将键的顺序保留在文件中。 如果没有,是否有某种解决方法?

8
PHP关键字“ var”有什么作用?
这可能是一个非常琐碎的问题,但是我既无法通过网络搜索引擎也无法在php.net上找到答案。如果您没有时间解释,请直接引导我到我可以阅读的地方。 “ var”关键字在PHP中是什么意思? PHP4和PHP5之间有什么区别吗?
427 php  keyword 


12
RESTful URL设计进行搜索
我正在寻找一种将搜索表示为RESTful URL的合理方法。 设置:我有两个模型,汽车和车库,汽车可以放在车库中。所以我的网址看起来像: /car/xxxx xxx == car id returns car with given id /garage/yyy yyy = garage id returns garage with given id 汽车可以单独存在(因此/ car),也可以存在于车库中。例如,代表给定车库中的所有汽车的正确方法是什么?就像是: /garage/yyy/cars ? 车库yyy和zzz中的汽车联合怎么样? 代表具有特定属性的汽车的搜索的正确方法是什么?说:告诉我所有带有4门的蓝色轿车: /car/search?color=blue&type=sedan&doors=4 还是应该改用/ cars? 在那里使用“搜索”似乎不合适-有什么更好的方法/术语?应该只是: /cars/?color=blue&type=sedan&doors=4 搜索参数应该是PATHINFO还是QUERYSTRING的一部分? 简而言之,我正在寻找有关跨模型REST URL设计和搜索的指南。 [更新]我喜欢贾斯汀的答案,但他没有涵盖多领域搜索的情况: /cars/color:blue/type:sedan/doors:4 或类似的东西。我们如何去 /cars/color/blue 多领域的情况?
427 rest 


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.