Friday, April 10, 2009

New Log for the project....

I was having to look at the logs for our project often and the jquery one we had before seemed a little heavy weighted to me. In fact, it would basically make my browser unusable while I was running in. In light of both of these facts, I made my own...and Devlin put it up on the TA server. Hopefully it will be a little nicer to our browsers. You can find it at http://imaj.lddi.org:8080/sandberg_log.html
Hope you enjoy!

Wednesday, April 8, 2009

PHP guids

I just got function number 4 from this site: .
It seemed to work perfectly well.

Monday, February 16, 2009

php SimpleDB files

It took me a while longer to find anything good and the only thing I found was this http://objectcentral.com/paws/ I did find some problems with this script and so I made a few changes myself. I have put everything you need into a zip file. The paws stuff depends on the Amazon folder and they both need to be in the same directory. I didn't want to bother to figure out the include stuff so I just put another copy of both folders in my list directory. Just add the amazon keys to the config file in paws directory and the line include 'paws/pawsSDB.php' into your php files. Then you can make use of all methods on the pawsSDB object.

The changes I made were two small things: 1) on the query method I added a parameter to tell it how many objects you wanted returned at a time. Currently, it defaults to 11 (because of the project) but you can pass in any number you want. 2) The getNextItemName method used to keep calling the last query until all the items that the query returned were sent back to you no matter what you set as the max number of items. I made it so that if you tell it to only return 11 from the query, you only get 11.

Anyway, go forth and do good stuff.

Thursday, February 12, 2009

SimpleDB and sorting comments


I was chatting with Dave Wilcox as I was working on my lab tonight and he is a life saver. (A wild cherry one, I would guess.) Anyway, as I was working on my query for comments he gave me the greatest tip ever!

If you want to sort by something in your SimpleDB query, it has to be referenced in the query.

For example, if I wanted to sort by coolness in my made up SimpleDB domain, you might think the query "['submitdate' > 'some param'] sort 'coolness' desc". This query seems to make sense to me and probably everyone who has ever used SQL. Yet, you won't get nothin' back from SimpleDB. You need to make sure you include whatever you want to sort by in your query: ['submitdate' > 'some param'] intersection ['coolness' = 'something that is always true' sort 'coolness' desc". Now SimpleDB will give you back all the results your heart or query desires. I thought it was very odd so I just wanted to warn everyone else! Good luck.

Picture from : http://ecx.images-amazon.com/images/I/519DTFXWQ6L._SL500_AA280_PIbundle-12,TopRight,0,0_AA280_SH20_.jpg

Wednesday, February 11, 2009

PHP s3 Objects

I have looked through a few php5 objects that will do all the s3 stuff for me and the best one I have found so far is http://code.google.com/p/php-aws/source/browse/trunk/class.s3.php# I have yet to actually use it so we will see how that goes. It seems like it works pretty well. Don't forget to install php5-curl (that is what it is on ubuntu anyway) because it uses that.

Thursday, February 5, 2009

use PHP without mod_rewrite

In a previous post I talked about how apache just magically found my php files even when I didn't enter /submit.php but only /submit. Apparently, by default in Ubuntu 8.10 with apt-get apache2/php5 install this behavoir is enabled automatically. However, on the Fedora image it appears that this is not enabled. From a comment posted by Artan in the origional post you need to do a little httpd.conf editing. His comment follows:

"I was trying to get my Apache to do the same thing, but it wasn't working. I finally found a way to do that and it's as simple as putting one option in the options directive in your httpd.conf file. This is called MultiViews.
If you look in the .conf file, among others, there will be a section called Directory "/var/www/html" or whatever the path to your directory is.
The Options directive will most likely be there and will have some options set. All I did was add MultiViews to the list of Option directive and it all magically worked.

This is what my Options directive looks like now:
Options Indexes FollowSymLinks Includes ExecCGI MultiViews
(that is all supposed to be in one line)"

Hope that helps!

Wednesday, February 4, 2009

Fedora Shutdown Script

Someone was asking me for this in class today : http://www.linuxforums.org/forum/redhat-fedora-linux-help/64580-where-shutdown-script.html If it works or not I know not since I am not using fedora. Good luck!

Show me my public ip address!

Well, alas, another small kink in the making of a distributed web app: finding my new EC2's public ip address. I would have thought there was a really easy way to do this from the command line on linux machines and maybe there is and I am completely ignorant. But, be that as it may, I figured the easiest way to solve my problem was to solve it myself. Introducing.....show me my public ip address Hit up this script with whatever kind of http producing program you got and all it will return is some headers followed by your public ip address. I am going to use it.

Tuesday, February 3, 2009

{"success":false, "error":"invalid arguments"}

Well, that was a junky three hours of my life. I am using php to implement my stuff and I actually went ahead and implemented RFC1867. The sad part is...no matter what I did, the app server rejected me like a stinky bum from the street.

Sadly, I had to admit that the black-box app server knew better than I or in other words, I couldn't figure out what I was doing wrong with my implementation of the RFC. I ended up just making a system call to curl. How sad is that...a computer beat me.

I think I am going to go read the real RFC and see exactly what I was doing wrong.

sendToHost - the php way

Just a heads up for any php guys. I have been using a function I found randomly through google to get all the replies from the app server. If you don't like raw http you probably shouldn't use it but I found it on this site.

I customized it myself so it worked better for me. One other thing that you might try is curl for php. I am pretty sure there is a library that allows you to create a curl object in php and use that to hit other sites. Anyway, good luck.

Saturday, January 31, 2009

Unstable URL Usage


Well, I looked at the urls for project 2 and just about fell out of my chair. I have chosen to use php and well, php and no suffix on the end of urls doesn't mix...or so I thought?!

I tried to fool around with mod_rewrite but I have been having a whale of a time trying to get mod_rewrite to work correctly on this computer. Anyway, tried writing some rules, they didn't seem to be working.

Then, all of a sudden, things just began showing up. I was puzzled. I don't think I did anything?!, I thought to myself. It took me a few minutes but I finally realized that apache is so smart that if I have a file called submit.php and I navigate to www.bla.com/submit that it will run the php file. How cool is that? Really, wickedly awesome cool.

App-Server from the comfort of the living room



Just looking at the number of EC2 images running under our account makes me wonder if people are missing something or are way ahead of me. What I think they might be missing is that we can develop all our html/ site on our own machines.

All we have to do is download apache, install the packages for the language above and then stick our files in the www dir (on default linux install anyway). Then we can visit them and they can do anything we want! They can hit the app server. Or they can steal off of the normal server or anyone else's server.

That is one of the best things about the internet. You can do anything you want to whoever is connected and has a public ip address. Granted, they may not respond or you might end up in jail but hey, you can still do it.

Basically, what this boils down to, is come back home! Work from your living room on your own computer without worrying about AWS stuff. Once your page is working, then you can get it onto an AWS instance and such. But if it works from your couch in your house, then it will work on AWS (provided you have the same packages installed.)

Elasticfox erratic error

Well, my first experience with elasticfox was not the best I have ever had. I think the whole plugin to firefox idea was, frankly, genius. It would have been way harder for me to want to use all the command line tools but with the quick plugin to a program I have open anyway, it's easy!

Back back to the task at hand! The bug I found was small, but very annoying. I created a new credential and messed up the secret key part. At first, I didn't notice so I was pretty miffed about why I couldn't connect to the account. Then, I finally realized that I had entered the password wrong, so I highlighted the user and changed the secret key and hit add. Then I went back and it still wasn't working.

After several days of being disgruntled and crabby about junky elasticfox, I tried something new. I removed the old user and added a new one; this time I made sure to have the right password. And whaaa bam! It worked everything was great.

So while everyone might not consider this a bug, I personally just assumed that clicking add after updating a credential would change it. Well, just so everyone knows...it doesn't!