linux

vim / vi / linux: properly indent html file

how can I easily indent html files with linux or vi or vim. ...

Cannot connect to a modified (bundled and registered) Amazon AMI

Hi all, I am having problems connecting to an AMI that I created by modifying an existing linux ami, bundling it and registering it. Heres what I did - Launch existing CentOS AMI (ami-cb52b6a2) - this is a Rightscale LAMP image configured Apache, PHP etc and copied over some PHP scripts etc Tested it - all worked as I want it to I bun...

How to tell the status of a Linux Daemon

Hi, We have a Linux Daemon in c and a bash script to start it. The daemon sometimes fail to start because of some configuration file errors but the script reports the daemon was started successfully. A snippet of the script is shown as below, could someone tell me what's wrong with the script? ... case "$1" in start) echo -n "Starting ...

Analyzing a Xen core dump

After a Xen guest domain hang, I took a dump using xm core-dump . Following the sparse documentation I found, I tried using the crash utility to analyze the dump. Unfortunately, the kernel image (Debian lenny) is stripped, so I am forced to make use of the map file. However, crash /boot/System.map-2.6.26-2-xen-amd64 vmlinux-2...

Multicasting + Linux Kernel

Hello friends, I have one doubt regarding multicasting in linux kernel. When multicast data arrives linux kernel checks MFC and if the matching entry is not found then kernel gives conrol message cache miss and header to the user space. My question is what happens to the data packet? Suppose i may deliberately not want to keep the entry...

Why is the last chunk of HTTP download really slow?

i have content length available in the beginning of the download. so i know how much bytes i need to request for. i download in chunks of 1024 bytes. in the last chunk i request for the number of bytes remaining. i am using the read function. but the last chunk takes a lot of time to arrive. is it normal? ...

How can I extract the title from an encrypted PDF in PHP?

How can I extract the title from an encrypted (write protected, not password protected) PDF file using PHP on Linux? Usage of external libraries or binaries are OK. Zen_PDF did not work (Exception: Encrypted document modification is not supported) nor did libextract (title="filename of pdf.pdf") ...

Detecting background operation

In C, what is the way to detect a program was called in "background mode" ? I have a program I would like to launch either interactively or in background. How can I detect I should not be reading from stdin and end in a "Stopped : tty input" state ? Should I test that stdin is closed ? How can I do that ? Edit : isatty seems like a go...

MySQL Connector C++ - make Error 1

Hi! I'm writing an application in C++ (using Eclipse with Linux GCC) that's supposed to interact with my MySQL server. I've downloaded the MySQL Connector C++ a, precompiled, and copied the files into the directories (/usr/lib, /usr/include). I've referenced in in the GCC C++ Linker Section of the Project Properties in Eclipse ( "mysqlc...

How to disable address space randomization for a binary on Linux?

I'm working on a runtime system for parallel programs that can take advantage of a common address space layout across multiple processes, potentially spread over several (thousand) nodes. Many times, software built for this environment is run on Linux systems that have address space randomization enabled by default, and users may not wan...

What is a good live-cd distribution that could be used as the base for my linux program?

There is an upcoming programming challenge (forensics challenge) that asks the entrants to write a program that runs on a bootable cd that helps format attached media to that computer. I'm considering submitting an entry and I'd like to utilize as much existing open-source software as possible. In fact, I think the programming I'll be ...

How to collect HDD size and available or used space in linux cli?

I'm trying to find some sort of command or regex to get the size and available or used space of a hard drive in linux. At the moment I'm using this; df -h and getting something like this; Filesystem Size Used Avail Use% Mounted on /dev/sda1 10G 3.1G 6.4G 33% / /dev/sda2 147G 5.8G 134G 5% /...

Is it safe to issue blocking write() calls on the same TCP socket from multiple threads?

Let's say I have two threads, T1 and T2. Thread T1 makes a blocking write() call on a TCP socket S to send a large buffer of bytes B1. The buffer of bytes B1 is so large that (a) the write call blocks and (b) TCP has to use multiple segments to send the buffer. Thread T2 also makes a blocking write() call on the same TCP socket S to se...

Testing performance of parallel programs on a single core machine

I would like to start playing with concurrency in the programs I write (mostly for fun), but I don't own a multi-core system and can't afford one any time soon. I run linux. Is there a way to, for example with a Virtual Machine, compare the performance of a multi-threaded implementation of a program with a single-threaded version, withou...

TextMate alternative for Linux

Is there any TextMate alternative for Linux? Something like e-TextEditor for Windows ...

freeware HTML creating tools for Linux

I have linux centos 5.3. I am in progress to create a website but i am not aware of writing HTML. I need some tool to convert text to html. On google I have found many tools with can help in creating html pages but all are for windows. Can anyone please suggest me any similar tool for linux system. ...

Bind threads to processors

Hi, When I run my multi-threaded code, the system (linux) sometimes moves the threads from one processor to another. As I have as many threads as I have processors, it invalidates caches for no good reasons and it confuses my tracing activities. Do you know how to bind threads to processors, and why does a system would do this ? ...

BASH: Strip new-line character from string (read line)

Hello! I bumped into the following problem: I'm writing a Linux batch script which does the following: Read line from file Strip the \n character from the end of the line just read Execute the command that's in there Example: commands.txt ls ls -l ls -ltra ps as The execution of the batch file should get the first line, and execu...

anyway to write dlls in linux?

Is there anyway to write dlls in linux? Do I have to install windows to write dlls in linux? Right now one of my courses are pretty retarded and requires me to write a dll for this. ...

On linux, how should I calculate the amount of free memory from the information in /proc/mem?

There are many fields in /proc/mem: I know that I can't just take "MemFree", because lots of memory is actually cached. So the question is, how can I calculate the amount of free memory? Assumptions: The system is configured with no swap space. My definition of "free memory" is that malloc starts failing when this hits zero. ...