使用命令行中的Android SDK,我可以使用以下命令获取可用的运行设备列表:
./adb device
Run Code Online (Sandbox Code Playgroud)
这给了我可用设备的序列号.如何从该序列号获取仿真器设备的AVD名称(如Eclipse ADT插件那样)?
我很难Actor在libgdx中使用我的事件.我正在使用夜间构建.
我的舞台是在子类的show()方法中设置的Screen:
stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
Gdx.input.setInputProcessor(stage);
TestActor actor = new TestActor();
stage.addActor(actor);
Run Code Online (Sandbox Code Playgroud)
我的演员班看起来像:
class TestActor extends Actor {
private Sprite sprite;
private TextureAtlas atlas;
public TestActor() {
atlas = new TextureAtlas(Gdx.files.internal("textures/images-packed.atlas"));
sprite = atlas.createSprite("logo-96");
setTouchable(Touchable.enabled);
addListener(new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
Gdx.app.debug(TestGame.TAG, "TestActor.touchDown()");
return true; // must return true for touchUp event to occur
}
public void touchUp (InputEvent event, …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用基于类的新(ish)视图,我想知道在那里获取select_related()的最佳方法是什么.这是我的观点:
class PostDetailView(DetailView):
model = Post
Run Code Online (Sandbox Code Playgroud)
该帖子来自URL中的"slug".这很好,但是,我想在那里得到select_related()以减少查询的数量.
我正在实施一个简单的推荐系统.我有中间件设置一个标识引用用户的会话变量.我有一个模型,它将推荐用户与推荐用户联系起来.我正在尝试使用User对象的post_save信号来填充此模型.如何从post_save信号处理程序中访问会话对象?
我为静态内容运行nginx,并作为Apache/mod_wsgi服务django的代理.我有example.com和test.example.com作为Apache/Django和static.example.com的代理,它直接通过nginx提供所有静态文件.我有一个通配符SSL证书,因此每个子域都可以使用SSL(我只有一个IP).
为什么使用时listen 443 default_server ssl;在任 test.example.com 或 example.com,SSL适用于这两种但我必须明确地听443 static.example.com?
ssl_certificate /etc/ssl/certs/example.chained.crt;
ssl_certificate_key /etc/ssl/private/example.key;
server {
listen 80;
listen 443;
server_name static.example.com;
# ... serves content ...
}
server {
listen 80;
listen 443 default_server ssl;
server_name example.com;
# ... proxy pass to http://example.com:8080 (apache) ...
}
server {
listen 80;
# why don't I need `listen 443;` here?
server_name test.example.com;
# ... proxy pass to http://test.example.com:8080 (apache) ...
}
Run Code Online (Sandbox Code Playgroud)