riak erlang doubt

Wes James comptekki at gmail.com
Fri Apr 20 15:09:31 EDT 2012


Probably you want

#!/usr/local/bin/escript

or

#!/usr/bin/env escript

at the top.

Wes

On Tue, Apr 17, 2012 at 2:15 AM, <Sangeetha.PattabiRaman2 at cognizant.com>wrote:

>  Dear Team,****
>
> ** **
>
>                 Please do me the needful In resolving the same ..****
>
> ** **
>
> I have installed erlang and riak cluster seprrately its working
> fine....ran some sample program on erlang it was running fine ...now i am
> trying to run erlang script to load teh data onto riak DB using
> load_data.erl and goog.csv....****
>
> 1 #!/usr/local/bin escript****
>
>   2 %% -*- erlang -*-****
>
>   3 main([Filename]) ->****
>
>   4     {ok, Data} = file:read_file(Filename),****
>
>   5     Lines = tl(re:split(Data, "\r?\n", [{return, binary},trim])),****
>
>   6     lists:foreach(fun(L) -> LS = re:split(L, ","), format_and_inser
> t(LS) end, Lines).****
>
>   7****
>
>   8 format_and_insert(Line) ->****
>
>   9     JSON = io_lib:format("{\"Date\":\"~s\",\"Open\":~s,\"High\":~s,
> \"Low\":~s,\"Close\":~s,\"Volume\":~s,\"Adj. Close\":~s}", Line),****
>
> 10     Command = io_lib:format("curl -X PUT http://127.0.0.1:8098/riak
> /goog/~s -d '~s' -H 'content-type: application/json'", [hd(Line),JS    ON]),
> ****
>
> 11     io:format("Inserting: ~s~n", [hd(Line)]),****
>
> 12     os:cmd(Command).****
>
> this is my load_data.erl...i have placed goog.csv and load_data.erl onto
> /home/hadoop/erlangdwnloadamazon/otp_src_R14B03/bin ...and trying to run
> the same on erl shell,c(load_data).on erlang shell ..struck up with teh
> following error****
>
> ** **
>
> Eshell V5.8.4  (abort with ^G)****
>
> 1> c(load_data).****
>
> ./load_data.erl:1: syntax error before: '#'****
>
> ./load_data.erl:8: no module definition****
>
> ./load_data.erl:8: Warning: function format_and_insert/1 is unused****
>
> error****
>
> 2> halt().****
>
> ** **
>
> ** **
>
> ** **
>
> Thanks & regards****
>
> sangeetha****
>
> ** **
>
> This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful.
>
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20120420/78a4968b/attachment.html>


More information about the riak-users mailing list