小编Abo*_*our的帖子

更改进程的父级

是否可以更改流程父级?
例如:父A有孩子B我可以让B的父母是Init进程而不杀A吗?

c linux process

14
推荐指数
2
解决办法
8402
查看次数

僵尸进程

我有一些关于僵尸进程的问题

  • 僵尸流程概念的好处是什么?
  • 知道内核为僵尸进程保留(PID,终止状态,资源使用信息)
    "资源使用信息"的含义是什么
  • 如何僵尸的PPID()= 1并且它仍然是僵尸,(init收到Zombies,因为它默认为wait())
    任何人都可以编写一些C代码来制作僵尸它的父亲是Init吗?
  • 可以僵尸拒绝释放一些内存锁?

提前致谢

c unix posix process systems-programming

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

使用ANTLR为java源代码生成抽象语法树

如何使用ANTLR从java src代码生成AST?
任何帮助?

java antlr abstract-syntax-tree

8
推荐指数
2
解决办法
8676
查看次数

如何在Android模拟器上模拟蓝牙

我用这个项目来模拟android模拟器上的蓝牙.
我有2个类,一个启用蓝牙

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    BluetoothAdapter.SetContext(this);

    BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
    if(adapter==null) { 
        System.out.println("\nBluetooth NOT supported. Aborting.");
      return;
    }

    if (!adapter.isEnabled()) {
        adapter.enable();
    }
    }
Run Code Online (Sandbox Code Playgroud)

另一次扫描设备并列出它们

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        BluetoothAdapter.SetContext(this);

        BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
        System.out.println("\nAdapter: " + adapter);

        if(adapter==null) { 
            System.out.println("\nBluetooth NOT supported. Aborting.");
          return;
        }

        if (!adapter.isEnabled()) {
            adapter.enable();
        }

        if (adapter.getScanMode() != BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) {
            adapter.startDiscovery();
        }


        Set<BluetoothDevice> devices = adapter.getBondedDevices();
        for (BluetoothDevice device : devices) {
            System.out.println("Found device: " …
Run Code Online (Sandbox Code Playgroud)

android bluetooth

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

客户端的图像处理

我需要从知道它的URL的网站上获取图像,然后在客户端编辑它(裁剪和调整大小).
使用JavaScript,Jquery,HTML5最好的方法是什么?
你能提供一些链接或教程,......?
提前致谢.

javascript jquery html5 ruby-on-rails image-processing

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

android 3.1:getDefaultAdapter()在android中返回null

mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
如果(mBluetoothAdapter == null){
Log.i(“错误”,“不支持蓝牙”);
返回;
}

当我在模拟器上运行此代码时,它会显示“不支持蓝牙”。
有什么帮助吗?

android bluetooth

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

数组ptr的地址等于它的值?

可能重复:
C:数组的地址如何等于它的值?

SA
在CI中尝试打印数组指针的地址.

int a[3] = {0,1,2};
printf("\n%p",a);
printf("\n%p",(&a));
Run Code Online (Sandbox Code Playgroud)

2语句打印相同的值为什么?
提前致谢

c arrays printf pointers

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

C中的gedit插件开发

我有兴趣在C中编写gedit-plugins.我已经检查了http://live.gnome.org/Gedit/NewMDIPluginHowTo
...但是没有任何运气.

如何获得有关在C中编写gedit插件的更多信息?

c gedit gedit-plugin

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

scanf失败了为什么?


当我写这篇文章时,编译并运行:

int x;   
scanf ("%d", &x);  
while (x!=4) {  
    scanf ("%d", &x);  
}
Run Code Online (Sandbox Code Playgroud)

当插入char或小于4的double数时,它进入一个无限循环.
当插入大于4的double时,它会终止.
任何解释?

c scanf

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

即使我发送SIGABRT,子进程也会正常退出

我正在尝试一些像fork()和exec()这样的进程操作我尝试了这个例子,其中父等待()他的孩子返回并测试他的孩子是否正常结束(通过exit()或返回他的来电)或异常(像SIGABRT一样接收信号)

#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<unistd.h>
#include <sys/wait.h>

int spawn (char* program, char** arg_list)
{
    pid_t child_pid;
    child_pid = fork ();
    if (child_pid != 0)
    return child_pid;

    else {
    execvp (program, arg_list);
    abort();
    }
}
int main ()
{
    int child_status;
    char* arg_list[] = {"ls","/",NULL};

    spawn ("ls", arg_list);

    wait (&child_status);


    if (WIFEXITED (child_status))
        printf ("the child process exited normally, with exit code %d\n",
        WEXITSTATUS (child_status));
    else
        printf ("the child process exited abnormally\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)

我希望看到句子"子进程异常退出",但我看到"子进程正常退出,退出代码为0"!!! 即使孩子通过调用abort()来发送SIGABRT任何帮助结束了吗?提前致谢

c linux

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

如何从/ usr/include中的Linux头文件中获取函数名称

/usr/include
我正在寻找一种打开和读取包含文件并解析它以打印位于其中的所有已声明函数的方法.我们有大多数Gnu C库标题.
任何人都可以解释或提供一个关于这个标题格式的链接.
我这样做是因为我正在尝试做一个C自动完成插件,如果我包含一个file.h,插件会给我所有函数都位于file.h中.

c linux gnu header

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

如何使用ruby脚本填充html文件

我有一个html文件有一般设计(一些div),我需要用一些HTML代码填充这个div使用ruby脚本.
有什么建议?

我有page.html

<html>
<title>html Page</title>
<body>

<div id="main">
</div>

<div id="side">
</div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我在里面收集一些数据并对它进行某种处理,我希望以一种漂亮的格式呈现它**
所以我想设置它的id为id = main的一些html代码就像这样

<html>
<title>html Page</title>
<body>

<div id="main">
<h1>you have 30 files in games folder</h1>
</div>

<div id="side">
</div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

**为什么我不使用ROR?因为我不想建立一个网站,我只需要构建一个桌面工具,但它的表示层是由浏览器解释的html代码,以避免使用图形库


我的问题不是"我怎么能写这个html文件"我可以处理它.
我的问题,如果我想在主div中的html文件中创建一个表,我将在ruby脚本中写入整个html代码将其打印到html文件,是否有任何lib或gem我可以告诉它我想要的一个包含3行和2列的表,它会生成html代码吗?

html ruby

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