linux

CherryPy interferes with Twisted shutting down on Windows

I've got an application that runs Twisted by starting the reactor with reactor.run() in my main thread after starting some other threads, including the CherryPy web server. Here's a program that shuts down cleanly when Ctrl+C is pressed on Linux but not on Windows: from threading import Thread from signal import signal, SIGINT import ...

Does python have hooks into EXT3

We have several cron jobs that ftp proxy logs to a centralized server. These files can be rather large and take some time to transfer. Part of the requirement of this project is to provide a logging mechanism in which we log the success or failure of these transfers. This is simple enough. My question is, is there a way to check if a fi...

Default absolute path to grep in Linux kernel 2.6.18-128.1.10.el5

There was a recent change on the server I do most of my work on and all PHP exec()'s now need absolute paths. Its faster than asking IT to ask it here. So, does anyone know where grep is by default? ...

Measuring time taken by an exec()-ed process on linux

I'm using the times() function to measure the value but I'm not sure if my approach is correct. Please have a look and advice struct tms tms_start, tms_end; if (!(pid=fork())) { //some necessary operations here times(&tms_start); execl(...); } else if (pid) { //in parent int status; wait(&status); times(&tms_...

Figuring out a C loop

This is one of the default gnome screensavers - "personal slideshow". It displays pictures from some location, pausing ~10s between pictures. Anyone know how it's looping & pausing? I'm trying to increase the delay, but I'm hesitant to add sleep() without first knowing how it's doing it. Thanks #include "config.h" #include <stdio.h> ...

Linux: How do I find out if a file has been updated by another process?

Hi, I am currently watching an XML file from log4j output. I have a custom viewer that displays the log-output in GUI. I need to watch this file as to when it gets updated so that the GUI can re-parse and update itself. In C# there is a FileWatcher concept so on Windows no-probs, but what options do i have using C on Linux. Is there a ...

What is the maximum size of an environment variable value?

Is there a limit to the amount of data that can be stored in an environment variable on Linux, and if so: what is it? For Windows, I've found following KB article which summarizes to: Windows XP or later: 8191 characters Windows 2000/NT 4.0: 2047 characters ...

Learning qplot

What is a good resource for learning qplot? Or even what is a good qplot reference? ...

Trouble installing PHP 5.3.0 with intl-support

Currently I'm trying to install PHP 5.3.0 on some Linux testing server. As we've urgently waited for ext/intl we want to check out the features it provides. I'm running configure successfully with the following arguments ./configure --with-apxs2=/usr/local/apache2/bin/apxs --prefix=/usr/local/php --with-zlib-dir=/usr/local/z...

NAT GRE (IP protocol 47) over Linux router

I have a host that has a permanent static GRE tunnel to a server on the Internet. Right now the host has its own real IP address. I want to put the host behind a Linux box (Smoothwall), and assign it a private IP address. Lets call: tunnel-server-ip = the IP of the end of the tunnel the host is connecting to (on the internet) real-ip = ...

Why does locale es_MX work but not es?

Wikipedia entry for GNU gettext shows an example where the locale is just the lanuage, "fr". Whereas the i18n gettext() “hello world” example has the locale value with both the language and country, "es_MX". I have modified the "es_MX" example to use just the lanuage, "es", but it produces the English text rather the expected Spanish. c...

How do you extract a JAR in a UNIX filesystem with a single command and specify its target directory using the JAR command?

I am creating a Python script within which I am executing UNIX system commands. I have a war archive named Binaries.war which is within an ear archive named Portal.ear The Portal ear file resides in, say /home/foo/bar/ jar xf /home/foo/bar/Portal.ear Binaries.war Will extract the Binaries.war file out of the /home/foo/bar/Portal.ear ...

peak memory measurement of long running process in linux

How do I monitor the peak memory consumed by a process in Linux? This is not a program I can internally modify to measure peak memory usage. I do not really want detailed measurements, nor do I want them to slow down my program excessively.. so valgrind or anything heavyweight is not what I am looking for... And like other posts earlie...

composing multiple mysql scripts

Is it possible to INCLUDE other mysql scripts in a composite script? Ideally I do not want to create a stored procedure for the included scripts... For larger projects I would like to maintain several smaller scripts hierarchically and then compose them as required... But for now, I'd be happy to just learn how to include other scripts.....

rpmbuild 32bit lib packages for x86-64

I'm trying to use rpmbuild to build x86-64 packages and libs-32bit package. The same src rpm is uesd to build both output packages. What is the arguments to rpmbuild to make package-lib-32bit-X.x.x68_64.rpm ? I currently do this to get a 32-bit package: CC='gcc -m32' CXX='g++ -m32' linux32 rpmbuild -bb -target=i586 package.spec That gi...

Transition from Python2.4 to Python2.6 on CentOS. Module migration problem.

Hey guys, I have a problem of upgrading python from 2.4 to 2.6: I have CentOS 5 (Full) It has python 2.4 living in /usr/lib/python2.4/ Additional modules are living in /usr/lib/python2.4/site-packages/ I've built python 2.6 from sources at /usr/local/lib/python2.6/ I've set default python to python2.6 Now old modules for 2.4 are out...

Real time video capture??

Hi all, Just as a hobby, I want to capture realtime video. The source of video for a start would be a web camera. I have one from logitech. What I am trying to do is make a custom window with Real time video display as one part and other miscellaneous widgets. As a starting point I looked in Qt and phonon did sound promising. But instal...

Running both python 2.6 and 3.1 on the same machine

Hi there, I'm currently toying with python at home and I'm planning to switch to python 3.1. The fact is that I have some script that use python 2.6 and I can't convert them since they use some module that aren't available for python 3.1 atm. So I'm considering installing python 3.1 along my python 2.6. I only found people on internet t...

How to mmap the stack for the clone() system call on linux?

The clone() system call on Linux takes a parameter pointing to the stack for the new created thread to use. The obvious way to do this is to simply malloc some space and pass that, but then you have to be sure you've malloc'd as much stack space as that thread will ever use (hard to predict). I remembered that when using pthreads I didn...

msgfmt "invalid multibyte sequence" error on a Polish text.

Using Complete C++ i18n gettext() “hello world” example I changed the locale from "es_MX" to "pl_PL" and the text from "hello, world!" to "Invalid input. Enter a string at least 20 characters long.". The Polish translation contains several characters that cause "invalid multibyte sequence" errors from msgfmt, "łąźó". The translated text ...