Author Topic: dood's scripts and stuff  (Read 796 times)

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
dood's scripts and stuff
« Reply #15 on: June 21, 2012, 04:31:09 pm »


               

Rolo Kipp wrote...


Does the Google Map API allow you to start with a very high resolution image and serve it out in bandwidth-friendly sections? I know their satellite images are handled this way, but can you do this with custom images? If it does, then that is the functionality I was looking for in Zoomify.


yeah, that's how google does it, too.  their API is the same for the satellite images and for custom images.  actually, i had to mangle the API a bit to make it work how i wanted for my images, but it does the same high res image -> cut into little pieces -> serve only those out that are needed thing.

Oh, yes! Or let players tag the map with screenshots from their explorations :-)


that functionality is already 90% there.  those little bubble baloons you see when you click on a blue maker can support images, videos, whatever.  it's basically its own little html iframe.  i would just have to implement the functionality and give them a "file upload" box.  then likely help them format the entry or something.

heck, they could have a tiny little wordpress page they could edit and then upload into there.  that might be the friendliest way to do it.  the easiest of course would be to only let them upload a .png with a caption.
               
               

               


                     Modifié par acomputerdood, 21 juin 2012 - 03:33 .
                     
                  


            

Legacy_WebShaman

  • Hero Member
  • *****
  • Posts: 1390
  • Karma: +0/-0
dood's scripts and stuff
« Reply #16 on: June 22, 2012, 01:12:50 am »


               What an awesome feature for any PW!

Thanks for this!
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
dood's scripts and stuff
« Reply #17 on: June 22, 2012, 01:52:40 pm »


               

acomputerdood wrote...

i realized i was polling the db every second to grab messages, and thought they would quickly get annoyed with me for hitting their translation page that often.  so i abandoned that effort.


i tried again and was just not getting the Babelfish perl module to work, so i tried to use WebServices::Google::Language.  that one errored out telling me to use version 2 of their translation services.  when i looked that one up, they wanted you to buy an API key from them.

so i'd say that the translation efforts on my end are done.  '<img'>


if somebody has another client (IRC or whatever) that can take advantage of a mysql db for chatting, then by all means pick up the project.
               
               

               
            

Legacy_Carcerian

  • Hero Member
  • *****
  • Posts: 1655
  • Karma: +0/-0
dood's scripts and stuff
« Reply #18 on: June 22, 2012, 02:09:19 pm »


               

acomputerdood wrote...

acomputerdood wrote...

i realized i was polling the db every second to grab messages, and thought they would quickly get annoyed with me for hitting their translation page that often.  so i abandoned that effort.


i tried again and was just not getting the Babelfish perl module to work, so i tried to use WebServices::Google::Language.  that one errored out telling me to use version 2 of their translation services.  when i looked that one up, they wanted you to buy an API key from them.

so i'd say that the translation efforts on my end are done.  '<img'>


if somebody has another client (IRC or whatever) that can take advantage of a mysql db for chatting, then by all means pick up the project.


Thx for trying '<img'>
               
               

               


                     Modifié par Carcerian, 22 juin 2012 - 01:10 .
                     
                  


            

Legacy_nwnsmith

  • Full Member
  • ***
  • Posts: 125
  • Karma: +0/-0
dood's scripts and stuff
« Reply #19 on: June 24, 2012, 01:34:23 am »


               Hey Dood, any chance of an adjusted player tracker for when your website is hosted on a different machine than your nwnx ?
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
dood's scripts and stuff
« Reply #20 on: June 24, 2012, 03:39:16 am »


               

nwnsmith wrote...

Hey Dood, any chance of an adjusted player tracker for when your website is hosted on a different machine than your nwnx ?


that's easy!  all you have to do is change the "$host" line in the cgi/perl file:

$db = "dalakora";
$host = "localhost";
$userid = "user_id";
$passwd = "user_pass";
$connectionInfo="dbi:mysql:$db;$host";


to properly reflect the location of the mysql database.  specifically, instead of "localhost" you'll have "my_nwnx_server_db_host.com" or whatever the IP/DNS name is.
               
               

               


                     Modifié par acomputerdood, 24 juin 2012 - 02:39 .
                     
                  


            

Legacy_lordofworms

  • Sr. Member
  • ****
  • Posts: 422
  • Karma: +0/-0
dood's scripts and stuff
« Reply #21 on: June 24, 2012, 03:37:34 pm »


               does the story submit portion work with sqlite?
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
dood's scripts and stuff
« Reply #22 on: June 24, 2012, 05:34:39 pm »


               @acomputerdood - I love your stuff!  '<img'>  Very innovative ideas.

@AnyoneAndEveryone - Hey, if anyone is still interested in playing around with real-time translation, I wanted to drop a few links and ideas which might be useful.  Years ago I wanted a way to mass translate TLK files into different languages and the programs which did the closest job were used for automatically translating .SRT, simple text files which contain timing information and subtitle text for movies or TV.  Now, there is a huge community of people who use these SRT files so there are always going to be bleeding-edge development to find new ways to get that text translated- and at least a few of those projects are open source.

Ok, so that's sort of the cornerstone of this idea.  The "in", hopefully.  While Google changed their Terms of Use for their translator, Microsoft Bing has their own translator (Terms of Use) and so some of the SRT translation projects have had to adjust.  One project which I had used in the past hasn't updated to use the Bing API, but the developer pointed to a Java wrapper for the Bing API which used Google API handles, IIRC.

And the reason I'm going the sort of circuitous route of suggesting this Java wrapper might be useful is that someone had tipped me off that MNXJ by MFX (SourceForge) could perform asychnronous activities by using a thread daemon- which would be a nice way to keep everything from getting locked up while waiting for a response from something like a translation service.

So, if anyone's still reading the idea is:
1. Rip code and techniques from SRT translation community, which is constantly updated as the situation changes
2. Use a Java wrapper for the API and something like MNXJ so the requests for real-time translation don't bog the server down during translation transactions which take any length of time to complete.

The actual mechanics of how that would be dealt with on the NWN side are sort of dealer's choice.  Whether the chat data would be stored in a db, dealt with and then shown to users when a successful translation came back for that line...or whether it would blindly send the threads out to the Java wrapper/plugin and just spam back what it received, as soon as it received it, are a matter of choice.

Aside from the translation of TLK files, I always liked the idea of something that would bring the international community a bit closer to the English-speaking one, at least on multiplayer servers.  I did proof of concept tests long ago which showed that mass translation of .TLK was possible with something like SRT translation programs but I don't have the skills (I'm not a programmer) to hook up the pieces of my idea about real-time translation to see if that would work.

I, uh, also realize this is no small amount of work.  But I've seen this idea floating around in various forms from various corners of the community and wanted to make a pitch at a solution I thought could work...and maybe someone would give it a try sometime.
               
               

               


                     Modifié par OldTimeRadio, 24 juin 2012 - 04:41 .
                     
                  


            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
dood's scripts and stuff
« Reply #23 on: June 24, 2012, 06:27:33 pm »


               

lordofworms wrote...

does the story submit portion work with sqlite?


i'm only somewhat familiar with sqlite, but i assume it should be reasonably compatible with my code.

if your nwnx and database are set up and working already, i assume all you'll need to do is check the syntax of my mysql statements to make sure they work.


i guess the tricky part would be finding a perl module that worked with sqlite for the web end.  i'd start with this one:

http://search.cpan.o...b/DBD/SQLite.pm 

and use my code and google as a template/guide to get yours up and running.
               
               

               


                     Modifié par acomputerdood, 24 juin 2012 - 05:33 .
                     
                  


            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
dood's scripts and stuff
« Reply #24 on: June 25, 2012, 11:32:51 am »


               it seems i just can't drop a project.....

good ideas OTR, but i (stubbornly) kept at my old chat/translation system, and figured it out.  i learned how to get microsoft/bing to do my translations using curl, so i can submit the string to be translated via curl and parse the results coming back.

i still have quite a bit of work to do to clean things up, but the main problem is that i'm sure i'm still breaking their TOS by using the script.  furthermore, the code pulls 10 text lines from the db every second, and right now queries for 10 translations.  that's pretty unacceptable.

i'll have to add in some intelligence to "remember" the previous translations, and of course recognize that it doesn't have to translate from english to english or whatever.  it's very likely that one off applications like this will slip under the radar.

it is, of course, nothing i can't handle '<img'>
               
               

               


                     Modifié par acomputerdood, 26 juin 2012 - 11:33 .
                     
                  


            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
dood's scripts and stuff
« Reply #25 on: June 26, 2012, 12:32:20 pm »


               

acomputerdood wrote...

it is, of course, nothing i can't handle '<img'>


it's 99% done.

in the login (chat.cgi) script, you set the language of your nwnserver and database.  this will be the language all submitted messages will be translated to, and all displayed messages will be transmitted from.

then, when a player loads the chat page, he selects the language he wants to chat in (only a couple exist now for development).  then, all messages typed by that web user will be assumed to be in his chosen language and translated into whatever language the nwnserver/mysql db is set to.  then, when the messages are displayed back to the web user, they are translated back into his chosen language.

for example, if your db is set to english, and the web user chooses spanish, then if he types "muy bien" into the web client, the page will translate it to "very well" and insert it into the db (and display it to nwn players).  then, the webpage pulls the chat entry "very well" from the db and translates it back to "muy bien" for the web user (and "tres bien" for other web users who selected french).

to cut down on the number of translation transactions the webserver is doing, i'm using a client-side cookie to store the web user's previous translations.  so only new messages are translated and then stored with the client.  it's not the most elegant solution, but it wasn't feasible to save all of that in javascript GET strings.


so, what did i mean by 99% done?  well, the bing translator's API key seems to expire each day, so i need to figure out a way to automatically pull it down.

conversely, you could sign up as a developer with a microsoft live account and get your own API key for the service.  the page says you get 2,000,000 characters translated per month for free.  it seems like a lot but i have no idea how that would scale out.  i've not read the TOS, so i don't know if my webchat would be in violation or not.

so sorry i don't have a demo to show you guys (or haven't released my code yet!).  until i can automatically grab whatever api key the web server uses (i'm not likely going to get my own), the demo won't be worth showing.

you'll just all have to trust me that it works!  haha
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
dood's scripts and stuff
« Reply #26 on: June 26, 2012, 10:22:03 pm »


               I think it's cool you decided to take another crack at it, ACD.  In reading your response, I wasn't sure if by "web client" you really meant a client at a web page or if you were simulating the transaction with curl. I just played around with going through curl using some instructions from here, signing up with Microsoft for the free key and so on.  The signing up for the key seems simple enough (and I'd imagine 2M characters a month is plenty for most servers), but I couldn't pull of grabbing the "temporal access token" he describes in Step 3 and so couldn't really continue.

Man, a lot has changed since the last time I played around with this kind of thing.  A lot more than I would have expected.  ':crying:'

While this is a less sexy solution, there's always the possibility of moving away from proprietary APIs like Google and Microsoft, and looking at approaches which involve a local dictionary server using open source software/data.  Two that seem somewhat promising are Apertium and Moses, which looks a little more mature.  I have no experience running either of those beyond their demo translation web pages. 
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
dood's scripts and stuff
« Reply #27 on: June 27, 2012, 12:50:05 am »


               OTR - yeah, by "web client" i meant my little cgi thing i wrote for my webpage.  i tend to mix terms a little bit.  so to clarify a bit, the cgi stuff is run on the server end, so the server was using curl to access bing's translation API to translate the text before sending it to the webpage of the user.

i may be inspired to take the extra tiny step and get myself an API key as well.  perhaps i can get it working.  so far i've just been using wireshark and chrome, so we'll see what i can do with that.  or maybe if i had some actual instructions '<img'>


and yes, i spent some time looking for offline free translators, but all i came up with would only translate single words.  i didn't see any that did phrases like the online ones did.

i (quickly) looked at apertium, and it was very limited in the languages it would translate.  moses seems a bit more promising, but i'll have to look at that more.
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
dood's scripts and stuff
« Reply #28 on: June 27, 2012, 05:35:24 pm »


               i got application key and figured out their API.  the page of instructions OTR posted had a command that was out of date but i was able to figure out the correct one.

you guys can try out the new webchat translator.

for as long as my 2 million characters holds out each month.

i guess it's good enough to update my vault entry.
               
               

               


                     Modifié par acomputerdood, 27 juin 2012 - 04:36 .
                     
                  


            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
dood's scripts and stuff
« Reply #29 on: June 27, 2012, 05:59:00 pm »


               Dood, you are amazing!  This is awesome!
'Image