我通过代码处理SIGSEGV:
int C()
{
int *i = NULL;
*i = 10; // Crash there
}
int B()
{
return C();
}
int A()
{
return B();
}
int main(void)
{
struct sigaction handler;
memset(&handler,0,sizeof(handler));
handler.sa_sigaction = handler_func;
handler.sa_flags = SA_SIGINFO;
sigaction(SIGSEGV,&handler,NULL);
return(C());
}
Run Code Online (Sandbox Code Playgroud)
处理程序代码在哪里:
static int handler_func(int signal, siginfo_t info, void* rserved)
{
const void* stack[MAX_DEPTH];
StackCrowlState state;
state.addr = stack;
state.count = MAX_DEPTH;
_Unwind_Reason_Code code = _Unwind_Backtrace(trace_func,&state);
printf("Stack trace count: %d, code: %d\n",MAX_DEPTH - state.count, code);
kill(getpid(),SIGKILL);
}
static …Run Code Online (Sandbox Code Playgroud) 我根据SDK中的示例编写了自己的SyncAdapter.它应该从外部源添加联系人,它在设备模拟器中工作得很好.但是当我在HTC Desire上运行它后,我无法在Contacts-> Display选项中看到我的帐户
此外,我在Desire上尝试了谷歌的例子,也无法在这个列表中看到它们.有谁知道任何解决方案?
我有下一个HTML代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
html {height:100%;}body {height:100%;margin:0;}
h1 {form-size:20px;margin:0;padding:20px;}
</style>
</head>
<body>
<table style="width:100%;height:100%">
<tr>
<td>
<div style="background-color:#f00;">
<h1>This text should make height of this cell</h1>
</div>
</td>
</tr>
<tr style="height:100%;" id="row">
<td style="background-color:#c0c;">
<div style="height:100%;width:100%;background-color:#00f;color:#fff;">
This cell should take all unused space of table
</div>
</td>
</tr>
<tr>
<td>
<div style="background-color:#0f0;">
<h1>This text should make height of<br> this cell</h1>
</div>
</td>
</tr>
</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
它在所有浏览器中都很完美 - 除了IE,其中中间单元格中的蓝色div仅占用文本空间.可能有人知道如何将它拉伸到桌子内的整个自由空间?
更新:我知道页面布局中的表格不好.如果你能告诉我div格式的例子,它有顶部和底部块,可变高度和中间部分,使用浏览器窗口的所有可用空间,我将使用它.我保证=)