小编cam*_*aca的帖子

关闭onCreate上的活动

我正在打开一个Activity使用这个:

startActivity(new Intent(Parent.this, Child.class));
Run Code Online (Sandbox Code Playgroud)

在孩子身上,我在onCreate函数上有这个代码(当然if包含的不仅仅是true):

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (true) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setPositiveButton("OK", null);
        builder.setTitle("Error");
        builder.setMessage("Connection error, please try later.")
            .show();
        finishActivity(0);
        return;
    }
}
Run Code Online (Sandbox Code Playgroud)

为什么活动没有结束?我收到警报框,但是我必须点击"后退"按钮才能返回.

android android-activity

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

Smarty和Kohana

是否有使用Smarty和Kohana 3的标准"官方"方式?我看到有些选项似乎不太理想,并且当Smarty或Kohana的次要版本号增加时可能会破坏.

(作为一个附带问题,将Smarty与Kohana一起使用是一个好主意吗?我只是想安装它,因为我对Smarty非常熟悉,我担心Kohana不会提供我喜欢的所有东西Smarty的..)

php smarty kohana kohana-3

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

Chrome中的Web字体

我有一个在Firefox上看起来很棒的webfont,而不是Chrome.我试过玩这个text-rendering房子,结果不那么引人注目.我的CSS是这样的:

@font-face {
    font-family: 'TextFont';
    src: url('[my font file url]') format('truetype');
    font-weight: normal;
    font-style: normal;
}
body {
    font-family: TextFont, Tahoma, Geneva, sans-serif;
    text-rendering: auto;
}
Run Code Online (Sandbox Code Playgroud)

改变text-rendering似乎没有在Firefox中做任何事情,所以我发布了一个截图.

结果:

  • Firefox(又名"应该是什么样子")

    在此输入图像描述

  • Chrome - text-rendering: auto

    在此输入图像描述

  • Chrome - text-rendering: optimizeLegibility

    在此输入图像描述

  • Chrome - text-rendering: optimizeSpeed

    在此输入图像描述

  • Chrome - text-rendering: geometricPrecision

    在此输入图像描述

与Firefox版相比,所有Chrome屏幕截图看起来都很糟糕.CSS中缺少什么东西?

我使用的是Windows 7,Firefox 8.0和Chrome 15.0.

css text-rendering webfonts

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

XHTML 1.0 Strict中的自定义数据

我在html中使用了一些自定义属性,用于jquery的东西.我看到data-XYZHTML5中有属性,但我需要xhtml 1.0严格.我还有其他选择吗?

html xhtml-1.0-strict custom-data-attribute

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

使用服务器推送在复杂页面中进行多用户编辑

我正在将Zend Framework用于名为Pricetag的应用程序,我们正在考虑添加对实时多用户编辑的支持.基本上,这个想法是,在每个步骤中,能够与其他在线用户分享您正在编辑的内容(很像Pivotal TrackerTrello).

这是我们所拥有的四个页面中最复杂(以编程方式说)的屏幕截图:

Pricetag Step 2截图

内部HTML并不重要(但是,如果你想要检查它,你可以注册为免费用户),基本上是一些输入和使用javascript添加/删除这些块("可交付成果"和"任务")的能力.

我假设我需要一些方法让服务器通知每个在线客户端页面的变化.我每次更改时都会发出请求(每次更新时右侧的白色块都会更新),但我不确切知道其他用户将如何接收这些信息.

每隔5秒左右轮询服务器似乎非常错误.该网站使用PHP,是否足以做到这一点?我应该与服务器中的单独脚本连接吗?是否已经构建了Zend Framework模块,即使我先向Google询问,我仍然缺少这个模块?

php zend-framework server-push

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

在最后一行对齐`dt`和`dd`

我有这个HTML:

<dl>
    <dt>some text</dt>
    <dd>12.45</dd>
    <dt>some larger text</dt>
    <dd>46.05</dd>
    <dt>some even larger text</dt>
    <dd>46.05</dd>
    <div style="clear:both;"></div>
</dl>
Run Code Online (Sandbox Code Playgroud)

......而这个CSS:

dl {
    width: 120px;
}
dt {
    float: left;
    clear: both;
}
dd {
    float: right;
}
Run Code Online (Sandbox Code Playgroud)

它正在产生这个(我添加了一些不重要的额外样式来显示正在发生的事情):

错误的对齐

问题是,最后一个与最后一个dd没有对齐dt.如何使数字与文本的最后一行对齐?(第二个dt/ dd很好)

这是一个解决我困境的问题.

编辑:要非常清楚,这就是我想要的:

修正

css

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

为什么`:type`有时会显示`a`而有时会显示`t`?

我有这两个功能:

cleanUp a = Data.List.filter (/=[]) a

joinByPairs [] = []
joinByPairs (x:[]) = (x:[])
joinByPairs (x:y:xs) = (x ++ y) : joinByPairs xs
Run Code Online (Sandbox Code Playgroud)

当我加载它们ghci并调用:type它们时,我得到以下结果:

*Main> :type joinByPairs
joinByPairs :: [[a]] -> [[a]]
*Main> :type cleanUp
cleanUp :: Eq t => [[t]] -> [[t]]
Run Code Online (Sandbox Code Playgroud)

显示a对比的逻辑是什么t?我不认为这是因为Eq t部分,因为我有其他功能,显示类似的东西otherFunction :: Eq a => [[a]] -> [[a]].

haskell ghci

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

Material Dialog scrolls body to top on open

I am using Material UI in a react app and want to open a dialog on my page. The Dialog opens fine, the only problem is when it opens it scrolls the body of my page to the top.

The scroll-to-top behavior also happens when I open a Material Popover and when I open a Material TextBox selector. I've searched for hours for a solution for this and it seems like no one else has experienced this behavior before.

Any …

css twitter-bootstrap reactjs material-ui

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

了解我的自定义 Svelte 组件中是否有单击事件处理程序

有没有办法知道我的自定义组件上是否设置了单击处理程序?我想向其中添加一个 CSS 类来添加样式cursor: pointer;,但前提是单击时会发生某些情况。

为了说明这一点,以下是自定义组件:

<script>
  $: magic = ? // this is what I'm after
</script>

<div on:click
     class:pointer={magic}
>
  I might be clickable!
</div>

<style>
  .pointer {
    cursor: pointer;
  }
</style>
Run Code Online (Sandbox Code Playgroud)

svelte

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

在PHP的DOMXPath中是否需要registerNamespace?

我正在使用这样的XML :(它是epub书中的标准container.xml)

<?xml version="1.0"?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
   <rootfiles>
      <rootfile full-path="OEBPS/9780765348210.opf" media-type="application/oebps-package+xml"/>
   </rootfiles>
</container>
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用PHP解析它.到目前为止这是我的代码:

$c = new DOMDocument();
$c->load($filename);
$x = new DOMXPath($c);
//fine up to here!

//is this even what I'm supposed to be doing?
$x->registerNamespace('epub', 'urn:oasis:names:tc:opendocument:xmlns:container');
$root = $x->query('/epub:container/epub:rootfiles/epub:rootfile');

//fine down from here!
$opf = $root->item(0)->getAttribute('full-path'); //I know I should check if the element's there and if it has the attribute. Not important.
Run Code Online (Sandbox Code Playgroud)

我的问题是:有没有办法不做那个registerNamespace电话?我不确定不同的epub是否设置了这个值有点不同,我需要这个代码来处理我抛出的任何epub.

php domdocument epub domxpath

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