what precisely do you want to automate. can you describe the intended workflow?
is sicaries tip not the answer to your problem?
regarding ssh:
if you install a ssh server on your windows machine then you can connect to it with ssh and you can execute console programs on the windows machine. it's been a while that i used that, but cygwin sshd worked well for me.
btw, an ssh server...
User Profile
Collapse
-
-
are you sure you have to set the DISPLAY variable on the server? my experience with windows is a bit dusty but sitting at my linux desktop i only do
and it works fine. every time i do this i get a different DISPLAY number so i guess ssh (or putty in your case) is taking care of this.Code:joe@desktop:~$ ssh -Y user@server [user@server ~] $ echo $DISPLAY localhost:22.0 [user@server ~] $ xclock
...Leave a comment:
-
feels to me as if this would be tough in bash, but i guess it should be doable in perl. just as a rough concept:
read the file line by line and store the current paragraph in some temp variable and check for the keyword. once the paragraph has ended either discard it or print itLeave a comment:
-
can't call a shell script from within awk
i can execute echo from within awk like so:
but if i want to execute another shell scriptCode:echo asdf jkl asdf \ | awk ' /jkl/ { sub(/jkl/,echo "X(&)") } {print}' asdf X(jkl) asdflike so:Code:cat ~/bin/doit #!/bin/bash echo -n KKK
it doesnt work. ...Code:echo asdf jkl asdf \ | awk ' /jkl/ { sub(/jkl/,doit) } {print}' asdf asdf -
yes, i could write my own. i was just wondering why there is none and whether i should take that as an indicator to look for another "stl way" of proceeding.
using transform, i would end up with
wouldnt i?Code:transform( List.begin(), List.end(), std::bind2nd( std::assign<double>(), 0.0 ) );
ahh std::fill didnt see that.
thanks to...Leave a comment:
-
I see std::plus<T>, but where is std::assign<T>
hi,
i find a std::plus<T> but what if i just want to assign all elements in my container a certain value. Im thinking of something along the lines of
but obviously there is no such thing as std::assign<T>Code:std::list<double> List; std::for_each( List.begin(), List.end(), std::bind2nd( std::assign<double>(), 0.0 ) );
... -
yak.
seems that (the implementation of stl that i use) does one reallocation for each call of
v.reserve( v.size() + 1 );
i.e. it doesnt grow in the same way as v.push_back() does, but it actually increases the capa by exactly 1.
im getting bored. maybe i give in to the extra temp copyLast edited by jabbah; Dec 17 '09, 12:16 PM. Reason: clarification: its not that _i_ have implemented stlLeave a comment:
-
what about something like this.
[CODE=c]
ostream& operator<<( ostream& out, const MyClass& x )
{
out << x.a << " " << x.b ..... ;
return out;
}
[/CODE]
now you can iterate over your list and use <<Leave a comment:
-
Maybe the problem lies in this line:
are you sure you didnt want to:
int i = 100;
int* p = &i;...Leave a comment:
-
-
agreed.
I was afraid that this would be your answer. Thanks a lot for clarifying this, Banfa!
That brings up another idea.
Suppose I make sure that there is always at least _one_ element free (because I call V.reserve( V.size() + 1 ) _after_ each push_back). Is that enough?
In other words can I be sure, that reallocation will only happen if V.capacity()...Leave a comment:
-
-
huh?!
has a message from me just disappeared?!
Im pretty sure that the thread went:
jabbah: Hi, I just found, ....
banfa: Here is the problem...
jabbah:ok, I understand....
banfa: That should work...
jabbah: I thought vector....
jabbah: < This Message Seems To Have Disappeard >
banfa: It doesn't matter...
can that be?! hm well
...Leave a comment:
-
I thought vector would double the capacity anyway whenever it is about to be exceeded.
so suppose befor i take action, we have
V.capacity()==V .size()==a
then I do one of:
V.resize( V.size()+1 ), or
V.resize( V.size()*2 )
no matter, afterwards we will have
V.capacity() == 2 * a...Leave a comment:
-
ok, I understand. thanks banfa.
regarding the tmp copy: what about
V.reserve( V.size()+1 );
V.push_back( V[0] );Leave a comment:
-
have you read this
http://bytes.com/faq.php?faq=posting..._or_coursework
and do you have a question?...Leave a comment:
-
is that safe: V.push_back( V[0] );
Hi, I just found, that code that ran under Visual Studio 8 doesnt run under 9 anymore and now im seeking confirmation of whether my code is unsafe and just accidentially worked or what one can expect from a standard conforming implementation of STL.
The basic thing is that, given a vector V with some elements in it, I want to push_back one of these elements, like this:
[CODE=c]#include <iostream>
#include... -
-
speaking of terminology, i notice that you emphasise the terms "adaptable functors" and "function adapters". whats behind that?
my guess is
- functor is a class with an operator()
- its called adaptable, if its derived from std::unary_func tion (or binary), ie has typedefs for args and returntypes
correct me if im wrong. and whats a function adapter?Leave a comment:
-
alright!
thanks. of course
so now i do:
which does what i want. thanks banfaCode:template< typename PREDICATE > int doit ( const int* a, unsigned int size, PREDICATE predicate ) { int sum = 0; for ( unsigned int i =0 ; i < size; ++i ) { if ( predicate(a[i]) ) sum += a[i]; } return sum; }Leave a comment:
No activity results to display
Show More
Leave a comment: