unix

How to call shell script from net assembly

Need to call unix shell script from a Net assembley, how would I do it.. and return tabular result(key value pair(s)) to the caller. ...

C/Linux : file permission problem with open

Hi, I am trying to read some text from a file and write it to another using open(), read() and write(). This is my open for the file-to-write-to (I want to create a new file and write into it): fOut = open ("test-1", O_RDWR | O_CREAT | O_SYNC); This is setting file-permissions to something I don't understand at all. This is the outp...

how to do this in c++gui

I want to write a program for UNIX in C++ with GUI (planning it to be Qt). I haven't learned the Qt library yet btw. I want the program to be like a world map that will be divided into many cells like a grid(the grid shouldn't be visible) and when i start to ping some IP it will show me that IP location on the world map (select it like a...

running BLAST (bl2seq) without creating sequence files

I have a script that performs BLAST queries (bl2seq) The script works like this: Get sequence a, sequence b write sequence a to filea write sequence b to fileb run command 'bl2seq -i filea -j fileb -n blastn' get output from STDOUT, parse repeat 20 million times The program bl2seq does not support piping. Is there ...

using the 'rm' command in a c program using the system() function in stdlib.h

i am trying to use the rm command in the main routine for deleting a file that i have taken a command line argument. The value is stored in argv[2] i have tried using system("rm argv[2]"); system("rm ./argv[2]"); system("rm $HOME/argv[2]"); But it gives me an error saying "cannot locate file argv[2]" The filename is stored in argv...

Sed removing duplicate characters and certain characters in beginning/end of string

Hello, I am asking for your help with sed. I need to remove duplicate underscores and underscores from beginning and end of string. For example: echo '[Lorem] ~ ipsum *dolor* sit metus !!!' | sed 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._()-]/_/g' Produces: _Lorem____ipsum__dolor__sit_metus____ But I ne...

Linking to libraries in gcc

I have a collection of dynamic libraries that I want to link to in /usr/local/lib, how can I do this using gcc without setting my LD_LIBRARY_PATH (i have heard it is bad to do this fora number of reasons). I have spent an hour looking at this on the internet, and fiddling with command line arguments, the only way I got it to work was usi...

Write program like netstat

I would like to write an application like a netstat - to show all the active connections and the open ports respectively. The problem is that I don't know how to do it - I've done some network programming but in general it was some simple server-client packet and simple TCP and UDP packets sending/receiving. I looked at the netstat cod...

replace with sed on Mac OS X Leopard doesn't do what expected

I'm trying to replace \" (backslash doouble quote) by ' (quote) using sed. sed "s/\\\"/\'/g" file.txt The command doesn't work as expected. It replaces all the " in the text file, not only the \". It does the same thing as sed "s/\"/\'/g" file.txt I'm working on Mac OS X Leopard. Does any one have a clue? ...

Source of quote about UNIX as a virtual machine and C as a scripting language

I recall a quote that goes something like this: Unix is the universal virtual machine and C is its scripting language. I am looking for the origin of this quote and the exact language. I vaguely remember Eric Raymond as the proximate source, but I can't find it in his writing. ...

generate sha256 with openssl and C++

Hello, I'm looking to create a hash with sha256 using openssl and C++. I know there's a similar post about this here: http://stackoverflow.com/questions/918676/generate-sha-hash-in-openssl, but I'm looking to specifically create sha256. UPDATE: Seems to be a problem witht he include paths. It can't find any openssl functions even...

Recovering files from archive of CVS *,v files

I trying to recover some old source code (plain text) from a bunch of files that used to be managed with CVS. I have a directory containing all of the source code files in CVS's *,v file format. This looks mostly like the original files, but there are quite a bit of CVS specific header and revision information in there. Is there a simpl...

htaccess rewrite rule doesn't work

Hi, in my .htaccess file i do have these lines: Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([a-zA-Z0-9_-]+)/([0-9])/([a-zA-Z0-9_-]+)\.(html)$ /first_gate/index.php?show=true&_=$1&__=$2 [QSA] So calling: http://www.domain.com/a-b-c-d/123/an-thing-here.html in the background it's intend...

how do I launch a url in firefox in the background from Ubuntu command line?

I use this command from the Terminal to launch a url in Firefox: firefox reader.google.com & I put the ampersand at the end so that it won't put my Terminal window in the background, but Gnome just ignores this and opens a new Firefox browser window on top of the Terminal. Is there a way to launch Firefox behind the Terminal? What I w...

create emacs alias that starts in background?

Hi, I have an alias in bash that runs emacsclient if emacs daemon is already running and start emacs otherwise. However, in the event that a fresh instance of emacs is fired up, can I make it run in the background so I can still use that terminal (or close it)? In my bash profile, I have alias ec="/usr/bin/emacsclient.emacs-snapshot -n ...

Unix makefile errors " 'ake: Fatal error: Don't know how to make (c file here)"

I've written the below makefile: hw2p1: hw2p1_main.o hw2p1_getit.o hw2p1_parseit.o hw2p1_moveit.o hw2p1_showit.o gcc hw2p1_main.o hw2p1_getit.o hw2p1_parseit.o hw2p1_moveit.o hw2p1_showit.o hw2p1_main.o: hw2p1_main.c gcc -c hw2p1_main.c hw2p1_getit.o: hw2p1_getit.c gcc -c hw2p1_getit.c hw2p1_parseit.o: hw2p1_parseit.c gc...

Java Posix IPC Is there an API?

Hi All: I'm wondering if I can access to a Posix Message Queue in Java as I have an application that can't be modified and uses a message queue to talk to other processes. Is there any api or package that do that? I know that I can use JNI but I need to do this ASAP so no time to develop that. Regards. ...

Awk, Sed : How to parse and sum values from a string

Hi all, I've a string like this Cpu(s): 1.9%us, 2.1%sy, 1.5%ni, 94.5%id, 0.8%wa, 0.0%hi, 0.1%si, 0.0%st it represents the Cpu usage of my unix box. Now I need to apply awk and sed (i think) to extract the current load of my CPUs. I'd like to extract the 'us', 'sy', 'ni' values from the string and then I want to sum them. The s...

Unix commandline history substitution ^foo^bar (for multiple replacements)

Occasionally I use the bash command to replace string in previous command: ^foo^bar Today I wanted to make the replacement in the following line for replacing all occurrences of checkbox with `radio: $ git mv _product_checkbox_buttons.html.erb _product_checkbox_button.html.erb $ ^checkbox^radio git mv _product_radio_buttons.html.erb ...

How can i send an email through UNIX mailx command

How can i send an email through UNIX mailx command ...