Monday, April 13, 2009

Lab 6 Notes

I used ruby/gtk/glade for project 6. I was surprised how easy it is to use Glade (especially version 3) to design GUIs for Linux.

One of the hardest things I ran into was trying to figure our how to get images to show up in gtk. It ended up not being too complicated, I had to do something like gtk_image.buffer = Pixbuff.new().

I'm surprised that lab 5 started working, because I was not able to access the images I uploaded before, but I guess it's working now. Not sure why.

Wednesday, April 8, 2009

RE: appserver image submission

Artan,

I tried to comment on your blog, but I can't seem to get the comment submit screen to show up.
To generate a GUID, I just found a library for my language (ruby-guid). This wikipedia article talks about what GUIDs are and how they can be generated. Just from glancing at the page, however, it seems that using a library would be much easier than trying to do it myself. What language are you using?

Monday, March 23, 2009

X Forwarding with Fedora image

At first I couldn't figure out how to see X programs from the Fedora image on my local box. I installed the packages needed for xclock and ran ssh with the -X flag (and the -i flag for my identity file), but no luck. I found forum post suggesting using the -v flag. When I did that I saw debug output about xauth not being installed. I searched on that and found a useful post on an IBM forum. It turns out all I have to do is install xauth, and X seems to be forwarded properly.

I am considering using ruby-gtk2 for the next project. It's not installed on the CS lab computers I've tried so I thought I could use an image on EC2. Maybe that's a waste of resources, but it's nice to have that option. Haven't tried out the ruby-gtk2 yet, but I'll post on how it works.

Wednesday, March 18, 2009

RMagick and ImageMagick or GraphicsMagick

I decided to use ImageMagick, rather than GraphicsMagick. It seems the newest version of RMagick has a helpful convenience method that seems to make the thumbnails trivial. When using RMagick 1, that method didn't seem to exist. To use RMagick 2, however, I need to be using a recent version of ImageMagick, rather than GraphicsMagick. Good thing Ubuntu is so good at handling all the dependencies. I reckon Fedora will be as well.

It's pretty sweet that these tools can actually change these photos. Hopefully the watermark won't be too bad.

Tuesday, March 17, 2009

Installing RMagick with gems

Getting the RMagick ruby gem to install wasn't too bad. Ubuntu has an RMagick package in the apt repository, but I installed a newer version of gems a while ago, and have kind of gone down the road of installing most ruby libraries as gems rather than with the Ubuntu package manager (although that probably would have worked as well).

To get it set up, I just had to install the libgraphicsmanager1-dev package and let apt install it's dependencies. Then I used gem to install rmagick. The default "gem install rmagick" seems to look for ImageMagick, rather than GraphicsMagick, but a little searching led me to this page on the RMagick website, which says how to install the correct gem for GraphicsMagick. You just have to tell gem to install version 1.15.nn, where nn is part of some sort of version number, which, as of this writing, seems to be 1.15.17 (See this RubyForge page and follow the download link to see the newest version).

I haven't actually tried RMagick yet, but at least the gem installs without failing, so hopefully it shouldn't be too hard to reproduce on the Fedora Amazon image. Good luck, everyone!

Saturday, March 7, 2009

Cleared the Pictures and Comments Domains

I cleared the pictures and comments domain earlier today, so that the db would be consistent with s3. I did so by deleting and creating them. Things seem to be working now. Thanks for your patience.

I'm still not sure what the cs462-data bucket was used for. Does anyone remember? Sorry if your stuff was in it.

Friday, March 6, 2009

cs462-data and theimageproject Buckets Deleted

Whoops. I accidentally deleted the cs462-data and theimageproject buckets. They are back now, but the data is gone.

I think the best step is to clear the comments and pictures domains in the simpledb so that the data there matches what's in the theimageproject bucket. Please let me know if you disagree or have any other suggestions.

So, if you're seeing some strange behavior this is probably why. Sorry about that.

Queues Visible

Thanks Brad, Bracken, and Devlin,

There is a right_aws sqs implementation for the newer queues and I can see our queues when I use it. Just had to look farther into the documentation.

Thursday, March 5, 2009

Possible Cause of Queue Trouble

The error I am getting involves parts of this message:
...QueueAlreadyExists...This queue already exists for another wsdl version. Queue names must be unique across wsdl versions....
I did a search and found a helpful page at the Amazon Web Services site. It seems that if we're using different versions of the API we may not be able to see the queues. I am using right_aws for ruby, which the documentation says uses the 2007-05-01 API. The newest version appears to be 2008-01-01. What are others using? I asked Devlin about it and I'll post if there's something we can think of.

Having Trouble with Queues

For the 2nd half of the App Server I am having troubles using the necessary queues. I can only see 2 queues, named "processing" and "storage". As far as I know I need to be able to access all the queues named on the wiki. I'll look into it and ask Devlin and post what I find out. If anyone has any suggestions, I'd appreciate a comment. Thanks.

Wednesday, February 18, 2009

Ratings * 100

I was thinking that the rating returned by simpleDB were a sum of all the ratings, so that the average rating could be found by dividing simpleDB's rating by the rating count. I think I was wrong. It seems that simpleDB's rating is the rating reported to the client times 100.

/list/recent in under 70 lines

I am using Sinatra (thanks for the tip Devlin) to make the http endpoints. It is neat how you can get a RESTful interface with such little code.
On to /list/popular, which should be less than 70 lines, if I've listened to anything I've been taught about avoiding code duplication.

Friday, February 6, 2009

POSTing image conntinued...

rest-client:
As a poster on a page I linked to mentioned, I can't figure out how to make rest-client post in multipart.

curb (ruby bindings for libcurl):
Rails was segfaulting.

curl on the command line:
A little hacky, but it works. I actually had a picture show up in the approval queue!

Also, I didn't change some hard coded image id's for the rate submitter and comment submitter, so that explains why rating would get back a number successfully, but on a refresh it wouldn't persist.

Look at tomorrow for multipart...

http://redwriteshere.com/tag/curb/

Thursday, February 5, 2009

Working on Webserver Layer

I was getting an "InvalidAuthenticityToken" exception when trying to post to my end point for the rating widget. I found a thread with Google on Ruby Forum that I think will help.

I thought the webserver was supposed to return json from /ratesubmit, but really it just returns a number, which is the rating.

For some reason, my rating seems to work, but when I reload the page, it doesn't seem to persist. I've tried posting to the reference app server and the load balanced app server.

To get things in config/initializers to work, restarting WEBrick is helpful.

POSTing a file in ruby is a fun challenge:
http://stackoverflow.com/questions/184178/ruby-how-to-post-a-file-via-http-as-multipartform-data
http://snippets.dzone.com/posts/show/5165
http://curb.rubyforge.org/

Couldn't get curb or rest_client to work..

A Couple Fixed Bugs

I found a couple bugs a while ago that I understand have already been fixed:
  • If there was only one tag, the app server would return a string representing the tag, rather than array of size one containing the tag. Not hard to code around, but I believe it was inconsistent with the API.
  • The comments on the reference web server implementation seemed to always be from the person who submitted the picture, rather than who submitted the comments
I know this is old news, but I didn't get around to posting it before.

Wednesday, January 28, 2009

Installing Rails

I got rails working with some help from some online suggestions.
Here's somethings that I think helped:

  • Initially just used Ubuntu gems to install rails. When I tried to start the server it complained it needed a newer rubygems (gem).
  • Install new rubygems from the website. Hopefully a future Ubuntu upgrade to rubygems won't wipe this out.
  • Default page that shows server configuration had an error complaining about missing sqlite3 file.
  • I don't know if the sqlite3-ruby gem was installed already or not, but I think it may have been.
  • sudo aptitude install libsqlite3-dev libsqlite3-ruby helped, but I don't know which did it.

I did other things too, but I'm not sure which are were necessary. I guess I'll get to find out when I install on the Fedora ami :-)

Wednesday, January 21, 2009

Persisting my AMI

Well, I just uploaded an ami called image. Oops. Hope no one was counting on their image being called image. I have now changed it to something more unique. I need to consider how to delete the wrong "image" image.