小编Har*_*ten的帖子

Android ListView将项目添加到顶部而没有列表视图滚动

我有一个listView,我想在列表视图的顶部添加新项目,但我不希望列表视图滚动其内容.我希望用户在添加新项目之前查看他正在查看的相同项目.

这是我向ListView添加新项目的方法:

this.commentsListViewAdapter.addRangeToTop(comments);
this.commentsListViewAdapter.notifyDataSetChanged();
Run Code Online (Sandbox Code Playgroud)

这是addRangeToTop方法:

public void addRangeToTop(ArrayList<Comment> comments)
{
    for (Comment comment : comments)
    {
        this.insert(comment, 0);        
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的listView:

<ListView
    android:id="@+id/CommentsListView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@+id/AddCommentLayout" 
    android:stackFromBottom="true" >        
</ListView>
Run Code Online (Sandbox Code Playgroud)

我想要做的是在用户滚动到顶部时加载旧注释.

谢谢您的帮助.

android listview scroll

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

Codeigniter扩展控制器,未找到控制器

在Codeigniter 2.1.2中,我想创建基本控制器,然后从该控制器扩展.它不起作用,我不明白为什么,我现在非常绝望.

\ application\core\MY_Base_Controller.php我有这个:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Base_Controller extends CI_Controller 
{
    function __construct()
    {
        parent::__construct();
...
Run Code Online (Sandbox Code Playgroud)

\ application\controllers\Home.php 我有这个:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 

class Home extends MY_Base_Controller {
Run Code Online (Sandbox Code Playgroud)

并且错误消息是

致命错误:第3行的......\application\controllers\Home.php中找不到类'MY_Base_Controller'

我不知道该怎么做,我在互联网上读到我必须将基本控制器放到核心文件夹我做了什么,我必须用前缀MY_命名基本控制器,我做了.但它仍然没有用.在我的config.php中也是这一行

$config['subclass_prefix'] = 'MY_';
Run Code Online (Sandbox Code Playgroud)

我使用xampp在localhost上运行它

谢谢您的帮助

编辑

有人可以请关注以下链接尝试,并告诉我什么是错的.我刚刚下载了codeigniter试图创建基本控制器并扩展欢迎控制器.不工作.在下面的rar中,只有修改过的文件.谢谢你 http://goo.gl/sKHkDl

编辑2

我可以通过将MY_Base_Controller重命名为MY_Controller实现此功能.这是否意味着,我只能为控制器创建一个扩展类?例如.我不能拥有

  • MY_Base_Auth_Controller
  • MY_Base_Article_Controller

只是而且只有MY_Controller

php extends controller codeigniter

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

如何从SQL Server获取证书公钥?

我已将证书导入到SQL Server数据库中。

 create certificate MyCertificate from file = 'c:\certificate.cer';
Run Code Online (Sandbox Code Playgroud)

现在,我想检索该证书的公钥。怎么做 ?

我可以

select * from sys.certificates
Run Code Online (Sandbox Code Playgroud)

但没有公钥列。

我知道我可以将其保存到磁盘

backup certificate MyCertificate to file = 'c:\MyCertificate.cer';
Run Code Online (Sandbox Code Playgroud)

但这不是我想要的。我只需要数据库来告诉我公钥或以某种方式获得我的整个证书,但我不想使用文件。

编辑:

我想使用SQL Server和证书来验证数据库表中一行的数字签名。但是由于函数VerifySignedByCert不会检查证书的到期日期(根据此注释:加密和签名的内置函数不会检查证书的到期日期。这些函数的用户必须决定何时检查证书的到期时间。位于http:/ /msdn.microsoft.com/zh-CN/library/ms187798%28v=SQL.90%29.aspx)我必须使用C#代码手动进行操作。

这就是为什么我想要获取证书的公钥和到期日期(可以在sys.certificates中找到)。但是似乎将证书存储在表的varbinary列中是最佳选择。还是还有其他更好的方法来实现这一目标?

谢谢您的帮助

database sql-server key certificate public

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