我有一个已经重新开发的网站,网址完全不同.我有数百或301要做(原始网址很多很长 - 我不知道为什么)我得到一些有趣的结果,其中一些重定向正在发生,其他重定向,但奇怪的URL.我想知道是否有特定订单301需要进入.例如:
redirect 301 /News/Smart-Site-Waste-Management.aspx http://...
redirect 301 /News/tabid/96/tagid/68/damaged-doors.aspx http://...
redirect 301 /News/tabid/96/EntryId/91/Smart-Site-Waste-Management.aspx http://...
redirect 301 /News/tabid/96/EntryId/156/Plastic-Surgeon-hits-the-headlines.aspx http://...
redirect 301 /News/RepairoftheWeek/tabid/194/tagid/78/Gallery/RepairoftheWeek/tabid/194/EntryId/221/Scratched-laminate-floor-repair.aspx http://...
Run Code Online (Sandbox Code Playgroud)
所以我的实际问题是,"较小的"网址(目录级别较低的网址)是否应该低于此顺序且更具体的网址更高?我的直觉告诉我,如果设置如上,所有这些URL将指向FIRST中指定的新链接,因为它们都以"News /"开头.这就是我在实践中看到的.
我有问题boost::regex::regex_match
.我打开工作BOOST_REGEX_MATCH_EXTRA
.
是)我有的:
(这是我的问题的一个简单例子,而不是一个真正的任务)
string input1= "3 4 5";
string input2= "3 4 7";
Run Code Online (Sandbox Code Playgroud)
我想得到什么:
list output1= [3 4 5];
list output2= []; //not matched
Run Code Online (Sandbox Code Playgroud)
正则表达式:
(这工作正常)
((?<group>[0-6])[ ]?)*
Run Code Online (Sandbox Code Playgroud)
output1:what["group"]=5
和what["group"].captures()= [3, 4, 5]
输出2: not matched
问题是:
我需要从正则表达式的多个部分收集数据到一个组.
我试过了:
((?<group>[0-6])[ ])*(?<group>[0-6])
Run Code Online (Sandbox Code Playgroud)
output1:what["group"]=4
和what["group"].captures()=[3, 4]
输出2: not matched
好的,我明白了.它没有看到第二组声明.
我试过了:
((?<group>[0-6])[ ])*(?&group)
Run Code Online (Sandbox Code Playgroud)
output1:what["group"]=4
和what["group"].captures()= [3, 4, 4]
输出2: not matched
我有一个以上的组,所以token_iterator无法帮助我.
表达式应该在配置文件中配置.静态Xpressive不能使用.
码
while (1)
{
keycode = key_hook();
if (keycode == SPACE || keycode == BKSPACE)
{
render_again = 1;
}
if (keycode == ESC)
break;
if (render_again)
{
render_again = 0;
render(all);
}
dprintf(1, ""); //I have no idea why this prevents the program from freezing
}
int key_hook()
{
char buffer[4];
read(0, buffer, 4);
return (*(unsigned int *)buffer);
}
Run Code Online (Sandbox Code Playgroud)
好吧,所以这段代码处理重绘屏幕上的文本.某些文本行使用下划线或突出显示termcaps (tputs(tgetstr("us, NULL")......)
.一切都打印得很好,但在第一次重新绘制文本后,显然会冻结,除非dprintf/printf
存在.该key_hook
函数只是读取4 bytes
距离stdin
,并将其转换为int
.
当我开始知道每个逻辑门已经定义时,我正在学习逻辑门C
.例如,对于AND
逻辑门,符号是&
.因为OR
,它是|
.但我找不到MUX
芯片的符号.
那么,如果有符号MUX
,有人可以告诉我吗?如果没有,有人可以告诉我如何MUX
在C中复制芯片吗?
这就是我的数据帧的样子.最右边的列("TimeForLevelChange")是我想要的列.当给定名称的级别更改时,我想从先前级别获取最小日期,并从发生级别更改的行中取出日期并计算差异.所以在第三排,约翰的等级从1变为2,他在等级1中花了16天(2016-01-17 - 2016-01-01),然后换到等级2.
library(data.table)
dt <- fread('
Name Level Date RecentLevelChange TimeForLevelChange
John 1 2016-01-01 NA NA
John 1 2016-01-10 NA NA
John 2 2016-01-17 1->2 16
John 2 2016-01-18 NA NA
John 3 2016-01-22 2->3 5
John 4 2016-01-26 3->4 4
John 4 2016-01-27 NA NA
John 7 2016-01-29 4->7 3
Tom 1 2016-01-10 NA NA
Tom 2 2016-01-17 1->2 7
Tom 2 2016-01-18 NA NA
Tom 3 2016-01-22 2->3 5
Tom 4 2016-01-26 3->4 4
Tom 4 2016-01-27 …
Run Code Online (Sandbox Code Playgroud) 考虑以下代码:
\n#include <stdio.h>\n\nint main(void) {\n printf("%llu\\n", 18446744073709551615);\n printf("%llu\\n", 18446744073709551615ULL);\n return 0;\n}\n
Run Code Online (Sandbox Code Playgroud)\n编译(gcc -std=c18
)后,我收到以下警告:
test1.c: In function \xe2\x80\x98main\xe2\x80\x99:\ntest1.c:4:26: warning: integer constant is so large that it is unsigned\n 4 | printf("%llu\\n", 18446744073709551615);\n | ^~~~~~~~~~~~~~~~~~~~\ntest1.c:4:20: warning: format \xe2\x80\x98%llu\xe2\x80\x99 expects argument of type \xe2\x80\x98long long unsigned int\xe2\x80\x99, but argument 2 has type \xe2\x80\x98__int128\xe2\x80\x99 [-Wformat=]\n 4 | printf("%llu\\n", 18446744073709551615);\n | ~~~^ ~~~~~~~~~~~~~~~~~~~~\n | | |\n | | __int128\n | long long unsigned int\n
Run Code Online (Sandbox Code Playgroud)\nC标准第 6.4.4.1.5 节和 …
假设我需要在标志和非标志变体中都使用枚举.
选项1:我可以复制一切:
enum Color { Red, Blue, Green }
[Flags]
enum Colors {
None = 0,
Red = 1,
Blue = 2,
Green = 4
}
// use cases
Color currentColor;
Colors supportedColors;
Run Code Online (Sandbox Code Playgroud)选项2:我可以将Flags变体用于所有内容:
Colors currentColor; // ugly, since neither "None" nor "Red | Blue" should be valid
Run Code Online (Sandbox Code Playgroud)我不喜欢其中任何一个:在选项1中Color.Red
,并且Colors.Red
完全不相关,这可能需要绑定代码.另外,我必须保持两个枚举同步.选项2的缺点是显而易见的.我真正喜欢的是类似的东西
enum Colors = Flag set of Color;
Run Code Online (Sandbox Code Playgroud)
这个要求有更优雅的解决方案吗?
在处理了GUI
向后打印文本之后(Hello = olleH)
,现在我想创建一个小按钮,copy
以一种可以将其粘贴到其他任何位置的方式(例如在任何编辑器中).我正在使用一个JTextfield
被叫jtxtoutcome
.我不知道我还能说什么,我想这很准确.
这是我用来改变结果的方法Textfield:
jtxtoutcome.setText(backwards);
Run Code Online (Sandbox Code Playgroud) 我有以下字符串:
char str[] = "A/USING=B)";
Run Code Online (Sandbox Code Playgroud)
我想分获得独立的A
和B
值与/USING=
作为分隔符
我该怎么做?我知道,strtok()
但它只是被一个字符分割为分隔符。
我很好奇是否有工具或简单的方法在给定的时间间隔内连续执行某个命令,并将其输出重新打印到屏幕上的相同位置.
促使我思考它的例子是'dropbox-cli status'.手动执行:
$> dropbox-cli status
Syncing (6,762 files remaining)
Indexing 3,481 files...
$> dropbox-cli status
Syncing (5,162 files remaining)
Indexing 2,681 files...
Run Code Online (Sandbox Code Playgroud)
我在寻找:
$> tracker --interval=1s "dropbox-cli status"
Syncing (6,743 files remaining)
Indexing 3,483 files
Run Code Online (Sandbox Code Playgroud)
虚构命令"跟踪器"将阻塞,并且每两秒输出行将连续重新打印,而不是创建附加日志输出.
c ×4
.htaccess ×1
bash ×1
boost ×1
boost-regex ×1
c# ×1
c++ ×1
coding-style ×1
constants ×1
copy-paste ×1
data.table ×1
dplyr ×1
enums ×1
gcc ×1
int128 ×1
java ×1
jtextfield ×1
linux ×1
mux ×1
r ×1
redirect ×1
regex ×1
regex-group ×1
string ×1
strtok ×1
swing ×1
symbols ×1
termcap ×1
terminal ×1
tokenize ×1
unsigned ×1
zoo ×1
zsh ×1