linux

Perl: Recursively rename all files and directories

I need to recursively rename every file and directory. I convert spaces to underscores and make all file/directory names to lowercase. How can I make the following script rename all files in one run? Currently the script needs to be run several times before all the files/directories are converted. The code is below: #!/usr/bin/perl use...

Intercept a request to read a particular file and instead generate the apparent output of that file read programatically

Sorry for the long and yet still somehow vague title! A friend of mine has a Flash Action script running on a LAMP server that currently reads an xml config file. He's asked me if it's possible to remove the xml file, and replace it somehow with a system (lets call it an 'auto xml generator') that intercepts the request to read that fil...

Convert Memory Size (Human readable) into Actual Number (bytes) in Perl

Is there an actual package in CPAN to convert such string: my $string = "54.4M" my $string2 = "3.2G" into the actual number in bytes: 54,400,000 3,200,000,000 And vice versa. In principle what I want to do at the end is to sum out all the memory size. ...

how to check if the OS is Windows or Debian in c++?

I want to clear console screen every time the user make an input in C++. I'm thinking of using system command. For Windows, it is "cls". For Linux, it is "clear". Is there a way check which system to use the appropriate command in c++? Thanks. ...

Tool to create UI for Linux (Gnome) shell scripts

I'm writing a bunch of Linux shell scripts with complex selections. For now I use zenity for prompts. I'd rather use something where I can show more than one UI element at a time and query it in a script (e.g. a list and some checkboxed and a file picker and an entry field. What are my options? ...

If change in a directory then do some action in linux

Hi All, I want to store the file and file information into the database automatically, when any file is inserted into the directory. Let suppose, in the /etc directory, we store some log files. And if we are inserted new file into /etc directory or change any existing file then automatically these file information should be go to spe...

Convert Chunk of Data into Tabular Format Using Perl

I have a data that looks like this 1:SRX000566 Submitter: WoldLab Study: RNASeq expression profiling for ENCODE project(SRP000228) Sample: Human cell line GM12878(SRS000567) Instrument: Solexa 1G Genome Analyzer Total: 4 runs, 62.7M spots, 2.1G bases Run #1: SRR002055, 11373440 spots, 375323520 bases Run #2: SRR002063, 22995209 spots, 7...

How to use Ptrace on Linux to print Call Stack of Other Processes of C++.

Hi, i am working on an application which needs call stack of all executing processes on Linux. i am trying to use ptrace but not able to go ahead with it because the steps i need to follow in my code are not clear to me. i also tryied backtrace, but its use is limmited to current process. could some one guide me on the same. Thanks,...

Unable to load libsctp.so for non root user

I have a Linux application that uses the libsctp.so library. When I run it as root, it runs fine. But when I run it as an ordinary user, it gives the following error: error while loading shared libraries: libsctp.so.1: cannot open shared object file: No such file or directory But, when I do ldd as ordinary user, it is able to see...

Program visible to Linux as normal directory

I'm trying to write program to work as programmable directory, in other words: User, or other systems open that directory and read/write files or dirs. I try to create program to cache most used files in memory (less I/O to HDD), but right now I don't know how to achive that. There are probably some docs about this but I can't find them....

How to convert a JET database to SQLite?

The title says it all. I'm a Linux user so an open-source, Linux-friendly solution would be preferable. Thanks ...

fetch value of ipaddress

i want to get ipaddress of mycomputer in a variable this statement prints ipaddress of my computer but i want to assign it in a varible how can i fetch the value of ipaddress from inet_ntoa(inaddrr(ifr_addr.sa_data)) into an variable ip of char* type . printf("IP Address: %s\n", inet_ntoa(inaddrr(ifr_addr.sa_data))); ...

Remove files created between certain time stamps.

Last night I had a script go a bit crazy and create a bunch of directories between 3:00 and 3:09am. Is there a quick one liner that will hunt these down and remove them for me? ...

Creating a file association icon in Ubuntu with xdgutils

I am using the xdg utility to attempt to associate a image with a file association. I have ran this command and the equivalent for 48,64 and 128 sizes, none of them seem to have an effect. xdg-icon-resource install --context mimetypes --size 256 image-256.png text-abc Any ideas? This is incredibly lame - but I have managed to get...

Generate cab files on Linux

I'm looking for a stanadlone application, script or library (better Java) to generate cab files on Linux. ...

need help with installing shared libraries on linux

Hi, I am new to linux and trying to get the Ajax Push engine server to work on Ubuntu 9.04. I installed the server from source it fails the check that it does by using its own javascript framework. The problem is that it fails to load the modules and the output that i get in the terminal when i start it is. [Module] Failed to load ...

How to avoid Eclipse leaks on XServer when editing Android XML files?

When I'm editing XML files in Eclipse (mainly, Android layouts and so), it causes leaks on XServer and it ends eating all my RAM (4GB), so I have to Ctrl+Alt+Backspace to continue. Do you know any remedy for that? Thank you! ...

Illegal token on right side of ::

I have the following template declaration: template <typename T> void IterTable(int& rIdx, std::vector<double>& rVarVector, const std::vector<T>& aTable, const T aValue, T aLowerBound = -(std::numer...

Algorithms behind load-balancers?

I need to study about load-balancers, such as Network Load Balancing, Linux Virtual Server, HAProxy,...There're somethings under-the-hood I need to know: What algorithms/technologies are used in these load-balancers? Which is the most popular? most effective? I expect that these algorithms/technologies will not be too complicated. A...

How does fork() return for child process

I know that fork() returns differently for the child and parent processes, but I'm unable to find information on how this happens. How does the child process receive the return value 0 from fork? And what is the difference in regards to the call stack? As I understand it, for the parent it goes something like this: parent process--invok...