linux

How can I use nftw(...) and define the block size for the stat function

Hi, I want to use nftw() to traverse my file system directory structure and sum up how many space each directory is using. I don't want to use du because it make fork call. I used nftw (with the flag - FTW_PHYS), nftw calls stat but i noticed that the default block size is 512bytes , while my file system use a different block size. any ...

Memory Optimization for child processes

I work on Linux for ARM processor for cable modem. There is a tool that I have written (as the job demands) that sends/storms customized UDP packets using raw sockets. I form the packet from scratch so that we have the flexibility to play with different options. This tool is mainly for stress testing routers. The details are here. I ac...

tar: add all files and directories in current directory INCLUDING .svn and so on

Hi all, I try to tar.gz a directory and use tar -czf workspace.tar.gz * The resulting tar includes .svn directories in subdirs but NOT in the current directory (as * gets expanded to only 'visible' files before it is passed to tar I tried to tar -czf workspace.tar.gz . instead but then I am getting an error because '.' has changed...

Cron job to call a JSP Page with Javascript

I am developing an Email client using Java Mail API. Now, to regularly check for New Mails, I want to call a page "Synchronize_update.jsp" I have to do it through a JSP as I need to also execute a piece of JavaScript Code towards the end which is basically an AJAX Call to Notify_all_for_new_mail.jsp. Can any one suggest me a solution? ...

Open a file case-insensitively in Ruby under Linux

Is there a way to open a file case-insensitively in Ruby under Linux? For example, given the string foo.txt, can I open the file FOO.txt? One possible way would be reading all the filenames in the directory and manually search the list for the required file, but I'm looking for a more direct method. ...

Uploading and Downloading Files on linux hosting server Using RSync algorithm

Hi All, i am writing an application in java that takes backup of files on server.It is a windows version application. In my application i have to perform incremental backup operation. For implementing incremental backup i am trying to follow rsync algorithm. i got one lib in java "jarsync0.3" but not getting how to write a code using rs...

Error 403 when accessing an address to rewrite

I have the following rewrite rules: RewriteRule ^products/([a-zA-Z]+)$ /proyect/clients/index.php?database=$1&module=products [L,QSA] The directory structure is as follows: /var/www/proyect/clients/index.php When writing the address "http://host/products/clientA/" is directed into the "/proyect/clients/index.php?database=clientA&mo...

Can't find OpenSSL headers/libs when installing Ruby1.9 from source

I'm trying to install Ruby 1.9 from source, and I can't seem to get it to figure out where the OpenSSL headers and libraries are located. ruby-1.9.2/ext/openssl/extconf.rb says it can't find openssl/ssl.h -- which I've very definitely installed in ~/.local/include (the corresponding OpenSSL library is in ~/.local/lib). How can I tell Ru...

Perl: How to add an interrupt handler so one can control a code executed by mpirun via system()?

We use a cluster with Perceus (warewulf) software to do some computing. This software package has wwmpirun program (a Perl script) to prepare a hostfile and execute mpirun: # ... system("$mpirun -hostfile $tmp_hostfile -np $mpirun_np @ARGV"); # ... We use this script to run a math program (CODE) on several nodes, and CODE is normally ...

Linux tool to check spelling of comments in c/c++ source code

What software do you suggest to check spelling of comments contained in c/c++ source code (especially doxygen comments)? I'm looking something that will parse only comments so I can easily find mistakes and correct them. The question is general but to be more specific - I'm using CodeLite IDE. ...

fdisk fix mis-aligned SSD to correct head and sector count

maletor@denmark:~$ sudo fdisk /dev/sdc WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sdc: 64.0 GB, 64023257088 bytes 255 heads, 63 sectors/track, 7783 cylinders Units =...

Pretty URL - mod_rewrite question

I'm trying to setup a simple mod_rewrite for formatting "pretty URLs". All I need is for something like: http://www.example.com/dir1/dir2/logs?page=12 to tranlate to http://www.example.com/logs/12 How would my .htaccess rule look like? ...

Help me understand the assembly code

I am trying to understand the assembly level code for a simple C program by inspecting it with gdb's disassembler. Following is the C code: #include <stdio.h> void function(int a, int b, int c) { char buffer1[5]; char buffer2[10]; } void main() { function(1,2,3); } Following is the disassembly code for both main and functio...

bash script - DB2 "db2 restore database" default answer YES

Hi, I'm trying to make a bash script that's going to backup a db2 database and then restore it into a different database. The problem is that DB2 asks a (y/n) question, and I can't get an auto answer for it to work - it needs a y and carriage return. I've tried the following line (and the yes command) tho it doens't work #while true; d...

What is the meaning of this splint warning and what might I be doing wrong?

This is the line of code: bool cpfs_utimens(struct Cpfs *, char const *path, struct timespec const[2]); Running splint 3.1.2 generates this warning: cpfs.h:21:74: Function parameter times declared as manifest array (size constant is meaningless) A formal parameter is declared as an array with size. The size of the...

Splint barfs on __thread, which is part of C99

Running splint matt@stanley:~/cpfs$ splint -paramuse +gnuextensions cpfs.c Halts on this line: __thread int cpfs_errno; With a parse error: cpfs.c:127:13: Parse Error: Non-function declaration: __thread : int. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. Checking the documentatio...

How to measure power consumed by my algorithm?

Hi, I have an image processing algorithm running on an ARM-Cortex-A8/Ubuntu 9.01 platform and I have to measure the power consumed by my algorithm, does anyone know how to do this? Any tools available for this? Thanks ...

Command Line to see the contents Shared Object Module(lib*.so)

What is the command line to see the contents of a Shared Object module (lib*.so)? Like how we use: ar -t lib*.a for archives(lib*.a) and it displays all the object files in the library. EDIT1 Example ar -t lib*.a gives me a display: asset.o sldep.o ...

Find files with no extension in linux and mass rename them

I have a bunch of files on my server that look like below. I need to write a script that will rename all the files from JPG to .jpg as you can see some of them already have the .jpg extension and some don't. Can you help me? I could do it in either bash or through php, whatever is easier, I just don't know how. Thanks Jason jects/Ed...

Why my centos ext3 filesystem go read-only?

My centos ext3 filesystem go read-only random(only the /var partition). When i reboot it, i will changed back to rw. os: centos 5.4 partition: /var, size:80G the /var is for web logs and mysql data file. ...