linux

Execute commands inside another process?

I want to be able to start a process and send input to it immediately. Take Bash as an example. The following code will enter another Bash process and then print "Hello World!" on the screen after I have terminated the process with "exit" bash echo "Hello World!" Is there a way to enter bash and then print "Hello World!" INSIDE that...

list directory entries in the svn repository ?

how i can write bash to List directory entries in the svn repository (i want to write bach file because i have a large number of repository) ,.,,please HELP ME ...

Ruby version of the TCL-based Expect?

Expect seems to be a very powerful automation tool: http://www.nist.gov/mel/msid/expect.cfm Is there a Ruby equivalent to that tool? ...

How to use the "pcap_lookupdev()" in libpcap ?

The code cant find any device, I want to know what does pcap_lookupdev() do ? thanks #include <pcap.h> int main(int argc, char *argv[]) { pcap_t *handle; char *dev;// = "eth0"; char errbuf[PCAP_ERRBUF_SIZE]; dev = pcap_lookupdev(errbuf); if (dev == NULL) { fprintf(stderr, "Couldn't find default device: %s\n"...

execute command within command ?

i want to ask if i can execute command within command ...or use the output of the previous command as the input of the followed command : command x then command y in command y i want use output of command x ...

Securing administrative section of my website

I have a classifieds website... As you might imagine, as a webmaster (administrator) I need to sometimes remove classifieds, edit them etc etc. I have my own Linux server, with root access offcourse. Currently I have a section of my website with all administrative php scripts which I use to remove classifieds, edit them etc: /www...

looking for memory overruns hunting tool for C code that is called from Java

Hi, I'm looking for memory overruns hunting tools for C code that is called from Java via JNI. Usual tools for C like gdb, valgrind don't work. Thanks ...

Easy makefiles for gcc/g++

My projects almst always consist of: 1- Pairs of Foo.h and Foo.cpp 2- Some extra headers util.h etc. What is the simplest way to write a makefile that a-runs $CC -c foo.cpp for each .cpp file, keeping a dependency to its coresponding .h file b- provides some way that I can manually add extra dependencies c-includes a linking s...

Changing the current directory in Linux using C++

I have the following code: #include <iostream> #include <string> #include <unistd.h> using namespace std; int main() { // Variables string sDirectory; // Ask the user for a directory to move into cout << "Please enter a directory..." << endl; cin >> sDirectory; cin.get(); // Navigate to the directory spec...

Expect works great interactively but not from file

It works great when I use expect interactively like this: root@vagrantup:/home/vagrant> expect -i expect1.1> spawn screen -x spawn screen -x 3195 expect1.2> send "ls\n" expect1.3> exit But the same commands used in a file: spawn screen -x send "ls\n" exit Only works sometimes, eg. 1/10 time every time I execute the file. It's reall...

C++ program to count number of objects in a particular Linux directory

I'm attempting to write a program in Linux using C++ that counts the number of files and folders in a user specified directory, but the more I read, the more confused I get. I'm new to C++ and to programming in general, and I understand that I have a big hurdle to vault at the start, but I'm not entirely sure where to start reading on th...

Google Analytics when website "inactive"

I am not entirely finished with my website, and I am using apaches authentication to demand password and username when entering the site. I wonder, will this cause any problems with using and testing Google analytics? Should I first "open" and remove the authorization before using GA? Thanks ...

Clone a git-svn repo by getting all of the svn part from the original svn repo

How can I clone a git repo from my laptop (at home) to a server (at university) while getting most of the repo from a third (svn) repo at another uni that is the main codebase. I'd like to minimise the amount of home<->uni traffic by maximising uniOne<->uniTwo traffic. this is what I have now on Laptop: --o--o--o---o---o---o git-s...

How to copy a file in creation without destroying it in Unix/Linux

I have a file under creation in a long process. To my understanding copying that file to another file would kill the creation process. Is there away to overcome this problem? ...

error: expected unqualified-id before ‘public’

I have read a few posts but cannot figure out what is wrong.My Code is a s follows #include <iostream> using namespace std; /* compiles with command line gcc xlibtest2.c -lX11 -lm -L/usr/X11R6/lib */ #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xos.h> #include <X11/Xatom.h> #include <stdio.h> #include <mat...

Are there any examples with libpcap and libnet ?

I want to capture ip packages on one server, and then forward the packages to another server by libnet, who has some examples ? thanks in advance. ...

question with memcached_get() in libmemcached

memcached_get (memcached_st *ptr, const char *key, size_t key_length, size_t *value_length, uint32_t *flags, memcached_return_t *error); Why need to pass the params "size_t key_length" and "size_t *value_length" here ? I think the value can be fetched by key directly. who can...

How can I "clip" the output of the find command?

I executed the following command: find / -type f -name fs-type -exec svnlook tree {} \; |egrep "/$" The result was svnlook: Can't open file '/var/lib/svn/repos/b1me/products/payone/generic/code/core/db/fs-type/format': Not a directory svnlook: Can't open file '/var/lib/svn/repos/b1me/products/payone/generic/code/fees/db/fs-type/fo...

How to set defualt python library path

I'm using FreeBSD 7.2. I upgraded to Python 2.6. However when I run any python app, it is still using /usr/local/lib/pytho25 as the library path. How do I change it? I cannot modify the python app. Basically I need to change the default lib path to python26. ...

Programmatically extracting .deb packages

Hi to everyone, i've got a question and i hope someone will help me :) I have .deb package which contents i need to extract. I need to do it programmatically. The problem is that i cannot find any valuable resources on the net which can help me. I really don't have any Linux (Unix) experience so maybe i'm searching for it in the wrong w...