linux

A question about semaphore.

#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <semaphore.h> void *thread_function(void *arg); sem_t bin_sem; #define WORK_SIZE 1024 char work_area[WORK_SIZE]; int main() { int res; pthread_t a_thread; void *thread_result; res = sem_init(&bin_sem, 0, 0); if...

Creating core dumps on Linux

Duplicate: generate a core dump in linux I am trying to create a core dump in my "Fedora Core release 3 (Heidelberg)". [root@testserver test_core_dump]# uname -a Linux testserver 2.6.12-1.1381_FC3 #1 Fri Oct 21 03:46:55 EDT 2005 i686 athlon i386 GNU/Linux I am following this to create core dumps. The problem is, /proc/sys/kern...

How to print a Qt dialog or window?

How do I get Qt to print a complete dialog or window? I could dump the window contents with an external program like xwd and print that, but I would prefer to do it all with Qt. ...

How can I disable "demand paging" for one of my userspace programs ?

For an dedicated test I have to disable "demand paging" for exactly one of my userspace programs http://en.wikipedia.org/wiki/Demand_paging Any idea how I could do this ? (embedded linux appliance; 2.6 kernel) ...

Best Squid Administrators GuideBook

Recently I have been charged with implementing Squid Proxy server for my organization of approximately 250 users. I have plenty of Linux experience and I am looking to find the best administrators guidebook for my buck. What are everyone's suggestions? Is a book the best way to go or are there other good online resources that I can re...

Splitting out the output of ps using Python

On Linux, the command ps aux outputs a list of processes with multiple columns for each stat. e.g. USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND ... postfix 22611 0.0 0.2 54136 2544 ? S 15:26 0:00 pickup -l -t fifo -u apache 22920 0.0 1.5 198340 16588 ? S 09:58 0:05 /usr/sbin/h...

linux: redirect stdout after the process started

I have a process that already started, with stdout to the console. can I redirect it to a file, without restarting it? ...

Apache + SSL Error 336027900

I was reviewing the logs for my companies servers today and I discovered that there appears to be an error 336027900 logged every 5 minutes. This is what the log shows: [Wed Mar 25 15:10:19 2009] [info] [client 127.0.0.1] Connection to child 3 established (server localhost:443) [Wed Mar 25 15:10:19 2009] [info] Seeding PRNG with 656 by...

Can pysvn 1.6.3 be made to work with Subversion 1.6 under linux?

I see no reference on their website for this. I get pysvn to configure and build, but then it fails all the test. Has anyone had any luck getting this to work under linux? ...

UDP-Broadcast on all interfaces

On a Linux system with a wired and a wireless interface (e.g. 192.168.1.x and 192.168.2.x subnets) I want to send a UDP broadcast that goes out via ALL available interfaces (i.e. both through the wired and the wireless interface). Currently I sendto() to INADDR_BROADCAST, however it seems that the broadcast only is sent through one of t...

linux, directories, where should stuff go

I'm currently trying to get to grips with using linux. I'm running mint linux (an ubuntu variant). When I install something using apt-get, files seem to get scattered across various system directories at random (system meaning not my home directory), of course I know this isn't at random it just seems this way at the moment. However if...

How to use "xargs" properly when argument list is too long

Can someone please give me an example of using xargs on the below operation? tar c $dir/temp/*.parse\ | lzma -9 > $dir/backup/$(date '+%Y-%m-%d')-archive.tar.lzma I get the error from bash "/bin/tar: Argument list too long" Particularily I am trying to do LZMA compression on about 4,500 files; so this isn't surprising. I just do...

How to fix this virtual host setup?

Hello all, I have setup up 2 virtual hosts that share the same IP on a centos server running apache 2. #<VirtualHost *:80> # ServerAdmin [email protected] # DocumentRoot /www/docs/dummy-host.example.com # ServerName dummy-host.example.com # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/du...

How can I get the resolution (width and height) for a video file from a linux command line?

I've been digging through the mplayer/mencoder and ffmpeg documentation and I can't seem to come up with anything. I'm not especially picky as to the output format as I can use a regular expression to pull it out, I just can't seem to get the data in the first place. Thanks in advance! ...

How do I set up my Linux X terminal so that emacs has access to 256 colors?

When I run emacs -nw in an X terminal window, and I ask for M-x list-colors-display, I am offered a paltry palette: black red green yellow blue magenta cyan white I am told it is possible to get 265 colors. Setting the TERM environment variable to xterm-256color does n...

Adding Shell Scripts to CVS from windows

I am going to add some Linux shell scripts to CVS. Can I download the scripts using SSH secure shell client to windows and then add to CVS using Tortoise CVS client? (Just for ease... We have nice GUI in tortoise otherthan using cvs commands :)) Will it destroy the privileges set from the Linux? ...

How to identify a 64 Bit build on Linux using the preprocessor?

Hi. I am about to port a Windows 32 Bit application to 64 Bit, but might decide to port the whole thing to Linux later. The code contains sections which are dependent on the amount of memory available to the application (which depends on whether I'm creating a 32 or 64 Bit build), while the ability to compile a 32 Bit version of the co...

sem_post() fail with valid semaphore

I have a queue with a semaphore. At certain point all the calls to sem_post() always return 'Invalid argument' error although the semaphore itself is valid The semaphore is a private member of C++ object which is never deleted, it also can be inspected in gdb. I added sem_getvalue() just before the sem_post() - the value reads OK and th...

bash stacktrace

I need something like a stacktrace in bash, is that possible? A script is misbehaving. I need to know who calls that script, and who calls the calling script, and so on, only by modifying the misbehaving script. What do you say? ...

python convert microsoft office docs to plain text on linux

Any recomendations on a method to convert .doc, .ppt, and .xls to plain text on linux using python? Really any method of conversion would be useful. I have already looked at using Open Office but, I would like a solution that does not require having to install Open Office. ...