May 18, 2009 at 2:31 am
· Filed under Google App Engine ·Tagged gae, Datastore, External, models, model
Problem:
I was tired of having all of my data models for my project in the same doc as the rest of my functional code. I wanted to move it all to a models.py file.
Resolution:
Simply create a new file and then copy/paste the datamodels into it. Remember to include the import for the google app engine data model library.
Models.py
from google.appengine.ext import db
class Thing(db.Model):
Text = db.StringProperty(multiline=True)
Author = db.UserProperty()
Created = db.DateProperty()
Ratings = db.ListProperty(db.Rating)
Tags = db.ListProperty(db.Category)
…
worker.py
from models import *
Further, I thought it would be sweet to actually have my models in a separate folder under my project. This fits my C# based view of the world and how i was brought up declaring classes in their own document. So New Problem.
Same as original but in a sub folder.
I found a great stackoverflow.com question/answer for this. At http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
Briefly, It says to use do the same as above with the models but with 2 additional pieces.
First, create the folder and create a new file __init__.py. This file can remain empty but will tell python that this folder is essentially and external package and that the name should be treated similarly to a name space.
Second, Update the import statement in worker.py to
from datamodels.models import *
This works like a charm. Thanks to the stack overflow guys that worked this out. follow the link and up the question/answer pair if you found this article useful.
Thanks,
John.
Permalink
May 18, 2009 at 1:57 am
· Filed under Google App Engine ·Tagged Google App Engine, gae, Google, Babble
I’m getting rolling on my first real Google App Engine Project and I figured I’d start this log to keep the things i learned while working on the project. If nothing else, I’ll be able to look back to this and remember some of the stuff i learned, assuming I keep up with blogging about the neat stuff i find or the problems I encounter and eventually solve.
If this blog helps anyone working in GAE, then I’m satisfied. If its just me babbling to myself, well I’m not sure why i was typing. I could just sit in a corner and go crazy…
More real posts to come.
John.
Permalink
January 22, 2009 at 5:47 pm
· Filed under SecondLife ·Tagged Awesomeness, Chat App, Gestures, Problem Solving, Second Life, SL
Gestures are Awesome.
I am working on a chat app like many other apps in SL and was having the issue of user’s using wrong channel to comm with me. So a friend did a little search and found one of those JRA posts requesting a feature that lets you set the channel you are chatting on and let it remain between requests. In the posted responses, one inventive chap posted that making a simple Gesture like /? and hooking it to the channel you chat (/1234) on works nicely. (https://jira.secondlife.com/browse/VWR-1330)
1 drawback i’ve found is found in all of Second Life material, once its out you can’t update them easily. So before I’m going to implement the gesture for real, I need to make my channel nearly hardcoded. (unless i can put some code in a gesture that lets it read a notecard or something, but i doubt it.) This is mega rambly at this point, but If you come across a similar problem, Gestures may save the day.
John – Giggy Karu
Permalink
January 2, 2009 at 4:28 pm
· Filed under SecondLife ·Tagged SecondLife, Second Life, LSL, Garbage Collection, heap memory issue
I’ve done a little experimenting with my dev code and i’m realizing that once a list is populated, the space is never cleared. It appears to reuse the space but it never frees it back to the script for use somewhere else. There does seem to be some long standing existence growth that kinda sucks too.
Has anyone figured out how to shrink lists after they aren’t needed back to null?
Read the rest of this entry »
Permalink
November 11, 2008 at 4:02 pm
· Filed under SecondLife ·Tagged Second Life, SL, Wiki fight
I was checking out the wiki at lslwiki.net and while reading the page for the llHTTPRequest and ran into a funny paragraph that reminded me of the PA Annoucements in Airplane.
"body specifies the body of the HTTP request and is only used when HTTP_METHOD is POST or PUT. The body is only limited to the amount of available free memory in the script (before the script has a stack/heap collision.) (As of 10/29/06 this seems to be limited to 2048 characters, and cuts off anything further – Seifert) (As of 22/08/07 this is no longer limited to 2048 characters. I was able to pass over 4096 characters with no cutoffs. – Zachary Carter)(AS of 20dec07 i can not have more than 2048 chars.. and HTTP_BODY_MAXLENGTH returns nothing, so how you did more Zachary ? – pierrehenri Beaumont) (March 19, 2008 [Server 1.19.1.81992 / Client 1.19.0 (5)]: I am able to send 14970 characters, ran out of memory when trying any higher. So it is limited to available memory as of this time. – Cory Fimicoloud) (November 5, 2008: Nope, tested and still limited to 2048. — Siann Beck)
11/11/08: I strongly suspect that one half of you above are talking about the 2k limit on the http response, and the other half are talking about the memory only limit on the http request+body, am I right? – DeFarge” (originally post at http://lslwiki.net/lslwiki/wakka.php?wakka=llHTTPRequest)
Thought it was amusing.
Giggy
Permalink
August 21, 2008 at 7:28 am
· Filed under SecondLife ·Tagged Blender, chat bots, ChatBots, Linden Scripting Language, LSL, LSLEditor, Second Life, SecondLife
Hi Again, I’m just a posting fool tonight. Don’t worry I’ll probably peter out soon and get some sleep. This time I’d like to give you some pointers (memory speaking) to tools that made working in Second Life easier in one case and completely frustrating but cool in another.
First, the uplifting tool….
LSLEditor -If you have ever done any real programming in your life, you know about 2 seconds into scripting directly in SL that this isn’t any kind of IDE for building code. I had more fun back when I used VI on an old AIX box we did our COBOL on /*side note, I’m not actually old enough to have “worked” in COBOL, I just took 2 semesters in it during my undergrad years*/. Your ability in SL to completely screw yourself over with the built in scripting tool is amazing. I finally found this little baby doing some searching on the wikis. Between this and using a little subversion source control, I felt like i was really programming.
Key Features for me:
- freakin auto-complete – including method parameters.
- Syntax highlighting
- Actually being able to run the code and Debug
- you don’t have to have SL running (standing around slumped over while coding is annoying.
Its got some minor eccentricities… but so does Visual Studio. Definitely if you are used to VS I’d try this little gem out and see what you think.
-*/-*/-*/-*/-*/
The bain of my Existence –
BLENDER – Blender has me as excited as a virgin on prom night, but just like that virgin, when i get my hands on it, i barely know what to do with it. I get the whole 3d modeling thing is tricky bit. and I’ve trialled a few of blenders relatives, and blender is very easy to use. I guess the real problem is, I’m an make it do stuff programmer and not a make it pretty programmer. writting the code to do the Communication with our technologies outside SL and all that was easy. Making the model of the object we’d use was tricky. (and to be honest i did just use the built in tools for that work) My models fall into 2 categories: Happy Accidents (ala Bob Ross), or relatively simple. I’ve got a wacom tablet, pen, and blender. Now all I need are a few thousand hours of practice and experimenting and a transfusion of artistic skill… oh well, its still a great tool and once I get it figured out, I’ll pass on those tips and tricks as well.
CU in SL.
- John – Giggy Karu in Second Life
Permalink
August 21, 2008 at 7:01 am
· Filed under SecondLife ·Tagged SecondLife, Second Life, ChatBots, chat bots, LSL, Linden Scripting Language
Sofar, I’ve bought 1 book and have done lots of wiki Trolling.
2 Good Wiki’s
http://wiki.secondlife.com/wiki/LSL_Portal – This is the official SL Wiki for the LSL language. It also has some decent modeling help and a lot of tutorial and sample code.
http://lslwiki.net – This one has alot of overlapping information as the official one, but some interesting QA style how to’s. Definitely worth a look.
1 ok at best book.
“Creating your World:The official guide to advanced content creation for Second Life(r)” published by Wiley Publishing, Inc. – This book, as do the other Official books of second life, has high production values and shiny pages with pretty pictures but really lacks the depth of knowledge I have come to expect when buying a book on programming langauge/techniques. LSL isn’t the greatest language but i was hoping it would be documented like a good C# book from an O’Reily or even Microsoft Press… It goes through in about ~230 pages what you learn within an hour of playing and wiki reading. I would pass on this book if i were you, but if your interested in a slightly used copy… leave a comment and we can talk…
For the rest of my reference materials, its good old google and posts similar to ones i intent to plop on the WWW eventually.
- John – Giggy Karu in Second Life
Permalink
August 21, 2008 at 6:44 am
· Filed under SecondLife ·Tagged SecondLife, Second Life, ChatBots, chat bots, LSL, Linden Scripting Language
So. For the last few weeks, I’ve been experimenting with getting the Company @#$%@#$% I work for’s technology applied in Second Life. We started by aiming for our big Enterprise level application, %^&*# and $&$%^&. (Branding soon to change, so don’t fall in love with the names). Once I got these working, i took a little time and did some scripting to allow our #$%^#^#, consumer level application, to work in second life as well.
This blog will be tips and tricks on modeling and scripting in SL and a little shameless plugging for our Products in SL. More To Come.
- John – Giggy Karu in Second Life
Permalink
August 21, 2008 at 12:50 am
· Filed under SecondLife ·Tagged Land, Second Life, SecondLife
Hi, This post is more aimed at getting hints/tips than giving. I’m starting to look for a nice little parcel of land I can set up a little vending/shop space on. something < 512 square meters and not too expensive. I’m looking to set up a free vending machine that kicks out objects containing the code to hook a users $%^&^ to an object in SL. I’m starting my scan now, but i find alot of crappy spam lands pop to the top of my searches.
- John – Giggy Karu in SL – Slurl to the parcel i buy…
Permalink
Older Posts »