我将数据存储在具有5个区域服务器的hbase中.我使用url的md5哈希作为我的行键.目前,所有数据仅存储在一个区域服务器中.所以我想预先拆分区域,以便数据在所有区域服务器上统一分布,这样数据将统一到达每个区域服务器.我想将数据拆分为行键的第一个字符.第一个字符是从0到f(16个字符).就像rowkey从0到3开始的数据将在第一个区域服务器中,3-6在第二个,6-9在第3个,ad在第4个,df在第5个.我该怎么做 ?
根据Linux中的管道方法,第一个命令的输出应该被视为第二个命令的输入.因此,当我这样做时which cp | ls -l,应将其视为ls -l $(which cp)
但输出显示其他东西.
为什么这样 ?
这是我的示例日志文件。http://pastebin.com/DwWeFhJk。
当我在做
tail -f log | awk '{if (NF>3) {print $1}; }'
Run Code Online (Sandbox Code Playgroud)
我得到的结果是正确的
64.242.88.10
64.242.88.10
64.242.88.10
64.242.88.10
64.242.88.10
64.242.88.10
64.242.88.10
64.242.88.10
64.242.88.10
64.242.88.10
Run Code Online (Sandbox Code Playgroud)
但是当我这样做时:
tail -f log |
awk '{if (NF>3) {print $1}; }' |
awk '{print $1}'
Run Code Online (Sandbox Code Playgroud)
我没有得到任何输出。甚至没有输出的情况下
tail -f log | awk '{if (NF>3) {print $1}; }' | grep "64"
Run Code Online (Sandbox Code Playgroud)
我不明白为什么第一个的输出awk没有作为第二个awk/grep管道之后的输入传递。
我正在使用以下代码将图像转换为 byte[]。
public static byte[] extractBytes (String ImageName) throws IOException {
ByteArrayOutputStream baos=new ByteArrayOutputStream();
BufferedImage img=ImageIO.read(new File(ImageName));
ImageIO.write(img, "jpg", baos);
return baos.toByteArray();
}
Run Code Online (Sandbox Code Playgroud)
现在当我测试我的代码时:
public static void main(String[] args) throws IOException {
String filepath = "image_old.jpg";
File outp=new File(filepath);
System.out.println("Size of original image="+outp.length());
byte[] data = extractBytes(filepath);
System.out.println("size of byte[] data="+data.length);
BufferedImage img = ImageIO.read(new ByteArrayInputStream(data));
//converting the byte[] array into image again
File outputfile = new File("image_new.jpg");
ImageIO.write(img, "jpeg", outputfile);
System.out.println("size of converted image="+outputfile.length());
}
Run Code Online (Sandbox Code Playgroud)
我得到了非常奇怪的结果:
Size of original …Run Code Online (Sandbox Code Playgroud) 根据https://www.ics.uci.edu/~pattis/ICS-33/lectures/complexitypython.txt,dict.clear ()的时间复杂度为O(1)。
据我所知, dict.clear() 与分配 dict = {} 不同,因为 dict.clear() 对同一个字典进行更改,而 dict = {} 创建一个新的字典。
现在,如果 dict.clear() 正在清除同一个 dict 对象,那么它如何在 O(1) 内完成它。
正如 signal(7) 的手册页中提到的,
Interruption of system calls and library functions by signal handlers
If a signal handler is invoked while a system call or library function call is blocked, then either:
* the call is automatically restarted after the signal handler returns; or
* the call fails with the error EINTR.
Which of these two behaviors occurs depends on the interface and whether or not the signal handler was established using the SA_RESTART flag (see sigaction(2)). The details vary across …Run Code Online (Sandbox Code Playgroud) 我读过了:
进程切换是从一个进程到另一个进程的上下文切换。它涉及切换所有流程抽象和资源,以支持属于新流程的抽象和资源。最值得注意和最昂贵的是,这意味着切换存储器地址空间。这包括内存地址,映射,页表和内核资源,这是一个相对昂贵的操作。
也:
上下文是任何时间点的CPU寄存器和程序计数器的内容。
当内核(即操作系统的核心)针对CPU上的进程(包括线程)执行以下活动时,可以更详细地描述上下文切换:(1)暂停一个进程的进程并存储进程该进程在内存中某个位置的CPU状态(即上下文),(2)从内存中检索下一个进程的上下文,并将其恢复到CPU的寄存器中,(3)返回到程序计数器指示的位置(即,返回到中断该过程的代码行)以恢复该过程。
由于每个进程的VAS都是独立的,并且最大容量为4GB,如果进程进行上下文切换,进程的整个VAS是否会加载到CPU上下文中?
另外,由于每个进程都有单独的页表,因此如果进行上下文切换,该页表是否也被带入CPU上下文中?
如果否,那么为什么进程上下文切换比线程上下文切换慢(线程共享相同的VAS)?
linux multithreading context-switch linux-kernel multitasking
我的数据是这样的:
data1_qqq_no_abc_ccc
data1_qqq_abc_ccc
data2_qqq_no_abc_ccc
data2_qqq_abc_ccc
data3_qqq_no_abc_ccc
data4_qqq_no_abc_ccc
data4_qqq_abc_ccc
Run Code Online (Sandbox Code Playgroud)
...
现在我想获取数据具有子串_no_abc_ccc的字段,但没有_abc_ccc.在上面的例子中,它的数据3
我正在尝试为它创建一个查询.粗糙的是
select SUBSTRING_INDEX(name, 'abc', 1)
from table1
where SUBSTRING_INDEX(name, 'abc', 1) not LIKE "%no"
and NOT IN (select SUBSTRING_INDEX(name, '_no_abc', 1)
from table
where name LIKE "%no_abc");
Run Code Online (Sandbox Code Playgroud) linux ×4
bash ×2
linux-kernel ×2
pipe ×2
awk ×1
command-line ×1
dictionary ×1
hadoop ×1
hbase ×1
image ×1
java ×1
kernel ×1
ls ×1
multitasking ×1
mysql ×1
python ×1
signals ×1
sql ×1
subquery ×1
system-calls ×1
tail ×1