linux

Deleting a line from a file, reading and rewriting is very inefficient ... can someone come up with a better algorithm?

Hi, Deleting a particular line/certain bytes from a file is very inefficient as there is a lot of reading and writing(re-writing) to be done. Is there anyway we can minimize work in such a process? Imagine if an entire file is a set of linked lists and as a user we know the structure of these linked lists then wouldn't it be wonderful a...

Using Git with non-root user

I've already set up a Git repository on GitHub and committed a few changes from my Windows machine. But tomorrow I'll have to work in this repository from a machine running Ubuntu with limited privilege (i.e. no sudo). Is there a portable version of Git for Linux? Or some source that allows me to compile and install Git only for the cu...

Difference between "command > log.txt" and "command 1>& log.txt" in Linux command shell?

Hi. When I run the command haizea -c simulated.conf > result.txt, the program (haizea) still prints its output to the screen. But when I try haizea -c simulated.conf 1>& result.txt, the output is now on the file result.txt. I'm quite confused about this situation. What is the difference between > and 1>&, then? ...

Example for kernel timer Implementation in Linux (in kernel 2.6.32)

hi, Could you please give any basic example of a kernel timer (start_ktimer) implementation in Linux? /renjith_g ...

Do rsync at the same time to the same destination

Dear Fellow developers, I have 10 production servers, What will happen when : I still do rsync for file (A,B,C), meanwhile at the same time my friends also do rsync for file (D,E,F) to the same production machine ? What if i and friends do rsync to the same file at the same time ? Thanks in advance for any answers ...

SSHing across VM's on Windows XP

I have 2 VM's, A and B, running Red Hat EL 4.5, on a host machine running Windows XP. A's ip is 192.168.1.100 B's ip is 172.16.1.100 I have setup 2 virtual networks on Microsoft Loopback Adapter 192.168.1.1 with subnet mask 255.255.255.0 172.16.1.1 with subnet mask 255.255.0.0 I am trying to SSH from A to B: user@B ~ # ssh 172.16....

When should we use mutex and when should we use semaphore

When should we use mutex and when should we use semaphore ? ...

linux redhat os download

I want to download Linux Redhat OS so , can any one send me link. Kindly help me ...

Git Pull: Change Authentication

Hey all, this is quick one, since I'm quite new to git. I have a repo setup on a server (A) where access is via ssh rsa keys. I have a few users there including myself. Now I do git clone on my local machine and get a local copy, make changes, and push origin master, everything works fine. The problem I'm experiencing is that our testin...

i_mode file type value of 16

I have been told that I need to add a new file type to linux. File types are declared in fs.h Relevant part posted here: * File types * NOTE! These match bits 12..15 of stat.st_mode * (ie "(i_mode >> 12) & 15"). */ #define DT_UNKNOWN 0 #define DT_FIFO 1 #define DT_CHR 2 #define DT_DIR 4 #define DT_BLK ...

How does the OS language represented in Linux

My Application is running in Linux. it would be localized. how can I get the OS Language? is it represented in Linux? as a numeric values? ...

How does SIGINT relate to the other termination signals?

On POSIX systems, termination signals usually have the following order (according to many MAN pages and the POSIX Spec): SIGTERM - politely ask a process to terminate. It shall terminate gracefully, cleaning up all resources (files, sockets, child processes, etc.), deleting temporary files and so on. SIGQUIT - more forceful request. It...

UNIX:How to convert ip address to binary code

Is there is any Command to convert ip address in to binary form? Eg: 10.110.11.116 output: 00001010.01101110.00001011.01110100 ...

Compiling programme linux 32 bit vs 64 bit

I am new to this 32 bit vs 64 bit thing. I have written programme in C++ in linux. I am wondering what determine the programme is 32 bit or 64 bit? This is because I compile the programme from a makefile written by others. How could I check it and how could I modify it to 64 bit? Thanks. ...

PHP stream socket server

I have a PHP server listening on port 5001 and 127.0.0.1 $socket = stream_socket_server("$host:$port", $errno, $errstr) It work fine when a client in php connects to the server, but the same fails if a client written in C tries to connect. I have updated firewall settings, just unable to resolve the issue. Is there a different way t...

How can I find the connected components of a graph in Perl?

I have the following collection of nodes and edges. What I want to do is to find all the distinct graph from it. my %connections=(36=>[31],10=>[3,4],31=>[30,22],30=>[20],22=>[20,8],20=>[1],8=>[5],5=>[2],2=>[1,20], 3=>[7]); In this example it will yield: my %all_graph = { graph1 => {36=>[31],31=>[30,22],30=>[20],22=>[20,8],20=>[1...

LWJGL won't read keyboard input

I'm trying to use LWJGL to get whether a key is pressed. If the escape key is pressed, then the application quits. However, I can't get it to read any keyboard input, although Display.isCloseRequested() works fine. I'm on RHEL using LWJGL 2.6 and Java 1.6. for(;;) { // check if we want to quit if(Keyboard.isKeyDown(Keyboard...

Nagios/NRPE giving a "No output returned from plugin" error

Hi, Getting a "No output returned from plugin" error message from a Nagios/NRPE script 1) Running Nagios v3.2.3 and NRPE v2.12 2) The script: OK_STATE=0 UNAME=/bin/uname -r echo "OK: Kernel Version=$UNAME" exit $OK_STATE 2) Command line results on the Nagios Server using NRPE Same OK results for both the root and nagios user...

Adding full directory via diff & patch

Hi. Is it possible to add a full directory via diff and patch? It seems as very convenient way to add additional modules on top of standard code-base. I googled for some solutions, but they generally work on file level, not on directory level. Thanks. ...

locate extended attributes

Is there a simple way to write a kind of wrapper script or patch for updatedb (or locate) such that locate can find user defined extended attributes (tags) (suppose in an ext3 filesystem, mounted with user_xattr option), too? ...