Dreamhost and RPC
|
Archaegeo Platini
Ancient Earth University
Join date: 12 Aug 2004
Posts: 152
|
10-28-2004 19:38
So im on Dreamhost now, and im a pretty good coder once I have an example to go by.
Could someone post a sweet and short example (someone who uses dreamhost and its systems) of dreamhost talking to SL and vice versa vix XML-RPC?
/usr/bin/python is the python path on my host machine, and its 2.1.3 if it matters. ive tried cutting and pasting a couple of the sample python XML scripts at the wiki, but it doesnt find the xmlrpc or xmlrpclib
Thanks much for any help for an old man.
_____________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dean Archaegeo Platini Ancient Earth University Courses for the Second Life secondlife://Sedig/211/46=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
Alondria LeFay
Registered User
Join date: 2 May 2003
Posts: 725
|
10-28-2004 22:14
I am on Dreamhost, however my implementation utilizes Perl. If your not set on Python, let me know and I can help you set something up.
|
Archaegeo Platini
Ancient Earth University
Join date: 12 Aug 2004
Posts: 152
|
10-28-2004 22:38
A perl example would be great too, im pretty language flexible when it comes to code. And i could always redo the dreamhost end, but i love to see just an example with howto type instructions for setting up on linux to server to SL.
Im sure other would as well, you could probably make it a mini tutorial, doesnt have to be a complicated full blown db, just passing one line back and forth wourld work.
_____________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dean Archaegeo Platini Ancient Earth University Courses for the Second Life secondlife://Sedig/211/46=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
|
10-29-2004 08:17
I'd prefer a C or C++ example myself. Just haven't gotten around to hunting one up yet.
_____________________
~ Tiger Crossing ~ (Nonsanity)
|
Archaegeo Platini
Ancient Earth University
Join date: 12 Aug 2004
Posts: 152
|
10-29-2004 08:19
ive seen examples of XML-RPC and SL, but what im more looking for is a concrete example from logging in to getting interaction, specifically with Dreamhost.
If necessary i can figure it out eventually, but thats why we have forums, so we can help each other avoid reinventing the wheel when necessary
_____________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dean Archaegeo Platini Ancient Earth University Courses for the Second Life secondlife://Sedig/211/46=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
10-29-2004 08:52
I heard a rumour that there are examples in the Wiki.
Azelda
|
Archaegeo Platini
Ancient Earth University
Join date: 12 Aug 2004
Posts: 152
|
10-29-2004 09:00
the wiki examples are just that, examples, but not a full fledged tutorial. they assume alot of preexistinig knowledge, and for someone who just wants to transfer some data, might not be enough
Again, not looking for examples, the wiki does have those, would like a very specific example
From login in unix shell to communicating between the two. Preferably with dreamhost.com
_____________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dean Archaegeo Platini Ancient Earth University Courses for the Second Life secondlife://Sedig/211/46=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
Francis Chung
This sentence no verb.
Join date: 22 Sep 2003
Posts: 918
|
10-29-2004 10:12
One silver platter, coming up  #!/home/xmlrpc/software/python/python ##!/usr/bin/python
from xmlrpclib import ServerProxy; import sys;
def llRemoteData(Channel, Int, String): client = ServerProxy("http://xmlrpc.secondlife.com/cgi-bin/xmlrpc.cgi"); return client.llRemoteData({"Channel" : Channel, "IntValue" : Int, "StringValue" : String});
reply = llRemoteData("74c5ce6d-11f3-dbb0-443f-c31b1bca72d2", 0, "Hello from " + sys.platform + "." );
for name, value in reply.iteritems(): print name, value;
Two notes: 1) You need Python v 2.3 to run this example properly. Dreamhost only provides Python v.2.1. 2) If you happen to be on marvin.dreamhost.com, I've got a copy of python 2.3.4 on /home/xmlrpc/software/python. You can make a copy into your own directory. Azelda also has a copy of python he/she/it is offering up as a public service somewhere. This script adapted/copied from something I found on the wiki. I'd post the link if the wiki was alive.
_____________________
-- ~If you lived here, you would be home by now~
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
10-29-2004 10:29
> he/she/it People in glass houses 
|
Archaegeo Platini
Ancient Earth University
Join date: 12 Aug 2004
Posts: 152
|
10-29-2004 10:32
Francis,
I tried a couple of the wiki examples, but it kept not finding xmlrpclib. Is that something that comes with 2.3? Or do i need to install that seperately?
Im on qbert, so no access to he great /home/hugh directory everyone is always talking about i suspose.
_____________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dean Archaegeo Platini Ancient Earth University Courses for the Second Life secondlife://Sedig/211/46=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
10-29-2004 10:40
You might try asking support to modify the mount tables to give you access to /home/hughperkins, which is on halston. Their support is very good; theres a very good chance theyll accede.
Azelda
|
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
|
10-30-2004 18:05
Something you might want to try on your command line is to see if that python is actually in your path. The EASY way to do that is to use the command:
which python
or to see if you have a path to PERL try this:
which perl
if they are not found, your path will be shown to you and say that they are not found in bla.
Next, if you want to see if it exists on your server try this:
find / -name perl 2>/dev/null
Now, what that does is uses the "find" command to search through the files beginning at the root "/" looking for the "-name" "perl". IF there are places you do not have access to, you will get errors. Standard error, designated by the 2 in: "2>/dev/null" will be redirected to the bit bucket as designated by ">/dev/null"
The important thing about this method for looking is that if you ARE able to use this perl or whatever you are looking for in the "find", you can ONLY use it if you can see it. You do NOT want to know about places you are not allowed to look. And since those files will probably be many, you only want the good news. Tell me what I CAN see, and throw away the rest. If you do not see anything, the next prompt will return and then you will need to ask the admin if it is there.
You can also try doing a "man perl" to see if it is properly loaded. Again, the MANPATH may also be needed to be updated... but that's a little different story. =)
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
|
Archaegeo Platini
Ancient Earth University
Join date: 12 Aug 2004
Posts: 152
|
10-31-2004 01:31
i finally got it working, but i had to install python 2.3.4 in my home dir since Dreamhost told me they dont do symbolic links across volumes and theyhave no plans to update current 2.1.3 thats in /usr/bin
thanks for the help though
_____________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dean Archaegeo Platini Ancient Earth University Courses for the Second Life secondlife://Sedig/211/46=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
10-31-2004 20:33
Hmmm, ok. Someone Unixy want to expand on that? The way I see it they have one single NAS with maybe 40 Unix Sharepoints. You can access these as long as you have them listed in the mount table. Most machines have about 20 listed, but lack the other 20. As far as I can tell they just need to add the appropriate share to the mount table?
Azelda
|
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
|
11-01-2004 07:43
Azelda, hi, UNIXLY (to hop on your word creating bandwagon) speaking, I believe the problem with the "links across volume borders" probably has something to do with their NFS mounting. Generally that can be problematic/not reliable. I'm not sure if they are using NFS (Network File System, some also call it Nightmare File System) or not, there are other file shareing apps out there... but NFS though designed to look like a true local filesystem is not, and there may also be some issues that NIS (Sun's YellowPages) or Network Information Systems throws some strangenesses and security issues in as well. Regardless of the issues with the sym-links, I think they should at LEAST put a copy on their local server, and let you all make a sym-link to that local version. Then they can add that ad boast of having Python's latest version. That's the only thing that makes sense. It certainly is not reliable to link to someone elses directory. You never know (disclaimer to all people we know/love/trust/have warm fuzzies for etc) who may do something nasty to you, like changing the link, trying to put a troajan horse in there. (again, sorry but the security nut in me just screams out NOT to do that kind of a link) Having said all that, it's probably ok to do if you really trust someone, just so you are aware of the potential security hole. 
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
|
Archaegeo Platini
Ancient Earth University
Join date: 12 Aug 2004
Posts: 152
|
11-01-2004 08:01
Nod, they probably dont do SYM links for that reason, security, or lack thereof, of making one users dir publicly sharable.
So i installed it on my home dir and it works, not the cleanest way to go, but till they upgrade from 2.1.3 to 2.3.4 its whats needed for RPC
_____________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dean Archaegeo Platini Ancient Earth University Courses for the Second Life secondlife://Sedig/211/46=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
11-01-2004 10:52
Well, the thing is the shares are NFS mounts all on the same central NAS, and /home just contains some sort of (hard? soft?) links to directories in these mounts anyway. Whilst we are each on different shell servers, the files are all stored on the same NAS, albeit in different NFS points of it.
There's no direct correlation between shell server and mountpoint name: its just a mix and match, ie two people on the same shell server could have different home directory mountpoints. However, each shellserver only gets maybe half of the mountpoints in its mount table.
Azelda
|
Nekokami Dragonfly
猫神
Join date: 29 Aug 2004
Posts: 638
|
01-25-2005 11:02
From: Alondria LeFay I am on Dreamhost, however my implementation utilizes Perl. If your not set on Python, let me know and I can help you set something up. Could you possibly post your Perl example (or whatever parts of it you think would be helpful that you'd like to share)? I'm planning to use Perl for a project bringing in external data to manipulate an object. I have another server, but I'd switch to Dreamhost based on your recommendation in another thread -- seems like a good place to work this from. Thanks, neko
|
Alondria LeFay
Registered User
Join date: 2 May 2003
Posts: 725
|
01-25-2005 18:25
Here is the main routine I use to send/recieve data via RPC: #!/usr/bin/perl # XML-RPC Secondlife Perl Uber-easy Wrapper Module
require RPC::XML; require RPC::XML::Client;
# SUB: sendrpc($key_to_send_to, $integer_val, @string_value) # RETURNS: Response, if any. sub sendrpc($$@) { my ($key, $ival, @svals) = @_; my $sval = "@svals"; my $client = RPC::XML::Client->new('http://xmlrpc.secondlife.com:80/cgi-bin/xmlrpc.cgi'); my $request = RPC::XML::request->new('llRemoteData', RPC::XML::struct->new( 'Channel' => RPC::XML::string->new($key), 'IntValue' => RPC::XML::int->new($ival), 'StringValue' => RPC::XML::string->new($sval) ) ); my $response = $client->simple_request($request); if ($response) { return $response; } }
1;
I created a custom lib directory to store my common use routines. For example, to utilize this function in another program, add this lines to the top part of the program (assuming your lib path is /home/[name]/lib): unshift (@INC, "/home/loginname/lib"); require ("slrpclib.pl");
To use the function, it is a simple matter of: my $response = sendrpc("f3f1e555-a4b7-357b-3815-847a78340c8f",100,"This is a test");
Hope that helps. 
|
Nekokami Dragonfly
猫神
Join date: 29 Aug 2004
Posts: 638
|
01-25-2005 19:40
Thanks!!
neko
|