linux

Read Pdf with C

I want to be able to read the content of pdf files. I need to do that with C on Linux. The closer i can get to this was here but I think Haru can only create pdf and is not able to read them (not 100% sure). PS: I only need the plain text from pdf ...

Determining the amount of time processes spend Blocking/Executing

OK so for a programming assignment that I have (Yes, we are all allowed to turn to any source we find suitable for help) I have to find out how much time processes spend blocking/sleeping/running. My first attempt was creating a bash script... that looked something like this: for i in `ls /proc/ | egrep [0-9]+` do cat /proc/$i...

Executing a JAR on X startup

I'm trying to setup a kiosk type system in linux where a java application launches when X is initialized. I've got a script which does the following: java -cp {correct path to JAR with main method} -jar {name of JAR} When I've cd'd into the directory where the JAR sits, everything is peaches and the system works like I want, however, ...

Implementing worker threads (in Linux): How offensive is this?

#include <pthread.h> static void * worker_thread(void *); void some_func(void) { pthread_t * tmp; tmp = malloc(sizeof(pthread_t)); if (NULL != tmp) { if (!pthread_create(tmp, NULL, worker_thread, (void *)tmp)) pthread_detach(*tmp); else free(tmp); } } static void * worker_thre...

Changing lines in a file

I'd like to replace (as an example) the text of lines 5-15 in a file with the text from lines 6-15 from another file. But I'd like to do this over about 2000 files, and would rather not have to do it manually. I could script something in perl, but I'd like to try to do it with any built-ins possible. ...

Peak memory usage of a linux/unix process

Is there a tool that will run a command-line and report how much RAM was used total? I'm imagining something analogous to /usr/bin/time ...

Cross-platform partition management library?

Hi, I'm looking for some sort of partition management library (preferably a Python one, but anything works) that will function on both Windows and Linux. (For working with USB devices, specifically, but any harddisk tool should do) We'd much rather not implement two different libraries as that makes it harder to maintain, but so far we...

Symbolic links in Windows

I am using a huge data-base of images. This database gets duplicated every time I create a new test using the image data-base. So in Linux, I use Link file to a common database set. Now, I am in Windows, Is there any way we can use the Linux link to files or some equivalent in Windows. Or using some relative file path is the only way ou...

compiling actionscript in linux

Hello all. I'm working on a website that requires a flash mp3 player. I have absolutely no idea the procedures from messing with flash/actionscript/flex etc., however I need to edit the flash very slightly (I need to add two lines of code). There are a multitude of tutorials out there for setting up a flash (or flex or whatever) developm...

Why core dump file is generated ?

I am working on a Linux project for which I've written a makefile. Sometimes when I run my code a core dump file is generated. The filename is of the form core.* . And it is occupying too much space. Now, how to avoid this core dump file from being generated? Also can anyone tell why it is generated only sometimes? One more thing. Is t...

Surprise! the shell suggests command line switches

I noticed that the bash shell can suggest command line switches for your command. Just type your command, a dash (-) and type tab. The shell will show you available switches. For example, try: andy@andyx:~$ java - and press tab - Surprise! The question is: How do I interface with this feature. I.e., if I write a program that is ...

Are software appliances a way to hide the fact that you are using open source?

I am perceiving a trend that says you should pursue software appliances whenever you are extensively using open source as it provides a method to avoiding your customers ask how it was developed. If a customer sees that you are charging them a lot of money yet used lots of free open source then they will want to negotiate more deeply t...

How to enable tab-completion of command line switches in bash?

With bash, I can complete a command with TAB. Normally, it should also complete the command line switches: e.g. when I typed: java - it should show me the possibilities. It does not. How can I enable this preview? See also Surprise! the shell suggests command line switches ...

How to name a thread in Linux?

I have a multithreaded Linux application written in C/C++. I have chosen names for my threads. To aid debugging, I would like these names to be visible in GDB, "top", etc. Is this possible, and if so how? (There are plenty of reasons to know the thread name. Right now I want to know which thread is taking up 50% CPU (as reported by ...

Unified authentication library

The idea of unified authentication behind a single API like PAM is very attractive to me. However, PAM seems to be more oriented toward shell authentication and offer a rather limited set of features from its API and require system-wide configuration from a file. I'm looking for something like this for a CGI (C language) web interface t...

files on multiple processes

Hello, If one of my processes open a file, let's say for reading only, does the O.S guarantee that no other process will write on it as I'm reading, maybe leaving the reading process with first part of the old file version, and second part of the newer file version, making data integrity questionable? I am not talking about pipes which...

Enumerating attached DVD drives in Linux / Java / Scala

In my Scala (runs on top of Java) Application I would like to get a list of all drives that contain DVD media, e.g. something like this: /dev/scd0 Star Trek DS9 DVD1 /dev/scd0 The 4400 DVD1 Not sure if it's possible to get the name of the disc, but the path is the important thing for me anyway. I would prefer a pure Java / Sca...

Vim movement on other programs

I'm learning Vim and with it came the urge to use 'hjkl' and friends on every other program, including mouse operated programs like browsers. How can I use these keyboard shortcuts, or something similar? I'm using Linux. ...

legacy gcc compiler issues

We are using a legacy compiler, based on gcc 2.6.0, to cross compile for an old imbedded processor we are still using (yes, it is still in use since 1994!). The engineer that did the gcc port for this chip has long since moved on. Although we might be able to recover the gcc 2.6.0 source from somewhere on the web, the change set for this...

Best practices to put into a man page

Is there a best practices guideline for writing man pages? What should be included in the layout? The standard ones are: NAME SYNOPSIS DESCRIPTION EXAMPLES SEE ALSO There are others like OPTIONS, AUTHOR. As a user what would be useful to have? What isn't helpful? ...