我试图从终端下载 VirtualBox。现在,当我尝试更新或输入命令时,它会读出:
tyiese@penguin:~$ apt-get update
E: Malformed entry 1 in list file /etc/apt/sources.list.d/virtualbox.list (Component)
E: The list of sources could not be read.
tyiese@penguin:~$ rm /etc/apt/sources.list.d/virtualbox.list
rm: remove write-protected regular file '/etc/apt/sources.list.d/virtualbox.list'? Y
rm: cannot remove '/etc/apt/sources.list.d/virtualbox.list': Permission denied
Run Code Online (Sandbox Code Playgroud)
我确实尝试删除该文件 - 我认为 - 但是,正如您所看到的那样,它未被接受。
我正在尝试像下面这样运行 docker。但是即使我安装了纱线它仍然不起作用。运行 rails: 时出错yarn not installed
。
Dockerfile
:
FROM rails:on-build
EXPOSE 3000
CMD [ "rails" , "s" , "-b" , "0.0.0.0" , "-p", "3000" ]
Run Code Online (Sandbox Code Playgroud)
rails/Dockerfile
:
FROM ruby:2.6.2
RUN apt-get update -y && apt-get install -y build-essential libpq-dev nodejs sqlite3
ONBUILD COPY app /opt/app
ONBUILD WORKDIR /opt/app
ONBUILD EXPOSE 3000
ONBUILD RUN bundle install
ONBUILD RUN rake db:migrate
ONBUILD RUN rake db:seed
Run Code Online (Sandbox Code Playgroud)
run.sh
:
docker-machine create -d virtualbox Char
eval $(docker-machine env Char)
docker build -t rails:on-build …
Run Code Online (Sandbox Code Playgroud) 如何使用C ++语言在tmp文件夹中创建一个临时文件夹。
我有3卷。Leopard,Development和10.6(在Mac OS X中),我想在当前主目录中创建一个临时目录。
这是我的代码。我对这条线感到困惑char* tempdir = "/Volumes/Development/NewFolder.XXXXXX"
:
if (!mkdtemp(tempdir))
fprintf(stderr, "Not able to create directory");
Run Code Online (Sandbox Code Playgroud) 我遇到了一个奇怪的问题.由于某种原因多个|| 语句,即使除以逗号和括号也不起作用.我期望工作的最后一件事是&语句,它要求满足两个条件,但在我的情况下,它适用于一个条件,就好像它是一个OR语句.
有人请向我解释为什么会这样.我很迷茫.
作品:
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
string quest;
quest = "Where is my dog?";
string::iterator m;
vector<string>question;
string t;
for(m = quest.begin(); m != quest.end(); m++)
{
if(*m != ' ' & *m != ',' & *m != '?' & *m != '.') //works with & and &&
{
t.push_back(*m);
}
else
{
cout << t << endl;
question.push_back(t);
t.clear();
}
}
}
Run Code Online (Sandbox Code Playgroud)
不起作用:
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{ …
Run Code Online (Sandbox Code Playgroud) 我想将String转换"1B4322C2"
为字节,但问题是,如果我使用getBytes()
它将它转换为字符串的长度加倍的字节,我想将它们转换为字符串长度的一半.
例如,上面字符串的输出应该是 {0x1B , 0x43, 0x22, 0xC2}
谢谢
我有以下代码:(只是用于加密/散列的测试文件)
<!doctype html>
<html>
<head></head>
<body>
<?php
error_reporting('off');
if (isset($_POST['submit'])) {
$salt = "2bZ@<^$";
$hash = hash("sha512", $_POST['hash']);
$hash = $salt . $hash;
$hash = md5($hash);
echo $hash;
$hashLen = strlen($hash);
echo "<br>The length of the hashed word is " . $hashLen . " characters long!";
}
?>
<form action="hashed.php" method="post">
<input type="text" name="hash">
<input type="submit" value="Hash" name="submit">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这有多安全?我知道这很可能是被黑客入侵,但需要多长时间?我目前正在制作一个php/mysqli注册表,并希望尽可能安全地使用户的密码,这样黑客就需要很长时间才能破解用户的密码.为了加密它,我可以使用它,例如:
用sha512,md5(md5),加入不同的盐,两个sha512,另一个md5和另一种不同的盐来混合它!
听起来有多安全?黑客破解密码需要多长时间?请您使用非常非常安全的加密方法告诉我.此外,我想让用户使用cookie登录:需要一种安全的方式将他们的信息存储在cookie中!
提前致谢 :)
我刚刚在Ruby中看过这个视频离子符号.在视频中,似乎说分配变量会创建一个相同名称的符号,并将其指向分配中的相应对象.
我理解字符串和符号之间的区别,因为每次字符串始终引用相同的对象时,字符串会创建唯一的对象.但是,我正在努力理解变量和同名符号之间的区别.
例如,如何:
var = 55
不同于:
:var = 55
我目前正在尝试制作类似于master password 的我自己的密码管理器应用程序,它使用一种算法来生成密码,因此它们不必存储在客户端计算机上或在线。
为了实现这一点,我决定使用使用CryptoSwift库的 ChaCha20 密码算法。这是我目前拥有的代码(OS X 应用程序):
import Cocoa
import CryptoSwift
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
func applicationDidFinishLaunching(aNotification: NSNotification) {
do
{
let UInt8String = "Test".utf8
print("UTF8 string: \(UInt8String)")
let UInt8Array = Array(UInt8String)
print("UTF8 array: \(UInt8Array)")
let encrypted = try ChaCha20(key: "Key", iv: "Iv")!.encrypt(UInt8Array)
print("Encrypted data: \(encrypted)")
} catch _ {
}
}
func applicationWillTerminate(aNotification: NSNotification) {
// Insert code here to tear down your application
}
}
Run Code Online (Sandbox Code Playgroud)
我得到错误的那一行是 …
我试图看看包含负数的两个输入数字(整数)是否均匀地进入6(余数为0).这是我正在尝试的代码.
if((in1)%6 == 0 && (in2)%6 == 0){
printf("Divisible: both\n");
}
else if((in1)%6 == 0 && (in2)%6 > 0){
printf("Divisible: only %i\n",in1);
}
else if((in1)%6 > 0 && (in2)%6 == 0){
printf("Divisible: only %i\n",in2);
}
else{
printf("Divisible: neither\n");}
Run Code Online (Sandbox Code Playgroud)
这适用于所有正整数,但对于任何负数,打印的代码总是"可分割:不"任何帮助我如何显示正整数和负数可被6整除,余数为0将是非常有帮助的
我想格式化用户帐户的输出,/etc/passwd
以仅显示名称,角色和目录路径,所有这些都用逗号分隔.我知道这应该很简单,但对于我的生活,我无法弄清楚如何在某些冒号之间展示.(注意这应该适用于任何用户名,而不仅仅是ex)
例如grep joe /etc/passwd
:
joe:x:1001:1001:System Admin:/home/joe:/bin/bash
Run Code Online (Sandbox Code Playgroud)
期望的输出:
joe, System Admin, /home/joe
Run Code Online (Sandbox Code Playgroud)
谢谢!