小编Hri*_*sto的帖子

确定已终止进程的pid

我想弄清楚发送SIGCHLD信号的进程的pid是什么,我想在我为SIGCHLD创建的信号处理程序中这样做.我该怎么做?我尝试着:

int pid = waitpid(-1, NULL, WNOHANG);
Run Code Online (Sandbox Code Playgroud)

因为我想等待产生的任何子进程.

c signals waitpid

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

MIPS $ gp注册

使用$gp寄存器存储值有危险吗?我想我的问题是它的真正功能是什么$gp,是否以某种方式在幕后调用,以便如果我使用它,事情可能会非常错误?

mips

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

我如何设计客户端队列系统?

概述

我正在研究一个项目,我遇到了一个问题,因为事情并没有按照我希望它们发生的顺序发生.所以我一直在考虑设计某种Queue,我可以用它来组织函数调用和启动期间使用的其他各种JavaScript/jQuery指令,即在页面加载时.我正在寻找的并不一定需要是一个队列数据结构,而是一些能够确保事物以我指定的顺序执行的系统,并且只有当前一个任务完成后,新任务才能开始.

我简要地看了一下jQuery QueueAjaxQueue,但我真的不知道它们是如何工作的所以我不确定这是否是我想采取的方法......但我会继续阅读有关这些工具的更多信息.

SPECIFICS

目前,我已经设置好了内部$(document).ready(function() {...});工作,内部发生了其他工作$(window).load(function() {...});.例如,

<head>
  <script type="text/javascript">    

    // I want this to happen 1st
    $().LoadJavaScript();
    // ... do some basic configuration for the stuff that needs to happen later...

    // I want this to happen 2nd
    $(document).ready(function() {

      // ... do some work that depends on the previous work do have been completed
      var script = document.createElement("script");
      // ... do some more work...
    });

    // I want this …
Run Code Online (Sandbox Code Playgroud)

javascript queue jquery client-side

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

script标记和"<%....%>"标记之间有什么区别?

我刚刚开始研究Web应用程序,并学习使用ASP.Net.我遇到过两种在HTML页面中添加脚本的方法.一种是使用脚本标记,另一种是使用<% ... %>标记.但是,我无法弄清楚,两者之间有什么区别,在哪种情况下我应该选择哪一个?

html asp.net scripting web-applications

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

Nullpointerexception java

首先,我是一名经验丰富的程序员,但对Java很少熟悉.八年前,我有两年的经验.

我在以下代码中遇到NullPointerException:

public static void handle(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException {

    Response gfexResponse = null;

    try {

        ActionFactory actionFactory = ActionFactory.getInstance();
        String requestURL = request.getRequestURI();
        String actionId = actionFactory.getActionId(requestURL);

        IAction action = actionFactory.createAction(actionId);

        ActionEvent event = new ActionEvent(request, 0, actionId);
        gfexResponse = action.execute(event);

    } catch (Exception ex) {        
        gfexResponse = new Response();
        gfexResponse.setError(ex.getMessage());
        gfexResponse.setOutcome(IViewConstants.ERROR);

    } finally {

        if(request.getParameter("loginId") != null){
            request.setAttribute("loginId", request.getParameter("loginId"));
        }

        if(gfexResponse.getMessage()!= null){
            request.setAttribute("message", gfexResponse.getMessage());
        }

        if(gfexResponse.getError()!= null){
            request.setAttribute("error", gfexResponse.getError());
        }

        if (gfexResponse.getContentType() != null) {
            response.setContentType(gfexResponse.getContentType());
            OutputStream outputStream …
Run Code Online (Sandbox Code Playgroud)

java nullpointerexception

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

从不兼容的指针类型分配

我已经设置了以下结构:

typedef struct _thread_node_t {
    pthread_t thread;
    struct thread_node_t *next;
} thread_node_t;
Run Code Online (Sandbox Code Playgroud)

......然后我定义了:

// create thread to for incoming connection
thread_node_t *thread_node = (thread_node_t*) malloc(sizeof(thread_node_t));
pthread_create(&(thread_node->thread), NULL, client_thread, &csFD);

thread_node->next = thread_arr; // assignment from incompatible pointer type

thread_arr = thread_node;
Run Code Online (Sandbox Code Playgroud)

thread_arr的位置 thread_node_t *thread_arr = NULL;

我不明白为什么编译器在抱怨.也许我误会了什么.

c struct pointers typedef

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

如何创建AppleScript应用程序以运行一组终端命令

我如何创建AppleScript命令,当我只运行脚本(或在Finder中双击它?)时,它会运行一组终端命令?这组命令完全删除了MySQL,并且不断地将它们写出来已经变得很痛苦.命令是:

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm /etc/my.cnf
Run Code Online (Sandbox Code Playgroud)

还有另一个sudo nano /etc/hostconfig打开文件的命令,我需要从文件中删除一行,但这似乎太难编码,所以我想我可以手工完成.但是使用单个脚本自动执行此操作将是一个巨大的帮助.

它只是一堆这些命令吗?

do shell script (...)
Run Code Online (Sandbox Code Playgroud)

谢谢,Hristo

macos shell applescript

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

Facebook风格状态输入边框

我试图用Firebug解决它,但没有机会.Facebook状态输入边框如何围绕自动调整输入?特别是,我对加入边境的小三角感兴趣.使用Firebug,我设法找到了三角形本身,它以GIF图像的形式提供:

.uiComposerAttachment, .nub {
    background: url(http://static.ak.fbcdn.net/rsrc.php/v1/zf/r/PfBgtiydy5U.gif) no-repeat center top;
    height: 7px;
    width: 11px
    position: absolute;
    left: 2px;
    top: 18px;
}
Run Code Online (Sandbox Code Playgroud)

但我无法弄清楚它是如何放置在输入上方以及如何添加边框,以背景图像的形式或定义为CSS边框?

html css facebook input

6
推荐指数
2
解决办法
2674
查看次数

用Javascript编程OOP - 正确

我很有兴趣改进我的javascript代码以正确OOP ....目前我倾向于做这样的事情:

jQuery(document).ready(function () {
    Page.form = (function () {
        return {
            //generate a new PDF
            generatePDF: function () {

            },
            //Update the list of PDFs available for download
            updatePDFDownloads: function () {

            },
            /*
             * Field specific functionality
             */
            field: (function () {
                return {
                    //show the edit prompt
                    edit: function (id, name) {

                    },
                    //refresh the value of a field with the latest from the database
                    refresh: function (id) {

                    }
                };
            }())
        };
    }());
});
Run Code Online (Sandbox Code Playgroud)

最后它只是主要是有组织的功能,我想...什么是一个很好的资源,我可以学习以OOP方式编写JavaScript,或者你有什么建议可以改善我目前的编程风格?

看起来我应该做一种模型原型并让我的 …

javascript oop jquery refactoring

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

什么是DOMs元素属性的attribute.specified?

我偶然发现了这样的事情......

function(element) {
  ...
  var attributes = element.attributes;
  for (var index = 0, length = attributes.length; index < length; index++) {
    var attribute = attributes[index];

    // what is ".specified"?
    if (attribute.specified) {
      ...
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我正在研究DOM元素的W3C规范,Element接口,我什么都看不到specified.

http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-745549614

什么attribute.specified意思?它代表什么?它在规格中的定义在哪里?

attributes dom

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