linux

Linux socket buffered data size

Is there any simple functions to check how much data is buffered but unread? FD_ISSET only indicates the presence of data in the buffer. Is possible not to create a second buffer in the program for greater control of buffer? ...

glibc detected *** ./a.out: free(): invalid pointer:

when i compiled(c++ program) in linux i am getting following error pls help me glibc detected *** ./a.out: free(): invalid pointer:0x0804878d *** ======= Backtrace: ========= /lib/libc.so.6[0xbd5f18] /lib/libc.so.6(__libc_free+0x79)[0xbd941d] /usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0x3233fe1] ./a.out(__gxx_personality_v0+0x100)[0x8048514]...

file operation write is not happening in new line

Hi following code sample seems to have some problem or either it has to do something with OS internals. #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> static void usage(); #define MONC_AM_CONF "/tmp/monc.c...

For IP Set top box - Win CE or Linux?

We are manufacturing an IP set top box in India for IPTV market. We are looking at two OS options - Win CE and Linux. Can anyone help us in selecting the best one in these two operating systems? Which one is better in terms of reliability, scalability and cost viability? ...

Ubuntu: how to make apt-get/synaptic work for own application

We are developing a (closed-source) Java application and think about possibilities to update the software automatically on the user's machines. Fortunately, for nearly all Linux systems there exist package managers. We don't think it would be useful to add our application to the common repositories for several reasons, but how to create ...

install rpcgen on debian lenny

Hey everybody, I am trying to compile VXI11 source codes on my debian - lenny, but I get this error: make rpcgen -M vxi11.x make: rpcgen: command not found Anyone know to rpcgen get intalled? Cant find solution. Any help is most appreciated. Thanks Petr ...

A scalable solution for server side push?

I would like to implement a mechanism which will provide a RESTful API that allows a client to register interest in a subject with a sever, and receive asynchronous notifications from the server after the interest is registered. In enterprise (messaging) architecture, this is known as publish/subscribe 'pattern'. With desktop applicatio...

usb probe function not called

Hello, I am writing a driver for a gamepad for linux. I have a ps3 controller (wired), a 360 controller (wired) and a Logitech precision (wired). I found the vendor id and product id for each, and I load one at a time. the 360 controller is the only one that calls the probe function. I have the exact same code, just different ids, and o...

C++ OpenCV2 cv::Mat::copyTo error in linux

Hi, while trying to compile the following code in OpenCV2 in linux, cv::Mat image1, image2; cv::Rect rect1, rect2; ... image1(rect1).copyTo(image2(rect2)); I get the following error: x.cpp: In member function ‘cv::Mat Process(cv::Mat)’: x.cpp:241: error: no matching function for call to ‘cv::Mat::copyTo(cv::Mat)’ cxcore.hpp:7...

Generate 12 Digit HEX number in KSH

Hi all, I need to generate 12 digit Hex numbers in KSH on Solaris Thanks ...

How to script scp -r copy ?

Hello, I can't seem to be able to convince scp to behave. For test data ubuntu@domU-12-31-38-00-D4-F1:/tmp$ find /tmp/a1/ /tmp/a1/ /tmp/a1/a2 /tmp/a1/a2/a3 On issuing the command ubuntu@domU-12-31-38-00-D4-F1:/tmp$ scp -r /tmp/a1 domU-12-31-38-00-E2-52.compute-1.internal:/tmp/a1 I would expect the same directory structure created...

How to create a temporary directory in C++?

I'm writing a function in C++ which creates a temporary directory. Such function should be as most portable as possible, e.g. it should work under linux, mac and win32 environments. How do I achieve that? ...

xslt produces a result that does not end with a carriage return (newline)

Hi all, I have an xslt script that transforms an xml file to another xml file. The problem I'm having is that the resulting xml file does not end with a newline like a well behaved linux file. I'm using <xsl:output method="xml" indent="yes"/> for the code to be nicely idented. Is there a way to tell xslt that this is Linux mode, and i...

Dynamic targets in Makefiles

I'm trying to create a Makefile that has a target per src/ subfolder so that it creates a static lib. I am currently trying this: %.o: %.cpp $(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $< lib%.a: $(patsubst %.cpp, %.o, $(wildcard src/%/*.cpp)) $(AR) rcs $@ $^ But this doesn't work, the target matching works, but the dependency tra...

How to reverse order of fields using AWK?

I have a file with the following layout: 123,01-08-2006 124,01-09-2007 125,01-10-2009 126,01-12-2010 How can I convert it into the following by using AWK? 123,2006-08-01 124,2007-09-01 125,2009-10-01 126,2009-12-01 ...

Can stdout, stderr always tee to a regular file?

Howdy, Can I configure bash on Linux to write a copy of all stdout and stderr to a regular file, without having to specify the redirection for each command? Thanks, Kent ...

Reading child process' output as soon as some is available?

I've been trying various methods (popen, pipes + fork/exec, ...) to read a child process' output, all of which are working, but exhibit the same behavior: whenever I try to read the output using read/fread, it only returns when the buffer is completely full, or when the child exits. I'm looking for a behavior that's more like that of soc...

Sort & uniq in Linux shell

What is the difference between the following to commands? sort -u FILE sort FILE | uniq Thanks! ...

Run a terminal command and saving the values returned using Python/Django?

Hi all, I have a question regarding the use of Python. How do i run a command line command using Python? And after running the command, how do i save the returned values? For example: user@home:~$: ls -l drwxr-xr-x 3 root root 4096 ..[etc] home -rw-r--r-- 1 user user 357 ..[etc] examples.doc So what i intend to do, is to run the co...

Eclipse, Subversion and relocating of projects

Hello, I use Eclipse 3.5.1 downloaded from Yoxos under Ubuntu 9.10. I had to correct some problems : - GTK bug (export GDK_NATIVE_WINDOWS=1) - sqlite3 (I replaced the version of Ubuntu by a fresh one from the site and compiled; before I got a crash each time I get a hint about a function) But I still have one with subversion : I r...