linux

How is it possible that kill -9 for a process on Linux has no effect?

I'm writing a plugin to highlight text strings automatically as you visit a web site. It's like the highlight search results but automatic and for many words; it could be used for people with allergies to make words really stand out, for example, when they browse a food site. But I have problem. When I try to close an empty, fresh FF wi...

Migrating a MySQL server from one box to another

The databases are prohibitively large (> 400MB), so dump > SCP > source is proving to be hours and hours work. Is there an easier way? Can I connect to the DB directly and import from the new server? ...

What is the format of /dev/input/by-path/pci-xxx-kbd output?

after doing $ cat /dev/input/by-path/pci-0000:00:02.0-usb-0:2:1.0-event-kbd > ~/test_kbd as root, I got a bunch of binary codes (which was expected). Now, I wanted to know how can I interpret this binary code to figure out what key has been pressed? What format is the output in? and is there a reference I could look at that would t...

Force consistent device naming on Debian Linux

I have a Debian (lenny) server with 9 sata disks. One disk is connected to the motherboard's sata controller. The others are connected to two PCI sata controllers (four disks each). The disk connected to the motherboard is the boot disk. Before this has worked fine and the boot disk has always been /dev/sda. But after upgrading the kern...

Why do I have to define LD_LIBRARY_PATH with an export every time I run my application?

I have some code that uses some shared libraries (c code on gcc). When compiling I have to explicitly define the include and library directories using -I and -L, since they aren't in the standard places. When I try to run the code, I get the following error: ./sync_test ./sync_test: error while loading shared libraries: libsync.so: can...

Why does wdiff not work with named pipes

How come I can do this in bash: $ diff -u <(echo -e "line1\nline2") <(echo -e "line1\nline3") --- /dev/fd/63 2009-03-30 09:49:07.527272646 +0100 +++ /dev/fd/62 2009-03-30 09:49:07.527272646 +0100 @@ -1,2 +1,2 @@ line1 -line2 +line3 i.e. I can use named pipes / process substituion to get the diff of a small chunk of text. However wh...

MD5 hash calculates differently on server

Hi Everyone, I am running some code that I have written in C which calls the md5 hashing functionality from a hashing library that someone else wrote (md5.c & md5.h). The odd behavior I have been seeing is: hashing working perfectly = I hash a string, and it comes out to the exact hash that I have verified it to be with multiple other...

Remote debug error with GDB

Hi, I tried to remote debug an 32-bit application on x86_64 suse linux, but get this "remote register badly formatted" error. I start up the gdbserver as listening on port 12345 (gdbserver localhost:12345 my_prog) And this is the error: $ gdb GNU gdb 6.6 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered b...

PHP Warning when attempting to use stat() or filemtime()

I am attempting to get the last modified time of a file that definately does exist: /document_root/myfile.pdf -rwxr-xr-x 1 11018 11008 198621 Nov 26 2007 myfile.pdf When i run the following statement (through PHP CLI as root): filemtime('/document_root/myfile.pdf'); I get errors: Warning: stat(): Stat failed for /document_r...

File search algorithms using indexing in linux

I think of implementing a file search program using indexing in linux... I know that there are several other file search programs like beagled. but I am doing this for study purpose... I am struck with how to do indexing.. I have the following idea that I took from maemo-mapper application.. for example if u have file named "suresh" its ...

Edit very large sql dump/text file (on linux)

I have to import a large mysql dump (up to 10G). However the sql dump already predefined with a database structure with index definition. I want to speed up the db insert by removing the index and table definition. That means I have to remove/edit the first few lines of a 10G text file. What is the most efficient way to do this on li...

How to get the SPID in linux 2.6 from C++

Hi! I have a question: Is there some way to the SPID in linux 2.6 from a C++ application? When I do a "ps -amT" I can see the threads in the process: [email protected]:~# ps -amT PID SPID TTY TIME CMD 1120 - pts/1 00:00:20 sncmdd - 1120 - 00:00:00 - - 1125 - 00:00:00 - - 1126 - 00...

how to pass int/char into system() a Linux system call

Ok it might sounds dumb, but I couldn't figure out a way to pass int/char into this system call here is how I would like it to work system ("cal %d %d", month, year); I expect this will give me the following command on terminal "cal 3 2009" and the terminal will show me the calendar of March 2009. But the compiler is complaining ...

designing consoles for hardware appliances

What are the best practices in designing UI for hardware appliances? Are there any frameworks in Java that are particularly suited to this task? ...

Operating System Scheduling Algorithms

What is the best algorithm to use for scheduling an application that will support 10K concurrent threads with heavy I/O but low CPU usage? Links to papers are appreciated. ...

How to limit I/O consumption of Python processes (possibly using ionice)?

I would like a particular set of Python subprocesses to be as low-impact as possible. I'm already using nice to help limit CPU consumption. But ideally I/O would be limited as well. (If skeptical, please humor me and assume there is value in doing this; it doesn't matter how long they take to run, there can be a lot of them, and there...

need hint with a custom Linux/UNIX command line utlity "cal" in C

Ok I need to make this program to display "cal" 3 month(one month before and one month after) side by side, rather than just one single month it displays in any Linux/UNIX. I got it working to display 3 calendar by using "system(customCommand)" three times; but then it's not side by side. I got some hint to use the following system cal...

Real Time Audio Analysis In Linux

I'm wondering what is the recommended audio library to use? I'm attempting to make a small program that will aid in tuning instruments. (Piano, Guitar, etc.). I've read about ALSA & Marsyas audio libraries. I'm thinking the idea is to sample data from microphone, do analysis on chunks of 5-10ms (from what I've read). Then perform a FF...

What's the easiest way to display an image in C/Linux?

I'm quite comfortable with C for numerical computation, but not for graphical programming. I have a Nx by Ny by 3 RGB matrix in a command-line program for linux (gcc, ubuntu) and I want to pop up a window with it as an image. What's the easiest way to do this? It has to be relatively quick because I'll be updating the image frequently....

How can I replace a specific line by line number in a text file?

I have a 2GB text file on my linux box that I'm trying to import into my database. The problem I'm having is that the script that is processing this rdf file is choking on one line: mismatched tag at line 25462599, column 2, byte 1455502679: <link r:resource="http://www.epuron.de/"/&gt; <link r:resource="http://www.oekoworld.com/"/&gt;...