kernel

how to order seaborn pointplot

时光毁灭记忆、已成空白 提交于 2019-12-28 18:50:23
问题 Here's code from kaggle Titanic competition kernel: grid = sns.FacetGrid(train_df, row='Embarked', size=2.2, aspect=1.6) grid.map(sns.pointplot, 'Pclass', 'Survived', 'Sex', palette='deep') grid.add_legend() It produces wrong plot, the one with reversed colors. I'd like to know how to fix this exact code fragment . I tried adding keyword paramas to grid.map() call - order=["male", "female"], hue_order=["male", "female"] , but then plots become empty. 回答1: In the code call to grid.map(sns

Can you enter x64 32-bit “long compatibility sub-mode” outside of kernel mode?

≡放荡痞女 提交于 2019-12-28 13:34:12
问题 This might be an exact duplicate of Is it possible to execute 32-bit code in 64-bit process by doing mode-switching?, but that question is from a year ago and only has one answer that doesn't give any source code. I'm hoping for more detailed answers. I'm running 64-bit Linux (Ubuntu 12.04, if it matters). Here's some code that allocates a page, writes some 64-bit code into it, and executes that code. #include <assert.h> #include <malloc.h> #include <stdio.h> #include <sys/mman.h> // mprotect

How convert a char[] string to int in the Linux kernel?

大城市里の小女人 提交于 2019-12-28 13:23:32
问题 How convert char[] to int in linux kernel with validation that the text entered is actually an int? int procfile_write(struct file *file, const char *buffer, unsigned long count, void *data) { char procfs_buffer[PROCFS_MAX_SIZE]; /* get buffer size */ unsigned long procfs_buffer_size = count; if (procfs_buffer_size > PROCFS_MAX_SIZE ) { procfs_buffer_size = PROCFS_MAX_SIZE; } /* write data to the buffer */ if ( copy_from_user(procfs_buffer, buffer, procfs_buffer_size) ) { return -EFAULT; }

Protected Mode Keyboard Access on x86 Assembly

别等时光非礼了梦想. 提交于 2019-12-28 12:32:49
问题 I'm working on keyboard input for a very basic kernel that I'm developing and I'm completely stuck. I can't seem to find any information online that can show me the information I need to know. My kernel is running in protected mode right now, so I can't use the real mode keyboard routines without jumping into real mode and back, which I'm trying to avoid. I want to be able to access my keyboard from protected mode. Does anyone know how to do this? The only thing I have found so far is that it

How does sched_setaffinity() work?

点点圈 提交于 2019-12-28 12:09:05
问题 I am trying to understand how the linux syscall sched_setaffinity() works. This is a follow-on from my question here. I have this guide, which explains how to use the syscall and has a pretty neat (working!) example. So I downloaded the Linux 2.6.27.19 kernel sources. I did a 'grep' for lines containing that syscall, and I got 91 results. Not promising. Ultimately, I'm trying to understand how the kernel is able to set the instruction pointer for a specific core (or processor.) I am familiar

Multicast from kernel to user space via Netlink in C

Deadly 提交于 2019-12-28 07:00:50
问题 I was trying to write a simple program communicating between kernel and user space using Netlink. Basically here's what I wanted to achieve: User space program starts binding to a user defined multicast group. Insert kernel module Kernel module sends a message to this multicast group User space program receives the message Here's my code: ======User space program====== #include<stdio.h> #include<string.h> #include<stdlib.h> #include<sys/socket.h> #include<linux/netlink.h> #include<sys/types.h

What does [ N … M ] mean in C aggregate initializers?

纵饮孤独 提交于 2019-12-28 04:54:22
问题 From sys.c line 123: void *sys_call_table[__NR_syscalls] = { [0 ... __NR_syscalls-1] = sys_ni_syscall, #include <asm/unistd.h> }; sys_call_table is a generic pointer to arrays, I can see that. However what is the notation: [0 ... __NR_syscalls-1] What is the ... ? EDIT: I learned another C trick here: #include <asm/unistd.h> will be preprocessed and replaced with its content and assigned to [0 ... _NR_syscalls-1] . 回答1: It is initialization using Designated Initializers . The range based

What is path //, how is it different from /

放肆的年华 提交于 2019-12-28 04:23:08
问题 We know root directory is /, and according to posix, there is another directory // which differs from /. When you ls / and ls //, the output is the same, so as stat, however if you cd / and cd //, they are different, though the directory content are the same. That really confused me. Anyone got an answer? 回答1: From Bash FAQ: E10) Why does `cd //' leave $PWD as `//'? POSIX.2, in its description of `cd', says that *three* or more leading slashes may be replaced with a single slash when

卷积:kernel size/padding/stride

六眼飞鱼酱① 提交于 2019-12-28 03:54:11
卷积的原理 卷积尺寸变化 输出尺寸=(输入尺寸-filter尺寸+2*padding)/stride+1 宽和高都是这么计算的; 输入图片大小为200×200,依次经过一层卷积(kernel size 5×5,padding 1,stride 2),pooling(kernel size 3×3,padding 0,stride 1),又一层卷积(kernel size 3×3,padding 1,stride 1)之后,输出特征图大小为:97 计算尺寸不被整除只在GoogLeNet中遇到过。卷积向下取整,池化向上取整。 (200-5+21)/2+1 为99.5,取99 (99-3)/1+1 为97 (97-3+21)/1+1 为97 常见的: stride为1,kernel为 3 ,padding为1 卷积前后尺寸不变 stride为1,kernel为 5 ,padding为2 卷积前后尺寸不变 ———————————————— 版权声明:本文为CSDN博主「maylisa_du」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/weixin_42490152/article/details/100160864 来源: CSDN 作者: c2a2o2 链接: https://blog

图片压缩

折月煮酒 提交于 2019-12-28 03:53:02
import com . sun . image . codec . jpeg . JPEGCodec ; import com . sun . image . codec . jpeg . JPEGImageEncoder ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import java . awt . * ; import java . awt . image . BufferedImage ; import java . awt . image . ConvolveOp ; import java . awt . image . Kernel ; import java . io . File ; import java . io . FileOutputStream ; /** * @Description 图片压缩 */ public class ImgUtil { private static final Logger logger = LoggerFactory . getLogger ( ImgUtil . class ) ; public static void main ( String [ ] args ) { ImgUtil imgUtil = new