No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
23 Posted Topics
Hi, I am reading a command in shell script using sed: echo $1 | sed -e "s/^[^=]*=\(.*\)$/\1/" what I don't understand is the sed command. I only know it tries to substitute "^[^=]*=\(.*\)$/" with "\1" and 1 is one of the positional parameters got from invoking the shell script, but … | |
Hi, I was wondering how to debug python script without adding pdb module to the script file. Say, I have a script test.py without adding "import pdb" and "pdb.set_trace()". Can I debug it in Python running in terminal by importing pdb there? How to set up breakpoints and start the … | |
Hi, Here are my two questions: 1. I am now learning to manage my code with CVS, and I just want to make a repository for my C++ files, Makefile and bash and python scripts only, not the object files and executables. So I made several subdirectories under my project … | |
Hi, I call "set -o notify" to notify me when my background jobs finish. I find that the messages upon finishing are different: for some job, it starts sometimes with "[jobID]", sometimes with "[jobID]+" and sometimes "[jobID]-". I wonder what they mean actually? Do they mean the jobs are finished … | |
Hi, I'd like to pass arguments with space inside to a bash script and further into an executable called inside the script. My bash script looks like: [code] #!/bin/bash ARG_OPTS="" while [[ -n "$1" ]]; ARG_OPTS="${ARG_OPTS} $1" shift done my_executable ${ARG_OPTS} [/code] one of the arguments to the executable is … | |
Hi, Here is my code, [code] ids=(1 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 90 100 110 120) for ((i=0;i<${#ids};i++)); do awk '{ print ${ids[${i}]}" "$1; }' > ${TMP} < ./results/$1${ids[${i}]}/test_error.dat done [/code] I got this error [quote] awk: { print … | |
Hi, I was wondering: if the memory allocation in the following codes is static or dynamic, why the upper limits on their sizes are different, why some of them would cause segment fault? what you would suggest to allocate array according to different need? 1. [code] double data[1048000]; for(int i=0; … | |
I perhaps have to resort to multiple thread programming to reduce computational time. I am now studying how to use POSIX library. I can access a cluster with 8 CPUs, each of which has one core. I was wondering how many threads to create would get approximately best time performance … | |
Hi, I am using copy_n from GNU C++ Library under Ubuntu 8.10. My code is like this: [code] #include <ext/algorithm> using namespace std; void myfun(char * flags ) { char * flags_new = new char[3]; copy_n(flags, 3, flags_new);// both copy_n and copy would give not in this scope error. delete … | |
Hi, I am goint to create a very large array but have this error when running this code [code] #include <iostream> #include <limits.h> #include <cstddef> #include <cmath> using namespace std; int main() { cout << UINT_MAX << " " << ULLONG_MAX << endl; cout << pow(pow(24,2),4) << endl; unsigned long … | |
Hi, These days I have to install a higher version of bash under my $HOME on my office server. I hope to make the new bash automatically run both when I ssh to my server and when I boot into my office computer which loads my $HOME on the server. … | |
Hi, How to get declaration in C mode with tags in Emacs. I only know how to get definition of self defined functions. But how to jump to their declarations and also how to get the declarations of C++ standard library functions and classes? Thanks! | |
Hi, I am beginning to use bashdb to debug my shell script. Here are my questions: 1. With "bash --debugger ./myscript.sh" it will run to finish without stop, while with "bashdb ./myscript.sh" would stop at the beginning. How could I stop in the first usage? 2. I am using Bashdb … | |
Hi, I am trying to debug my shell script by bashdb. My script take as argument "--gdb", so I wrote [quote]bashdb myscript.sh --gdb[/quote] However, this way it will produce error that bashdb: [quote]unrecognized option '--gdb'[/quote] If I quote --gdb as [quote] bashdb myscript.sh '--gdb'[/quote] then I will end up with … | |
In the following code: [code] for(int i = 0; i < argc; i++) cout << (i > 0 ? " " : "") << argv << (i < argc - 1 ? " \\" : "") << endl; [/code] I try to use "next" to step over, but always step … | |
Hi, I am new to using C and C++ libraries. So my questions might seem to be naive. 1. When installed, will the source files ( .c or .cpp) of a library be placed into some system directory like /usr/local/src/ for other code that will use them? 2. If not, … | |
Hi, I am now trying to install a C library zlib to be /usr/local/include/zlib, /usr/local/lib/zlib and /usr/local/share/man. Here is the relevent part in the configure file of the library: [QUOTE] prefix=${prefix-/usr/local} exec_prefix=${exec_prefix-'${prefix}'} libdir=${libdir-'${exec_prefix}/lib'} includedir=${includedir-'${prefix}/include'} mandir=${mandir-'${prefix}/share/man'} [/QUOTE] First, what does "-" mean in "prefix=${prefix-/usr/local}"? Second, how can I achieve what I … | |
Hi, I read something like "\mkdir ${RESULT_DIR}". Just curious about why "\" is added before the command? Thanks for help! | |
can any function, for example printf, restart from beginning of the same line? So we will not have multiple lines of output Another question, any way to retrieve the previous ouput that have been bumped out of the window in case of large amount of output? I am using Windows … | |
Hi, I am sorting an double array, using qsort() #include<stdio.h> #include<stdlib.h> ... int compar( const void *arg1, const void *arg2 ) { return ( * ( double **) arg1 >= * (double** ) arg2 ); } .... int main(int argc,char *argv[]){ ... qsort(array, size_ct,sizeof(double),compar); ... } It turns out that … | |
Hi, I have an array. I put its definition in a .c file and externally delare it in a .h file like this: //.c file unsigned char jetmap[][]={ {0, 207, 255}, {0, 223, 255}, {0, 239, 255}, {0, 255, 255}, {16, 255, 239}, {32, 255, 223}, {48, 255, 207}, {64, … | |
Hi, I got this message "Windows has triggered a breakpoint in inout.exe. This may be due to a corruption of the heap, and indicates a bug in inout.exe or any of the DLLs it has loaded. The output window may have more diagnostic information" while debugging the following program in … | |
Hi, When using "..printf Functions" with Conversion specifier type "%g", it gives different results under different environment. For example, "sprintf(string,"%g",1e-6);" gives "1e-006" in Windows (Visual C++) and "1e-06" in Linux (gcc). Maybe I am wrong about it. Is it possible to get the same format under whatever operating system or … |
The End.