问题列表 - 第44004页

C#Nullable Equality Operations,为什么null <= null解析为false?

为什么在.NET中呢?

null >= null
Run Code Online (Sandbox Code Playgroud)

解析为假,但是

null == null 
Run Code Online (Sandbox Code Playgroud)

解析为真?

换句话说,为什么不null >= null等同于null > null || null == null

有人有正式答案吗?

.net c# null comparison-operators

39
推荐指数
3
解决办法
2万
查看次数

6
推荐指数
1
解决办法
2202
查看次数

如何在小部件点击上启动网站?

我有一个显示文本字段的基本小部件。我试图弄清楚当用户单击小部件本身时如何启动网站 url。我似乎无法找到有关此事的任何代码。

url android widget onclick

4
推荐指数
1
解决办法
4672
查看次数

Actionscript 3'这个'问题

有人可能会指出为什么以下代码在第一种情况下失败:

情况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在这种情况下是否有关于使用的规则?

flash actionscript this actionscript-3

2
推荐指数
1
解决办法
1500
查看次数

选择文件后立即POST

我有以下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)

这给了我以下的东西.

替代文字

我在想

  1. 我如何使用JavaScript,以消除Submit按钮的需要.这意味着,一旦我Choose File,所选文件将立即上传?
  2. 如何确保显示所选文件名的字段足够长,以便...不会显示?

html javascript

25
推荐指数
1
解决办法
3万
查看次数

徽章图标资源/视图

是否有内置徽章图标,如信息图标,以便我可以在我的应用程序中显示其他视图的状态更新?手动复制很容易,但我想使用内置资源(如果有的话).

iphone

6
推荐指数
1
解决办法
1225
查看次数

Android ListView状态列表未显示默认项目背景

已经在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)

android listview state background

13
推荐指数
1
解决办法
2万
查看次数

如何在JSON中更好地构造数组数组

在以下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)

javascript arrays json

9
推荐指数
1
解决办法
6万
查看次数

无效的URI - 如何防止,URI :: InvalidURIError错误?

我从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?

谢谢!

ruby-on-rails ruby-on-rails-3

5
推荐指数
1
解决办法
8421
查看次数

Django静态文件问题

重复Django staticfiles应用程序帮助

我正在使用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.

python django

2
推荐指数
1
解决办法
7658
查看次数