为什么在.NET中呢?
null >= null
Run Code Online (Sandbox Code Playgroud)
解析为假,但是
null == null
Run Code Online (Sandbox Code Playgroud)
解析为真?
换句话说,为什么不null >= null等同于null > null || null == null?
有人有正式答案吗?
我有一个显示文本字段的基本小部件。我试图弄清楚当用户单击小部件本身时如何启动网站 url。我似乎无法找到有关此事的任何代码。
有人可能会指出为什么以下代码在第一种情况下失败:
情况1
// In a constructor
this.gallery = new Gallery();
addChild(this.gallery);
this.gallery.addEventListener(GalleryEvent.WHATEVER, function(event:*) {
// When this callback fires, there is a fail:
// because there is no 'this.gallery'.
this.gallery.someAction();
});
Run Code Online (Sandbox Code Playgroud)
案例2
this.gallery.addEventListener(GalleryEvent.WHATEVER, function(event:*) {
// This works fine
gallery.someAction();
})
Run Code Online (Sandbox Code Playgroud)
this在这种情况下是否有关于使用的规则?
我有以下HTML代码
<form action="/script/upload_key.py" method="POST" enctype="multipart/form-data">
Key filename: <input name="file_1" type="file">
<input name="submit" type="submit">
</form>
Run Code Online (Sandbox Code Playgroud)
这给了我以下的东西.

我在想
Submit按钮的需要.这意味着,一旦我Choose File,所选文件将立即上传?是否有内置徽章图标,如信息图标,以便我可以在我的应用程序中显示其他视图的状态更新?手动复制很容易,但我想使用内置资源(如果有的话).
已经在SO上阅读了很多相关问题,并通过Android文档和源代码查看了这一点,但是我很难过,尽管listSelector似乎只对所选项目应用样式,但是我没有震惊......
我在main.xml中定义了Listview:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fadingEdgeLength="5dp"
android:divider="#000000"
android:dividerHeight="1dp"
android:listSelector="@drawable/list_selector" />
<TextView
android:id="@android:id/empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:singleLine="false"
android:text="@string/message_list_empty" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
引用的listSelector在这里(主要借用SDK中的默认Android状态列表:/android/platforms/android-8/data/res/drawable/list_selector_background.xml):
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- the window has lost focus, disable the items -->
<item
android:state_window_focused="false"
android:drawable="@drawable/shape_row_disabled" />
<!-- the list items are disabled -->
<item
android:state_enabled="false"
android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/shape_row_disabled" />
<item
android:state_enabled="false"
android:state_focused="true"
android:drawable="@drawable/shape_row_disabled" />
<item
android:state_enabled="false"
android:drawable="@drawable/shape_row_disabled" />
<!-- the list items are enabled and being pressed -->
<item …Run Code Online (Sandbox Code Playgroud) 在以下JSON对象中:
var employees = { "accounting" : [ // accounting is an array in employees.
{ "firstName" : "John", // First element
"lastName" : "Doe",
"age" : 23 },
{ "firstName" : "Mary", // Second Element
"lastName" : "Smith",
"age" : 32 }
], // End "accounting" array.
"sales" : [ // Sales is another array in employees.
{ "firstName" : "Sally", // First Element
"lastName" : "Green",
"age" : 27 },
{ "firstName" : "Jim", // Second Element
"lastName" …Run Code Online (Sandbox Code Playgroud) 我从delayed_job得到了以下回复:
[Worker(XXXXXX pid:3720)] Class#XXXXXXX failed with URI::InvalidURIError: bad URI(is not URI?): https://s3.amazonaws.com/cline-local-dev/2/attachments/542/original/mac-os-x[1].jpeg?AWSAccessKeyId=xxxxxxxx&Expires=1295403309&Signature=xxxxxxx%3D - 3 failed attempts
Run Code Online (Sandbox Code Playgroud)
这个URI来自我的应用程序的方式是.
在我的user_mailer中我做:
@comment.attachments.each do |a|
attachments[a.attachment_file_name] = open(a.authenticated_url()) {|f| f.read }
end
Run Code Online (Sandbox Code Playgroud)
然后在我的附件模型中:
def authenticated_url(style = nil, expires_in = 90.minutes)
AWS::S3::S3Object.url_for(attachment.path(style || attachment.default_style), attachment.bucket_name, :expires_in => expires_in, :use_ssl => attachment.s3_protocol == 'https')
end
Run Code Online (Sandbox Code Playgroud)
话虽这么说,是否有一些类型的URI.encode或解析我可以做什么来防止有效的URI(因为我检查URL在我的浏览器中工作)错误和杀死rails 3中的delayed_job?
谢谢!
我正在使用Django 1.3测试版,静态文件应用程序令人困惑.在开发模式下,它意味着自动从STATIC_URL路径中提供文件.
来自http://docs.djangoproject.com/en/dev/howto/static-files/
如果您正在使用内置开发服务器(runserver管理命令)并将DEBUG设置设置为True,那么您的静态文件将自动从开发中的STATIC_URL提供.
这似乎不起作用,所以我尝试了一个url模式('/ static /'),它路由到static.serve视图.这只是404'd.不知何故,它与STATIC_URL冲突,如果我将其更改为'assets /',它将从静态服务文件就好了.对静态URL使用'/ static'是合乎逻辑的,但这有冲突.
网址格局:
urlpatterns = patterns('',
# Serve static files for *development only*
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT}),
Run Code Online (Sandbox Code Playgroud)
静态文件设置:
STATIC_ROOT = '/home/dave/static/flux'
# URL that handles the static files served from STATIC_ROOT.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
Run Code Online (Sandbox Code Playgroud)
理想情况下,我希望Django使用静态URL在开发中搜索文件,而不必使用任何urlpatterns.