linux

What does this expression evaluate to? (bash shell script)

I am trying to do a code walk through a badly written bash script. I have come across this statement: FOOBAR_NAME=`date +WeekNo.%W` There are no prior declarations of any of the RHS variables in the script, lines preceding this statement. So my question is: What does FOOBAR_NAME resolve to, when it is used a few lines down in the s...

convert NTP time to Human-readable time

hello all. i have managed to make a NTP request and retrieve the server time from it's NTP response. i want to convert this number to a Human-readable time, writing in C++. can some one help me ? as example you can look at: http://www.4webhelp.net/us/timestamp.php?action=stamp&stamp=771554255&timezone=0 once you set the timestamp...

Playing Fragmented MP4

Hello, I have fragmented mp4 files which are obtained via Smooth Streaming. I could not find any player for Linux to play these fragmented mp4 files. So i want to ask if there is a way to play these fragmented mp4 files? Or... Is there a way to do something with ffmpeg(or something like this) and play with a conventional video player. Or...

using stat to detect whether a file exists (slow?)

I'm using code like the following to check whether a file has been created before continuing, thing is the file is showing up in the file browser much before it is being detected by stat... is there a problem with doing this? //... do something struct stat buf; while(stat("myfile.txt", &buf)) sleep(1); //... do something else alt...

Automake: Syntax of conditionals in Makefile.am

I am familiar with the if VAR_NAME, where VAR_NAME is defined by an AM_CONDITIONAL clause inside of configure.ac. Is there a corresponding "if not defined" construct in Makefile.am? ...

Programming language for an app that needs to be running forever

I'm upgrading an app that registers the time employees arrive and leave the office. I would like not to install this app into one of our current servers, which are somewhat important, beacuse I would have to leave a session open and i'd like to keep things separated. So all I have is cheap, cheap hardware. Basically a 500MHz, 64MB RAM De...

shell command for finding all packages that provide a certain virtual package

Hello, As the tile suggests, I want to get a list of all packages that provide a certain virtual package. A way of doing this would be to write a shell script that parses all output of apt-cache search -f .* And spits out all packages that have the virtual package in the provides section. The problem with this approach is that it tak...

Compiling C++ program for Linux in Windows using Eclipse?

I wanted to know if it is possible to write and debug a C++ application for Linux in Windows using Eclipse? If so could you point me in the right direction for configuring Eclipse? Thanks ...

When is it appropriate to use C++ Smart Pointers in GUIs (Programs with main loops)

Hi friends. I am leaning towards using std::tr1::shared_ptr to automatically manage a pointer to a utility class in my GUI program. Basically here's a skeleton of the program: int main () { Allocate dynamic memory for utility class GUI code.. GUI code... GUI Code.. GUI Main Loop } The program finishes when the user ca...

Consuming bandwidth

Dear Community, I know how to write a basic bash script which uses wget to download a file, but how do I run this in an endless loop to download the specified file, delete it when the download is complete, then download it again. ...

Getting the socket FD from IP address and port

Is their a way (except looping on all open FDs) to obtain the FD for a given IP addr & port? I have a bunch of open UDP sockets each bound to an IP address & port. The application, in some instances, acts as a forward application. Is their a getfdbyname system call? Specifically, my UDP application(C) sits between nodes A and B . 1) A...

Linux: How to modify shared library name in Dynamic Section of an ELF binary

I have a shared library with soname: libfoo.so How do I link my binary to libfoo.so such that the shared library name in my binary's ELF section is: libfoo5.so? I tried creating a symlink: libfoo5.so -> libfoo.so, and then linking my library as such: g++ ... -o mybinary *.o -Lpath -lfoo5 However, when I print out the dynamic section...

Linux: how are .pc files used when linking against a shared library?

From my knowledge, *.pc files store metadata about shared libraries. Does the linker automatically use these files when linking against a shared library? If so, where does it search for these files? ...

Add application to Ubuntu's root's autorun

Hello, I need to add my lampp to autorun. Where shuld I put this command /opt/lampp/lampp start to be runned from root on system bootup? Thank you. ...

How do I diagnose why a .so file won't load when executing a .mex file in MATLAB?

I'm trying to use a video library called VideoIO with MATLAB for a machine learning project. When I try to invoke the library in MATLAB, I get an error saying that it can't find libavutil.so.50, one of the ffmpeg libraries that VideoIO depends on. I've checked a few different things but can't find anything that looks wrong, other than th...

linux raw ethernet socket bind to specific protocol

I'm writing code to send raw Ethernet frames between two Linux boxes. To test this I just want to get a simple client-send and server-receive. I have the client correctly making packets (I can see them using a packet sniffer). On the server side I initialize the socket like so: fd = socket(PF_PACKET, SOCK_RAW, htons(MY_ETH_PROTOCOL));...

How to open tar.gz files in eclipse

Hi, If I downloaded a tar.gz file on my computer and extracted it with code in it, how do I run it in eclipse in Linux (for C). The downloaded files contains .c files and .o files. ...

How to symlink folders and exclude certain files

Hey Guys, I'm not a server guru (unfortunately) but have a decent knowledge of linux & bsd. I'm trying to symlink multiple instances of HLDS (game server) but need to exclude certain folders & config files to achieve this properly. I need to do it this way as HLDS loads many mods automatically, and putting an exception to disable the mo...

Autoupdating AIR apps on Linux without prompting for sudo password

Hey there overflowers, Maybe that's more of a Linux question than an Adobe Air one, but there you go: I have an AIR 2 app that does auto-update in the background, with no need for user interaction. It uses Air's own ApplicationUpdater framework (the one that doesn't require a UI) - all goes well until the package gets downloaded and nee...

Is it safe to replace GCC's system-level C++ runtime with a version from newer GCC?

Linux C++ programs build with GCC link against libgcc_s.so.1 and libstdc++.so.6 libraries, each of which contains multiple ABIs: newer versions contain ABIs from previous version plus new ones. GCC ABI policy document says programs build against older runtime should be able to be run with the new runtime. So, theoretically, older binarie...