我有一些特定日期格式的字符串,我想使用 GNU date 命令(coreutils 8.20)处理这些字符串。我可以使用 +FORMAT 字符串获取输出日期,但不能理解使用相同字符串输入的字符串。我很确定我遗漏了一些明显的东西。是什么赋予了?
teggl@mckinley { ~/scripts }$ date +%Y%m%dT%H%M%S
20131202T182052
teggl@mckinley { ~/scripts }$ date --date="20131202T182052" +%Y%m%dT%H%M%S
date: invalid date ‘20131202T182052’
Run Code Online (Sandbox Code Playgroud)
注意:我不是在寻找 awk-y 字符串解析,我需要 date 来理解输入的日期,所以它知道它是否有效(例如日期 20140231T120000 是不可能的)。
我对开发人员和用户点的这些术语感到有些困惑.例如,我在Ubuntu上.
GNU libs(https://www.gnu.org/software/libc/)默认安装,gnulib(https://www.gnu.org/software/gnulib)不是,对吧?GNU libs遵循POSIX stadard,但是:http://www.gnu.org/software/libc/manual/html_mono/libc.html#POSIX-Threads,
所以看起来,例如,pthread_create这里没有实现并实现Gnulib,对吧?Gnome glib只是第3个图书馆,对吗?但它基于GNU libs或
Gnulib?还有其他类似的图书馆吗?谢谢.
我有一个 makefile,其中有一个名为 的数组SOURCES。在这个数组中,有ac文件,也有c++文件。但是我想将该数组中的每个路径的扩展名更改为.o. 我怎么能这样做呢?我知道要将一个扩展名更改为另一个扩展名,我可以这样做:OBJECTS=$(SOURCES:.c=.o),但我也想对 c++ 文件执行此操作。
我一直在努力学习为 AMD64 处理器编写汇编代码。我一直在看 gcc 生成的代码。最终,我开始看到诸如
call *(%rax)
Run Code Online (Sandbox Code Playgroud)
操作数前面的 * 是做什么的?我正在阅读的 System V ABI 文档中出现了类似的内容,上述问题的答案将帮助我继续。以下是上下文中使用的语法示例,取自 System V ABI 文档本身:
// System V ABI suggested implementation of a
// C switch statement with case labels 0, 1, and 2,
// and a default label.
// Jump to the default case if the control variable is
// less than 0.
cmpl $0, %eax
jl .Ldefault
// Jump to the default case if the control variable is
// greater than 2.
cmp $2, %eax …Run Code Online (Sandbox Code Playgroud) 面对makefile中的以下错误
Makefile:54: *** multiple target patterns. Stop.
Run Code Online (Sandbox Code Playgroud)
makefile 的完整源代码如下
MINGW_HOME ?= C:/mingw
PRODUCTNAME ?= Jitsi
COMPANYNAME ?= jitsi.org
PRODUCTBUILDVERSION ?= 1.0.0.0
PRODUCTBUILDVERSION_COMMA ?= 1,0,0,0
TARGET_BASENAME ?= run
TARGET_DIR ?= ../../../../release/windows/tmp
ifeq ($(wildcard /bin/cygpath.*),/bin/cygpath.exe)
target.dir := $(shell cygpath --mixed "$(TARGET_DIR)")
cygwin.target.dir := $(shell cygpath --unix "$(TARGET_DIR)")
else
target.dir := $(TARGET_DIR)
cygwin.target.dir := $(TARGET_DIR)
endif
CC = $(MINGW_HOME)/bin/gcc.exe
CPPFLAGS := $(CPPFLAGS) \
-Wall -Wreturn-type \
-DPSAPI_VERSION=1 \
-DWINVER=0x0502 -D_WIN32_WINNT=0x0502 \
-I$(target.dir) \
-I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32"
LDFLAGS = -mwindows
LIBS = -ladvapi32 -lpsapi
MACHINE …Run Code Online (Sandbox Code Playgroud) 我试图将包含宏的头文件包含到我的主程序集文件中,但编译失败。
下面是我的main.S文件
#include "common.h"
BEGIN
mov $0x0E40, %ax
int $0x10
hlt
Run Code Online (Sandbox Code Playgroud)
以下是我的common.h文件:
.macro BEGIN
LOCAL after_locals
.code16
cli
ljmp $0, $1f
1:
xor %ax, %ax
/* We must zero %ds for any data access. */
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
mov %ax, %bp
/* Automatically disables interrupts until the end of the next instruction. */
mov %ax, %ss
/* We should set SP because BIOS calls may depend on …Run Code Online (Sandbox Code Playgroud) 在github/dd.c的 GNU dd 命令源代码中,
有一个 CPP(CPreProcessor) 指令#define fdatasync(fd) (errno = ENOSYS, -1),我理解正确,但是
无论我在 c 编程论坛上读到什么,它都提到表达式求值和返回的顺序在 c 中是未定义的,这意味着在 中
int i = 0; printf("%d, %d\n", i++, i++);,我们不能确定输出是0, 1或1, 0
那么 gnu-dd 程序员怎么能如此肯定地-1返回,而不是errno,
谢谢
最近我用c ++练习算法.在这里练习:poj
我发现两个非常混乱的问题.我写了一个MAZE类,在MAZE中有三个主要功能,它们是
int left_path();int right_path();int mini_path();
打印答案的函数:
void display(){
cout<<left_path()<<" "<<right_path()<<" ";
cout<<mini_path()<<endl;
}
Run Code Online (Sandbox Code Playgroud)
程序可以正常工作.我们看到函数display()可以很容易; 我这样写
void display(){
cout<<left_path()<<" "<<right_path()<<" "<<mini_path()<<endl;
}
Run Code Online (Sandbox Code Playgroud)
只有一个变化;但是程序无法工作,它就像无限循环一样.
以下是另一个问题:函数mini_path的框架是这样的
int maze::mini_path(){
ini();
queue<pair<int,int> > q;
q.push(make_pair(x,y));
while(!q.empty()){
pair<int,int> tmp=q.front();
q.pop();
int t=...;
if(E){
return t;
}
if(E){
S
}
if(E){
S
}
if(E){
S
}
if(E){
S
}
}
return -1;
}
Run Code Online (Sandbox Code Playgroud)
如果最后有"return -1",则该函数正常工作,否则函数返回随机大数.
该程序只在一个文件中,我使用枪编译器.
我没有显示总代码,因为我认为没有人想看到它们.我只是想问一下哪些问题可能导致奇怪的行为.
源代码(问题2简化):
typedef enum {LEFT=-1,RIGHT=1,UP,DOWN} direction;
ifstream fin("file_test3.txt");
class maze{
public:
maze(){input();}
int mini_path();
void input();
void display(){ …Run Code Online (Sandbox Code Playgroud) 我使用MinGW最新版本来编译以下代码.我得到了以下信息
y:/bbom/source/om0/basic/test.cpp: In static member function 'static void somecl
ass::init(class_object*)':
y:/bbom/source/om0/basic/test.cpp:68:50: error: no matching function for call to
'class_object::add_method(void (&)(object*, arch&))'
y:/bbom/source/om0/basic/test.cpp:68:50: note: candidate is:
y:/bbom/source/om0/basic/test.cpp:27:54: note: template<class p_function> void c
lass_object::add_method(typename p_function::funcion_type)
make.exe: *** [y:/bbom/bin/om0/basic/test.a] Error 1
Run Code Online (Sandbox Code Playgroud)
这是我的代码从这个问题不需要的每件事中脱掉
#include <exception>
class exception : public std::exception
{
public:
exception() {}
exception(const exception &);
~exception() throw() {}
virtual const char *what() const throw();
};
typedef unsigned id, version;
class class_object;
class object
{
public:
virtual ~object() {}
void *get_method(id);
class_object *get_class_object(); …Run Code Online (Sandbox Code Playgroud) 当从相同的输入字符串获取bas64编码的字符串时,我发现JavaScript,Groovy和Go具有相同的结果,但GNU base64略有不同.这是为什么?
JavaScript(nodejs v0.10.33):
new Buffer('Laurence Tureaud is Mr. T').toString('base64');
TGF1cmVuY2UgVHVyZWF1ZCBpcyBNci4gVA==
Run Code Online (Sandbox Code Playgroud)
Groovy(Java 8上的2.3.7):
'Laurence Tureaud is Mr. T'.bytes.encodeBase64().toString()
TGF1cmVuY2UgVHVyZWF1ZCBpcyBNci4gVA==
Run Code Online (Sandbox Code Playgroud)
去(1.4):
b64.StdEncoding.EncodeToString([]byte("Laurence Tureaud is Mr. T"))
TGF1cmVuY2UgVHVyZWF1ZCBpcyBNci4gVA==
Run Code Online (Sandbox Code Playgroud)
GNU base64(带有UTF-8术语字符集的GNU coreutils 8.12.197-032bb):
echo 'Laurence Tureaud is Mr. T' | base64
TGF1cmVuY2UgVHVyZWF1ZCBpcyBNci4gVAo=
Run Code Online (Sandbox Code Playgroud)