问题列表 - 第39379页

Android:如何防止软键盘向上推?

我的应用程序底部有一个垂直滑动抽屉.当软键盘打开时,它会向上推动抽屉的标签,使其位于键盘顶部.我实际上希望它保持在屏幕的底部,当键盘显示时隐藏.

其他人遇到这个问题?知道如何解决它吗?

keyboard layout android view

352
推荐指数
15
解决办法
26万
查看次数

Java convert GIF image to PNG format

I have to build a Java servlet that receives an image and returns that image converted to PNG format. How can I achieve this? By converting I don't mean changing the file extension, like some examples suggest.

Thanks in advance!

java png gif

6
推荐指数
3
解决办法
7166
查看次数

How to get array overlaps using LINQ?

Suppose I have the following arrays:

List<int[]> numbers = new List<int[]>();
numbers.Add(new int[] { 1, 2, 3 });
numbers.Add(new int[] { 3, 4, 5 });
numbers.Add(new int[] { 5, 6, 7 });

int[] numbersToFind = new int[] { 4, 5, 6 };
Run Code Online (Sandbox Code Playgroud)

I want to find which of the numbers elements contains one/more of the values in numbersToFind, is there an easy way of doing this with LINQ? That is, some code that would return a IEnumerable<int[]> containing an …

c# linq arrays

4
推荐指数
2
解决办法
2140
查看次数

Rails 3使用SQL IN和SQL OR运算符进行ActiveRecord查询

我正在使用"where"语法编写Rails 3 ActiveRecord查询,该语法使用SQL IN和SQL OR运算符,并且无法弄清楚如何将它们一起使用.

此代码有效(在我的用户模型中):

Question.where(:user_id => self.friends.ids)
#note: self.friends.ids returns an array of integers
Run Code Online (Sandbox Code Playgroud)

但这段代码

Question.where(:user_id => self.friends.ids OR :target => self.friends.usernames)
Run Code Online (Sandbox Code Playgroud)

返回此错误

syntax error, unexpected tCONSTANT, expecting ')'
...user_id => self.friends.ids OR :target => self.friends.usern...
Run Code Online (Sandbox Code Playgroud)

知道如何在Rails中编写它,或者只是原始SQL查询应该是什么?

ruby sql activerecord ruby-on-rails ruby-on-rails-3

16
推荐指数
4
解决办法
2万
查看次数

在自定义组合框中绘制图像

对于当前项目,我需要一个带有颜色名称(字符串)的下拉菜单,其旁边有一个小的示例方块(图像).所以,我能够设计一个自定义的ComboBox来实现这一目标.但是,我遇到了一个问题....当我从列表中选择一个项目时,颜色示例没有显示,只有颜色的名称.(见下面的例子)

扩展菜单:

替代文字

选择项目后:

替代文字

为了首先绘制字符串旁边的颜色,我使用了:

    // Draws the items into the ColorSelector object
    protected override void OnDrawItem(DrawItemEventArgs e)
    {
        e.DrawBackground();
        e.DrawFocusRectangle();

        DropDownItem item = (DropDownItem)Items[e.Index];
        // Draw the colored 16 x 16 square
        e.Graphics.DrawImage(item.Image, e.Bounds.Left, e.Bounds.Top);
        // Draw the value (in this case, the color name)
        e.Graphics.DrawString(item.Value, e.Font, new
                SolidBrush(e.ForeColor), e.Bounds.Left + item.Image.Width, e.Bounds.Top + 2);

        base.OnDrawItem(e);
    }
Run Code Online (Sandbox Code Playgroud)

DropDownItem包含图像和要绘制的字符串.那么......有没有人知道我需要覆盖什么或者我需要做什么才能让ComboBox绘制图像和字符串两者,就像扩展列表时选择项目时一样?

非常感谢; 干杯!

c# user-controls drawing combobox image

8
推荐指数
1
解决办法
3852
查看次数

GWT和Enum的问题

我在GWT应用程序的客户端部分有一个枚举,当我尝试运行与序列化问题相关的异常时,我得到一个异常.我做错了吗?我读到GWT支持枚举,我使用的是最后一个版本.

枚举:

public enum AnEnum implements Serializable {

    ITEM_A("Item a description"), ITEM_B("Item b description");

    private String description;

    private AnEnum(String description) {
        this.description = description;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

}
Run Code Online (Sandbox Code Playgroud)

例外:

Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:742)
    ... 47 more
Caused by: com.google.gwt.user.client.rpc.SerializationException: Type '(...).client.(...).AnEnum' was not included in the set of types which can be serialized …
Run Code Online (Sandbox Code Playgroud)

java gwt enums

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

php是一种可扩展的Web语言吗?

我听说PHP不适合大型网站althogh我不知道在这种情况下大型网站的含义是什么,比如像Facebook这样的东西?无论如何,PHP确实可以扩展到大型网站吗?

php

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

即使安装了gem,Ruby也找不到所需的库

我花了几天时间尝试安装ruby 1.9.2并使用gems: - /我最终放弃了我的Mac OSX 10.6机器,下面是我的Ubuntu机器上的当前状态.任何建议将不胜感激!

# ruby test.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- mongo (LoadError)
 from <internal:lib/rubygems/custom_require>:29:in `require'
 from test.rb:1:in `<main>'
# cat test.rb
require 'mongo'
db = Mongo::Connection.new.db("mydb")
# gem which mongo
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/mongo-1.1.2/lib/mongo.rb
# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"
Run Code Online (Sandbox Code Playgroud)

根据这个页面:http://docs.rubygems.org/read/chapter/19 我用symlinked我用来匹配gem正在使用的ruby:

# which ruby
/usr/local/rvm/bin/ruby
# ls -l `which ruby`
lrwxrwxrwx 1 root root 44 2010-11-17 13:25 /usr/local/rvm/bin/ruby -> /usr/local/rvm/rubies/ruby-1.9.2-p0/bin/ruby
# gem env | grep 'RUBY EXECUTABLE'
  - RUBY EXECUTABLE: …
Run Code Online (Sandbox Code Playgroud)

ruby gem require rvm

5
推荐指数
2
解决办法
2676
查看次数

unix信号如何工作?

信号如何在unix中工作?我经历了WR史蒂文斯,但无法理解.请帮我.

c unix signals

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

如何使用Django自定义管理命令选项?

Django doc告诉我如何通过一个例子为我的django自定义管理命令添加一个选项:

from optparse import make_option

class Command(BaseCommand):
    option_list = BaseCommand.option_list + (
        make_option('--delete',
            action='store_true',
            dest='delete',
            default=False,
            help='Delete poll instead of closing it'),
    )
Run Code Online (Sandbox Code Playgroud)

然后文档就停止了.如何编写handle此类的方法来检查用户是否提供了--delete选项?有时Django很容易让事情变得困难:-(

django django-manage.py

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