Wednesday, July 13, 2011

Littlefield Data Aggregator Scripts / How to Win Littlefield

I wrote some scripts to aggregate littlefield data onto one screen. It's written in python, meant to have mod_python run it as a web page, for your entire team to log in and get the information. This way, only one person (the techy guy) needs to have to host and run the python code.

Here is the link:
http://aml.cs.byu.edu/~davidw/littlefield.py

Sunday, March 29, 2009

making a java application for the approval client

I will put here a link to a tar to the packages and source files that I found and am using to get the Approval Client running.

here's a link to the source and lib files that i'm using:

http://students.cs.byu.edu/~davidw/commons-codec-1.2.zip

In there, just link the .jar files in your project that you're using and make sure that you put the com and org files in the src directory.

The interface is a bit different than what I'm used to with boto. The AmazonSQS interface and the AmazonSQSClient classes are both classes that I used to communicate with sqs.

Sunday, February 15, 2009

programming the app server

I wish I had done this earlier. While doing the app server, I had to change where my web server was posting to. I would go into my code and just change the url in all of the six or so places every time I needed to change where it was posting to. I decided later that in my user-data script, I would create a python file that would basically return the app server url that the other files in the web server could call to get the url. I wish I had done this earlier rather than later.

Saturday, February 7, 2009

simpledb queries

here's a helpful page on how to do simpledb queries the right way.

http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide/index.html?UsingQuerySampleDataset.html

Thursday, February 5, 2009

some lab 3 stuff

OK.

Lab 3 is not documented very well. I'll try to correct some things here:

in forming your json, on the appserver page, it has SINGLE QUOTES around the keys in the json. in using simplejson, this is not correct. simplejson will not interpret it correctly if they're not DOUBLE QUOTES.

here are a line on how to get things from s3:
sdb = boto.connect_sdb(KEY, SECRET KEY)
imageDomain = sdb.get_domain('picture')

items = sdb.query('picture', "['ratesort' < '" + nextratesort + "'] sort 'ratesort' desc", 11)
for key in items:
item = imageDomain.get_item(key)

what the query returns back seems to be a list of the keys into the domain. you can use these keys to get individual items out as i've done above.

Edit: I'm not sure exactly which ones of the values of the json need to have quotes around them, but i got a few errors because at least a few didn't have quotes, so I put quotes around all of mine to avoid the error.

Wednesday, February 4, 2009

A couple of things about project three

I know that one of the domains to access simpledb is "pictures" (case matters).

Here's some code that

sdb = boto.connect_sdb(ACCESS KEY, SECRET ACCESS KEY) # these keys may or may not be necessary... i saw some examples iwth them and some without them.
imageDomain = sdb.get_domain('picture')

with this, you can loop over all the keys in the domain and get information out.

Tuesday, February 3, 2009

fix to the load balancer registration

I found out that my ami had to register itself automatically with the load balancer.

Basically, I found a web site that would tell me my public ip address, did a curl -s on this web site to get the response back, pipe that into grep and save that to a file. i do the same thing with ifconfig (the first the that comes back should be the private ip of the ami). i load these as strings into my program and do a wget on the address to register with the load balancer. my lines in my program look something like this:

os.system("curl -s http://www.ipaddress.org | egrep -m1 -o \'[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\' > /tmp/publicip.out")

then i load in the first line of /tmp/publicip.out into a variable in the program, concat that onto the end of a string and wget the loadbalancer url with that.