I need to write a program that is creating a N amount of sub processes and every single one of them adds one to a shared memory variable. My idea is to use semaphores and shared memory, but the processes are not waiting for each other and the shared memory variable is also not working as I want it. mydefs.h
Trying in PHP to mysqldump -v to popen and not getting output
I’m writing a wrapper for mysqldump and want to show the output nicely in a PHP CLI application. I’m attempting to run mysqldump -v using popen so that I can get the verbose output and display progress indicators to the user. However no output is returned (by default it gets logged to the screen v…
PHP popen Application cannot open shared object
I’ve created a simple C++ Application with the boost framework. The Application is running correct from the command line. After this I’ve created a PHP file with a popen to this binary. After visiting the website I’ve got the following error message from apache2/error_log System is openSuse …
renaming file using shell script
I have tons of image inside a folder and it also has different file types. I have tried googling for an answer but I can’t seem to find one. I wanted the files to be named 1.jpg, 2.png, 3.gif. . . n.JPEG. Could someone help me out with this? Answer Try the command below: Make note that the command above
Can tar extraction erase brother directory ?
I made several backups on different directories with Backup Manager. Eg: /home/user1 /home/user2… It gives me some tar files. The content of a tar file looks like : I tried to test the restoration with something like : But the command above recreate all the structure inside the choosen directory. That g…
Linux xargs command
A quick question. A command doesn’t require xargs, but the command requires xargs command. Can please someone explain me the concept of xargs more clearly. Thanks. Answer In short, xargs converts stdin (standard input) to arguments for the command you specify. For example seq, as you can see, prints a s…
How to control global OpenMP settings from C/C++?
OpenMP doesn’t provide API to adjust some crucial settings in runtime, e.g. OMP_WAIT_POLICY or GOMP_SPINCOUNT (at least in gcc 4.8.3). Such settings are designed to be changed through environment variables for some reason. Not very convenient. Is there any way I can change such settings in run-time from…
Removing specific string from lines in file using sed
I have a file like so: I want the following output: What I tried is: But this is not what I want… Answer Try this way
How do I find what libraries need to be installed on a client linux machine if I compile a binary with a newer version of gcc?
Say I have a C++ binary that was compiled with a version of gcc say 4.4.x, which is used on a client linux box. If I want to upgrade my compiler to use a newer one, say 4.9.3 (because I want to use C++11): What kind of things would need to be upgraded on the client box to run this
Raspberry PI remote debug GTK error
I’m using NetBeans IDE 8.0.2 on my Win7 machine to develop Raspberry Pi opencv C++ application. I’m building & debugging the application remotely on the Raspberry Pi from my Win7 machine. At run time the application fails with “Gtk-WARNING **: cannot open display:” error when reach…