linux

Find missing numbers in continuous filenames (advanced ls & find)

Let's say I have a script that generates incrementing folder names over time (100, 101, 102, 103, 104, etc...). These folders are synced between machines and there is a chance of creation failure for any given folder on system 2. System 1 is always in sync: 100/ 101/ 102/ 103/ 104/ etc... System 2 may have errors: 100/ 102/ 103/ etc......

Segmentation Fault With Char Array and Pointer in C on Linux

So I have the following program: int main(){ char* one = "computer"; char two[] = "another"; two[1]='b'; one[1]='b'; return 0; } It segfaults on the line "one[1]='b'" which makes sense because the memory that the pointer "one" points to must be in read only memory. However, the question is why doesn't the line "two[1]='b'" s...

Assembly and System Calls

Im having a bit of trouble understanding the more complex system calls in assembly. I wrote a exec system call and it worked great .bss .text .globl _start _start: #exit(0) system call movl $1, %rax movl $0, %rbx int $0X80 Though I am a bit insure and have not been able to find info pertaining to how you...

Eclipse 3.5 / Statet / R Console not working on Ubuntu linux

Hi, I had Eclipse 3.4 working nicely with the R Console over rJava. I want to get Sweave working in Eclipse, but need Eclipse 3.5 / statet 0.8 to do it. When I try to start the rJava Console the JVM starts, but no feedback comes back to the console in Eclipse. JVM process below - any help gratefully received. Thanks, Dave dave 2...

How can I add text to the same line?

I used this command to find mp3 files and write their name on log.txt: find -name *.mp3 >> log.txt I want to move the files using the mv command and I would like to append that to the log file so it could show the path where the files have been moved. For example if the mp3 files are 1.mp3 and 2.mp3 then the log.txt should look lik...

An script that accepts a command

#!/bin/sh #My script echo "Are you sure you want to reorganize your files?" echo "Type y or Y to continue. Anything else will stop the process" read response if [ "$response" = "y" ] || [ "$response" = "Y" ]; then mkdir video mkdir audio mkdir text mv -v *.txt text >> log.txt mv -v *.wmv video >> log.txt mv -v *.mov video >...

How can I program software using Python for Linux/Windows?

For example, using C# I can make software fairly easily for Windows. I downloaded Python but all I get is a terminal like window for executing single lines of code. Is there a free IDE/Visual editor for designing GUI's in conjunction with Python? Thank SO. :D ...

Good framework for the game of Go (weiqi, baduk)?

I enjoy the game of Go (also known as weiqi in China or baduk in Korea). I want to create a program (an evaluation function) to play it. I would prefer if the framework handled two important tasks: Handle rules for the game, including captures, ko rules, and final scoring. Handle communication between a server like KGS and my program...

Coming from making Windows-only programs in C#, what steps are there for developing for Linux AND Windows?

I want to start making a little window-based program that runs on both Linux and Windows flawlessly. It must have a GUI. What are the things I should be reading about? I'm completely in the dark regarding this. Thank you. ...

SIGINT handling and getline

I wrote this simple program: void sig_ha(int signum) { cout<<"received SIGINT\n"; } int main() { string name; struct sigaction newact, old; newact.sa_handler = sig_ha; sigemptyset(&newact.sa_mask); newact.sa_flags = 0; sigaction(SIGINT,&newact,&old); for (int i=0;i<5;i++) { cout<<"Enter text: "; getline(cin,name)...

How to check the presence of php and apache on ubuntu server through ssh

Hello, I am not much into linux, so can any body please guide me how can I check whether the apache is installed with php and mysql on ubuntu server through ssh. Also if installed in which directory. And if in case some other package is installed like lighttpd. Thank You. ...

How to program a mouse click on Mac OS X and on Linux?

I know how to program a click on Win32 (click on the screen programmatically) using C or Ruby. Does anyone know how to do it on Mac OS X and Linux just as a comparison? thanks. ...

How to catch the ouput from a execl command

I'm using the execl function to run a Linux process from C. When I do, for example: int cmd_quem() { int result; result = fork(); if(result < 0) { exit(-1); } if (result == 0) { execl("/usr/bin/who", "who", NULL); sleep(4); //checking if father is being polite exit(1); } else { // father's time ...

Oldest code in a typical Linux distro

Just out of curiosity: What's the oldest code/package in a typical linux distro? Emacs? GCC? ...

'RTLD_NEXT' undeclared

I'm trying to compile a C program but I get the error 'RTLD_NEXT' undeclared. I think this is supposed to be defined in dlfcn.h which the c program includes, but when I looked inside dlfcn.h there is no RTLD_NEXT. How do I fix this? ...

How to make this C program compile?

When I type gcc gprof-helper.c to compile the program I get these errors: gprof-helper.c: In function `wooinit': gprof-helper.c:38: error: `RTLD_NEXT' undeclared (first use in this function) gprof-helper.c:38: error: (Each undeclared identifier is reported only once gprof-helper.c:38: error: for each function it appears in.) This is t...

How can I pipe the output of a program that can only write to a file (and not to STDOUT)?

I'm trying to write something like Perl Audio Converter, so I need to be able to decode every relevant audio format to wav (PCM) and then encode wav to every relevant audio format. I'd like to do this in parallel, by piping the output of the decoder directly to the input of the encoder. Most decoders have an option to decode to stdout, b...

Alternatives to gprof

What other programs do the same thing as gprof? ...

How to use gmon.out besides gprof?

What programs use gmon.out? ...

How to modify a C program so that gprof can profile it?

When I run gprof on my C program it says no time accumulated for my program and shows 0 time for all function calls. However it does count the function calls. How do I modify my program so that gprof will be able to count how much time something takes to run? ...