linux

Why the php code below is not returning the expected values?

I am trying to make a few php scripts that will run among other things system calls commands like top and other custom scripts. You can see the code below is super simple. The problem that we are having with the php below is that when I call the php from the linux prompt like: #php checkTOP.php it will return the top -n 1 output in ...

Pipe to/from Clipboard

Is it possible to pipe to/from the clipboard in bash? Whether it's piping to/from a device handle or using an auxiliary application, I can't find anything. For example, if /dev/clip was a device linking to the clipboard we could do: cat /dev/clip # dump the contents of the clipboard cat foo > /dev/clip # dump the contents of "f...

How to programmatically edit the routing table

I am writing a daemon running on an embedded platform that needs to change the default route of the device according to which interface it is connecting on at a given time. How can I do this programatically? I know I can use system("route del default && route add default gateway blah"); etc but is there a more direct way? UPDATE: I so...

Freeing up a TCP/IP port?

netstat -tulnap shows me what ports are in use. How to free up a port, in Linux? ...

Concurrency in a GIT repo on a network shared folder

Hello, I want to have a bare git repository stored on a (windows) network share. I use linux, and have the said network share mounted with CIFS. My coleague uses windows xp, and has the network share automounted (from ActiveDirectory, somehow) as a network drive. I wonder if I can use the repo from both computers, without concurrency p...

flex compiler error (warning) message in flex ant task

I have following warnings if I compile our flex project with the ant task from the flex sdk. Does anyone have an idea where this comes from and why this happens and if I can safely ignore it? (The swf file itself seems to get created without an actual error) [mxmlc] The args attribute is deprecated. Please use nested arg elements. [mxml...

Best Practices in creating software appliances?

I have an application that a customer has asked us to package into a software appliance and wanted to find a list of all of the things that I need to consider. Stuff related to choosing the operating system is well-documented, but other aspects such as building usable web consoles, frameworks I should consider (the application is written...

What are the negative consequences of including and/or linking things that aren't used by your binary?

Let's say that I have a binary that I am building, and I include a bunch of files that are never actually used, and do the subsequent linking to the libraries described by those include files? (again, these libraries are never used) What are the negative consequences of this, beyond increased compile time? ...

Linux MMAP internals

I have several questions regarding the mmap implementation in Linux systems which don't seem to be very much documented: When mapping a file to memory using mmap, how would you handle prefetching the data in such file? I.e. what happens when you read data from the mmaped region? Is that data moved to the L1/L2 caches? Is it read direct...

Cannot retrieve output parameters from MSSQL stored procedure using PHP

I am executing a MSSQL stored procedure that is supposed to return an output parameter (ErrCode), as well as a resultset. I am calling the procedure from PHP using the following code, but so far have been unable to retrieve the output parameter: $stmt = mssql_init("addFaculty", $this->db); mssql_bind($stmt, "@FacultyID", $FacultyID, S...

How to create a linux equivalent "nl" command using system calls in C?

I have an exercise to do where I need to code in C, commands equivalent to cat and nl using only system calls. The system calls given to us are open(), close(), read() and write(). I've already done the "cat" equivalent and it seems to be running fine, now I need to do the "nl" one but I'm having trouble with how am I going to write lin...

JBoss Configuration

I have been tasked with setting up a server for running JBoss presumably the latest version. I was wondering if anyone had any recommendations for setting up the disk partitions for a Linux (Red Hat) system? Currently they are running the lab with everything on one partition, and I would like to avoid that going into production. Specif...

Need to build (or otherwise obtain) python-devel 2.3 and add to LD_LIBRARY_PATH

I am supporting an application with a hard dependency on python-devel 2.3.7. The application runs the python interpreter embedded, attempting to load libpython2.3.so - but since the local machine has libpython2.4.so under /usr/lib64, the application is failing. I see that there are RPMs for python-devel (but not version 2.3.x). Another...

Git clone hang

As a prospective Linux developer I want to clone the git repositoy of Torvalds. The problem is when I call the git clone after some time the git clone process just hang. No error message no timeout nothing. So I press ctrl+c and I restart and again, same thing. It hang at random percentage. It hang during the "Retrieving object" process...

How can I use paste and awk inside Perl?

I have the following code that uses 'paste' and AWK script inside Perl. use strict; use Data::Dumper; use Carp; use File::Basename; my @files = glob("result/*-*.txt"); my $tocheck = $ARGV[0] || "M"; foreach my $file ( @files ) { my $base = basename($file,".txt"); my @res = `paste <\(awk '\$4 == "M...

Remote X Display with Fedora 10 running KDM and XFCE

I am developing a JSF web application on a Windows box using Emacs as my editor but I far prefer to use Emacs in a Linux environment. In the (somewhat distant) past it was a no-brainer to use a remote X display to accomplish this very useful programming aid. Cygwin helps out somewhat but true remote X is the preferred solution. Howeve...

A C daemon that does traffic shaping

Hi there... I'm working on a C daemon that monitors a configuration file (updated using a web interface) and then uses the Linux "tc" (traffic control) command to update the systems traffic shaping configuration. What's a good way to actually invoke the tc program? Should I use the exec family? Is there a library I can use that would b...

How do I transparently compress/decompress a file as a program writes to/reads from it?

I have a program that reads and writes very large text files. However, because of the format of these files (they are ASCII representations of what should have been binary data), these files are actually very easily compressed. For example, some of these files are over 10GB in size, but gzip achieves 95% compression. I can't modify th...

How to "walk around" in the File System with Java

Hi. I'd like to do a search for folders/directories from java, and go into those folders/directories in java. I guess it's called system utilities? Any tutorials out there, or books on the subject? Thanks ;) ...

boost version in linux distros

Hello! Does anybody know the reason why fedora 10 (quite a modern linux distro I'd say) still shipped with boost version 1.34, while latest release is 1.38 ? ...