linux

Check if process is running

Hello, I am trying to check if a process is running. If it is running I want a return value of 'OK' and if not a return value of 'Not OK'. I can only use 'ps' without any other arguments attached (eg. ps -ef) if thats the correct term. The code I have is: if ps | grep file; then echo 'OK'; else echo 'NO'; fi The problem with this i...

Files appending instead of overwriting on upload (SFTP/SSH2)

I have been having weird FTP issues on certain VPS servers. I am not the one who set this up but could request a change if I find out the issue is on the server. Not sure if it is my FTP Program (CuteFTP) or the server it is on. Not to familiar with servers and settings but this seems to be what is happening (I am using the protocol type...

Subversion Permissions Conflict Leads To Interface Problem

I've been using SVN to track my projects, and I've run into a problem several times. svn: Directory "/programming/projects/mydirectory" containing working copy admin area is missing I bet you're familiar with that one. What seems to be making this happen is when I try to "svn add" a directory that I don't have write permission to....

Canadian Cross binutils To ARM

I'm using JLime on my HP Jornada 720 that uses a ARM processor. I've already have a cross-compiled gcc for x86(arm-linux-gcc). The idea of what I want to do is very difficult to understand, then take a look at this chart: arm-linux-gcc(at my Ubuntu laptop) -> binutils to run on a ARM processor(targeted to compile mips-elf while on my...

How do I play a tone in Linux using C?

I'm trying to write a program to randomly generate music based on a simple set of rules. I would like the program to be able to generate its own sounds, as opposed to having a file with audio for each note. Does anyone know a simple way of doing this? It would be nice (but not essential) for the sound to be polytonal, and I would like a ...

How to get linux console $COLUMNS and $ROWS from PHP cli?

I'm currently creating a new neat CLI library for PHP, and i'd like to figure out the width/height of the console it's running in. I've tried many things like digging through $_ENV, exec("echo $COLUMNS"), etc, but no result, while if i type echo $COLUMNS or $ROWS in bash commandline, it neatly displays the value. What do i need to do ...

What does phrase "Reuse of local addresses is supported" mean?

In The Single UNIX Specification, Version 2 http://www.opengroup.org/onlinepubs/007908799/xns/syssocket.h.html claims that the param value of SO_REUSEADDR in setsockopt means: "Reuse of local addresses is supported". Can some clarify me that phrase? ...

Firefox: Disabling exit alert boxes?

Is it possible to completely disable the JavaScript exit alert boxes that spring up when I try to leave the page? I'm running Firewatir on Ubuntu. ...

Sorting postgresql database dump (pg_dump)

Hello, I am creating to pg_dumps, DUMP1 and DUMP2. DUMP1 and DUMP2 are exactly the same, except DUMP2 was dumped in REVERSE order of DUMP1. Is there anyway that I can sort the two DUMPS so that the two DUMP files are exactly the same (when using a diff)? I am using PHP and linux. I tried using "sort" in linux, but that does not work....

Does a cross-platfrom compiler that can compile a native executable that can be run both in linux windows exist? Could it exist?

I remember a few years ago(2002) there was a multipartite virus that could be run natively on linux and windows. I don't know if a compiler could be specially craft an executable so that it could be read as both ELF and PE, so that the os would start executing at different entry points. Or a program that could merge two programs, one com...

Compose multiple JPEG files without re-compression

How can I compose (adjoin) multiple JPEG files without re-compression? I know there is jpegtran that can losslessly crop and resize JPEG images, so I wonder if there is similar tool to adjoin images lossless? Their size is a multiple 1 MCU block (16 pixels in both directions). ...

Range for FD (File Descriptor) in Linux

Possible Duplicate: Is 0 or 1 valid return values for socket() function call what is the range for FD(File Descriptor)? For example : int sockfd = socket(AF_INET, SOCK_STREAM, 0); or newsockfd = accept(sockfd, (struct sockaddr *) & cli_addr, (socklen_t *) & clilen); what is the range sockfd , newsockfd ? Are these >...

Avoid jvm capturing SEGV and hs_err_pid generation

I have a jni lib that crashes on a certain point. What I get is a hs_err_pid file with [error occurred during error reporting (printing native stack), id 0xb] content and a core file of this error creation. Therefore I would like to stop jvm from capturing these signals and just let the process dump core normally instead. Platform Deb...

How to invoke same program with different name?

I direct you to Kernighan & Ritchie exercise 7.1 Write a program that converts upper case to lower case or lower case to upper case depending on the name it is invoked with,... How can I invoke the same program with different names? I am using Linux, so I am invoking a compiled program just by entering: $./a.out What should ...

Java Swing display stops updating until X event generated

EDIT: additional info at the end I've got a (large) Java Swing application that's demonstrating some very strange behavior. If the computer running it is left idle (no mouse or keyboard input) for a sufficiently long time (varies between an hour or so and a couple of days), the Swing display sometimes stops updating totally (we've got,...

erasing terminal output on linux

Hi, I was writing a command line program which will have a status bar, much like wget. The main problem I'm facing is: how do I delete what I've already sent into stdout/stderr? I had on idea: use the backspace char '\b' and erase the output I've sent. Is that the best way? Is it the only way? Is there a better way? PS: I don't want ...

apt-get environment variables when spawning "debian rules" file

What are the environment variables made available to debian/rules (often make) when spawned by apt-get during installation of a package under Ubuntu? I am specifically after the environment variables that would pertain to Gnome's configuration directories. I'd like avoiding "hardcoding" things like ~/.conf/apps/ ... since I have been to...

Socket listen doesn't unbind in C++ under linux

I have a socket that listens on some port. I send the SIGSTOP signal to the thread that waits on the port(using accept) and terminate it. then I close the fd of the socket that I waited on. But for the next run of my project it doe's not allow me to listen on that port again. My program is in C++ under linux. What should I do? Some part...

How do I suspend another thread (not the current one)?

I'm trying to implement a simulation of a microcontroller. This simulation is not meant to do a clock cycle precise representation of one specific microcontroller but check the general correctness of the code. I thought of having a "main thread" executing normal code and a second thread executing ISR code. Whenever an ISR needs to be ru...

Linux application - minimize the dependencies

I am trying to minimize the dependencies caused by the shared library mysql++. I know it sounds strange; but I am struggling to solve a platform limitation on Slamd64 ( with 32bit compatibility installed ), where it natively doesn't have certain libraries. I am in a situation where I cannot alter the setup of libmysqlclient due to depend...