问题列表 - 第33704页

加密GAE <> Android通信的纯文本密码

我有一个Android应用程序,它与Google App Engine(GAE)后端进行通信.对于身份验证,我有一个用户名和密码,但我不想在客户端上存储纯文本密码,并在不安全的通道上以纯文本格式传输.因此,当用户第一次输入密码(注册或登录)并将其存储在手机以及GAE数据库中时,我正在考虑对密码进行哈希处理.但是,我不确定使用哪种加密哈希函数,目前正在考虑sha1(),如果我需要做其他事情或只是一个sha1(plainTextPassword).

有什么建议?

authentication encryption google-app-engine android

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

正则表达式:匹配可选单词

需要匹配句子的第一部分,直到给定的单词.但是,该单词是可选的,在这种情况下,我想匹配整个句子.例如:

我有一句话,附有我不想要的条款.

我有一句话,我喜欢它.

在第一种情况下,我想要"I have a sentence".在第二种情况下,我想要"I have a sentence and I like it."

Lookarounds将给我第一个案例,但是一旦我尝试使其成为可选项,为了涵盖第二个案例,我得到了整个第一句话.我试过让表达懒惰......没有骰子.

适用于第一种情况的代码:

var regEx = new Regex(@".*(?=with)");
string matchstr = @"I have a sentence with a clause I don't want";

if (regEx.IsMatch(matchstr)) {
    Console.WriteLine(regEx.Match(matchstr).Captures[0].Value);
    Console.WriteLine("Matched!");
}
else {
    Console.WriteLine("Not Matched : (");
}
Run Code Online (Sandbox Code Playgroud)

我希望的表达方式:

var regEx = new Regex(@".*(?=with)?");
Run Code Online (Sandbox Code Playgroud)


有什么建议?

提前致谢!
詹姆士

c# regex

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

urllib2.urlopen()缓存内容吗?

他们没有在python文档中提到这一点.最近我正在测试一个网站只是使用urllib2.urlopen()来刷新网站以提取某些内容,我注意到有时当我更新网站时,urllib2.urlopen()似乎没有得到新添加的内容.所以我想它确实在某处缓存了东西,对吧?

python urllib2 urlopen

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

如何在FOR循环中反转顺序

我有一个简单的FOR语句,如下所示:

var num = 10,
    reverse = false;

for(i=0;i<num;i++){
    console.log(i);
}
Run Code Online (Sandbox Code Playgroud)

反向为假时,我希望它返回类似[0,1,2,3,5,5,7,8,9]的内容

但是,当反向为真时,它应该返回[9,8,7,6,5,4,3,2,1,0]

获取此结果的最有效方法是什么,如果在循环内反转为true或false ,则不检查每次?

我不想这样做:

var num = 10,
    reverse = false;

for(i=0;i<num;i++){
    if(reverse) console.log(num-i)
    else console.log(i)
}
Run Code Online (Sandbox Code Playgroud)

我想在循环外只检查一次反向.

javascript performance for-loop

15
推荐指数
3
解决办法
4万
查看次数

获取div内的所有输入字段(不含JS库)

如果不使用像jQuery这样的javascript库,在div中获取所有输入字段的最简单方法是什么?与此jQuery代码段类似:

var inputs = $('#mydiv :input');
Run Code Online (Sandbox Code Playgroud)

javascript textinput

21
推荐指数
4
解决办法
4万
查看次数

致命错误:registerContainerConfiguration的声明必须与Kernel :: registerContainerConfiguration的声明兼容

有人知道为什么会这样吗?

就我所知,子类方法的声明方式与父类相同.

谢谢!

这是我的内核代码:

<?php

require_once __DIR__.'/../src/autoload.php';

use Symfony\Framework\Kernel;
use Symfony\Components\DependencyInjection\Loader\YamlFileLoader as ContainerLoader;
use Symfony\Components\Routing\Loader\YamlFileLoader as RoutingLoader;

use Symfony\Framework\KernelBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\ZendBundle\ZendBundle;
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;
use Symfony\Bundle\DoctrineBundle\DoctrineBundle;
use Symfony\Bundle\DoctrineMigrationsBundle\DoctrineMigrationsBundle;
use Symfony\Bundle\DoctrineMongoDBBundle\DoctrineMongoDBBundle;
use Symfony\Bundle\PropelBundle\PropelBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Application\UfaraBundle\UfaraBundle;



class UfaraKernel extends Kernel {
    public function registerRootDir() {
        return __DIR__;
    }

    public function registerBundles() {
        $bundles = array(
                new KernelBundle(),
                new FrameworkBundle(),
                new ZendBundle(),
                new SwiftmailerBundle(),
                new DoctrineBundle(),
                //new DoctrineMigrationsBundle(),
                //new DoctrineMongoDBBundle(),
                //new PropelBundle(),
                //new TwigBundle(),
                new UfaraBundle(),
        );

        if ($this->isDebug()) { …
Run Code Online (Sandbox Code Playgroud)

php dependency-injection symfony

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

ListView SelectedIndexChanged事件没有选定项目问题

我有一个小的C#3.5的WinForms应用程序,我对工作抓起,从一个服务器的事件日志名称为列表视图.当选择这些项目中的一个,另一个是列表视图填充来自如下所示,抓住了第一个项目的Text属性SelectedItems集合中使用SelectedIndexChanged事件选择的事件日志中的事件日志条目.

string logToGet = listView1.SelectedItems[0].Text;
Run Code Online (Sandbox Code Playgroud)

这在第一次工作正常,但第一次列表视图中的第二个事件日志名称选择失败.正在发生的事情是SelectedItems集合SelectedIndexChanged事件越来越是空的,所以我得到一个ArgumentOutOfRangeException.

我很茫然.关于我做错了什么或更好的方法做任何想法?

c# listview selectedindexchanged winforms

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

自定义验证属性不称为ASP.NET MVC

大家好我已创建自定义验证属性并将其分配给类级别验证.不幸的是,它没有被调用.我尝试各种方式,认为它可以解决问题.但是,它花了我几个小时,我发现验证机制没有调用该属性.

为了说明你,我把以下代码.

属性

[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
    public sealed class BooleanDependencyAttribute : ValidationAttribute
    {
        private const string _defaultErrorMessage = "?????????{0}";
        private readonly object _typeId = new object();

        public string DependencyPropertyName { get; private set; }
        public string DependentPropertyName { get; private set; }

        public BooleanDependencyAttribute(string dependencyPropertyName, string dependentPropertyName)
            : base(_defaultErrorMessage)
        {
            DependencyPropertyName = dependencyPropertyName;
            DependentPropertyName = dependentPropertyName;
        }



        public override object TypeId
        {
            get
            {
                return _typeId;
            }
        }

        public override string FormatErrorMessage(string name)
        {
            return String.Format(CultureInfo.CurrentUICulture, …

c# asp.net-mvc asp.net-mvc-2

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

如何使用Jquery获取按钮的id值?

我有一个动态创建的编辑按钮的表.按钮的ID是附加表内容id的字符串.

即: <input id='edit'+id type='button' value='Edit' onclick=edit(this.id) />

如何使用jquery获取按钮的ID(= edit + id)值.

谢谢.

html jquery

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

如何用一个选择器选择一个jQuery元素的子元素?

我有一个divid article_50.如果我要选择.title里面的元素article_50,我可以做以下事情: $("#article_50 .title").

现在说我想选择相同的标题,但在点击事件中:

$("#article_50").click(function(){
    $(this).children(".title").hide();
});
Run Code Online (Sandbox Code Playgroud)

现在我不得不调用该children方法来选择该.title元素.我可以在同一选择器中选择它而无需调用children吗?

像这样的东西:

$("this .title").hide();

谢谢!

jquery jquery-selectors

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