I'm writing an application that is split into two parts for Mac OS X - a daemon and an agent. I'm using a standard unix socket to communicate between the daemon and the agents. That is, the socket is created with PF_UNIX and SOCK_STREAM.
When agents are created (whenever a user logs in), one of the first things it does is to connect to...
I have a number of .css files spread across some directories. I need to find those .css files, read them and if they contain a particular class definition, print it to the screen.
For example, im looking for ".ExampleClass" and it exists in /includes/css/MyStyle.css, i would want the shell command to print
.ExampleClass {
color: #ff00...
I'd like to run a program on a directory of files. I know how to do this with one file, using
cat myFile.xml | myProgram.py.
How can I run myProgram.py over a folder, say myFolder?
Thanks!
...
I have a C program, and I'd like to have it filter all its input with tr. So, I'd like to start up tr as a child process, redirect my stdin to it, then capture tr's stdout and read from that.
Edit: here's the code I have so far, which doesn't work. It segfaults instantly, but I don't understand why:
#include <stdlib.h>
#include <stdio....
Hi,
I'm calling a C/C++ program from python with Popen, python code should observe behavior of child process and collect some data for his own work.
Problem is that C code already uses pipes for calling some shell commands - so after my execution from python, C program cannot execute bash shell command.
Is there any way in calling fro...
Hi,
I'm trying to retrieve a UNIX timestamp from a query by combining a date and a time field in the table, however it keeps returning as zero.
SELECT *,
UNIX_TIMESTAMP(startdate starttime) AS start,
UNIX_TIMESTAMP(enddate endtime) AS end
FROM mytable;
Can anyone help me out?
Thank...
An enormous equation. You need to add \left| on the left side of corresponding |. The corresponding | you need to replace with \right|.
Equation
\begin{equation}
| \Delta w_{0} | = \frac{|w_{0}|}{2} \left( |\frac{\Delta g}{g}|+|\frac{\Delta (\Delta r)}{\Delta r}| + |\frac{\Delta r}{r}| +|\frac{\Delta L}{L}| \right)
\end{equation}
[Pr...
EDIT: I don't know in advance at which "column" my digits are going to be and I'd like to have a one-liner. Apparently sed doesn't do arithmetic, so maybe a one-liner solution based on awk?
I've got a string: (notice the spacing)
eh oh 37
and I want it to become:
eh oh 36
(so I want to keep the spacing)
Using awk I don't fi...
$ cat read.sh
#!bin/bash
// how can I read the columnwise data to awk-script?
awk '{sum+=$1} END {print sum}' read
$ cat data
1
2
3
4
5
$ . ./read.sh <data
awk: cmd. line:1: fatal: cannot open file `read' for reading (No such file or directory)
...
When searching code for strings, I constantly run into the problem that I get meaningless, context-less results. For example, if a function call is split across 3 lines, and I search for the name of a parameter, I get the parameter on a line by itself and not the name of the function.
For example, in a file containing
...
someFuncti...
echo $_POST['time']."<br/>";
echo $_POST['day']."<br/>";
echo $_POST['year']."<br/>";
echo $_POST['month']."<br/>";
I have value store like this now I want to create a timestamp from these value.
How to do that in PHP?
Thanks in advance
...
when I try to sort the following text file 'input':
test1 3
test3 2
test 4
with the command
sort input
the output is exactly the input. Here is the output of
od -bc input
:
0000000 164 145 163 164 061 011 063 012 164 145 163 164 063 011 062 012
t e s t 1 \t 3 \n t e s t 3 \t 2 \n
0000020 1...
I installed Xcode a long time ago.
Apparently I didn't check back then the "UNIX Developemtn Support" checkbox.
Now I want to have them bu when I click on the installation this is what appears:
The UNIX Development Support check box is disabled
Q. ¿How can I install the UNIX Development Support? Is there a way to run some script ...
This is probably a dup (but did not find it..)
When you type ls -l in unix you get output like this:
% ls -l
total 48
-rwxr--r-- ... change*
-rwxrwxrwx ... checkVersion*
-rwx------ ... info*
I know that the first group of rwx sets the users permisions and the last group sets "everyone else's" permisions. I think that the secon...
What is the best practice when storing a directory in a file name on a unix system? Should the directory path end in a slash?
Method A
TMP="/tmp/pasteTmp/"
which allows you to do:
cd "$TMP$fileName"
Method B
TMP="/tmp/pasteTmp"
which allows you to do (with an extra slash which seems less clean):
cd "$TMP/$fileName"
but a...
I have a multithreaded code that has to generated a set of objects and write them to a file. When I run it I sometime get "Too many open files" message in Exception. I have checked the code to make sure that all the file streams are being closed properly. Here is the stack trace.
When I do ulimit -a, open files allowed is set to 1024. W...
I'm reading text files but I don't know in advance the kind of line ending used in this file. I need to know whether it uses UNIX \n or windows style \r\n line endings.
What is a reliable and fast way to detect this?
...
How could one get started with smartcards programming? I am asking here about all the toolkit he needs in order to get started: books, tutorials, hardware etc.
I am planning in playing around with a couple of smartcards programmers and I am pretty new to this field.
Edit: I am mostly interested in programmers that play nice with Unix-l...
logging a output(regular or error) of a unix program into a file.
...
A simple link would be nice for me to understand how to install my C++ program as a daemon in UNIX, now I know some will say this should be on Server Fault, but as far as I understand it I need the init.d shell script to actually create the start and stop for the daemons.
But if you guys can show me a simple shell script for the daemon ...