linux

How do you use cat recursively?

Suppose I want to count the lines of code in a project. If all of the files are in the same directory I can execute: cat * | wc -l However, if there are sub-directories, this doesn't work. For this to work cat would have to have a recursive mode. I suspect this might be a job for xargs, but I wonder if there is a more elegant solution...

Is there C# look-alike for Linux?

Is there C# look-alike for Linux? What about a compiler? ...

Can this build system be sped up?

Our build is dog slow. It uses nested gnu makefiles on linux. It creates three builds for three different targets from the same source tree. It uses symlinks to point to each of the three parallel directory trees in turn. We can do partial builds by using make inside subdirectories, which saves time, but if our work spans multiple direct...

What is a good way to dump a Linux core file from inside a process?

We have a server (written in C and C++) that currently catches a SEGV and dumps some internal info to a file. I would like to generate a core file and write it to disk at the time we catch the SEGV, so our support reps and customers don't have to fuss with ulimit and then wait for the crash to happen again in order to get a core file. We...

Resources for developing a C++ MySQL application for Linux

I'm going to be developing a C++ application that uses a MySQL database. I've written similar apps in Java using JDBC, as well as the Spring Framework. Are there equivalent libraries for C++? What have you had the most success with? ...

How to print the Nth column of a text file with AWK using argv

Suppose I have a text file with data separated by whitespace into columns. I want to write a little shell script which takes as input a filename and a number N and prints out only that column. With awk I can do the following: awk < /tmp/in '{print $2}' > /tmp/out This code prints out the second column. But how would one wrap that in...

Debugging an application in Linux

I want to debug an application in Linux. The application is created in C++. The GUI is created using QT. The GUI is linked with a static library that can be treated as the back end of the application. I want to debug the static library but am not sure how to do that. I tried using gdb gdb GUI But how can I attach the library? Has a...

xls to text converter

Anyone know of a free xls to text converter that can be run from the unix command line? ...

How to remove elements from xml using xslt with stylesheet and xsltproc?

I have a lot of XML files which have something of the form: ...

Does Java work with PCF fonts?

I am trying to make IBM jre to use PCF fonts from default X11 installation on my linux box. In particular adobe-helvetica font. I have toyed to modify fontconfig.properties in jre/lib folder but no matter what I do Java seams to use some other fonts. I guess there is some algorithm how java VM tries to link java logical fonts to actual p...

Temporarily prevent linux from shutting down

I have a backup script that runs in the background daily on my linux (Fedora 9) computer. If the computer is shut down while the backup is in progress the backup may be damaged so I would like to write a small script that temporarily disables the ability of the user to reboot or shut the computer down. It is not necessary that the scri...

Subversion with AD Groups with Linux?

I try to migrate a Windows SVN Server to Linux. I have configured Apache to validate against AD for Useraccess so only AD Users can logon. Now i have to set permissions for repositories with authz files. When i set permission with AD username it works, but AD groups it doesn't. The authz file looks like the following: [test:/] user1=rw...

How do I edit /etc/sudoers from a script?

I need to edit /etc/sudoers from a script to add/remove stuff from white lists. Assuming I have a command that would work on a normal file, how could I apply it to .etc/sudoers? Can I copy and modify it, then have visudo replace the original with the modified copy? By providing my own script in EDITOR? Or can I just use the same locks...

Is there an equivalent to the .Net FileSystemWatcher in the Linux world?

I find the .Net FileSystemWatcher class really handy for writing utilities that automatically come to life when files show up in their watched folders. Is there any equivalent to this functionality in the *nix world that would allow me to watch a folder (and possibly all of its subdirectories)? Edit: Preferably this will be something th...

Logging over the wire?

We have cases wherein we write a lot of log files to the host increasing the i/o on a host. Are there any good open source logging over the wire solutions. The application language is C++ on Red Hat Linux 3. ...

Cross-platform way to open a file using Java 1.5

I'm using Java 1.5 and I'd like to launch the associated application to open the file. I know that Java 1.6 introduced the Desktop API, but I need a solution for Java 1.5. So far I found a way to do it in Windows: Runtime.getRuntime().exec(new String[]{ "rundll32", "url.dll,FileProtocolHandler", fileName }); ...

How to warn for the use of unset variables in a korn shell script

Is there any way to throw errors or warnings in a korn shell script to prevent the use of unset variables ? Let's assume I have a temporary folder that I want to remove. TEMP_FILES_DIR='/app/myapp/tmp' rm -Rf $TEMP_FILE_DIR #notice the misspelling How to prevent this kind of mistakes before they actually happen? I know the script sh...

Linux filesystem benchmarking best practices

(Not really a programming question, sorry) I'm working on benchmarking various filesystems (most importantly: ext3) with various filesystem options (for instance: noatime, relatime etc.) for specific situations on a Linux box. For raw filesystem benchmarks, I'm looking into bonnie and bonnie++. What is the most useful way to use bonn...

Integrated authentication for mysql

When working with MSSQL on Windows I was used to a very convenient feature called integrated authentication. In short, being authenticated in Windows can give you access to the database, so no need to give any specific password. Now I am developing an application on Linux with no user interaction; this application needs to access a mysql...

race condition in the common lock on file?

this is the standard approach to create locks using file system. For example, visudo uses it: [ -f ".lock" ] && exit 1 touch .lock # do something rm .lock 1) I'm confused, for there's a race condition, yet Linux uses it 2) is there a better way to lock on files from shell? 3) or do I have to use directories instead? Found solutio...