linux

how to copy from other file in vi editor

how to copy from other file with ctrl-c and in vi editor with p yank (paste), i have no idea!! thinks ...

Tutorial/Guide to create a classic, small Linux application in a package (Debian)

I've made a small script in my machine, and an alias in .bashrc that calls it. It's a bash script with 3 lines, but it can grow. Now, some people in my team found it useful, and want to use it. Instead of saying "copy this alias, do this, do that, install that lib" I was thinking about creating a simple package to be a little more prof...

Restore trash item to original location - Linux

Hey, I'm wondering if it is possible to restore a file that is in the trash (~/.Trash) to its original location. I understand there is a restore command but I don't understand its arguments or how to correctly use it. Is this a fairly simple thing to do? Cheers ...

vsFTPd: per-user IP filtering for vitrual users

Hello, I'm running a vsFTPd FTP server with virtual users (i.e. users are stored in Berkeley DB and do not exist at OS level). The users are authenticated via /etc/pam.d/ftp: %PAM-1.0 auth required pam_userdb.so db=/etc/vsftpd/vsftpd-virtual-user account required pam_userdb.so db=/etc/vsftpd/vsftpd-virtual-user I wan...

Notepad++ like editor for linux which highlights words on right clicking

Hi, Sorry for the extremely bad title. What I'm looking for is the notepad++ feature where I can highlight words on right clicking and choosing one of the 5 styles (so that all instances of that word get highlighted with that color), in some editor in linux (Red hat). I know this might be a stupid request, but I find that it helps me in...

How to stop all instances of cron?

I have a cron job that executes a rake task in rails. I noticed in the log that it was running the task 4 times everytime it was executed. The problem is that there are 4 instances of cron running. I ran: /etc/init.d/crond stop And now there are only three. Running: ps -ef | grep cron I see this: root 1029 1 0 Oct20 ?...

Ubuntu init.d script not being called on startup

I've got a script in ubuntu 9.04 in init.d that I've set to run on start on with update-rc.d using update-rc.d init_test defaults 99. All of the symlinks are there and the permissions appear to be correct -rwxr-xr-x 1 root root 642 2010-10-28 16:44 init_test mike@xxxxxxxxxx:~$ find /etc -name S99* | grep init_test find: /etc/rc5.d...

"Variable $foo will not stay shared" Warning/Error in Perl While Calling Subroutine

Dear All, Update3: If you like this posting please don't upvote me but upvote the genius answer by DVK below. I have the following subroutines: use warnings; #Input my @pairs = ( "fred bill", "hello bye", "hello fred", "foo bar", "fred foo"); #calling the subroutine my @ccomp = connected_component(@pairs); use...

Pygtk and segmentation fault

Why I get this segmentation fault?: >>> import gtk >>> a = gtk.Window() >>> a.show() >>> b = gtk.Dialog("hellooo") >>> b.show() # here the dialog appears >>> b.show() Segmentation fault ...

Abort linux polling

I am porting an audio mixer from directsound on Windows to alsa on Linux. I am polling on, let's say, 16 file descriptors using the system call "poll". Now i need to be able to abort the polling somehow. On Windows i am using the WaitForMultipleObjects using events and when i need to abort the waiting i just SetEvent on one of the events...

vim - Some folds are not being saved.

Why do some folds in vim are saved some not while some are being saved? I have the following in my .vimrc: autocmd BufWinLeave *.* mkview autocmd BufWinEnter *.* silent loadview Example: I make these 2 folds in a file: +-- 2 lines: if(!bRet)---------------------------... return bRet; } +----------- 5 lines: else---------...

Linux Install Gcc

I am new to linux and I am setting up a Linux-64 bit for programming in C++ and I want to install the gcc.x86_64 and gcc-C++.x86_64. I use command yum install the two packages. However, half way through the installation, I got no mirror found for the packages. What should I do to install it? It shows Error Downloading Packages: glibc-...

Configuring PATH globally for SSH remote commands

Hello, I have a problem with the PATH variable on Debian Linux when executing commands via SSH. This happens for example when I use GIT or Mercurial and I have them installed in /opt instead of /usr/local. But I can also reproduce this easily like this: When I login to the server via SSH in a normal way and then do echo $PATH then I ge...

Source Insight alternative for Linux

Hi all.. I need a C/C++ source code editor (for Linux) which has Source Insight's features, such as: Context window : when our cursor is above variable/class/function, the context window will display the declaration of that variable/class or the implementation body of that function Ctrl+Click at any variable/class/function, it will ju...

uniq : only when different by more than 1 character OR case

Hi all :) I got a text file with LOTS of names. I want a list of all the strings(lines) that is either 1) Different in CASE (i.e audi vs AuDI) 2) Different by more than 1 character ie (mygoo VS my-goo) Any ideas ?? ...

How to save XImage as bitmap?

Hello, i'm trying to create JNI C++ library that will capture desktop video (frames). First step is to simply make a screenshot of desktop. Code is : #include <iostream> #include <X11/Xlib.h> using namespace std; int main() { Display *display; int screen; Window root; display = XOpenDisplay(0); ...

Can I squeez my own program between the preprocessor and compiler?

Is this a stupid question? Or can I specify g++ to use a program between the preprocessor and compiler? Alternatively, I know that I can just run the preprocessor on a file (hence all the files). Then I am guessing there is a switch to run only the compiler. So I can manually invoke these two and put my program between. If so, how do I ...

Cg Redistributable Libraries - Linux location

Hi! I want to run program that needs Cg Redistributable Libraries (from Nvidia). I would like to know, where should i put those libraries, so that program will be able to find them. If I install Cg Toolkit, the program works normally. I am using Ubuntu linux. Thank you. ...

is there a way to change the target of symlink /proc/self/exe?

hi all: recently i'm working on make checkpoint on linux process and encountered a problem,it looks like that when i munmap memory map of the executable to current process,the symlink /proc/self/exe is dead.what i want is to make this symlink pointing to a other executable(the one for my resumed processs),is that possible?i tried del...

Get inexistent system user info without the output

This is my code for getting all system users: def get_all_system_users user_paths = Dir["#{ENV['HOME']}/../*"] users = user_paths.map { |path| path.split("..")[-1].gsub(/\W/, '') } users.select { |user| %x{id #{user}}.include?("uid") } end The problem is the id #{user} command which returns an output for inexistent users that b...