#1 2009-05-12 18:19:37

sahanakrish
Member
Registered: 2009-04-27
Posts: 10

[resolved] tSystem1 Usage

I am trying to auto tweet some values from the database  to my twitter account every 5 min  and i am using the tsystem to  the same

"curl -u user:pswd -d status="+(String)globalMap.get("cur_post")+" http://twitter.com/statuses/update.xml"

this works when the text i want to tweet( (String)globalMap.get("cur_post") ) is just a string like :"Testing_1_2_3"
but if my (String)globalMap.get("cur_post") or tweet has spaces in  it  "Testing 1 2 3" then it tweets only the first word of my text .i.e Testing

i tried all the following
"curl -u user:pswd -d status=Testing 1 2 3 http://twitter.com/statuses/update.xml"
tweets just : Testing
"curl -u user:pswd -d status=\"Testing 1 2 3\" http://twitter.com/statuses/update.xml"
tweets just : "Testing
"curl -u user:pswd -d status=\'Testing 1 2 3\' http://twitter.com/statuses/update.xml"
tweets just : 'Testing

does not work either and i see the following error

curl: (6) Couldn't resolve host '1'

curl: (6) Couldn't resolve host '2'

curl: (6) Couldn't resolve host '3"''
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed


Any help or suggestions?

Last edited by sahanakrish (2009-05-12 21:35:21)

Offline

#2 2009-05-13 07:55:32

shong
Talend team
Registered: 2007-08-29
Posts: 10310
Website

Re: [resolved] tSystem1 Usage

Hello guy
To make your job run, you can replace all the " " with "_".

Code:

"curl -u user:pswd -d status="+(String)globalMap.get("cur_post").replaceAll(" ","_")+" http://twitter.com/statuses/update.xml"

Best regards
       
        shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#3 2009-05-13 15:19:24

sahanakrish
Member
Registered: 2009-04-27
Posts: 10

Re: [resolved] tSystem1 Usage

Thanks Shong.

If i replace all " " with "_" it will definetly work and it would look like
This_is_my_first_tweet.
But i want the spaces to be retained which i can achieve if i use the curl cmd on the cmd promt
curl -u user:pswd -d status="This is my first tweet"  http://twitter.com/statuses/update.xml

I was wondering how to get the same result(retained spaces)in Talend tsystem_1 component?

Thanks,
Sahana

Offline

#4 2009-05-14 21:49:36

sahanakrish
Member
Registered: 2009-04-27
Posts: 10

Re: [resolved] tSystem1 Usage

I found the solution
We have to use the cmdArray(String[]) instead of command(String)
Have a tjava custom object where you build the String array which contains cmd and its parameters and then put that in the globalMap and get the array from globalMap in tsystem


Uploaded Images

Last edited by sahanakrish (2009-05-18 22:04:47)

Offline

#5 2009-05-15 08:09:29

shong
Talend team
Registered: 2007-08-29
Posts: 10310
Website

Re: [resolved] tSystem1 Usage

Hello

Thanks for sharing your solutions, but I don't see your image. Can you try to upload it again?

Best regards

         shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#6 2011-05-05 21:34:29

gvarga
Member
Registered: 2011-04-15
Posts: 11

Re: [resolved] tSystem1 Usage

Hi,

I would like to use tSystem in same way, but it does not work for me in TOS 4.2RC3. sad

For example:

tRowGenerator -> tJava -> tSystem

tJava code: globalMap.put("test", "hello");
tSystem command: "cmd /c echo " + (String)globalMap.get("test")

expected output: hello
actual output: null

Can you check what's wrong?

Thanks in advance!

Gabor Varga

Offline

#7 2011-05-06 07:11:47

shong
Talend team
Registered: 2007-08-29
Posts: 10310
Website

Re: [resolved] tSystem1 Usage

Hi Gabor Varga
Try to use tJavaRow replace tJava, eg:
tRowGenerator -main--> tJavaRow -main--tFlowToIterate--iterate--> tSystem

on tJavaRow:
globalMap.put(''test", input_row.columnName);


Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#8 2011-05-06 07:27:23

gvarga
Member
Registered: 2011-04-15
Posts: 11

Re: [resolved] tSystem1 Usage

Hi,

Thanks for the quick reply!

I tried what you suggested and it works fine now! big_smile

tRowGenerator -main--> tJavaRow -main--tFlowToIterate--iterate--> tSystem

Thank you very much! smile

Best regards,

Gabor Varga

Offline

Board footer

Powered by FluxBB