小编Per*_*age的帖子

我如何递归JS-Beautify?

我在目录和子目录中有很多html文件.我可以js-beautify通过命令行执行命令,并希望以递归方式将其应用于所有这些文件.

我试过了

找 .-name" .html"-type f | js-beautify -r andjs-beautify -r | 找 .-name" .html"-type f

但它不起作用.然而,JS-美化确实工作,如果我看到这样的信息js-beautify -r myfile.html或者js-beautify -r *.html(在一个目录下的所有文件的情况下,而不是在子目录)

任何人都可以告诉我应该如何处理这两个命令?

javascript bash shell

14
推荐指数
4
解决办法
4797
查看次数

CFI指令意味着什么?(还有一些问题)

好的,这将是一个很长的问题.我试图理解"缓冲区溢出"是如何工作的.我正在阅读通过aleph1 粉碎堆栈以获得乐趣和利润,并且刚刚获得了以下代码的反汇编:

void function(int a, int b, int c) {
   char buffer1[5];
   char buffer2[10];
}

void main() {
  function(1,2,3);
}
Run Code Online (Sandbox Code Playgroud)

使用-SGCC旗帜的disameembly 给了我:

    .file   "example1.c"
    .text
    .globl  function
    .type   function, @function
function:
.LFB0:
    .cfi_startproc
    pushq   %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    subq    $48, %rsp
    movl    %edi, -36(%rbp)
    movl    %esi, -40(%rbp)
    movl    %edx, -44(%rbp)
    movq    %fs:40, %rax
    movq    %rax, -8(%rbp)
    xorl    %eax, %eax
    movq    -8(%rbp), %rax
    xorq    %fs:40, %rax
    je  .L2
    call    __stack_chk_fail
.L2: …
Run Code Online (Sandbox Code Playgroud)

c c++ x86 assembly gcc

11
推荐指数
2
解决办法
4043
查看次数

Android Studio:Gradle 执行失败。原因:管道破裂

每当我在 android-studio 中构建/运行我的 android 项目时,我都会收到一个消息框:Failed to complete Gradle execution.Cause: Broken pipe然后旧版本的应用程序开始在我的设备上运行。我尝试清理该项目,但收到相同的消息。我尝试了这里的解决方案,但没有帮助。我也尝试了这里的解决方案。我得到以下命令的输出gradlew compileDebug --stacktrace --info

Task 'compileDebug' is ambiguous in root project 'Wifi'. Candidates are: 'compileDebugAidl', 'compileDebugJava', 'compileDebugNdk', 'compileDebugRenderscript', 'compileDebugTestAidl', 'compileDebugTestJava', 'compileDebugTestNdk', 'compileDebugTestRenderscript'.

* Try:                      
Run gradlew tasks to get a list of available tasks. Run with --debug option to get more log output.

* Exception is:             
org.gradle.execution.TaskSelectionException: Task 'compileDebug' is ambiguous in root project 'Wifi'. Candidates are: 'compileDebugAidl', 'compileDebugJava', 'compileDebugNdk', 'compileDebugRenderscript', 'compileDebugTestAidl', …
Run Code Online (Sandbox Code Playgroud)

android android-studio

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

Dictionary中的Dictionary类和Map类有什么区别?

我刚刚看到HashMap和HashTable之间区别.除了显而易见的同步和非同步差异之外,我注意到在HashMap实现时HashTable扩展了Dictionary类.两者都存储对,所以有什么不同.我试着用搜索引擎的它,我发现SO(几个问题1,23).除了课程已经过时之外,我没有找到任何令人满意的结果.这两个班级之间有什么区别吗?如果不是,为什么字典类现在已经过时了?Map<Key, Value>Dictionary

java dictionary

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

如何批处理“diff”文件?

我有两个目录“sampleWith”和“sampleWithout”。这两个目录都包含相似的子目录和文件结构。我如何diff对应文件?

例如:有以下文件“sampleWith/a/index1.html”和“sampleWithout/a/index1.html”。我想要diff这两个文件并将输出写入相应的文件(例如 1.txt),并且我想对子目录中的所有文件执行此操作。我该怎么做呢?我知道我可以通过以下方式比较两个文件diff file1.html file2.html >> 1.txt获取 1.txt 中的输出,但如果我想跨目录比较类似的文件,我不知道该怎么做。我有很多文件想要比较,手动执行每个文件会花费很多时间。有人可以帮忙吗?谢谢!

编辑:

diff -r dir1/ dir2/正在将其写入单个文件。有什么办法可以将输出写入不同的文件吗?

bash shell

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

如何使用C中的数组表示法访问char*?

标题很简单.我想char *使用指针表示法访问字符串.我知道我可以使用derefencing运算符直接打印字符串.对于考试,我写了以下程序:

#include<stdio.h>

void printString(char * str){
    while(*str){
        printf("%c", *str);
        str++;
    }
}

int main(){
    char myString[] = "This is a String.";
    printString(myString);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

该程序正确打印字符串.但是,如果我将我的printString功能更改为以下,我会得到垃圾:

void printString(char * str){
    int i = 0;
    while(*str){
        printf("%c", *(str+i));
        i++; str++;
    }
}
Run Code Online (Sandbox Code Playgroud)

为什么会这样?如何使用数组表示法访问字符串?

c

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

标签 统计

bash ×2

c ×2

shell ×2

android ×1

android-studio ×1

assembly ×1

c++ ×1

dictionary ×1

gcc ×1

java ×1

javascript ×1

x86 ×1