linux

Efficient filesystem searching

I am writing a program which searches through all the sub-directories of a given directory. The problem is, is that I know the name of the file that I am looking for (data.txt) but I still need to know all of the (possibly multiple) locations where the file is. I am using this code to search: struct dirent *dp; struct stat s; DIR *dir; ...

screen recording in x windows system.

Hi everyone, can anybody tell me how to record screen activities for specified amount of time. Look i have to choose for x only. I know xwd is there to dump screen, can it be extended to record the screen. No fancy debian tools and image magick utilities please. ...

Problems with shell-script while!

First of all, I'm a beginner on shell-script. This code I've done is not working. I want to repeat a code for 30 seconds but it doesn't work. It just keep doing my logic indefinitely. DIFF=0 while [ $DIFF < 30 ]; do START=$(date +%s) ######## My logic ######### DIFF=$(( $END - $START )) echo $DIFF cd .. sleep 5...

Segmentation fault while embedding python in ubuntu

I have an application where I'm embedding python. It was developed on windows where it works fine, but now I'm porting it to linux with less success where it crashes in Py_Initialize(). From gdb, it seems to happen when loading the os module. gdb reports this callstack on seg fault: #0 0x002384fc in import_submodule (mod=None, subname...

Grails on linux problem: provider for SAXParserFactory can not be found

Running a recently started Grails (1.3.1) application fails on both our linux machines (Bamboo server & laptop) with the exception "Provider for javax.xml.parsers.SAXParserFactory cannot be found". This both using maven or standalone. On our OS X and Windows developments machines using JDK 1.6_020 the problem does not occur. When using ...

Move window between tmux clients

I'm just learning tmux and I have no experience with screen. I'm wondering if I can move a window in on tmux client to another tmux client. I basically just want to move my irc client to a new window on my screen. ...

Help setting up sphinx

ok I downloaded sphinx-0.9.9.tar.gz to my desktop I extracted to a folder called sphinx on my desktop. I run: cd ~/Desktop/sphinx ./configure --prefix=/usr/local/sphinx --with-mysql alot of stuff happens. Then I run this line make I get this error: make: * No targets specified and no makefile found. Stop. I...

Can't get Crontab to work

I've been trying to get crontab to work for a while but it doesnt seem to want to work. The python script I need to initialise every midnight works perfectly from the command terminal. The location of my python script is: /home/rv/ncbi-blast-2.2.23+/database_backup/backup.py My contab looks like this: SHELL=/bin/bash PATH=/sbin:/...

Linux daemonize

I am writing a linux daemon . I found two ways to do it. Daemonize your process by calling fork and setting sid. Running your program with & Which is the right way to do it ...

Adding a file to a project via project.vim

I'm using project.vim to manage a project, and I'm having trouble adding a file to the project. I read the documentation and it said to 'insert the filename into the project entry, then hit return on it'. From what I understand, a project entry is one of the sections in the project window that looks like... Header Files="Header File...

How to get an array of .png files in a folder using Bash

Hi I am a newbe to bash programming and need some help. I am building a pipeline for image processing. I would like to be able to take the png images in a folder and pass them to clusterImage.pl once that is done I would like to then pass the outputted file to seperateObjects.pl the outputted file is of the same name but has kmeansOutput...

Why running sudo to my own account fixes graphical problems in Swing GUI

My swing GUI application starts with a script. When I run that script under Linux without sudo it gives me unexpected Look and feel and other graphical problems. Why is running with sudo su to my own account fixes this problem? ...

Load a .so library into ctypes

I have compiled a library using cmake add_library(object3d SHARED some_file.h some_file.cpp). After compilation, I get a file: libobject3d.so I would like to call a function in this library. This function definition in some_file.h is: void ComputeGeometryImage(char * input_image, int geometry_image_size, float * output); I did check...

virtual memory consumption of pthreads

Hello I developed a multi-threaded TCP server application that allows 10 concurrent connections receives continuous requests from them, after some processing requests, responds them to clients. I'm running it on a TI OMAP l137 processor based board it runs Monta Vista Linux. Threads are created per client ie 10 threads and it's pre-thre...

Deleting an opened file in Infinite looped process

Hi , I have doubt in the following scenario Scenario: A process or program starts with opening a file in a write mode and entering a infinite loop say example: while(1) whose body has logic to write to the opened file. Problem: What if i delete the opened or created file soon after the process enters the infinite loop Thanks in adva...

How to get free minor number for a linux device driver?

I have multiple processes in my linux environment that have to use the same device driver to access a number of similar devices. My problem is that if one process instantaiates a device(by instantiate, I mean mknod ) file, and uses a minor number say 0 and 1 for two devices. So how does the other process while doing the same thing come t...

fork and exec in bash

How do I implement fork and exec in bash? Let us suppose script as echo "Script starts" function_to_fork(){ sleep 5 echo "Hello" } echo "Script ends" Basically I want that function to be called as new process like in C we use fork and exec calls.. From the script it is expected that the parent script will end and then after 5 seco...

Question on sed command?

I am trying to use sed to delete parts of a text file with lines like: 23920 E S:1 R:2 C:14 L:5 ch 80 7279 1113 5272 -342 1168 5642 -347 1265 5587 23921 E S:1 R:2 C:14 L:6 ch 1 4605 1267 4586 11 1331 4587 -31 1306 4692 The parts I need to delete are the parts like E S:1 R:2 C:14 L:5 ch 80 and E S:1 R:2 C:...

How do you change the default Pear/PECL build folder from /var/tmp?

I'm trying to install a PECL package on Linux, but the installer never gets past the configure stage. My hosting provider mounted a file system at /var/tmp that prevents files from executing, and that's causing this error: root@host [/usr/local/apache/conf/includes]# pecl install pdo downloading PDO-1.0.3.tgz ... Starting to download P...

How to compile Mercurial and move it to another computer.

I have been trying to install Mercurial on a GoDaddy deluxe server which I have ssh access to. It fails because the server does not have GCC installed and I do not wish to attempt to install it. GoDaddy support said I need to compile Mercurial locally and move it to their server. Could anybody refer me to some resources on how to compil...