Programming :: Passing Input To Processes As Streams (language-neutral)?
Jun 5, 2009
I am trying to figure out if there is a way to start a process, and while it is running, pass input to it as though it were a stream. Although the subject of this post mentions this question is "language-neutral", specifically, I am trying to do this in Common Lisp. Truly, I am looking for the principles behind the method of doing this, which seem to me as though they would be language neutral.
I have done Google searches, and found nothing relevant to my query. Without using sockets and IP communication, I would like to start a process (let's use the MySQL command-line client, for example) and then in my Common Lisp (CL) program, pass it input like so:
Code:
(format *mysql-client-instance* "SELECT * FROM some_table;")
Simply, how would I go about sending input to an active process as though it were a stream? My thinking is there has to be some way to do it - similar to the Expect superset of Tcl.
View 2 Replies
ADVERTISEMENT
Apr 13, 2011
I started to run a C++ my program in Linux and I don't know how to test my program that works fine with a text file. This is a project for my uni and to explain more clear, My program is a sample database for modify or add and search and it read data from a binary file and also write into a binary file. I have got an input from my lecture and she said after compiling in Linux I must write:
1-to compile:
Code:
g++ (files with cpp)
2-to see the output:
Code:
./a.out
3-to test with input:
Code:
./a.out < input.txt >
My problem is in step three. What I must write in the command part after" step2" to see the output?
View 3 Replies
View Related
Nov 12, 2009
I am not sure if that Subject really explains it, basically I have a script that executes a CLI java-applet that requires a passphrase from the user. I can easily execute this by issuing the -p argument followed by the passphrase however that shows up on possible logs or at least on the results of the ' ps ' command. If you do not supply this -p argument it provides a new line with the echo " Enter Passphrase: " and asks for input.
how can I provide a result/input for the Passphrase request and is it still possible to throw this application in the background with the ' & ' following the command? I have seen a few examples that show a /bin/expect that expects a result and sends a command however I would like to refrain from any extra dependencies. Example of Regular Execution of application:
Code:
$ /usr/local/***/**** -u USERNAME -r Default-Realm -f certificate.der
Password:
View 6 Replies
View Related
Aug 27, 2010
How can I to pass a perl variable into html input tag? For example, If a have got a cgi script:
Quote:
use CGI;
use DBI;
my $owner = $cgi->param('owner');
[code]....
How can I to pass $owner variable?
View 1 Replies
View Related
May 29, 2010
I can't get Thai language input to work.
In "language support" I installed Thai, but it remains grayed out.
In "ibus preferences / input method", no languages are shown.
I added:
I added: "ibus-daemon --xim" to startup applications. No effect.
View 1 Replies
View Related
Mar 11, 2011
I just switched back from Mint 10, and while setting to work different input method apps like SCIM and Ibus, bumped into a problem(welcome back to SUSE). After installing Scim, my chinese input works only on one application (Goldendict), it doesn't work in any other app. So I tried Ibus, same result. SO far nothing helped me to make them work. What I 'm trying to find out. Is where I can setup language input method in SUSE, I haven't found such an option anywhere in KDE, yast. WHile in Mint there is such an option, where you can change your inpud method either to scim, xim, scim-bridge or ibus. I tried qtconfig, there I found it, P.S. Warning rage words!: I feel like I should say it. But my previous SUSE experience and overall usage history proves that there is no better distro than Ubuntu nowadays, this is sad indeed, cause I used to start from SUSE. But its true, SUSE is a real pain in the ***, when it comes to getting things done. It seems like whenever u try to setup something there is always a bad feeling of failure. Don't know, but again I'm been consecutively annoyed but its numbness. I'm sorry, cause I feel like I disregard ppl's hard work and support.
View 9 Replies
View Related
Jan 4, 2010
I'm on a project and I need to type Chinese. I'm new to this Linux thing (only a week) and very noobie.
View 2 Replies
View Related
Oct 27, 2010
how to change my input language (the way typing in accents affects the output character).
Currently I am on a Brazilian abnt keyboard and an English system (which is what I want), but I am unable to output accented characters - which I sometimes want, when I am not programming. I need something to switch around, but cannot find where to configure additional languages (not keyboards) neither where to switch.
I am on 10.04 with a gnome desktop.
View 6 Replies
View Related
Sep 10, 2010
The Korean language works fine with firefox.
But when I want to type Korean on Internet explorer, it just shows question marks. (look at the picture)
How do I fix this?
I really need to use a website with IE and type Korean, ASAP!
View 3 Replies
View Related
Jul 14, 2011
I originally made this post in Linux-General, but only one person was really answering the question and now he hasn't been responding, so I've come here since Scim is also Slackware related.Simply put, I need to be able to use Scim to input the Korean language.Here's the original thread:[URL]
View 14 Replies
View Related
Apr 20, 2010
I have a problem passing a file descriptor from one process to another.
I have two processes A and B. Both are running in different network and
filesystem namespaces, so it is impossible to use unix domain sockets or
net sockets to pass a file descriptor from process A to process B.
The usage of STREAMS is also impossible, as you can see in
fixunix.com/unix/84093-streams-pipes-ioctl-i_sendfd.html
[quotation begin]
Linux doesn't have STREAMS, which are the System V way
of doing this task. ...
[quotation end]
Are there additional possibilities for file descriptor passing like
using named pipes or something like that or does anybody know
a good workaround for this problem ?
View 9 Replies
View Related
Jan 6, 2011
from the php or html webpages pages, can we find the direct link to the flv files. videos it is easy, ok, because it places with firefox the flv file into the temp. but what about all other streams of webcams, videos, music, ... so that one can use mplayer
View 1 Replies
View Related
Jan 24, 2011
HOW to Go about the Linux Programming of DATA FUSION
Need to Multiplex ( Mux ) two Data Streams broadcast over Wireless and then Demultiplex (DeMux )on the Receiving side and give output on Individual O/p Screens. : DETAILS ::
My main PROJECT is,
1) First Stream :: GPS Stream
2) Video Stream :: Conversion of Analog Signal to Digital ( Using Compression Divx :: Not an issue )
Tx : Merging the Two Streams ( Mux ) and then Transmitting over Wireless as a Single Stream.
Rx : DeMux the Stream and Display GPS Data on Different O/P Screen and Video Stream on Different O/P Screen.
::Boundaries::
For now A Terminal on Both Ends can perform the Function with a OS in the Later Stages it will be embedded.
View 1 Replies
View Related
Jul 31, 2010
I'm having trouble getting ALSA to play multiple sound streams (multiple sounds at once). My code is running on an embedded ARM board using a AC97 sound. It will only play one without any mixing, I have to use pure ALSA as higher sound mixers are a nightmare to cross compile for ARM. I've tested my system with aplay for example
aplay -D plughw:0,1 bang.wav
works fine. So I tried dmix with
aplay -D plug:dmix Win.wav
That gave the following error
ALSA lib pcm_direct.c:1587snd_pcm_direct_parse_open_conf) The field ipc_gid must be a valid group (create group audio)
aplay: main:550: audio open error: Invalid argument
I checked asound with
/etc # cat asound.conf
pcm.EP93XX {
type hw
[code]....
Does this mean dmix will not work? Is there someway with the above setup I can play multiple sounds? I have to use the vendor ALSA build (so can't update ALSA), I can change the .confs however. Also because I'm cross compiling things like pulseaudio SDL are very difficult to get working, so I basically need to use the above ALSA. Is there anyway I can find if dmix exists on the system?
Should add aplay -L does show dmix ?
iec958 'cards.pcm.iec958'
spdif 'cards.pcm.iec958'
[code]....
View 3 Replies
View Related
Sep 8, 2010
Is there a DE/distro neutral (I guess CLI) method of changing a given user's user ID on a Linux system? I want to set all my systems to have the same UserID so my external hard drive stops giving permission errors when moving between them.
View 1 Replies
View Related
May 18, 2010
I'm struggling with the issue of passing a vector of a class to itself, here's what state its in now... (tried many variations, but without direction).
Code:
#include <iostream>
#include <string>
[code]...
View 2 Replies
View Related
Aug 21, 2010
I'm trying to work out the best way to achieve the following.
1)php page that grabs data from a local database. (not a problem)
2)It then needs to send this data to a c program/service running on a remote server. (I probably need it to be able to handle 4+ million reocrds in an array)
3) The c service then needs to process the data and send it back to the initial php script that called it. i was hoping this could be in a an array like structure of some kind. 4)update the db with the results.
I was thinking of using gsoap to write a simple c soap service that php can communicate with. Would this be the right way of doing this or would something like sockets in php be a better way of sending this volume of data as an array or struct to linux c socket if thats even possible.
View 3 Replies
View Related
Mar 7, 2010
Groovy is an object-oriented programming language for the Java platform. I do not have experience in Java, only perl and shell scripts. Recently I have been asked to maintain a software written in groovy (also to make enhancements). So can I learn groovy without knowing java language. or isit I have to learn java before venturing into groovy.
View 1 Replies
View Related
Jan 12, 2011
i'm programming a small tcp client, but i need that the server knows the source ip. My client receives a external connection and forwards, but the ip seen by the server, of course, is the client ip. I would like, change this ip to original source ip.
I don't know how to do this. I tried with the connect and select function.
View 5 Replies
View Related
May 8, 2010
I have a file with around 1000 IP addresses in it and I need to be able to ssh into each one of them, run a single command, and then exit. I already know the ssh command I want to run and it looks like this:
Code:
shpass -p [password] ssh -p 10022 -o StrictHostKeyChecking=no root@[ip variable] 'reboot'
(I know shpass is not good to use and keys are the correct way but I don't have any other options in this scenario.) if these ip addresses were in a .csv file, by themselves with no other information, how would I create a script to do the above command to each ip until the end of the file?
View 8 Replies
View Related
Jun 11, 2010
If I have the following links in HTML
Code:
<a href=lang.php?lang=cymraeg>Cymraeg</a>
<a href=lang.php?lang=english>English</a>
and lang.php has a link to page2.html, how do I pass on the value of the lang parameter from lang.php to page2.html? The value needed is the one passed in to lang.php.
View 3 Replies
View Related
Apr 26, 2010
Below I've presented the declaration, definition and the calling method of a function w.r.t pass by reference:
Declaration
Code:
void getUnpackedMsg (unsigned char &data, unsigned int numberOfBits);
Definition
line 278: Shown in RED
Code:
void packedMessage :: getUnpackedMsg (unsigned char &emptyArray, unsigned int numberOfBits)
{
...
...
printf ("
[code].....
View 3 Replies
View Related
Jan 14, 2009
I cannot for the life of me get this little (simple) script I wrote to work. Here is the entire script:
Code:
#!/bin/bash
ASPECT=`mediainfo $1 |grep "Display aspect ratio" |cut -d : -f 2`
HEIGHT=`echo "320 / $ASPECT" |bc`
SIZE=`echo 320x$HEIGHT`
[code]......
An input filename ($1) is fed into mediainfo, which by the use of grep and cut spits out a single number which is the aspect ratio. This is then divided by bc into 320, which gives the desired height dimension for the file that I want ffmpeg to create for me. Finally, ffmpeg runs using the calculated dimensions... Basically, it's the passing of the $ASPECT variable to bc that seems to fail. It looks like bc won't read the output from the mediainfo line... It always crashes out with:
Code:
(standard_in) 1: illegal character: ^M I've tried doing something even simpler like this to debug by just trying it to display the calculation on the screen:
Code:
#!/bin/bash
ASPECT=`mediainfo $1 |grep "Display aspect ratio" |cut -d : -f 2`
HEIGHT=`echo "320 / $ASPECT" |bc`
echo $HEIGHT
and it does the same, so it's definitely bc that won't accept the output from mediainfo.
View 4 Replies
View Related
Mar 19, 2010
I was trying to make a code for passing variables by reference..here's the code:
#include<iostream>
using namespace std;
void fun(int& ,int& );
int main(){
[Code].....
invalid initialization of non-const reference of type 'int&' from a temporary of type 'int*'
View 9 Replies
View Related
Feb 11, 2011
I have to launch a new thread from my existing main program and pass data to it.
For now the data is simply a string value.
How I go about passing data to a new thread while it is running.
View 5 Replies
View Related
May 23, 2010
I have the following snippet HTML code:
Quote:
<table id="profile">
<tr>...............</tr>
<tr>
<td width="40%">
[Code].....
How can pass values in args[0] and args[1] to Perl/CGI script?
View 2 Replies
View Related
Dec 19, 2008
I am unable to find a description of alsa's programing language, this sort of stuff:
[Code]...
I need to know what, for example, 'ttable' means and what is its syntax. This seems to be a state secret.
View 2 Replies
View Related
Mar 27, 2010
I wonder why arrays in the C programming language are pointers to the first element of the array, not the first element of the array itself?
View 14 Replies
View Related
Jan 9, 2014
I want to build on the code from /etc/apt/apt.conf.d/05etckeeper to work with Snapper, the new-in btrfs (et al) snapshot package.
Code: Select allDPkg::Pre-Invoke { "if [ -x /usr/bin/etckeeper ]; then etckeeper pre-install; fi"; };
DPkg::Post-Invoke { "if [ -x /usr/bin/etckeeper ]; then etckeeper post-install; fi"; };
The etckeeper code will work well as a template, but I need to pass a parameter between the pre- and post- instances. The parameter is obtained from the pre- invocation and passed to the post- invocation.I know that something similar to my quest is done with the 'pid' but how to do it in the 'standard' way. Happily there can't be multiple dpkg instances running concurrently (prevented by dpkg?) so I don't have to worry about that issue.
Q1. What is the 'standard' way of passing parameters about?
Code: Select allsnapper -c etc create -t pre -p (which 'prints' the parameter (int) to pass to the following invocation)
snapper -c etc create -t post --pre-number <parameter> in place of the two etckeeper calls.
Q2. How do I pick up the 'printed' output of the 'pre' call? I think it's just a 'get' from the stream but perhaps I've missed something.?
View 2 Replies
View Related
Jun 19, 2010
I am trying to simulate a shell. So what I do is checking of having the parameters from standard input, suc as "/bin/ls -l /home/france/Documents", and then passing them to function execute, which at some point calls execvp(argv[0],argv)The problem is that I don't succeed in using these arguments, while if I call execvp(paramList[0],paramList) it works!!!! Where paramList is exactly what I would put on standard input, but defined statically.
Code:
#include<unistd.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
[code].....
View 2 Replies
View Related