小编y43*_*34y的帖子

为什么仅索引扫描需要这么长时间?

为什么执行我的简单查询

select count(this_.Id) as y0_ from Activity this_
Run Code Online (Sandbox Code Playgroud)

需要这么长时间(这次超过10分钟)?

这是查询计划(EXPLAIN ANALYZE的输出):

QUERY PLAN  
 Aggregate (cost=854047.36..854047.37 rows=1 width=4)
> (actual time=728525.277..728525.277 rows=1 loops=1)   
->  Index Only
> Scan using activity_pkey on activity this_  (cost=0.56..805401.87
> rows=19458196 width=4) (actual time=36.961..725381.557 rows=19517989
> loops=1)  
> Heap Fetches: 10351403  
Total runtime: 728533.529 ms
Run Code Online (Sandbox Code Playgroud)

和PostgreSql版本:

PostgreSQL 9.3.5 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.7.2-5) 4.7.2, 64-bit
Run Code Online (Sandbox Code Playgroud)

在Id字段中,索引也在这里:

ALTER TABLE public.activity
ADD CONSTRAINT activity_pkey 
PRIMARY KEY (id);
Run Code Online (Sandbox Code Playgroud)

sql database postgresql postgresql-9.3

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

平面YUV420数据布局

在我的项目中,我使用OpenH264编解码器,据说以YUV 4:2:0 planar格式输出数据.解码后,我得到一个带有width * height * 1.5元素的数组,在显示时,看起来像这个图像:

http://o3d.googlecode.com/svn/trunk/samples_webgl/assets/shaving_cream.png

为什么主要的一个下面有四个区域(包含Y-负责灰度 - 元素),而不是两个,就像我的第二张图片一样?这是否意味着格式不同或我错了,我的世界崩溃了?

我认为resoult应该是这样的:

在此输入图像描述

c++ image-processing yuv codec h.264

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

自定义SurfaceView和默认android视图之间的通信

我的问题是自定义GameView(扩展SurfaceView)和TextView之间的通信:我想从GameView内部设置TextView的文本.在主要活动我正在使用这个布局文件,它应该解释我的应用程序的结构:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:background="#00ff00"
    >
    <TextView
        android:id="@+id/scoreTV"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="score: 0" 
        />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="back"
        android:layout_alignParentRight="true" />                   
</RelativeLayout>
<org.gk.grApp.GameView
    android:id="@+id/gameplayScreen"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我无法在GameView对象中更改TextView的文本,因为无法从另一个接触UI线程.Handler也不起作用,因为我无法给Gamecher的构造函数提供一个处理程序的引用,这是在加载这个xml文件后执行的(读取xml文件的默认构造函数,例如这里我如何在LinearLayout中使用GLSurfaceView和其他视图,如TextView或Button?).你知道我现在应该做什么吗?也许我的演绎错了,所以请告诉我这个.

编辑:我改变了我的xml文件,而不是我现在拥有的GameView:

<LinearLayout
    android:id="@+id/gameplayScreen"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    >
    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我还在构造函数的签名中添加了一个参数(第三个):

public GameView(Context context, AttributeSet as, Handler h) { ... } 
Run Code Online (Sandbox Code Playgroud)

并在GameplayActivity中更改了我的onCreate:

protected void onCreate(Bundle savedInstanceState) {        
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gameplay);

    LinearLayout ll = (LinearLayout)findViewById(R.id.gameplayScreen);
    GV = new GameView(this, null, scoreHandler);
    ll.addView(GV);         
}
Run Code Online (Sandbox Code Playgroud)

它可以工作,现在我可以设置TextView的文本,但是在单击后退按钮后会抛出另一个异常:"执行暂停未恢复的活动:{org.gk.grApp/org.gk.grApp.MainMenuActivity}".我刚刚开始搜索有关此信息.

android handler surfaceview

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