linux

Relocating /proc/proc_id/ kind of directories in linux

I am writing a daemon in c++ on linux which would launch many processes. I'm considering a scenario when the daemon itself is killed. On restarting the daemon, I would like to kill all other processes launched by this daemon. Ideally I would like all the processes created by this daemon to die if it is killed. I'm considering a scenar...

How to write reliable file management code on NFS

Please give me some general advises on how to write reliable file management code using NFS. How to avoid or handle ESTALE errors? Programming language doesn't really matter. Thanks. ...

how to find the target file's full(absolute path) of the symbolic link or soft link in python

when i give ls -l /etc/fonts/conf.d/70-yes-bitmaps.conf lrwxrwxrwx <snip> /etc/fonts/conf.d/70-yes-bitmaps.conf -> ../conf.avail/70-yes-bitmaps.conf so for a symbolic link or soft link, how to find the target file's full(absolute path) in python, If i use os.readlink('/etc/fonts/conf.d/70-yes-bitmaps.conf') it outputs ../conf....

How do you get PHP, Symlinks and __file__ to work together nicely?

On my localhost box I have the following directory structure: /share/www/trunk/wp-content/plugins/otherfolders /share/www/portfolio/wp-content/symlink Where symlink is a symbolic link to /trunk/.../plugins/. Basically, this is because I need to test multiple WordPress installs and set them up, but I don't want to have to move plugins ...

HTTP Record/Playback alternatives to Eclipse+Solex

Hey All, I have been playing with Solex, http://solex.sourceforge.net/ ... quite a cool Eclipse plugin that allows you to record and playback HTTP traffic, make assertions, request-time header mods based on variables pulled from prior requests (via regexp, XPath). All in all, quite impressed; However, I can not see any method for runti...

How to rename() without race conditions?

If I want to rename A to B, but only if B doesn't exist, the naive thing would be checking if B exists (with access("B", F_OK) or something like that), and if it doesn't proceeding with rename. Unfortunately this opens a window during which some other process might decide to create B, and then it gets overwritten - and even worse there's...

Sorting on the last field of a line

What is the simplest way to sort a list of lines, sorting on the last field of each line? Each line may have a variable number of fields. Something like sort -k -1 is what I want, but sort(1) does not take negative numbers to select fields from the end instead of the start. I'd also like to be able to choose the field delimiter too....

GTK+ underscores - physically painful

Programming with GTK+ is annoying and physically painful because of the sheer amount of reaching out for the "_" key. For anyone with actual GTK+ experience, have you found a work around for this?. The platform is linux based. ...

Source code of PThread Library?

Hi, I am trying to find the source code of pthread library. (I guess its a supposed to be a part of Linux source code) But somehow can't find any good website that has it. I like this website: http://lxr.linux.no/#linux+v2.6.34.1/ where I usually find what I need. Somehow pthread source is not searchable. Anyway, I wanted to mention t...

Linux command to find text in most recent file matching name pattern

I have a directory of files like so: parent /dir1 file1 file2 other something name_pattern.o23409284 name_pattern.o29203429 name_pattern.o39208235 /dir2 ... I want to run a command that will look in the newest name_pattern.o* file for a line beginning with: ***END ...

Why running Java UI without SUDO breaks GUI appearance?

Why running application with SUDO changes GUI appearance? I.e.Button background, Button size, JTree appearance are behaving differently depending on how the GUI was started with SUDO or not. Will appreciate your suggestions. Thank you ...

how to use sed to delete some string

In my case text: 21 130.104.72.201 3124 HTTP [C]±ÈÀûʱ ·¨Óï³ãëÌìÖ÷½Ì´óѧ 03-05 14:34 0.238 22 129.108.202.10 3128 HTTP [C]ÃÀ¹ú µÂ¿ËÈø˹´óѧ 03-05 14:08 1.983 23 130.88.203.27 3128 HTTP [C]Ó¢¹ú Âü³¹Ë¹ÌØ´óѧ 03-05 14:08 0.996 24 129.74.152.66 3124 HTTP [C]·¨¹ú ʥĸÂêÀûÑÇ´óѧ 03-05 14:08 0.922 command: sed 's/HTTP.*://' ip_all02.txt ...

tokyo-python Install Issues

Hey guys, I'm trying to use Tokyo Cabinet in Python via the tokyo-python package. I've installed Cabinet, and the Cabinet development library. However, whenever I try to install tokyo-python with pip or easy_install, I get this ugliness. matt@amalgam:~/$ bin/pip install tokyo-python Downloading/unpacking tokyo-python Downloading tokyo-...

Building an Operating System

Hello friends, I would like to build an operating system, it's one of my dreams. Before that I like to recreate ubuntu or debian or something else. but before that I need some advice and help from all my friends. I am stuck in how to start what languages I need to build theories behind an OS lots of queries etc etc etc. I am happy i...

Modifying Shared Libraries in Linux

Is it possible to modify a shared library (.so) in Linux without getting its source code??? I know about LD_PRELOAD, but is that useful for functions that are used IN the shared library itself??? Is there a way to decompile/disassemble and then recompile/reassemble binary ELF files? ...

How to connect 2 webcams to a PC ?

How do I connect two webcams to a PC? I need to grab the frames from the two webcam inputs simultaneously. What software should I use and is there any extra hardware that I will need? I prefer connecting the cameras using USB as most computers have several of these ports. Also please suggest solutions that will work in Linux. I'm using U...

Resize native window

Hi Does anyone know of a cross-platform way to resize a native window - by native i mean one that runs inside of Windows', Mac's or Linux's windowing toolkit? Any help would be appreciated! ...

How to read the commentary of a certain svn commit version using terminal?

How to read the commentary of a certain commit version using terminal? Like: svn commit_version read or something similar? ...

C write() doesn't send data until close(fd) is called.

So I have this test code to send "HELLO" over a USB serial port: int fd; struct termios tty; if((fd = open("/dev/ttyUSB0", O_WRONLY|O_NONBLOCK|O_NOCTTY)) == -1){ err(1, "Cannot open write on /dev/ttyUSB0"); } tcgetattr(fd, &tty); tty.c_iflag = 0; tty.c_oflag = 0; tty.c_lflag = 0; tty.c_cflag = 0; tty.c_cc[VMIN] = 0; tty.c_cc[VTIME] = ...

Flash on Linux Server

Hi, I'm a Flash fanboy and want to hear that Flash works well with a Linux Server. How is Flashes performance in a Linux environment? I'm ignorant about servers and linux, but should have an answer. I'm trying to be objective. Thanks, REQUIREMENTS: • First prove Flash without a media server 'just flash runtime AVM2' • Have an answer f...