linux

Rails Comments on View if-end statement screw up rendering on Linux/Apache/FastCGI

Hi, the following code does work under my Windows development environment, but not on my production Linux/Apache2/FastCGI env. in my view rhtml file : <td id='first_column' class='column'> <% content_for :head do #DO NOT CACHE THIS content for : HEAD %> <%= stylesheet_link_tag('live_tree') %> <%= javascr...

Linux Tool to read values of the stack

Hello, I would like to know if there is a Linux tool that allows you to read the values of the program stack?? For instance when running the binary of a program containing the line: foo(parameter); the parameter would be put on the stack, and I would like to know if there is a tool to access it. thanks. ...

casting issue with realpath function (c programming)

When I compile the following code: #define _POSIX_C_SOURCE 200112L #define _ISOC99_SOURCE #define __EXTENSIONS__ #include <stdio.h> #include <limits.h> #include <stdlib.h> int main(int argc, char *argv[]) { char *symlinkpath = argv[1]; char actualpath [PATH_MAX]; char *ptr; ptr = realpath(symlinkpath, actualpath); ...

Append to /etc/apt/sources.list

I'm creating some scripts to streamline application installations and I need to append to the end of /etc/apt/sources.list This code below append to files in ~ but not in /etc/apt/ echo "deb http://ppa.launchpad.net/person/ppa/ubuntu karmic main" >> /etc/apt/sources.list @meder I have tried these following commands with no luck: su...

mdns: is there a web-service interface to avahi-daemon?

I would like to query the mdns database of avahi-daemon through HTTP. Is there a way to do this? ...

How to run an X program from outside the X session (e.g. from the console or SSH)

Without being the person logged in at the console, how do I run an X application and have it display on that X session? Assume I am either root, or I am the same user who logged in, so in principle I have persmission to do this. But how do I convince X of this? Some examples of situations like this: Log in with SSH and run a program t...

Paste two text lists (one list a file) into one list separated by commas

An example of the process/output would be: File1: hello world File2: foo bar Resulting file after concatenation: File3: hello;foo world;bar For a large list of non-predictive text (no-wild cards - but lines are aligned as above). I cannot figure out how to do this with the paste command under Ubuntu. ...

Installing python on 1and1 shared hosting

Hi, I'm trying to install python to a 1and1.com shared linux hosting account. There is a nice guide at this address: http://www.jacksinner.com/wordpress/?p=3 However I get stuck at step 6 which is: "make install". The error I get is as follows: (uiserver):u58399657:~/bin/python > make install Creating directory /~/bin/python/bin /usr...

CShell word replacement

Hey, I have a short text file with the following syntax: FileName: some name Version: 3 Length: 45 hello, this is an irrelevant, unimportant text. So is this line. Now, I'm trying to write a script that replace the version number with a given new number. Anyone knows how to? I really don't mind it to be ugly thanks, Udi ...

Add windows encoding to Eclipse on linux

Hi, I have a legacy project which has all the source files, templates, properties written in cp1250 encoding. (Windows 1250 - central european). Recently I switched from Windows to Ubuntu and found out, that fresh installation of Eclipse 3.5 doesn't have cp1250 in neither project properties nor workspace settings. How do I install new en...

How to handle execvp(...) errors after fork()?

I do the regular thing: fork() execvp(cmd, ) in child If execvp fails because no cmd is found, how can I notice this error in parent process? ...

How to handle unicode strings in a XeLaTeX document?

Hi, an earlier question led me to XeLaTex (it was about LaTeX and Unicode). So I've got now this document: \documentclass[a4paper]{article} \usepackage[cm-default]{fontspec} \usepackage{xunicode} \usepackage{xltxtra} \setmainfont[Mapping=tex-text]{Arial} \begin{document} গ a ä ͷ \end{document} With the font "Arial" only the a and th...

Sorting and extracting of dirnames

There are a lot of directories named like web001 web002 ... web123 ... I want to extract a max-number from this set... Something like num="´find -name /dirname sort ... | tail´" with extracting. I have no ideas... Thank you ...

Game programming with Java in Linux

Recently I've been craving some game programming. I primarily use Linux, and was wondering if there are any good graphics libraries for Java development on Linux? Google didn't turn up very much useful information on the subject. Also, would another language be better? I would like to avoid using python -- Ruby and Java are my two favor...

How to parse /proc/pid/cmdline

Hi. I'm trying to split the cmdline of a process on Linux but it seems I cannot rely on it to be separated by '\0' characters. Do you know why sometimes the '\0' character is used as separator and sometimes it is a regular space? Do you know any other ways of retrieving the executable name and the path to it? I have been trying to get ...

How to wait for process child?

I do the usual fork + exec combination: int sockets [2]; socketpair (AF_LOCAL, SOCK_STREAM, 0, sockets); int pid = fork (); if (pid == 0) { // child dup2 (sockets[0], STDIN_FILENO); dup2 (sockets[0], STDOUT_FILENO); execvp (argv[0], argv); _exit (123); } // parent close (sockets[0]); // TODO wait and see if child crashes I...

How to extract archive from this script (using tar)

Hi, I have absolutly no idea how to unpack the created archive. I give you the complete Script. A Debian based Distibution named Univention uses this to backup several files in an tar archive. The real archive is packed in an function. The main Content where they create the actual tar file is: cat "$TMPDIR/freeinfo.txt" >> "$TMPDIR/In...

C++ fork() and execv() problems

Hi all, I am kind of newbie on C++, and working on a simple program on Linux which is supposed to invoke another program in the same directory and get the output of the invoked program without showing output of the invoked program on console. This is the code snippet that I am working on: pid_t pid; cout<<"General sentance:"<<en...

Organizing School Workspace/Writing Makefile

I am doing some C programming for school and I have found myself reusing libraries that I have created, over and over again (stacks, user input, error handling, etc). Right now, my personal SVN directory structure looks like this: trunk/ |-- 2520 | `-- assignments | |-- A2 | |-- Makefile | |-- README | ...

how do i source .bashrc remotely

I'm currently writing a script to set some PATH in a remote machine using ssh. I have successfully set the variables in the .bashrc. However, it the last step of my script is "source .bashrc". However, when i ssh to the machine manually, the PATH is still not set. What is the problem? ...