问题列表 - 第35562页

电子邮件地址为密码盐?

使用电子邮件地址作为密码的是不是一个坏主意?

php passwords salt

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

C++模板和继承

我可以这样混合继承和模板吗?:

template <class T> 
class AbstractType { // abstract
//....
}

template <class T> 
class Type1 : public AbstractType<T> {
//....
}
Run Code Online (Sandbox Code Playgroud)

稍后,我可以像这样使用这些类:

AbstractType<SomeClass>* var1 = new Type1<SomeClass>();
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助.

c++ inheritance templates

4
推荐指数
2
解决办法
844
查看次数

测量系统调用的速度

我正在尝试在Redhat Linux上优化我们的gettimeofday()系统调用.通过他们的文档,可以通过使用虚拟动态共享对象(VDSO)在用户区域中运行调用来提高速度.我很好奇我怎么能在第一时间调整通话的速度?我想进行更改,然后将其与之前的结果进行比较

linux performance system-calls

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

我可以使用Javascript更改HTML元素的ID吗?

我有javascript变量obj,它代表DOM中的一个元素,我希望更改它的ID.我试图通过以下方式做到这一点,这也说明它不起作用!

obj.id = "newID";

alert(obj.id); // this gives me newID as required

var element = document.getElementById("newID");

if (element != null) { alert("Hooray"); // this alert never gets displayed! }
Run Code Online (Sandbox Code Playgroud)

上面我的代码有什么问题,这意味着id似乎被改变但在DOM中没有被提取?提前谢谢了.

javascript dom getelementbyid

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

如何忽略WebService请求中的SSL证书错误?

问题:我编写了一个控制台程序,它使用SQL Server 2005 Web服务将报告上载到SQL Server 2005报告服务(这样我就不必每次手动上传100个报告).

它在本地和远程工作正常.但现在,问题是一台服务器使用SSL所以rs.Url ="https://hostname/ReportServer/reportservice2005.asmx

现在的问题是SSL证书无效......我可以通过忽略此错误从浏览器访问reportserver.我怎么能用网络服务呢?

 ' http://msdn.microsoft.com/en-us/library/aa225813(SQL.80).aspx
    ' COR.Reporting.ReportingServiceInterface.CreateThisReport(strFileNameAndPath, strReportName, strReportingPath)
    ' COR.Reporting.ReportingServiceInterface.CreateThisReport("c:\path\to\file\xy.rdl", "xy", "/COR")
    Public Shared Sub CreateThisReport(ByVal strFileNameAndPath As String, ByVal strReportName As String, ByVal strReportingPath As String, Optional ByVal bOverwrite As Boolean = True)
        Dim rs As ReportingService2005 = New ReportingService2005
        rs.Credentials = ReportingServiceInterface.GetMyCredentials(strCredentialsURL)
        rs.Timeout = ReportingServiceInterface.iTimeout
        rs.Url = ReportingServiceInterface.strReportingServiceURL


        Dim btBuffer As Byte() = Nothing

        Dim rsWarnings As Warning() = Nothing
        Try
            Dim fstrStream As System.IO.FileStream = System.IO.File.OpenRead(strFileNameAndPath)
            btBuffer = New [Byte](fstrStream.Length) …
Run Code Online (Sandbox Code Playgroud)

ssl web-services ssl-certificate reportingservices-2005 ssrs-2008

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

Python:有没有理由*不*缓存对象的哈希?

我写了一个类,其.__hash__()实现需要很长时间才能执行.我一直在考虑缓存它的哈希值,并将其存储在一个变量中,._hash因此该.__hash__()方法只会返回._hash.(将.__init__()在第一次或第一次结束时计算.__hash__().)

我的理由是:"这个对象是不可变的 - >它的哈希值永远不会改变 - >我可以缓存哈希值."

但现在让我思考:你可以对任何可清洗对象说同样的话.(除了散列为其id的对象外.)

那么有没有理由缓存对象的哈希值,除了哈希计算速度非常快的小对象?

python hash caching

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

有这样的设计模式吗?怎么称呼它?

我有这样的设计:

public interface MyInterface {
    public abstract List<Sth> getSth();
}

public class MyConcreteImplementation implements MyInterface {
    private ConcreteSth mSth = new ConcreteSth();

    public List<Sth> getSth(){
        return mSth.getSth(additionalParams); 
    }
}
Run Code Online (Sandbox Code Playgroud)

上面代码的目的是提供从其他类调用的统一方法.

这可以称为模式吗?如果是这样如何命名呢?

java provider design-patterns naming-conventions wrapper

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

加载x86或x64程序集

我有两个版本的System.Data.SQLite.DLL - 用于x86和x64平台.x86版本保留在应用程序文件夹中,x64版本保留在appFolder\x64文件夹中.该应用程序编译为AnyCPU.如何根据Windows平台加载所需的SQLite版本?

.net c# 64-bit x86

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

如何更改事件分配的方法?

我正在获取具有某个属性的所有事件,并且我想修改这些事件,添加对另一个方法的调用.

var type = GetType();
var events = type.GetEvents().Where(e => e.GetCustomAttributes(typeof(ExecuteAttribute), false).Length > 0);

foreach (var e in events)
{
    var fi = type.GetField(e.Name, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField);
    var d = (Delegate)fi.GetValue(this);
    var methods = d.GetInvocationList();
    foreach (var m in methods)
    {
        var args = e.EventHandlerType.GetMethod("Invoke").GetParameters().Select(p => Expression.Parameter(p.ParameterType, "p")).ToArray();
        var body = m.Method.GetMethodBody();

        /**

        TODO:

        Create a new method with the body of the previous
        and add a call to another method

        Remove current method
        Add the new created …
Run Code Online (Sandbox Code Playgroud)

.net c# reflection

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

将应用程序图标和窗口图标设置为Windows 7友好图标

我使用.net 4.0在Visual Studio 2010中创建了一个WPF项目

我已经创建了一个具有许多不同大小和格式的图标,从16x16 4位BMP到256x256 24位BMP.我将它设置为应用程序属性页中的程序图标,并作为WPF窗口中图标的窗口图标.

这很有用.图标显示在所有预期位置,但是,似乎总是使用较低分辨率图像之一.在任务栏中,它似乎使用16x16图像.在文件夹中,如果您查看exe文件并将其设置为超大图标,则它会显示为一个小图像,周围有很多白色空间,而不是选择大图标.即使我将其设置为256x256图标作为唯一的图标,它似乎将其缩小,然后将其放在中间,周围有很多空白区域.

c# windows wpf icons visual-studio-2010

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