我正在尝试使用以下代码加密一些数据:
public static byte[] EncryptString(byte[] input, string password)
{
PasswordDeriveBytes pderiver = new PasswordDeriveBytes(password, null);
byte[] ivZeros = new byte[8];
byte[] pbeKey = pderiver.CryptDeriveKey("RC2", "MD5", 128, ivZeros);
RC2CryptoServiceProvider RC2 = new RC2CryptoServiceProvider();
byte[] IV = new byte[8];
ICryptoTransform encryptor = RC2.CreateEncryptor(pbeKey, IV);
MemoryStream msEncrypt = new MemoryStream();
CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write);
csEncrypt.Write(input, 0, input.Length);
csEncrypt.FlushFinalBlock();
return msEncrypt.ToArray();
}
Run Code Online (Sandbox Code Playgroud)
但是,当它到达初始化我的CryptoStream对象时,它会抛出以下错误:
"Stream不支持寻求." 为了澄清,上面的代码中没有错误处理,所以只是运行它不会"破坏",坚持.但是,单步执行代码,CryptoStream对象一旦初始化就会在其属性中显示此错误.
为什么是这样?我怎么能避免它呢?
我有一个A类并编写一个子类B.A只有一个构造函数是参数化的.B必须调用A的超级构造函数.现在我想使用Object作为参数.该对象应该调用B的方法.因此参数对象必须保存B的引用或必须是内部类.
public B(){
super.(new parameter(this))
}
Run Code Online (Sandbox Code Playgroud)
现在当我想调用构造函数时... Eclipse说:
在显式调用构造函数时,不能引用'this'或'super'
我唯一能看到的就是一个set方法,将"this"-instance注入参数对象.我不想编辑超级班.
你有没有看到更好的方法呢?
得到了我需要修改的#.net应用程序.此刻的查询有效地做到了这一点:
select * from contract where contractnum = :ContractNum
Run Code Online (Sandbox Code Playgroud)
(非常简化,只是为了表明我们正在使用=和一个参数)
该参数从C#app上的Settings.Settings文件中读取,并且其中包含一个字符串.我需要修改它以包含多个合同,所以我想我可以将SQL更改为:
select * from contract where contractnum in (:ContractNum)
Run Code Online (Sandbox Code Playgroud)
但无论我如何格式化参数中的字符串,都不会返回任何结果.
有没有办法让oracle用参数做一个IN?
任何帮助表示感谢,谢谢大家.
基本上,我有dev分支,我喜欢做的是在我实现某些东西时创建一个功能分支,然后将其合并.因此发生以下情况
a
b
c
d - dev
/
e
f - feature
Run Code Online (Sandbox Code Playgroud)
由于dev不是一个头,是否仍然可以将dev设置为dev和feature指向f?
我很确定git可以做到这一点很好,但似乎无法说服Mercurial这样做......
任何人都可以帮忙吗?
我想使用嵌入式Jetty 7作为端点.这是我试过的:
public class MiniTestJetty {
@WebService(targetNamespace = "http")
public static class Calculator {
@Resource
WebServiceContext context;
public int add(int a, int b) {
return a + b;
}
}
public static void main(String[] args) throws Exception {
int port = 8080;
Server server = new Server(port);
Calculator calculator = new Calculator();
Endpoint.publish("http://localhost:" + port + "/calc", calculator);
server.start();
server.join();
}
Run Code Online (Sandbox Code Playgroud)
}
但我无法确定这是否真的使用Jetty而不是默认的sun HttpServer.
一篇博客提到
System.setProperty("com.sun.net.httpserver.HttpServerProvider",
"org.mortbay.jetty.j2se6.JettyHttpServerProvider");
Run Code Online (Sandbox Code Playgroud)
但是在Jetty 7中似乎没有这样的HttpServerProvider.
感谢任何帮助,Axel.
作为ASP.NET MVC 2 Beta 2更新的一部分,默认情况下不允许JSON GET请求.看来您需要在从控制器返回对象之前将JsonRequestBehavior字段设置为.JsonRequestBehavior.AllowGetJsonResult
public JsonResult IsEmailValid(...)
{
JsonResult result = new JsonResult();
result.Data = ..... ;
result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
return result;
}
Run Code Online (Sandbox Code Playgroud)
这背后的原因是什么?如果我使用JSON GET尝试进行远程验证,我应该使用不同的技术吗?
我们在网站上有一个很大的应用程序,我们有一些链接,比如蓝色链接,就像这个网站上的蓝色链接一样.现在我想做一些其他的链接,但颜色较浅.显然我只能通过添加CSS文件中的十六进制代码来做,但我们的网站允许用户决定他们想要什么颜色的自定义配置文件/网站(如Twitter).
所以,我的问题是:我们可以减少百分比的颜色吗?
我们假设以下代码是CSS:
a {
color: blue;
}
a.lighter {
color: -50%; // obviously not correct way, but just an idea
}
Run Code Online (Sandbox Code Playgroud)
要么
a.lighter {
color: blue -50%; // again not correct, but another example of setting color and then reducing it
}
Run Code Online (Sandbox Code Playgroud)
有没有办法减少百分比的颜色?
爆炸COM对象进行调试的正确方法是什么?我有一个返回多级对象的第三方函数.文档是不存在的,所以我希望能够回显对象的所有内容或在Komodo IDE中调试它.
科莫多只是说对象而已.也许转换为数组?
我知道一些现有的选项,比如$com->Status,但是有更多的变量返回,我想知道它们是什么.
我正在使用SCP将文件上传到远程服务器,但在这样做之前,查看该文件是否存在的正确方法是什么?
我在div中有一个图像.我需要添加一个水印效果,或者基本上是另一个图像,超过div的图像.我怎么能用css做到这一点?
示例代码:
<div id="image">
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
#image {
background:url(images/images.png) no-repeat;
}
Run Code Online (Sandbox Code Playgroud) c# ×2
css ×2
java ×2
asp.net ×1
asp.net-mvc ×1
branch ×1
com ×1
constructor ×1
cryptography ×1
encryption ×1
explode ×1
file-upload ×1
jax-ws ×1
json ×1
komodo ×1
mercurial ×1
merge ×1
net-ssh ×1
object ×1
oracle ×1
oracle10g ×1
parameters ×1
php ×1
ruby ×1
scp ×1
sql ×1