假设我正在异步使用c ++文件流.我的意思是从不使用std :: flush或std :: endl.我的应用程序将大量数据写入文件并突然崩溃.缓存系统中剩余的数据是否刷新到磁盘,还是丢弃(丢失)?
这是一个失败的示例:
#!/usr/bin/perl -w
# client.pl
#----------------
use strict;
use Socket;
# initialize host and port
my $host = shift || 'localhost';
my $port = shift || 55555;
my $server = "10.126.142.22";
# create the socket, connect to the port
socket(SOCKET,PF_INET,SOCK_STREAM,(getprotobyname('tcp'))[2])
or die "Can't create a socket $!\n";
connect( SOCKET, pack( 'Sn4x8', AF_INET, $port, $server ))
or die "Can't connect to port $port! \n";
my $line;
while ($line = <SOCKET>) {
print "$line\n";
}
close SOCKET or die "close: $!";
Run Code Online (Sandbox Code Playgroud)
有错误: …
以下测试被拒绝:
CL-USER> (apply 'and '(t t t))
; Evaluation aborted on #<CCL::CALL-SPECIAL-OPERATOR-OR-MACRO #x3020013A1F3D>
Run Code Online (Sandbox Code Playgroud)
我的第一个回答是试图将对and特殊运算符的调用封装成lambda或定义我自己的定义,但当然它无法工作.因为它会导致在&rest参数上调用apply函数'and...你将如何解决这个问题?
我有兴趣知道emacs选定区域中的非空白字符数.怎么做?我没有找到任何"内置"功能.我想我需要实现自己的elisp函数.我不知道如何做到这一点.任何帮助或材料表示赞赏.
我正在关注elisp的介绍.第一章.这是我从html书中复制/粘贴的两个例子.我已经评估了两种形式,在这里我复制/粘贴返回的值和输出作为*Messages*缓冲区的副作用(我不知道如何复制迷你缓冲区内容).
第一种形式
(let ((zebra 'stripes)
(tiger 'fierce))
(message "One kind of animal has %s and another is %s."
zebra tiger))
Run Code Online (Sandbox Code Playgroud)
来自*消息*的输出
One kind of animal has stripes and another is fierce.
#("One kind of animal has stripes and another is fierce." 23 30 (fontified t))
Run Code Online (Sandbox Code Playgroud)
第二种形式
(let ((birch 3)
pine
fir
(oak 'some))
(message "Here are %d variables with %s, %s and %s value."
birch pine fir oak))
Run Code Online (Sandbox Code Playgroud)
*Messages*的输出是:
Here are 3 variables with nil, nil and some value.
"Here …Run Code Online (Sandbox Code Playgroud) 到目前为止,我的应用程序请求其配置文件中的隔离 cpu 列表。然后它pthread_setaffinity_np()用来强制在那种CPU上运行。通常,制作配置文件的人会进入该文件/boot/grub/menu.lst并选择正确的条目,以便了解当前的隔离 cpu 列表是什么。
title CentOS (2.6.32-431.5.1.el6.x86_64)
root (hd0,1)
kernel ... isolcpus=4-15
Run Code Online (Sandbox Code Playgroud)
因此,我想避免人们必须在配置文件中手动输入该列表。我的应用程序是否有可能以编程方式获取该列表?
我的项目需要一个3DES加密/解密库.你知道一个在linux上工作的实现吗?
Linux是目标平台,但我在Windows上进行基本编译/调试.因此,如果它可以在Windows上运行,可能会非常感激,而不是强制性的.
我尝试在QT中创建一个线程,可以声明,创建和启动它,但它不会触发Run函数(我可以看到通过在该函数中放置一个断点)
VT.h:
class VT : public QThread
{
public:
void Run();
};
Run Code Online (Sandbox Code Playgroud)
VT.cpp
void VT::Run()
{
..
}
Run Code Online (Sandbox Code Playgroud)
并在main.cpp中:
VT vt;
vt.Start();
// starts ok but no action
Run Code Online (Sandbox Code Playgroud)
我在VT.h中包含其他标题,它们是否阻止?有些不妥.问题?
c++ ×3
linux ×3
elisp ×2
emacs ×2
3des ×1
common-lisp ×1
cpu ×1
encryption ×1
file-io ×1
filesystems ×1
io ×1
kernel ×1
let ×1
lisp ×1
perl ×1
qt ×1
regex ×1
sockets ×1
system-calls ×1