linux

Linux command to remove leading zeros from a file name

I have a directory with a bunch of files with names like: 001234.jpg 001235.jpg 004729342.jpg I want to remove the leading zeros from all file names, so I'd be left with: 1234.jpg 1235.jpg 4729342.jpg I've been trying different configurations of sed, but I can't find the proper syntax. Is there an easy way to list all files in the...

linux terminal animation - best way to delay printing of 'frame' (in C)

I'm working on a simple pong clone for the terminal and need a way to delay the printing of a 'frame'. I have a two dimensional array screen[ROWS][COLUMNS] and a function that prints the screen void printScreen() { int i = 0; int j; while(i < ROWS) { j = 0; while(j < COLUMNS) { printf("%c", ...

How to use patches created in windows (with CRLF) in linux?I

Standard linux patch hard-coded only for unix text files. PS: I do no want convert ALL to unix and then convert result back. ...

Setting up .emacs file for mac ruby development

I am having a difficult time loading ruby-mode in emacs on my mac. The .emacs file is located at ~/.emacs I've added several commands to it (many pasted from this site) and none seem to get loaded. Any advise? I"m not sure if the file isn't loading or I have the command syntax wrong. All I need is the following 4 space indent (auto...

OpenCV 1.0: cvCreateFileCapture Always Returns Null under Fedora 11

I'm attempting to open a video file using openCV 1.0's highgui.cvCreateFileCapture(path) function on a Fedora 11 system. Unfortunately, this function is always returning null. I've attempted to use it on a few different video formats, and I've even taken the steps recommend on the openCV wiki (http://opencv.willowgarage.com/wiki/VideoCod...

Pseudo filesystems on *nix

I need some opinions pointers on creating pseudo-filesystems for linux/*nix systems. Firstly when I say pseudo-filesystem I mean something like /proc where the structure within does not represent actual files on disks or such but the state of the kernel. I would like to try something similar as an interface to an application. As an exa...

How do I build an app for an old linux distribution, and avoid the FATAL: kernel too old error?

I distribute a statically linked binary version of my application on linux. However, on systems with the 2.4 kernel, I get a segfault on startup, and the message: "FATAL: kernel too old." How can I easily get a version up and running with a 2.4 kernel? Some of the libraries I need aren't even available on old linux distributions circa 2...

Google API to find the search count

When I google for something, I get the count. Results 1 - 10 of about 800 Is there any API or something like that to capture the number "800"? I have a database of a few thousand words and I want the google count against it. ...

help required for seperating sublists with colon

Hi, I am new to linux and am trying to parse a bunch of files that looks as follows - Some text start list some other text start sublist1 continue sublist1 more elements more elements2 a sublist2 a sub-sublist1 Where all the spaces before the list are tabs. I need a way to parse the text so that a colon is added for sublist...

Java: Graphics in Linux

Does X-Windows have to be installed on a Linux-box in order for Java to display fullscreen graphics? ...

mysqlclient library linkage problem

I am linking an application with mysqlclient library on 64-bit CentOS 5.4 and get a linkage error (cannot find -lmysqlclient). The library is in /usr/lib64/mysql/: una@localhost$ ll /usr/lib64/mysql/ total 9072 ... lrwxrwxrwx 1 root root 26 Jan 3 15:54 libmysqlclient_r.so -> libmysqlclient_r.so.15.0.0 lrwxrwxrwx 1 root root ...

Run a program under certain amount of physical memory?

Hi, I want to install qt in my Dreamhost Linux host. As you know, any hosting service will limit its users resource such as CPU and memory. When linking QT, it will cause the ld linker more than 400M memory, and then it get killed by the process monitor of Dreamhost... I try to google for hours without finding any real answer for m...

raw sockets on 64bit machine compilation problems

Hi All. I'm trying to do some raw socket programming. I have some example code that compiles/run just fine on a 32 bit machine but when I try to compile the same code on a 64 bit machine I get this discrepancy between /usr/includes/sys and/usr/includes/linux header files. I would have thought that on a 64 bit machine all the headers are ...

SOLR getting started, little help

I have managed to install SOLR and run the admin interface... I have no clue on how to add indexes to SOLR... I have a virtual server (wampserver) and in the SOLR tutorial they are referring to a TERMINAL all the time... I guess they mean the LINUX terminal or something, but how should I do the same thing in windows OS? For instance,...

Problem removing duplicate files using awk

Contents of part3.1.awk { current_line=$0 if (current_line!=prev) { print $1 " -> " " -> " $5 " -> " $8 } prev=$0 } To get the list of processes, i run this in terminal. I want to get output with removed duplicates and sorted too. $ps -ef | awk -f part3.1.awk | sort What wrong am i doing? ...

Has anyone been able to create a hybrid of PE COFF and ELF?

I mean could a single binary file run in both Win32 and Linux i386 ? ...

How do I read a given number of lines from the end of the file using streams in C++?

For my implementation of tail shell command in Linux, I need to read certain amount of lines/bytes from the end of the file using stream input/output. Does anyone have suggestions how to do that? I suspect I need to open a file and pass some parameter to the ifstream constructor, but I don't know what exactly. Googling didn't find anythi...

How do I create virtual ethernet devices in linux?

I am testing an implementation of a protocol that talks between two computers using ethernet (not IP). In order to not actually have to have two physical computers, I want to create two virtual ethernet interfaces. These would only be able to talk to each other, so one endpoint program would bind to one interface and the other endpoint w...

Auto code completion in VIM?

Hi, Can VIM do auto code completion like what Eclipse does? Usually I connect to my Linux developing server through Putty from my Windows laptop. So, I hope I can find a plugin for VIM which can do drop-down menu like auto completion when I can type variable names in Putty, is this possible? Thanks! ...

missing symbols that should be there

I'm stumped. Here is the output of ld. /usr/lib/libvisual-0.6/actor/actor_avs_superscope.so: undefined reference to `visual_mem_free' /usr/lib/libvisual-0.6/actor/actor_avs_superscope.so: undefined reference to `visual_mem_malloc0' Here are the macros: #define visual_mem_new0(struct_type, n_structs) \ ((struct_type *) v...