小编use*_*878的帖子

从父母发送信号给孩子

我正在使用http://www.code2learn.com/2011/01/signal-program-using-parent-child.html网站上的这个教程,并试图了解为什么信号没有被孩子收到?

这是代码:

#include <stdio.h>  
#include <signal.h>
#include <stdlib.h>  
void sighup(); /* routines child will call upon sigtrap */  
void sigint();  
void sigquit();  
void main()  
{ int pid;  
    /* get child process */  
    if ((pid = fork()) < 0) {  
        perror("fork");  
        exit(1);  
    }  
    if (pid == 0)  
    { /* child */  
        signal(SIGHUP,sighup); /* set function calls */  
        signal(SIGINT,sigint);  
        signal(SIGQUIT, sigquit);  
        for(;;); /* loop for ever */  
    }  
    else /* parent */  
    { /* pid hold id of child */ …
Run Code Online (Sandbox Code Playgroud)

c linux fork signals ipc

6
推荐指数
1
解决办法
1万
查看次数

如何将浮点数转换为时分秒?

我有浮点值,我试图将它们转换为小时:分钟:秒,但我失败了。我已经关注了以下帖子:

将浮点数转换为 hh:mm 格式

例如,我有一个浮点格式的值:

time=0.6 

result = '{0:02.0f}:{1:02.0f}'.format(*divmod(time * 60, 60))
Run Code Online (Sandbox Code Playgroud)

它给了我输出:

00:36 
Run Code Online (Sandbox Code Playgroud)

但实际上它应该像“00:00:36”。我如何得到这个?

python time floating

2
推荐指数
1
解决办法
3万
查看次数

如何在ubuntu中创建多个文件

为什么这段代码不能写入不同的文件?

---文件名:"file.c".C

  int main(){
  // skipped rest of the code
  FILE * pfile;
  while(i<25)
  {
        sprintf(mytext,"%d.txt", i); // trying to make mytext1.txt, mytext2.txt ...
        pfile = fopen ("mytextd.txt","w"); // trying to write in each files "confuse here"
        printf("eneter in server recieve");
        if(pfile != NULL)
        {
    //    while(i<25)
    //    {
            read(connfd,sendBuff,sizeof(sendBuff));
            fputs(sendBuff,pfile);
            fputs(sendBuff,stdout);
            i++;
    //    } 
          fclose (pfile);
        }
    }
  }
Run Code Online (Sandbox Code Playgroud)

c ubuntu

1
推荐指数
1
解决办法
119
查看次数

自定义复选框:如何检查复选框是否被选中

我使用这个制作了自定义复选框:

在此处输入链接描述

也可在 stackoverflow 上找到:在此处输入链接描述

但我正在尝试检查框是否被交叉检查,但我失败了 bcz jquery 没有显示任何内容。

$(document).ready(function () {
    var ckbox = $('#demo_box_2');

    $('#demo_box_2').on('click',function () {
        if (ckbox.is(':checked')) {
            alert('You have Checked it');
        } else {
            alert('You Un-Checked it');
        }
    });
});
Run Code Online (Sandbox Code Playgroud)
input[type=checkbox].css-checkbox { position: absolute;  overflow: hidden;  clip: rect(0 0 0 0);  height:1px;  width:1px;  margin:-1px;  padding:0; border:0; } 
input[type=checkbox].css-checkbox + label.css-label { padding-left:20px; height:15px;  display:inline-block; line-height:15px; background-repeat:no-repeat; background-position: 0 0; font-size:15px; vertical-align:middle; cursor:pointer; } 
input[type=checkbox].css-checkbox:checked + label.css-label { background-position: 0 -15px; }  .css-label{ background-image:url(http://csscheckbox.com/checkboxes/lite-x-red.png); } …
Run Code Online (Sandbox Code Playgroud)

html css jquery

1
推荐指数
1
解决办法
988
查看次数

css,jquery调整可拖动div之间的线

我画了一条连接可拖动 div 的线。但是,当 div 被拖动时,该线失去了它的源点和目标点(即从一个 div 到另一个 div)。我的目标是以这样一种方式设置线,它不应该从任何 div 中丢失它的边缘,并且无论我在何处拖动 div,它都会不断动态更新自身,即高度、旋转、位置。

抱歉英语不好。请帮忙.....!这是我的代码

var coordinates = function(element) {
  element = $(element);
  var top = element.position().top;
  var left = element.position().left;

  //--------------line------------------------------
  var length = Math.sqrt(((left) * (left)) + ((top) * (top)));
  var angle = Math.atan2(top, left) * 180 / Math.PI;
  var transform = 'rotate(' + angle + 'deg)';

  $('#results').text('X: ' + left + ' ' + 'Y: ' + top).attr('style', 'margin-left:' + left + 'px');
  //$('#line1').attr('style', "margin-left:"+left+"px;margin-top:"+top+"px;height:"+(parseInt(100+top))+"px;transform:"+transform+";width:"+length+"px;");

  $('#line1').attr('style', "transform:" + transform + …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

1
推荐指数
1
解决办法
525
查看次数

如何使用正则表达式拆分字符串和日期

这篇文章更接近我的问题,但它确实是这样,我有希望:

如何将字符串拆分为文本和数字?

我有一个字符串,如下所示:

'Legal Leaves 2017'
Run Code Online (Sandbox Code Playgroud)

我试图通过使用这种技术分裂成字符串和年份:

import re
match = re.match(r"([a-z]+)([0-9]+)", 'Legal Leaves 2017', re.I)
match.groups()
Run Code Online (Sandbox Code Playgroud)

但我没有得到任何结果,这意味着我的正则表达式不正确.请帮助.

python regex string split

0
推荐指数
1
解决办法
193
查看次数

标签 统计

c ×2

css ×2

html ×2

jquery ×2

python ×2

floating ×1

fork ×1

ipc ×1

javascript ×1

linux ×1

regex ×1

signals ×1

split ×1

string ×1

time ×1

ubuntu ×1