unix

UNIX, get environment variable

Hi SO I have a ridiculous question due to a ridiculous problem. Normally if I want to get the contents of an environment variable in UNIX shell, I can do echo ${VAR} Let's assume, due to my ridiculous situation, that this isn't possible. How do I get the contents of an environment variable to stdout, without someone who is lookin...

Can someone help fix my vimrc config?

set nohlsearch set ai set bg=dark set showmatch highlight SpecialKey ctermfg=DarkGray set listchars=tab:>-,trail:~ set list autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class set tabstop=4 set shiftwidth=4 set expandtab set autoindent set smartindent syntax on set listchars=tab:>- set listch...

Options for Linux OS executable archive files - self installers

I am looking to create a web-project that is able to install with a program. The user should be able to download an archive file or tar file, run it (executable), and the setup script would ask for paths and configurable values and then unpack its 'payload' and sorting out the contents for deployment. This would be a Linux version of t...

regular expression

Hi I need a regular expression that'll give me something like this part ./something\", [something.sh from something like this string ("./something\", [something.sh", ["./something\", [something.sh"], [/* 37 vars */]) is that possible? I'm having real trouble making this since there's that \" escape sequence and also that ',' chara...

questions about multi threading for sockets/tcp-connections.

I have a server that connects to multiple clients using TCP/IP connections, using C in Unix. Since it won't have more than 20 connections at a time, I figured I would use a thread per connection/socket. But the problem is writing to the sockets as I'll be sending user prompted msgs to clients. Once each socket is handled by a thread, how...

Signal Handling in C

How can I implement signal Handling for Ctrl-C and Ctrl-D in C....So If Ctrl-C is pressed then the program will ignore and try to get the input from the user again...If Ctrl-D is pressed then the program will terminate... My program follows: int main(){ char msg[400]; while(1){ printf("Enter: "); fgets(msg,400,stdin); prin...

Get directory path by fd

I've run into the need to be able refer to a directory by path given its file descriptor in Linux. The path doesn't have to be canonical, it just has to be functional so that I can pass it to other functions. So, taking the same parameters as passed to a function like fstatat(), I need to be able to call a function like getxattr() which ...

API for parse/update UNIX configuration files

Unix configuration files come in all shapes and forms. I know that Webmin has a Perl API that makes it easy to parse and modify most common configuration programmatically, while preserving changes that might have been made by hand. Are there any other libraries that has similar functionality, perhaps for other languages (Python, Ruby, C...

Testing the program in different OS

I want to test my program by installing it in different OS versions. My development computer is Ubuntu. What other Linux versions can I test by installing them inside VirtualBox and running my program there? Though it is not critical for me right now, I want to try something different and see what happens. Also, what is the chance that...

Detecting a symlink in Java

Given a Java 'File' object, how can I detect whether or not it refers to a symlink? (If it helps/matters, I know the file refers to a directory, not to a file) ...

Jboss logging issue

How to check whether all the jboss services are running or not in unix ? ...

How can I obtain the IPv4 address of the client?

Hello! I'm prepping for a simple work project and am trying to familiarize myself with the basics of socket programming in a Unix dev environment. At this point, I have some basic server side code setup to listen for incoming TCP connection requests from clients after the parent socket has been created and is set to listen... int sockf...

Formatting the date in unix to include suffix on day (st, nd, rd and th)

How can I add the suffix on the day number of a unix date? I'll explain. I have a TextMate bundle snippit that writes out today's date. It uses unix date and formatting. Here is the code: `date +%A` `date +%d` `date +%B` `date +%Y` It outputs: Monday 22 March 2010 I would like to add the suffix to the day (st, nd, rd and th) like s...

How can I obtain the local TCP port and IP Address of my client program?

Hello! I'm prepping for a simple work project and am trying to familiarize myself with the basics of socket programming in a Unix dev environment. At this point, I have some basic server side code and client side code setup to communicate. Currently, my client code successfully connects to the server code and the server code sends it a ...

How can I obtain the IP address of my server program?

Hello! This question is related to another question I just posted. I'm prepping for a simple work project and am trying to familiarize myself with the basics of socket programming in a Unix dev environment. At this point, I have some basic server side code and client side code setup to communicate. Currently, my client code successfully...

Can somebody give a high-level, simple explanation to a beginner about how Hadoop works?

I know how memcached works. How does Hadoop work? ...

I am currently serving my static files in Django. How do I use Apache2 to do this?

(r'^media/(?P<path>.*)$', 'django.views.static.serve',{'document_root': settings.MEDIA_ROOT}), As you can see, I have a directory called "media" under my Django project. I would like to delete this line in my urls.py and instead us Apache to serve my static files. What do I do to my Apache configs (which files do I change) in order to...

Mono vs .NET Interop curiosity

I'm developing a huge console application for Unix using C# via Mono. If I develop that app using M Visual Studio and .NET 3.5 and I carefully neglect to use win32 specific API calls, should I expect that application to automatically work in my Unix box? Or should I just get MonoDevelop and go the Mono way? ...

How to print ASCII value of a character using basic awk only.

I need to print the ASCII value of the given charecter in awk only. the below gives 0 as output. echo a | awk '{ printf("%d \n",$1); }' Help please. ...

Extracting columns from text file using Perl one-liner: similar to Unix cut

I'm using Windows, and I would like to extract certain columns from a text file using a Perl, Python, batch etc. one-liner. On Unix I could do this: cut -d " " -f 1-3 <my file> How can I do this on Windows? ...