linux

What is the C++ equivalent of PHP's is_dir() ?

What is the C++ equivalent of PHP's is_dir() ? http://www.php.net/manual/en/function.is-dir.php bool is_dir ( string $filename ) Tells whether the given filename is a directory. Working on a Linux platform only, what library would you use? And what if cross-platform support mattered, what method would you use? ...

how to let wc command recursivly ?

Let it counting *.h *.cpp in Sub directory. ...

Is there any way to get ps output programmatically?

I've got a webserver that I'm presently benchmarking for CPU usage. What I'm doing is essentially running one process to slam the server with requests, then running the following bash script to determine the CPU usage: #! /bin/bash for (( ;; )) do echo "`python -c 'import time; print time.time()'`, `ps -p $1 -o '%cpu' | grep -vi ...

Determine which executables link to a specific shared library on Linux

How can I list all executables on my Red Hat Linux system which link to libssl? I can get close with: find / -type f -perm /a+x -exec ldd {} \; | grep libssl ldd shows me which libraries the executable links with, but the line that contains the library name does not also show the filename, so although I get a lot of matches with g...

Virus scanning in a Java webapp?

I'm writing a Java-based web app that allows users to upload and submit content to the site. Before it is made available, though, I'd like to perform a virus scan to ensure that no malicious content gets posted. Does anyone know of an anti-virus scanner that can be accessed via Java? The app will be hosted on Linux (CentOS 5.5 x64) an...

Validating file paths

We want to validate file paths, e.g. foo/bar, which the user can enter. Is it possible to create files with leading or trailing space on OS X or Linux, e.g. foo/ bar /bazz? ...

does RoR develpment need shell access?

let's say that RoR development environment is set up and working does the developer need shell access to develop the RoR application? would ftp be good enough? why? I don't want to give my future developers ssh access to my linux box. Or can I set up their file permission so they can read only their project directory? UPDATE the who...

How to install rrdtool on centOS 4.4 ?

first I 'm trying to install rrdtool using: yum install rrdtool but failed: no source? so I try to install it from source when I'm doing: ./configure It says: configure: error: Please fix the library issues listed above and try again. some library issues it list to me: configure: WARNING: ------------------------------...

UI utility library for OpenGL 3+, or is Xlib ok?

I want to write some OpenGL 3.2, likely also OpenGL 4 stuff on Linux, and I just saw that libsdl 1.2 (the latest stable release) supports only 2.x. LibSDL 1.3 (which is in development) should support it, but it'll be a while before it gets into mainstream distributions. Is there any library out there right now which allows me to create a...

How do I go about Power and Square root functions in Assembly(IA32)?

How do I go about Power and Square root functions in Assembly Language (with/out) Stack on Linux. Edit 1 : I'm programming for Intel x_86. ...

C++: How to check if a file/directory is readable? (PHP equivalent: is_readable)

I am trying to validate a directory with C++. http://php.net/manual/en/function.is-readable.php bool is_readable ( string $filename ) Tells whether a file (or directroy) exists and is readable. What would be the equivalent of the above in C++? I am already using the boost/filesystem library to check that the directory exists. I ha...

the output of my fortran code is killed , any suggestion?

I'm trying to run a code on ssh that works perfect for a smaller mesh , but since the new mesh is much bigger i used ifort command to compile it, ifort -mcmodel=medium -i-dynamic -otest.out*.f and it complies but when i run it , the output is: killed i know that problem is from memory, does anyone know if there's any way to run it? how...

How to port in.mpathd from Solaris to Linux?

How to use in.mpathd command in solaris(by using which options)?? ...

Syncronization of access right between lighttpd and system

Hello! We are in the middle of designing a web server application which runs on an existing Linux system. We are using the lighttpd server, and have now ran into some security issues. For various reasons we have chosen Lua to develop our application. Since we have existing users that logs in to the machine using ssh, we would like the us...

How to capture from webcam in Linux using Mono?

How can I capture a frame from a video-4-linux device (e.g.: /dev/video0) using Mono and C#? OS is Angstrom Linux running on BeagleBoard. ...

analysis of core file

hi I'm using Linux redhat 3, can someone explain how is that possible that i am able to analyze with gdb , a core dump generated in Linux redhat 5 ? not that i complaint :) but i need to be sure this will always work... ? EDIT: the shared libraries are the same version, so no worries about that, they are placed in a shaerd storage ...

shell script (running via cron) to enter password when prompted

Hi, I have a daily cron task which automatically unrars a rar file and processes it's contents, however, the contents are now password protected so i'm wondering if there's a reliable way to echo the password when prompted? The password prompt comes from the UNRAR program i've installed, running on CentOS. Thanks for any help! ...

Best way to extract number of partitions?

Assuming that there are only primary partitions on a disk, what is the best way to find the current number of partitions? Is there any better way than: fdisk -l > temp #Following returns first column of the last line of temp e.g. /dev/sda4 lastPart=$(tail -n 1 temp | awk '{print $1}') totalPartitions=$(echo ${lastPart:8}) $totalParti...

How to programmatically get the address of the heap on Linux

I can get the address of the end of the heap with sbrk(0), but is there any way to programmatically get the address of the start of the heap, other than by parsing the contents of /proc/self/maps? ...

Linux and memory leaks

Does Linux automatically re-claim all memory used by an applications immediately? If so then should the application really bother about freeing all memory before exit? Is it really worth to call the destructor of every class in a multi-threading application before making a call to exit(0)? If Linux always re-claims all memory used by...