i found an article about self modifying code and tried to do some examples, but i get always segmentation faults. As fas as i can understand, there is a violation in memory permissions. The code segment is (r)ead/e(x)ecute and so the attempt of writting results to this fault. Is there a way to test the program either by changing the
Looking for an accurate way to micro benchmark small code paths written in C++ and running on Linux/OSX
I’m looking to do some very basic micro benchmarking of small code paths, such as tight loops, that I’ve written in C++. I’m running on Linux and OSX, and using GCC. What facilities are there for sub millisecond accuracy? I am thinking a simple test of running the code path many times (several tens of millions?) will give me enough
what is the ‘what’ command on AIX under LINUX
I am used to use what to find out some version string in my program, which is normal defined as a string in the c++ code, starting with “@(#)”. Now I cannot find it in Linux. Can anyone tell me what I am supposed to do? Thanks a lot! Answer The what command is part of the Source Code Control
C system function causes error ‘sh: Syntax error: “(” unexpected ‘
I wrote a simple program in C on Linux to delete all the files in a directory except one called svn like this: But when I compile and run it, the terminal says: sh: Syntax error: “(” unexpected However, when I type and run the command in the terminal directly, all things are done correctly. Any ideas? Answer The answer
How to specify ignore pattern in grep?
How can I make grep to ignore some files (e.g. .svn directories, binary files, etc.) while grepping recursively? Answer Use an –exclude pattern as already answered here
Linux kernel module compiling
I try to compile simple linux kernel module: My makefile: Now i haven’t errors in my .c file. But when i try make in terminal: make: Nothing to be done for `all’. What’s wrong? Thank you. Answer The default command in your makefile is That instructs make to cd to /lib/modules/$(KVERSION)/build and run In turn, that makefile is not finding
Can I squeeze my own program between the preprocessor and compiler?
Is this a stupid question, or can I specify g++ to use a program between the preprocessor and compiler? Alternatively, I know that I can just run the preprocessor on a file (hence all the files). Then I am guessing there is a switch to run only the compiler. So I can manually invoke these two and put my program
Python 2.7 cannot import PyQt4
I’ve upgraded to Python 2.7 from Python 2.6 on Ubuntu Maverick Meerkat (10.10) and I’m unable to import PyQt4. I installed both Python 2.7 (python2.7) and PyQt4 (python-qt4) from the Ubuntu repositories. I installed PyQt a while back, but I installed Python 2.7 recently. If I try Python 2.6 (since it’s shipped with Ubuntu, the command is simply python), it
200,000 images in single folder in linux, performance issue or not?
I have a php/mysql website with over 200,000 images in single folder (linux server). I don’t think, that I will never need to see them in file explorer, instead they will be viewed on website on their individual pages. They are just displayed in product page on website. File system is ext3. so is it wise to save them in
How can I format my grep output to show line numbers at the end of the line, and also the hit count?
I’m using grep to match string in a file. Here is an example file: grep -i null myfile.txt returns How can I return matched lines together with their line numbers like this: I know -c returns total matched lines, but I don’t how to format it properly to add total null count in front, and I don’t know how to