unix

Xcode build phases

Hey guys I was wondering if in an xcode build phase if it was possible to get the users root directory. Right now I am trying to copy it to "~/" but it says that doesn't exist Is there another way to get the user directory (or the users short name)? Or is there a system folder I can write to that won't run into permission problems? ...

Using Sleep() while using timers through setitimer

I am using a timer in my C++ code through setitimer function from sys/time.h. This maps the SIGALRM signal to my timer handler method. After this I am not able to use sleep function. I am assuming it is because sleep uses SIGALRM signal as well. Can you suggest any workaround for this problem? Thanks for replying. ...

Shell script that writes a shell script

Two questions: how can I write a shell variable from this script into its child script? Are there any easier ways to do this? If you can't follow what I'm doing, I'm: 1) starting with a list of directories whose names will be stored as values taken by $i 2) cd'ing to every value of $i and ls'ing its contents 3) echoing its contents ...

How to return only part of a line with egrep

I have a program that returns something like this: status: playing artURL: http://beta.grooveshark.com/static/amazonart/m3510922.jpg estimateDuration: 29400 calculatedDuration: 293000 albumName: This Is It position: 7291.065759637188 artistName: Michael Jackson trackNum: 13 vote: 0 albumID: 3510922 songName: Billie Jean artistID: 39 son...

Deploying .Net Web Application to non-windows server

My question is what is needed and what are the restrictions of deploying a .Net web application to a specific server. Does the server need to be running windows? Does the server need to have the .Net framework installed on it? (is this possible with non-windows servers?) Does the server need to have IIS installed on it? (is this poss...

Location of configuration in unix program

I want to write a unix/linux program, that will use a configuration file. My problem is, where should I put the location of the file? I could "hardcode" the location (like /etc) into the program itself. However, I would like it, if the user without privileges could install it (through make) somewhere else, like ~. Should the makefile...

Existing C++ *nix system library?

There are several good cross-platform libraries, by which we usually mean something that wraps the commonalities of Windows and *nix. Is there anything for developers that don't really care about Windows but want the benefits of C++ wrapping *nix system calls? I am thinking of a library that reduces the tedium of struct setup, checking...

Splitting a binary file on binary delimiter?

I'm working on a shell script to convert MPO stereographic 3D images into standard JPEG images. A MPO file is just two JPEG images, concatenated together. As such, you can split out the JPEG files by finding the byte offset of the second JPEG's magic number header (0xFFD8FFE1). I've done this manually using hexdump/xxd, grep, head, and ...

clearcase: Backup for only modified checked-out elements in all views.

Hi all, Having a regular size-efficient backup for only the modified checkedout elements in all views would be a great thing for us, since a great deal of the defined dynamic/snapshot views cannot be included in the daily backup policy. The following ksh code is near to what we would need for a dynamic view, but it trivially assumes tha...

How do I compile .s assembly code in UNIX SPARC 64bit correctly?

Greetings all. Having problem trying to compile and run this "hello, wold" .s code in sparc UNIX 64bit environment and got $: "hello.s", line 1: error: invalid character (0xef) and etc. on other lines and addresses. Thought it was ANSI UTF issues, changed and saved and tried both types. Then tried to save file with ECO conversion to UNIX...

What does the `cc` option `-ldl` do in the following command?

hi... during compilation of dynlinktest.c it gives following error: unipro@ubuguest:~$ cc dynamiclinktest.c -o dynamiclinktest /tmp/ccli8dp2.o: In function main': dynamiclinktest.c:(.text+0x53): undefined reference todlopen' dynamiclinktest.c:(.text+0x83): undefined reference to dlsym' dynamiclinktest.c:(.text+0x109): undefined referenc...

Implementing EINVAL, EPERM, ESRCH in Kill()

I am trying to implement EINVAL, EPERM, ESRCH in my program. ERRORS EINVAL An invalid signal was specified. EPERM The process does not have permission to send the signal to any of the target processes. ESRCH The pid or process group does not exist. Here's my source code : #include <stdio.h> #include <sys/types.h> #inc...

Help analysing a process before it crashes and consumes all resources on a box

Hi guys, One of the servers I'm working on regularly crashes/freezes and consumes ALL resources on the box. It will continue doing this until the process is killed (difficult to run manually since the box has no resources to allow me even to enter a command) or the box is manually rebooted. I'm not very experienced in unix OSes - can y...

Can i control PSFTP from a Python script?

Hi, i want to run and control PSFTP from a Python script in order to get log files from a UNIX box onto my Windows machine. I can start up PSFTP and log in but when i try to run a command remotely such as 'cd' it isn't recognised by PSFTP and is just run in the terminal when i close PSFTP. The code which i am trying to run is as follo...

Java simple Timestamp to Date conversion

I've been trying to find the answer to this for a while today and there's just so much contradictory information.... What I'd like to do is get a current unix timestamp in android, and then convert it to a format that allows me to getHours() and getMinutes(). I'm currently doing this: int time = (int) (System.currentTimeMillis()); Tim...

Why do I always need "ruby" in front of "script/runner"??

When I do just script/runner it gives me -bash: script/runner: Permission denied When I do sudo script/runner it gives me sudo: script/runner: command not found It only works when I do ruby script/runner. Why? Everywhere else I see people just run script/runner without the ruby in front of it... Is there a "fix" for this? It's causing ...

sigset: ignoring ctrl-c in Unix

Hello, I am trying to make my program ignore ctrl-c in unix which seems to work, the issue is that it keep writing "Syntax error". Here is the code extern "C" void ignore( int sig ) { fprintf( stderr, "\n"); // Print a new line // This function does nothing except ignore ctrl-c } int main() { // For ...

What does waitpid() do?

What is the use of waitpid()? ...

How to print hex value of 255 in Unix ?

Hi, can you please tell me How to use printf to find out the hex and octal values of 255? Thanks a lot. ...

difference between character devices vs Terminal devices vs Streams

Hello guys, I am unable to figure out the exact difference between character devices vs Terminal devices vs Streams. Any help is very much appreciated. Thanks & Regards, Mousey. ...