问题列表 - 第17580页

从下载的tar或zip安装gem

首先让我说我不能做宝石安装,我不知道为什么.可能是因为我住在中国和防火墙随机的东西.

所以我必须在本地安装宝石.例如,我想安装这个宝石谜语.但是这个gem下载为tar或zip,当我打开它时,它是一个文件夹而不是.gem文件.

那么该怎么办?

ruby-on-rails

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

将Cc重新绑定到Cc

我使用的是蝰蛇,我想改变它C-cC-g原来的emacs的功能.我可以重新绑定C-g使用(define-key viper-vi-global-user-map "C-g" 'keyboard-quit),但我怎么能重新绑定C-c,因为它是一个前缀键?

谢谢!

emacs viper viper-mode

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

第二部分:如何使Ruby AES-256-CBC和PHP MCRYPT_RIJNDAEL_128一起发挥得很好

这个问题是我最后一个问题的延续,关于如何使Ruby AES-256-CBC和PHP MCRYPT_RIJNDAEL_128一起发挥得很好.我现在已经开始工作,但我仍然在努力朝着另一个方向努力.PHP生成的密码似乎具有提供的所有信息,但是我无法使用Ruby代码来解密它而不会出现错误.

这是我用来生成密码的PHP代码:

$cleartext = "Who's the clever boy?";
$key = base64_decode("6sEwMG/aKdBk5Fa2rR6vVw==\n");
$iv = base64_decode("vCkaypm5tPmtP3TF7aWrug==");
$cryptogram = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $cleartext, MCRYPT_MODE_CBC, $iv);
$result = base64_encode($cryptogram);
print "\n'$result'\n";

RESULT
'JM0OxMINPTnF1vwXdI3XdKI0KlVx210CvpJllFja+GM='
Run Code Online (Sandbox Code Playgroud)

然后这是尝试在Ruby中解密:

>> cipher = OpenSSL::Cipher::Cipher.new('aes-128-cbc')
>> cipher.key = Base64.decode64("6sEwMG/aKdBk5Fa2rR6vVw==\n")
>> cipher.iv = Base64.decode64("vCkaypm5tPmtP3TF7aWrug==")
>> cryptogram = Base64.decode64('JM0OxMINPTnF1vwXdI3XdKI0KlVx210CvpJllFja+GM=')
>> cleartext = cipher.update(cryptogram)
=> "Who's the clever"
>> cleartext << cipher.final
OpenSSL::Cipher::CipherError: bad decrypt
 from (irb):100:in `final'
 from (irb):100
Run Code Online (Sandbox Code Playgroud)

令人沮丧的是,可以从加密字符串中获取整个明文.重复上述内容,但在密码中添加一个无意义的填充:

  >> cleartext = cipher.update(cryptogram + 'pad')
  => "Who's the clever …
Run Code Online (Sandbox Code Playgroud)

php ruby openssl aes mcrypt

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

将UTF-8八位字节转换为unicode代码点

我有一组UTF-8八位字节,我需要将它们转换回unicode代码点.我怎么能在python中做到这一点.

例如,UTF-8八位字节['0xc5','0x81']应转换为0x141代码点.

python unicode utf-8

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

如何知道我正在使用哪个Linux发行版?

已移至https://superuser.com/questions/80251/how-to-know-which-linux-distribution-im-using

如何知道我正在使用哪个Linux发行版?

uname -a给Linux xxxxxx.net 2.6.9-42.0.3.EL.wh1smp#1 SMP Fri 8月14日15:48:17 MDT 2009 i686 i686 i386 GNU/Linux我怎么知道这是Ubuntu/Debian/Fedora或者红帽?

我使用/etc/init.d/serviced restart重启服务器,似乎不是Redhat系列

更新:

[~]$ cat /etc/issue
cat: /etc/issue: No such file or directory
[~]$ cat /etc/issue.net
cat: /etc/issue.net: No such file or directory
[~]$ lsb_release -a
-sh: lsb_release: command not found
[~]$ cat /etc/*-release
cat: /etc/*-release: No such file or directory
[~]$ cat /etc/*-version
cat: /etc/*-version: No such file or directory
[~]$ cat /etc/*release
cat: /etc/*release: No such file or directory
[~]$ cat /etc/*_release …
Run Code Online (Sandbox Code Playgroud)

linux distribution version

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

如何将图像转换为iPhone中的数据

任何人都可以告诉我如何将图像(PNG)转换为iPhone中的数据

iphone

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

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

"我的其他车是cdr"是什么意思?

任何精通lisp的人都可以向我解释这个笑话吗?我已经对函数式编程语言进行了一些阅读,并且知道CAR/CDR意味着地址/减量寄存器的内容,但我仍然不太了解幽默.

lisp cons cdr

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

您对Telerik Extensions for MVC有何看法?

我已经开始使用Telerik Extensions for MVC.它们没有无缝地集成到我当前的项目中,但我可以重新组织它以适应它.

但是,我想知道它最终是否值得.我一直在寻找扩展的评论,我没有看到太多.所以我在这里问.

在他们的网站上他们声称:

您可以使用轻量级,语义呈现的扩展来为您的Web应用程序实现前所未有的性能,该扩展完全利用没有回发,没有ViewState和没有页面生命周期的ASP.NET MVC模型.

所以我很好奇,您对Telerik Extensions for MVC有什么看法?

model-view-controller asp.net-mvc telerik

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

会话变量,Web服务,ASP.NET和C#

我遇到了ASP.NET的会话变量和Web服务代理对象的问题.我可以访问我在实际.asmx文件中创建的任何数据,但添加数据"通过"会话变量导致绝对没有任何事情发生.

我的目标很简单,我想创建一个"几乎购物车".客户在此文本框中输入标题,然后将其发送到Web服务.在主页中调用Web服务,它会抓取一个数组列表,其中包含客户请求的"标题".

数据在下拉框中可见,标签存储所有项目的总成本(我现在不担心成本).

问题是,无论何时我调用Web服务方法,绝对没有任何反应.

有问题的守则:

Basket.asmx

public class basket  : System.Web.Services.WebService {

ArrayList reservations = new ArrayList();
double total = 0;

public basket()
{
    reservations.Add("Extreme Test Data");
    reservations.Add("Moar Test Data");
}

[WebMethod]
public string[] getReservations()
{
    //This may be part of the issue, still not sure.

    return (string[])reservations.ToArray(typeof( string));
}
[WebMethod]
public string toString()
{
    return reservations[reservations.Count - 1].ToString();
}


[WebMethod]
public double getTotal()
{
    return total;
}

[WebMethod]
public void addCost(double price)
{
    total = total + price;
} …
Run Code Online (Sandbox Code Playgroud)

c#

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