linux

'find' optimization

'find ./ -name *.jpg' I am trying to optimize 'find' command for the above statement. method which handle the '-name' predicate in find implementation. static boolean pred__name __common (const char *pathname, const char *str, int flags) { boolean b; char *base = base_name (pathname); strip__trailing __slashes(base); ...

How do I crop a very large text file between first and last occurrence of a string? (Linux)

On a Linux system, I have a very large text file and I need to create a new text file which contains every line between the first and last of occurrence of a particular sessionId (those lines included). I guess I probably need to use sed or something? As a bonus, sometimes I won't know which log file will contain the session trace. So ...

How can I make QtCreator compile with gsl library?

Hi, I am trying to use the GNU Scientific Library (GSL) http://www.gnu.org/software/gsl/ in QtCreator. How can I tell Qt creator to add these flags: http://www.gnu.org/software/gsl/manual/html%5Fnode/Linking-programs-with-the-library.html to link correctly? ...

Is there a way to 'uniq' by column ?

Hello, i've a .csv file like this : [email protected],2009-11-27 01:05:47.893000000,xx2.net,127.0.0.1 [email protected],2009-11-27 00:58:29.793000000,xx3.net,255.255.255.0 [email protected],2009-11-27 00:58:29.646465785,2x3.net,256.255.255.0 ... I have to remove similar e-mails ( the entire line ) in the file. The problem is how...

Running a SQL query on my database behind the DMZ

Hi All, I am working on a web app that is hosted on a web server in a demilitarized zone (DMZ). I need to run MySQL queries on the database that is on its own server which is on the same local network as the web server, but not accessible via the internet. I can access the Web Server using putty, and the web server has MySQL installed....

EAGAIN error for accept on blocking socket

I am using a blocking socket to accept connection. I rarely get this error which makes it hard to debug. The accept returns with EAGAIN error. How can that be for a blocking socket? ...

search through a range of directories bash script

Hi, I have written (tried to) this small bash script for searching through a range of directories. #!/bin/bash shopt -s nullglob for file in [ac]*/blarg do echo $file done This script searches through directories starting with "a" through "c" for "blarg". It only goes one level deep. How can I make it step through all directori...

C++ static library link with shared lib. Compiling would be fine?

Here is a C++ project, and its lib dependency is Hello.exe -> A.so -> B.a B.a -> A.so Hello.exe depends on B.a and A.so, and B.a depends on A.so. GCC compiler will link Hello.exe successful? And if there is a b.cc file in B.a which includes a header file a.h of A.so, and also uses some interfaces of A.so, then with rig...

Keep getting gcov error when trying to run lcov in Windows command line

Hi all: I was wondering what else is actually needed in order to run lcov in windows command line? Every time when I run perl lcov, I always get a reminder or errors similar to the following: geninfo: ERROR: need tool gcov! I looked into my bin directory, and couldn't find a gcov.exe. I normally do perl genhtml filename to get a ht...

Visual SVN client for Linux

Does any one know of a good, free, visual SVN client for Linux? ...

Passing information between two seperate programs

I want to pass a value of an input variable in my program lets say#1 to another program #2 and i want #2 to print the data it got to screen, both are needed to be written in c++. The this will be on Linux. ...

How to programmatically set volume in Windows, Mac and Ubuntu?

I'd like to programmatically set volume in Windows, Mac and Ubuntu using C/C++. Command line also can but C/C++ preferred. Thank you in advance! ...

What could cause the dead loop, indicated by print "Dead loop on virtual device " in linux kernel?

The print comes when the 'current lock owner' of a kernel resource is current CPU. I don't know what could lead to this condition. Couldn't find much on the net. Anyone debugged this? ...

Linux group scheduling for user not being applied to setuid-ed process

On the 2.6.28-11 Linux kernel, I am using setpriority to bias the amount of cpu time different user processes receive. User 1 is to receive double the CPU power of user 2. Using Linux's setpriority, I have assigned user 2 a lower priority (higher in terms of nice values). When I run the exact same program via the shell with the computer ...

Crypto requirements and language/framework selection.

I want to build a web-based information management application for a client. The application will be used to store passwords and critical documents online. I want to know: (1) Which language/framework to go with: PHP or Ruby on Rails (RoR) or any other? (2) What type of hosting for good-security, Linux or Windows? Any other thing to b...

create word doc file from linux command line

I have some HTML files that I need to distribute in MS Word doc format (don't ask!). I can manually open each in OpenOffice and then save as a doc file. But I have quite a few files so I want to automate this. Do you know a way? ...

Pseudo-random stack pointer under Linux?

I was playing around with some code when I noticed something strange: [~] main% cat test.cc #include <stdio.h> void f() { int i; fprintf(stderr, "&i = 0x%08X\n", (long)&i); } int main(int argc, char**argv) { f(); } [~] main% g++ test.cc [~] main% ./a.out &i = 0xBFA27AB4 [~] main% ./a.out &i = 0xBFAD7E24 [~] main% ./a.out &...

Writing software for E-Book Reader Devices

Can you please recommend any E-Book Reader which can execute a third-party software, so that anybody can create software for such device? ...

A shell script problem for comparing difference between two files. [Linux]

Now my program generates two data files. a.txt and b.txt Take a.txt as an example, it's content just like this: 0,0 0,1 1,0 -3,1 1,-2 1,3 ...... b.txt is similar with a.txt. Now, I hope to find out difference lines count. In other words, for example, if b.txt like this: 0,0 1,1 1,2 -3,1 1,-2 1,3 ...... a shell script output 2 as...

Python: when to use pty.fork() versus os.fork()

I'm uncertain whether to use pty.fork() or os.fork() when spawning external background processes from my app. (Such as chess engines) I want the spawned processes to die if the parent is killed, as with spawning apps in a terminal. What are the ups and downs between the two forks? ...