unix

Confusing output from time...

This command gets some data from MySQL and then manipulates it. Why is the 'real' time so much higher than the 'user' time? >time ./command.rb real 45m45.457s user 3m36.478s sys 0m28.226s For clarification - I understand the difference between the real, user, and sys output. However, I am confused at why there is such a gre...

Unix C++ simple server question: sending data back to browser

Hi. I am creating a simple Unix server written in C++ that simply waits for incoming connections, and then when a connection is established, it sends the requested data back to the client's browser to be displayed. I have everything working except for the sending of the data to the client. This is how it should work: I start server and...

Should I use msgsnd or mq_send?

I'm learning Unix IPC, and my book only talks about the msg* family of functions. However while browsing the man pages I learned about the mq_ equivalents. http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi/0650/bks/SGI%5FDeveloper/books/T%5FIRIX%5FProg/sgi%5Fhtml/ch06.html describes some differences between the two, but I'm not sure...

Performance of one huge unix directory VS a directory tree?

My PHP project will use thousands of pictures and each needs only a single number for it's storage name. My initial idea was to put all of the pictures in a single directory and name the files "0.jpg", "1.jpg", "2.jpg", and all the way to "4294967295.jpg" . Would it be better performance-wise to create a directory tree structure and na...

Searching code files for a particular string

Hello, Im using Ubuntu Karmic as my operating system . I frequently need to search my project folder for a particular string, to see if its there in any of the files in the project folder or its subfolders. I currently use the find command to do that, and have written a script that accepts the string im looking for as the parameter. fi...

add seconds to a date

i need to add a seconds in a date. for eg:if i have a date as 2009127000000, i need to add the seconds to this date. also for eg 20091231235957 adding 50 seconds. is this possible in C? ...

How does a process come to know that it has received a signal

Hi, Please correct me if i am wrong. Here is my understanding about signals: As far as i know, signal generation and signal delivery are 2 different things. In order to generate a signal, the OS simply sets a bit in a bitarray maintained in the Process Control Block(PCB) of the process. Each bit corresponds to a particul...

junit testing a class with shell scripting functionality under win32

Hi, We have an API which is used in a class via an exposed interface. The API is meant for UNIX family and assumes, that every UNIX has /bin/sh. Thus when running the junit test under win32 we get: Cannot run program "/bin/sh" Is it a catch-22 situation or there is a chance to work it out? Maybe some framework other than junit exists ...

XArgs command on cygwin is mangling file paths

I'm trying to use xargs on a Cygwin Windows system to remove SVN files deleted locally. I run the following command that generates the following output: svn status | grep '^\!' | sed 's/! *//' weblings-webplatform\vendor\jetty-7.0.0.pre5\contexts-available\test-annotations.d\META-INF\MANIFEST.MF weblings-webplatform\vendor\jetty...

Offset from GMT standard time

Does Unix store the offset of the machine from GMT internally? like for eg:india standard time is GMT + 5:30.is this 5:30 stored some where? i need this to use it in a script like below if[[ off is "some value"]] then some statements fi ...

changing to parent directory in unix

in general we use cd .. for going to the parent directory cd ../../ to go to the parents parent directory. and cd ../../../../../ for 5th parent directory. is there any simplified way of doing this? shell i am using is ksh. ...

Removing duplicates on a variable without sorting.

I have a variable that contains the following space separated entries. variable="apple lemon papaya avocado lemon grapes papaya apple avocado mango banana" How do I remove the duplicates without sorting? #Something like this. new_variable="apple lemon papaya avocado grapes mango banana" I have found somewhere a script that accompli...

unix process id

how to a Write a script that runs a 5 instances of a child process in the background (at a gap of 5 seconds) and do a continuous check to see if any of the child process is completed it starts another instance of the same process till the child process has executed 20 instances. ...

Performance profiling on Linux

What are the best tools for profiling C/C++ applications on *nix? (I'm hoping to profile a server that is a mix of (blocking) file IO, epoll for network and fork()/execv() for some heavy lifting; but general help and more general tools are all also appreciated.) Can you get the big system picture of RAM, CPU, network and disk all in on...

Removing a process from Connect:Direct queue.

How do we remove a process from a the Connect:Direct Process queue? ...

Assign threads to run on a custom Core in Unix

Is it possible to run a particular thread/process on any core we want? Since multi-core systems are available today . Is it possible to assign two (mutually independent ) segments of code run on any core we want to rather than wait for it to be assigned in a round robin fashion? This way we can truly reap the benefits of parallel proces...

why can't I find my.cnf?

I did updatedb. I did locate my.cnf But I cannot find it? Nothing. (I installed MYSQL using aptitude install mysql-server, and mysql does work right now.) ...

Postgres Error (Getting PLJava set up)

I have been struggling with a problem trying to get PLJava to work on PostgreSQL on RHEL. Here is what I have (based off of this: PL/Java README) .cshrc setenv JAVA_HOME /opt/jdk1.6.0_17/ setenv LD_LIBRARY_PATH ${JAVA_HOME}/jre/lib/i386 setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${JAVA_HOME}/jre/lib/i386/client setenv LD_LIBRARY_PATH ...

Is writing to a socket an arbitrary limitation of the sendfile() syscall?

Prelude sendfile() is an extremely useful syscall for two reasons: First, it's less code than a read()/write() (or recv()/send() if you prefer that jive) loop. Second, it's faster (less syscalls, implementation may copy between devices without buffer, etc...) than the aforementioned methods. Less code. More efficient. Awesome. In U...

difference between -h <name> and -o <outputfile> options in cc (C++)

I am building .so library and was wondering - what is the difference b/w -h and -o cc complier option (using the Sun Studio C++) ? Aren't they are referring to the same thing - the name of the output file? ...