Usually I use shell command time. My purpose is to test if data is small, medium, large or very large set, how much time and memory usage will be.
Any tools for linux or just python to do this?
...
File1:
hello
world
How would one delete the leading/trailing blank spaces within this file using sed - using one command (no intermediate files)?
I've currently got:
sed -e 's/^[ \t]*//' a > b
For leading spaces.
sed 's/ *$//' b > c
And this for trailing spaces.
...
File1:
hello (OPTION1) 123456 123456 123456
world (OPTION1) 123456 123456 123456
foo (OPTION1) 123456 123456 123456
bar (OPTION1) 123456 123456 123456
How would one remove each string after each first word in the textfile File1?
This would probably be down with awk/sed/cat - but I cannot figure it...
While I was working i came across a code which was written by somebody else.
i see a statement as ,
sprintf(o_params->o_file_name,
"%s_%s_%04.4d_%s_%s.ASC",
"OUTD", "RM", sequence_no, DateStamp_buf1, TimeStamp_buf1
);
In the above statement, I see %04.4d. Is this a correct format specifier?
The variable sequence_no ...
Could anybody please tell me which is best guide/book/material for socket programming in C?
I am reading beej's guide for network programming but it just gives an overview.
Can you suggest any other books or guides?
...
Problem:
I have a hand held device that scans those graphic color barcodes on all packaging. There is a track device that I can use that will slide the device automatically. This track device functions by taking ascii code through a serial port. I need to get this thing to work in FileMaker on a Mac. So no terminal programs, etc...
What...
I'm trying to build a firewall manager in PHP, but when I execute, <?php exec('iptables -L'); ?>, the result array is empty.
I have tried, <?php echo exec('whoami'); ?>, and the response is www-data (the user that Apache is using). What can I do to execute the exec function as root? (Preferably without changing the Apache user.)
...
How can one create a new file descriptor from an existing file descriptor such that the new descriptor does not share the same internal file structure/entry in the file table? Specifically attributes such as file offset (and preferably permissions, sharing and modes) should not be shared between the new and old file descriptors.
Under b...
File1:
hello
world
I don't know the best method to extract a list of words from a text file, find their definitions and paste them into an output textfile. I've been thinking of using WordNet - but don't know how to automate the process.
Does anyone have any ideas (perhaps google/APIs/linux applications) that one could use to find th...
Windows has an option to open a file with exclusive access rights. Unix doesn't.
In order to ensure exclusive access to some file or device, it is common practice in unix to use a lock file usually stored in the /var/lock directory.
The C instruction open( "/var/lock/myLock.lock", O_RDWR | O_CREAT | O_EXCL, 0666 ) returns -1 if the l...
I am using some macro in my source file (*.c ) .
Is there any way during compilation or from the library that I can identify the exact header file from which this particular macro is getting resolved ?
The issue is we are using a macro #defined to 10 in some header file, but the value being received in the code is 4 . So instead of g...
I'm looking to be able to run a single query on a remote server in a scripted task.
For example, intuitively, I would imagine it would go something like:
mysql -uroot -p -hslavedb.mydomain.com mydb_production "select * from users;"
...
I'm trying to figure out the security concerns between buffer overflows in Windows vs Unix.
As I understand it, the buffer overflow Windows hack cannot be implemented in Unix because each process is given it's own memory space. Does this mean that processes in Windows share memory space?
...
I understand the basics of networking such as Lan and stuff. I know what many of the protocols are and how to build a client/server socket program in C. But what I really want is a very good understanding of how networks actually work. Not only from a programming aspect but also from a application aspect. I am looking for some materi...
FILE:
hello
world
I would like to use a scripting language (BASH) to execute a command that reads each WORD in the FILE above and then plugs it into a command.
It then loops to the next word in the list (each word on new line).
It stops when it reaches the end of the FILE.
Progression would be similar to this:
Read first WORD fr...
I have a table with two columns
column_1 column_1
12345 12345
73255 73255
71377 71377
Now i want to create an xml like
<header>
<value>12345</value>
<value>73255</value>
<value>71377</value>
<footer>
basically i need to use a select query and put any one of the fields into the values of xml.
could you please suggest h...
Hello there,
i am trying to check, with plain c, whether the DST is set on a specific date and time. i have tested gmtime and localtime, but these functions only take care of the current system DST.
Thanks for your advice.
thomas
...
Writing my own toy shell, and have run into a bump trying to implement job control.
I am setting the process group of the child, both in the child and the parent with setpgid. My wait call is:
pid = waitpid(-pid, &status, 0)
However, waitpid returns -1 and perror says "No child process". However, it does seem to wait every time. ...
How do I view the file below in Enterprise Guide (v 4.1 ) ??
%let libWORK=%sysfunc(pathname(WORK)); * work lib is on UNIX ;
data _null_;
file "&libWORK./MYFILE.htm";
put '<html>' /
' <head>'/
' <title> A Title </title>'/
'</head> <body> some content </body> </html>';
run;
...
Basically, I am creating an XML file by taking the values from a column of a table.
I am starting an AWK script from a shell script (ksh if it matters) like this:
SQL_RESULT=`sqlplus -s ${CONNECT_STRING} << EOF
${SQLPLUS_SETTINGS}
select customer_id from GD9_GENTH_CUST_SUBSCR;
exit;
EOF`
FILE_LIST=`echo $SQL_RESULT|sed -e 's/\n/''/g'`
...