小编zam*_*otn的帖子

使用Django admin的自定义列

我有一个模型Data,与这样的表相关联(该模型Data仅由IntegerField组成):

subject | year | quarter | sales |
----------------------------------
   1    | 2010 |   1     | 20    |
   1    | 2010 |   2     | 100   |
   1    | 2010 |   3     | 100   |
   1    | 2010 |   4     | 20    |
   1    | 2011 |   1     | 30    |
   1    | 2011 |   2     | 50    |
   1    | 2011 |   4     | 40    |
   2    | 2010 |   1     | 30    |
   2    | …
Run Code Online (Sandbox Code Playgroud)

python django django-admin

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

为什么Bitmap.getConfig()返回null?

我有一些XML-Layout生成的ImageView,我想复制我点击LinearLayout下面的图像.

我有后续事件指派给所有ImageView的onClick事件:

public void onClick(View v) {
    // Take layout where i want to put my copy-image
    LinearLayout savingLayout = (LinearLayout)findViewById(R.id.linearSaved);

    //Create a new image
    ImageView savedImage = new ImageView(savingLayout.getContext());
    //Take the bitmap from the object i clicked
    Bitmap b = ((BitmapDrawable)((ImageView)v).getDrawable()).getBitmap();
    //Take the config of the bitmap. IT RETURNS NULL
    Bitmap.Config cfg= b.getConfig();
    //Copy the Bitmap and assign it to the new ImageView... IT CRASH (cfg == null)
    Bitmap b2 = b.copy(cfg, true); …
Run Code Online (Sandbox Code Playgroud)

java android android-emulator

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

Quarkus 不在 @QuarkusTest 套件中 @Inject beans

我对 Quarkus 很陌生,但我对其他 IoC 框架(Spring)非常精通。我有一个声明如下的 bean

@ApplicationScoped
public class TestingRepo {
    public String greet() {
        return "Hi";
    }
}
Run Code Online (Sandbox Code Playgroud)

我也有一个 Quarkus 测试,看起来像这样

@QuarkusTest
public class InjectionTest {

    @Inject
    public TestingRepo tr;

    @Test
    public void testInjection() {
        Assertions.assertNotNull(tr);
    }
}
Run Code Online (Sandbox Code Playgroud)

当我这样做时,mvn test我得到:

[ERROR] testInjection  Time elapsed: 0.006 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: not <null>
     at org.mytest.InjectionTest.testInjection(InjectionTest.java:25)
Run Code Online (Sandbox Code Playgroud)

我缺少什么吗?我期待着注射豆子,但没有注射null!感谢您的帮助。

java testing unit-testing quarkus

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