unix

I'm familiar with Python and its data structures. Can someone give me a very basic example on how to use Hadoop Mapreduce?

What can I do with Mapreduce? Dictionaries? Lists? What do I use it for? Give a real easy example ...

call external program in python, watch output for specific text then take action

Hello everyone, i'm looking for a way in python to run an external binary and watch it's output for: "up to date" If "up to date" isn't returned i want to run the original command again, once "up to date" is displayed i would like to be able to run another script. So far I've figured out how to run the binary with options using subproces...

passing parameters from unix to pl sql

Hi. I have a dumb problem. From a ksh I'm connecting to sql plus to execute some query. I want to pass 2 parameters from unix to pl sql. I found some stuff but it does not works. UNIX: sqlplus -L $ORA_CONNECT @"$FIC_REQ" $1 $2 PLSQL: DECLARE param1 := $1; param2 := $2; BEGIN SELECT * from MYTABLE where field1=param1...

Different standard streams per POSIX thread

Is there any possibility to achieve different redirections for standard output like printf(3) for different POSIX thread? What about standard input? I have lot of code based on standard input/output and I only can separate this code into different POSIX thread, not process. Linux operation system, C standard library. I know I can refact...

Security strategies for storing password on disk

I am building a suite of batch jobs that require regular access to a database, running on a Solaris 10 machine. Because of (unchangable) design constraints, we are required use a certain program to connect to it. Said interface requires us to pass a plain-text password over a command line to connect to the database. This is a terrible se...

add string after each line bash

How do I add a string after each line in a file using bash? Can it be done using the sed command, if so how? ...

php,unix command ,imagick help me

This command add the text "flower" to the image: convert flower.jpg -font courier -fill white -pointsize 20 -annotate +50+50 'Flower' flower_annotate1.jpg I'm using ImageMagick 2.2.0. I'm running it from PHP using: system('convert flower.jpg -font courier -fill white -pointsize 20 -annotate +50+50 'Flower' flower_annotate1.jpg'); b...

bash string replacing a some char with another

folks, i have a string like AxxBCyyyDEFzzLMN I want to replace all x and y and z with _ so that the output is A_BC_DEF_LMN How to do that? I know a series of echo "$string" | tr 'x' '_' | tr 'y' '_' will work, but I want to do taht in one go, without using pipes EDIT: The following worked echo "$string" | tr '[xyz]' '_' ...

Write STDOUT & STDERR to a logfile, also write STDERR to screen

I would like to run several commands, and capture all output to a logfile. I also want to print any errors to the screen (or optionally mail the output to someone). Here's an example. The following command will run three commands, and will write all output (STDOUT and STDERR) into a single logfile. { command1 && command2 && command3 ; ...

php,unix command ,imagick ,overflow

This is Add text to image echo system('convert mug.jpg -font courier -fill green -pointsize 30 -annotate +100+230 \'hi Wlecome yy\' mug123.jpg'); unix command run in php it is working fine when we change the point size hi welcome is over flow the image how can we over come? ...

phpMyAdmin Cron to Delete Temporary Files

I have a folder on my hosting which I periodically upload something to - /public_html/uploads - and I'd like to set up a cronjob through phpMyAdmin to empty it out on a regular basis. The current cron I have in pMA is find /public_html/uploads -maxdepth 1 -ctime 1 -exec rm -f {} \; (Ignore the fact that it's running every minute for...

how to grep for the whole word

I am using the following command to grep stuff in subdirs find . | xargs grep -s 's:text' However, this also finds stuff like <s:textfield name="sdfsf"...../> What can I do to avoid that so it just finds stuff like <s:text name="sdfsdf"/> OR for that matter....also finds <s:text somethingElse="lkjkj" name="lkkj" basically s:text an...

How to write to a remote domain

Hello, I have a domain www.example.com In the domain, www.example.com/write directory is chmod to 777. Now, suppose, if I want to create a new directory like www.example.com/write/new from www.some-domain.com, what should I be doing. I know PHP, Python. Please relate the answers to this. ...

Auto-Completion in Unix VI editor

Hey guys, after using graphical IDE's like Visual Studio, I'm used to pressing CTRL+Space to auto-complete a variable or function name. Now, I know such a thing isn't completely possible in VI, but I heard there was a list of commands that could be mapped that allowed automatic completion of variables and functions in the current file op...

unix DECLARE_WAIT_QUEUE_HEAD (var) var prototype?

hello i want to work with 2 queue in the module where i change my pointer to them therefore i need to use : //declartion wait_queue_head_t **currentQ; DECLARE_WAIT_QUEUE_HEAD (readWaitQ1); DECLARE_WAIT_QUEUE_HEAD (readWaitQ2); if(condition){ currentQ = &readWaitQ1; }else{ currentQ = &readWaitQ2; } but i get incorrect type f...

malloc in kernel

when i try to malloc at kernel mod i get screamed by the compiler : res=(ListNode*)malloc(sizeof(ListNode)); and the compiler is screaming : /root/ex3/ex3mod.c:491: error: implicit declaration of function ‘malloc’ what should i do ? ...

How to search a file for a pattern and get a new file from the match point to end of file?

I need to take a file and find the first occurrence of a literal string pattern as a complete line of the file: Acknowledgments: And then I wish to create a new file from the line of match all the way to the end of the file. I expect perl is a good way to do this, but I'm not much of a perl person, alternatively maybe sed is a good w...

Loading zsh as the default shell in gnu screen

Hello, Im using KUbuntu 10.04 (Lucid Lynx). I have installed zsh and screen. I have set zsh as the default shell, by setting Command to zsh in Settings->Edit Current Profile of the terminal. But,when i launch screen,the bash shell is loaded. If i run the command zsh, then zsh starts but the following message is displayed: "/home/joel/....

After tar extract, Changing Permissions

Just a Question Regarding unix and PHP today. What I am doing on my PHP is using the Unix system to untar a tarred file. exec("tar -xzf foo.tar.gz"); Generally everything works fine until I run into this particular foo.tar.gz, which has a file system as follows: Applications/ Library/ Systems/ After running the tar command, it seem...

Using UNIX find to generate TAGS files when the $CWD contains a space or special character

The following UNIX one-liner looks for Python files below the CWD and adds them to a TAGS file for Emacs (or we could do the same with Ctags). find . -name *.py -print | xargs etags This breaks if the CWD has a space or other unusual character in its name. -print0 or -ls don't seem to help, in spite of what man find says. Is there a n...