linux

Checking internet connection with command-line PHP on linux

I'm using command-line PHP on linux to open bluetooth dialup connection, and I need a quick'n'dirty way to check if internet connection is active. Well, doesn't have to be dirty, but quick is appreciated. :) Using exec to run external commands is not a problem. I'm thinking of pinging some stable server (e.g. google), but I'm wondering ...

Is there a C++ unit testing library that is similar to NUnit?

We need to migrate a unit test harness developed with C# and NUnit to C++ running on Red Hat Linux. We want to minimize the efforts in migration. We are reading resources such as this: http://gamesfromwithin.com/exploring-the-c-unit-testing-framework-jungle But we don't see anything similar to NUnit. ...

How is the Linux calculating MemFree

I am trying to understand my embedded linux memory usage. By using the top utility and the process file /proc/meminfo I can see how much virtual memory a process is using, and how much physical memory is available to the system. But it would seem for any given process the virtual memory can be very much higher than the used physical m...

Get file creation time with Python on linux

os.stat returns st_mtime and st_ctime attributes, the modification time is st_mtime and st_ctime "change time" on POSIX. is there any function that return the creation time of a file using python and under Linux? ...

Problem Linking Boost Library in Linux

I am trying to build a project using Boost's Asio and I am having some trouble. Initially, I tried to build the project without any additional libraries since everything is supposedly in the header files. The program I am trying to build looks like this: #include <iostream> #include <boost/asio.hpp> #include <boost/date_time/posix_tim...

Getting another program's output as input on the fly

I've two programs I'm using in this way: $ c_program | python_program.py c_program prints something using printf() and python_program.py reads using sys.stdin.readline() I'd like to make the python_program.py process c_program's output as it prints, immediately, so that it can print its own current output. Unfortunately python_prog...

latest mono on centos

How can I install the latest version of mono (maybe from trunk) on the centos (5.3+) ? EDIT: Or do I have to change my server environment to Ubuntu Server or OpenSuse ? ...

How do I map a segfault instruction pointer address from /var/log/messages to an address/function in my .map file?

(My environment is 64-bit Ubuntu, my application is C++ compiled and linked with g++.) When an application does something like divide by zero or run a asm("int $3") left in the code, one of the following gets logged via syslog to /var/log/kern.log and /var/log/messages: Sep 10 18:06:47 VM kernel: [117194.123452] a.out[20288] trap divid...

Receiving key press and key release events in Linux terminal applications?

I would like to write a simple C program that will perform different actions based on both "key down" and "key up" events. This program will be run from inside rxvt. What library or mechanism should I use to access both key presses and releases? Is it true that reading /dev/tty will only provide key releases? Is this also true for termc...

Subversion post-commit hook to update 'staging' version not working

We have a staging version of our web application (it is basically a subversion working copy that no-one works on) that lives in '/apps/software'. Each developer has their own working copy in '~/apps/software'. I would like to utilise a simple post-commit hook script to update the staging copy every time a developer commits a change to th...

Help: Maximum number of clients reached - Segmentation fault

I want to simulate many key press events. I found a solution by using XTestFakeKeyEvent, but when I simulate more than 210 times my program raises a "Maximum number of clients reached" segmentation fault. I don't known how to solve this problem. My code here: #include <X11/Xlib.h> #include <X11/keysym.h> #include <X11/extensions/XTest....

Linux console keyboard handler

Is it possible to write a C program which works in XFCE's terminal until the user hits Esc-key? If yes, how? ...

Why is the startup of an App on linux slower when using shared libs?

On the embedded device I'm working on, the startup time is an important issue. The whole application consists of several executables that use a set of libraries. Because space in FLASH memory is limited we'd like to use shered libraries. The application workes as usual when compiled and linked with shared libraries and the amount of FLA...

How to display the process currently holding a semaphore?

In userspace Linux, I have a process blocking on a semaphore, as found by strace. Once the error condition occurs, the blocking is repeatable, so there must be another process that holds the semaphore and did not release it. Is there a way to know which other process is currently holding the semaphore? ipcs lists the semaphore, so does...

Standalone executables with mono on linux?

Using Mono on Linux, is there any way to create a standalone executable which will run on systems without mono installed? ...

is chmod o=- -R / a feasible solution to user restricting?

we do: useradd -s /bin/rbash -d /home/dir/user1 -m user_1:user_1 rbash is not even a solution because you can browse all files with midnight commander. then we create user_1.domain.com we assign this vhost user_1:user_1 our whole point is to disable this user poking into server's other directories. How do we do it? is chmod o=- -R...

How to split a file and keep the first line in each of the pieces?

Given: One big text-data file (e.g. CSV format) with a 'special' first line (e.g., field names). Wanted: An equivalent of the coreutils split -l command, but with the additional requirement that the header line from the original file appear at the beginning of each of the resulting pieces. I am guessing some concoction of split and hea...

Windows resource editor for Linux

Is there any command line tool for Linux (FreeBSD, etc) which can modify like Resource Hacker versioninfo in exe file? There are some utils for that purpose under Windows, but I'm doing cross-building of Windows Tcl Starpacks on FreeBSD. Of cource it is possible to recompile TclKit with my versioninfo and icons but I don't want to do i...

Display only files and folders that are symbolic links in tcsh or bash

Basically I want do the following: ls -l[+someflags] (or by some other means) that will only display files that are symbolic links so the output would look -rw-r--r-- 1 username grp size date-time filename -> somedir -rw-r--r-- 1 username grp size date-time filename2 -> somsdfsdf etc. For example, to show only direct...

Managing user configuration files across multiple computers

I commonly work on multiple computers. I have various configuration files, eg, .bashrc, .gitconfig, .irbrc, .vimrc and configuration folders, eg, .vim/ that contain valuable customizations. Sometimes I want small variations in configuration between the different computers. I want to use version control to manage these different files. ...