Hi, I'm brushing up on my general programing skills and I've come across a snag. I'm writing a program that simulates a colony of bunnys. Once this program starts it is autonomous, however, at any point the user should be able to press the 'k' key to cull the population by half. I can't think of a way to do this without pausing the progr...
Can someone please explain to me what happens inside an interrupt service routine (although it depends upon specific routine, a general explanation is enough)? This always used be a black box for me.
...
Hello guys,
I have questions regarding stacks and dynamic memory allocation.
1) Does kernel determine the size of the stack dynamically during run time or sets the size before the load time ? If stack size is allocated dynamically how can stack overflow take place (Because if size of stack reaches beyond the limit the page handler wil...
I have lines of data that contain
single column and two columns. What I want to do is to
extract lines that contain only 2 columns.
0333 foo
bar
23243 qux
yielding only:
0333 foo
23243 qux
Note that they are tab separated, even for lines with only one column
you have tab at the beginning.
What's the way to do it?
I tried this...
Hi,
I ssh to another server and run a shell script like this nohup ./script.sh 1>/dev/null 2>&1 &
Then type exit to exit from the server. However it just hangs. The server is Solaris.
How can I exit properly without hanging??
Thanks.
...
Hi,
I am writing a Perl script and I need to execute Unix Ctrl-Z on the script.
How can I do it in Perl ?
thanks.
...
hi,
i have 2 csv files on my windows machine that i want to transfer to a unix server every hour (because the 2 files are updated every 30min).
so i search on the web and i found this possibility: to ftp the files from windows to unix using a batch and task scheduler.
i want to know if it's possible to do it from the unix server with ...
Hi, I have created a following program in which I wish to poll on the file descriptor of the file that I am opening in the program.
#define FILE "help"
int main()
{
int ret1;
struct pollfd fds[1];
ret1 = open(FILE, O_CREAT);
fds[0].fd = ret1;
fds[0].events = POLLIN;
while(1)
...
I made the following script which searches for certain processes, displays uses pflags for each one, and stops when it finds one with the word "pause":
!cat find_pause
#!/usr/bin/perl -W
use warnings;
use strict;
if (open(WCF,
"ps -ef | grep '/transfile' | cut -c10-15 | xargs -n1 pflags 2>&1 |"
)) {
while (<WCF>) {
...
Hi guys, I got a small problem
.
I have this date format from .net json output:
Date(1280471989140);
when I try to convert using
+ (NSDate*)dateFromUnixDate:(double)unixdate {
NSTimeInterval unixDate = unixdate;
return [NSDate dateWithTimeIntervalSince1970:unixDate];}
but I got the wrong date back,why?
thanks
...
Hi All,
I am looking for a real world scenerio where using exec will be the only availble option ( The problem could not be solved if exec is not used)
I know what is exec and how it differs from fork, but still intrested in real world problem that enforce the use of exec command.
...
Hi,
I was trying to set the timezone of my system, and was trying to use settimeofday(), which takes a timezone struct as an argument, but just read that that struct is now obsolete (http://linux.about.com/library/cmd/blcmdl2_settimeofday.htm) How could I go about doing this?
Thanks in advance.
EDIT: Ugh, I feel really stupid.
I crea...
I have asked how to make any command "ask for yes/no before executing" in the question
http://stackoverflow.com/questions/3231804/in-bash-how-to-add-are-you-sure-y-n-to-any-command-or-alias
It seems like for the command
hg push ssh://[email protected]//somepath/morepath
I can also do this:
echo ssh://[email protected]...
I am trying write a shell script that will kill all processes that are running that match a certain pattern, then restart them. I can display the processes with:
ps -ef|grep ws_sched_600.sh|grep -v grep|sort -k 10
Which gives a list of the relevent processes:
user 2220258 1 0 16:53:12 - 0:01 /bin/ksh /../../../../../ws_...
Hi,
I am using 'expect' to automate ssh password authentication. When I run the script in SunOS, I find the spawned ssh process gets killed once the below script is completed. This is not the case in Linux. How do we avoid it? Should we ignore the SIGCHLD signal somehow?
Is there anyway to determine through this script if spawned proces...
The Unix cut command takes a list of fields, but not the order that I need it in.
$ echo 1,2,3,4,5,6 | cut -d, -f 1,2,3,5
1,2,3,5
$ echo 1,2,3,4,5,6 | cut -d, -f 1,3,2,5
1,2,3,5
However, I would like a Unix shell command that will give me the fields in the order that I specify.
...
I want to learn about debian source packaging.Is there any good tutorial for that.Please give your suggestions.
...
The standard chmod privileges are "644" for files and "755" for directories, aren't they?
In most cases, PHP doesn't need to write to files or directories. So couldn't I take the write privileges from all groups?
I could assign "444" to all files and "555" to all directories.
Wouldn't that be more secure?
Thanks in advance!
Note: ch...
When we develop locally, we append ".dev" or ".prod" to files that should be made available only to the development/production server respectively.
What I would like to do is; after deploying the site to the server, recursively find all files with the ".dev" suffix (for example) and remove it (renaming the file). How would I go about do...
I want to add a timestamp to server events and store the result in a log.
My first idea was :
( ./runServer.sh ) | sed "s/.*/`date +%s` & /" | xargs -0 >Server.log 2>&1 &
But it seems sed never reevaluates the date, so all events get the same timestamp.
Now I'm trying to get around that using environment variable but I can't find ...