Other Projects
Since Dynamic Persuasion is over, I’ll be no longer updating this blog. You can view my other projects from the quarter, plus any new ones I am working on at my other WP blog: http://labs.eric-decker.com. The layout and design it temporary, for when I redesign my portfolio site I’ll redesign the blog to go with it.
No commentsCase Study: Problems encountered with Amazon API, PHP, XML, and Cross Domain Policy
Case Study: Using Amazon’s WSDL
First I downloaded the package from Sephiroth.it that handles all the SOAP, which you can get here: http://www.sephiroth.it/file_detail.php?id=112. You’ll get a few files, the most important ones being the PHP files, since that includes all the SOAP stuff that I vaguely understand, let alone be able to write from scratch. However, this is set up for books and requires some modification to work for an music artist search.
First, in the soapClient.php file, you’ll need to set your $Token with the one you were given from Amazon.com when you signed up for their AWS account. (I guess you don’t need to worry about the ‘Tag ID’) Now, if you open up the AmazonSearch.php, you’ll see the WSDL file we’ll be referencing, which is: http://soap.amazon.com/schemas2/AmazonWebServices.wsdl. Now, make sure that if you’re looking at the WSDL though your browser; that you are looking at this one, because there are a bunch of them. And trust me, if you spend hours looking at the wrong one trying the figure out how the hell it works, you’ll feel like an idiot when you realize that you were looking at a different schema. Trust me.
Now, still in the AmazonSearch.php file, find where there are $Category variables, and change them from ‘book’ to ‘music’. This will make sure we are only getting results from that are music, but I think that it only searches popular music (as opposed to classical, which might be ‘classical’)
Now in the DoKeywordSearch function, there is a variable that calls _DoSearch, and the first parameter is ‘KeywordSearchRequest’ which is find if that’s how you want to perfom the search, but I want to search by the artist’s name. So change it to ‘ArtistSearchRequest’, and right above that for the $Params array, make sure you change the first item to be ‘artist’ (from ‘keyword’). We should be done here in this file. Maybe.
Back in the SoapClient.php file, we can configure it to get certain results. The section that looks like the following is where we get our data:
$r .= “asin$i=$ResultRow[Asin]&url$i=$ResultRow[Url]&title$i=$ResultRow[ProductName]
Basically, where you have this format: var$i=$ResultRow[Var], where as ‘var’ is the variable that is passed into Flash, and ‘Var’ is the attribute name from the WSDL. Accessing the data from Flash is as simple as this, here is an example for getting the album name:
PHP: title$i=$ResultRow[ProductName]
Flash: myVars[’title’+a]
With that, you should be able to check the WSDL and grab whatever info you need. Unless, if you might have noticed, an element is of type “typens:ArtistArray”
Above this little section in the PHP, there’s some code that looks like this:
$ResultRow = $Result[$i];
$det = $ResultRow[’Details’];
if(is_array($det[Authors])){
$authors = $det[’Authors’];
} else {
$ authors = $det[’Authors’];
}
So all this does is break apart the array, if there are more than one author, and strings them together. So, logically, if you want to change this to Artists, all you have to do is replace ‘Authors’ with ‘Artists’ right? That’s that the WSDL says anyways. Well, it’s not. Why? I wish I knew, I could have saved a lot of time. What you want to do is not use the Details array for this part. So I just modified mine to look this (not that I changed our variable of $authors to $artist):
$ResultRow = $Result[$i];
$det = $Result[$i];
if(is_array($det[’Artists’])){
$artist = implode(”,”,$det[’Artists’]);
} else {
$artist = $det[’Artists’];
}
Random Errors with PHP and mySQL:
So I had an issue with my database, which is locaed at mysql.eric-decker.com, and my project was up on eric-decker.com/projects. On some computers (Macs, besides my own) the site would not work – it would not fine the database. I ran a packet sniffer and the issue was that the php file was running into cross domain policy violations. (Which is weird, since the database is on a subdomain)
Well, that wasn’t the problem. It’s just a weird bug, and it happens randomly and effect the way some browser on Macs handle the XML from the PHP file. So, in the php file, after you create your XML string, you need two extra lines (this goes after your closing xml tag)
echo ‘ ‘;
flush();
Don’t know why or how, but that seems to fix that issue, so be on the lookout for it. You might want to incluse that in all PHP files with XML returns from now on, just to be on the safe site.
Cross Domain Policy with CIAS at RIT:
So I had a lot of trouble with cross domain policy. First I had the site on my own server, and for some reason CIAS would block it from functioning. It worked everywhere on different platforms except in building 7. So I moved the site to CIAS, which then let me do the database calls but not the Amazon calls. So I put the amazon php files on my server, and made a remote call to them from CIAS. However, I had to add a crossdomain.xml file allowing traffic from CIAS. Here’s the trick: Every sub domain is different. So rit.edu is different from cias.rit.edu and different from ecd7720.cias.rit.edu. Simple solution in to add in the file: *.rit.edu so any sub domain can call xml files. So for those of you working off of the CIAS server, keep in mind that even though you might be accessing and making calls to cias.rit.edu/~dce that now all users have subdomains, so really you’re calling dce.cias.rit.edu which can mess up security settings.
3 commentsFinal Project
Wow I just realized it’s been almost a month since the last post, well, not really but whatever. Project 3 is ‘complete’ and working. There were lots of issues, such as getting the correct information from Amazon and the royal pain of security settings. RIT seems pretty fucking anal about that stuff and it caused hours and hours of problems. Anyways, here is the project: Coda
Here are some screen shots, but you can see even more if you visit the site above .
![]()
Project 3 Prototype Stage 1
Here’s the prototype for Coda:
http://www.eric-decker.com/projects/coda/proto.html
This prototype allows you to submit a list of artists, as well as optional Last.fm data, to Amazon. You’ll be returned a list of albums by those artist from within the however many last months you tell it to (6 by default). I ran into a lot of little problem with the WSDL and using the SOAP stuff, and I’ll post more of that later when the project comes to a finish. Here are some refined comps, too:
Oh, and if you were wondering: Coda is a musical term for this little icon that is basically a reference to another section of music. Kinda appropriate, gotta give props to Pat for that one.
No commentsProject 3 - Comps again
Another set of comps for project 3.
Audience & Appearance:
Ideally the audience for this website would be any age that prefers any genre. But most likely, the demographic will be mainly 18-25 year olds who’s musical taste probably falls somewhere in the indie rock, folk, alternative category. This assumption is based upon the majority of the users on Last.fm, which has similar functionality to my site.
With that said, I made the site more geared towards the indie/folk/alternative crowd. Right now the site feels a little too feminine, and that’s due to having the pastel coloring and script font. However, it doesn’t bug me too much. I might like to still incorporate the pallet changer, so there can be options for people who don’t like it.
Image Issues:
Safety Cropping - Some images have random bordering, such as a 1 pixel thick line on the right. To compensate for this, I think I shall crop the image inwards by 99% to remove any garbage left over from cropping.
Making the program design randomly - Rather than just have things arranged totally randomly, I want there to be a loose grid structure. So there could be, for example, two rows of three. The items in the rows might have random rotation, but I will make it so that it looks less random by having it alternate the way it slightly rotates each image so they sort of zig zag. (For example, if there are four images in a row and the random for the rotation of them are 8, 6, 7, 5; then the images will be rotated 8º, -6º, 7º, -5º.)
Project 3 Comps
Here are some comps for project 3. The user will be able to pick from one of four color schemes. The navigation is handled thought the wheel, which is abstracted off of a record, or “compact disc” to today’s kids. There are three sections: View, Manage, and Change Colors. Manage lets users add artists and band names to their account, as well as the option to import Last.fm data. In View mode the user gets a chronological list showing least recent to most recent, as well as upcoming releases.
*For comp #1, note that it just so happens that The Shepherd’s Dog album art works well with the selected color scheme, it does not adjust the interface colors, although that would be a cool idea.
No commentsProject 3 Wireframes & Ideas
Here is the basic flow chart for project 3:
I have two ideas for project 3 as far as design style goes. The first one is that the user can scroll through a list and on the left there are CD jewel cases that move in 3D space. Here is an example I built to see how realistic it would be to try and tackle it: 3-D CD test
Here is the comp for the idea:
![]()
I should give props to this site, which might have influenced me a bit in this concept: http://www.vpbookclub.com/
The other idea, which came about as I was thinking of how people found out about records before the internet, is that they would go to a record store to “buy” music. So my other idea is that the user is in a music store and there is some hippie owner that is sitting behind the desk and you can browse the albums. I think this idea came about from when I saw the Willie Nelson costume at the Halloween store.
![]()
Project 3 concept
Project 3 concept
The Problem: It can be difficult to keep up with all your favorite bands, sometimes it is not until a moth or so after they release a new album that you find out about it.
The Solution: My website will allow users to create an account, for which they input all the bands they want to keep informed about. They can also add their top 50 artists from their Last.fm account if they have one. Then using Amazon’s ECS API, the website will search amazon’s database for all new and upcoming albums from those artists. The user can visit just once a month and be kept up to date with their music.
• Why would someone want to use this?
To easily and quickly see if there are any new albums from artist they enjoy.
• Return value
The user needs to return to the site to keep updated and informed about music they enjoy.
• STAF & spread
As a valuable resource, people can tell their friends about it. Additionally, users could see their friend’s favorite artists. Another idea is that people could mark what albums they have and rate them. A way to encourage STAF is by limiting the amount of artists users can submit, and they get more ’space’ by referring friends.
• User generated content
The reference information is all generated based upon either what artist the user inputs, or depending on their listening habits if using the last.fm option. Additionally, if users are allowed to rate albums, that is more UGC. Another idea is making a music network map, that visualizes people with similar taste in music to you.
• How this works as a ‘Product’
First of all, once it is built, it is good to go as long as there are no bugs, and Amazon does not change it’s web services. As a bonus, when albums are returned they can have a link to buy it, and if someone follows that link I can receive up to 10% of the profit. If the site did become viral with millions of people using it, and if people were buying music from Amazon though my reference, there would be enough income to offset cost for server bandwidth overages and costs.
Technical Challenges:
To retrieve product information from Amazon, I need to use their E-Commerece Service (ECS). Queries are sent using either Java or Ruby, and are returned with XML. Basically I will get the artist the user has uploaded from the database (can be one long varchar field separated with commas and then split) as well as from their last.fm account as an XML file. Then that data has to be sent to the java class and that will request all the albums from amazon’s API. Then the requested info is passed back as XML, and then into Flash, which can parse it and display it accordingly.
Project 2: Generically Perfect
The concept for project 2 was changed to make it more doable in the time frame we had to work on it (which was more or less one week). The concept was that studies show that people find faces beautiful based on symmetry. We of course know that is not totally true, because really ugly people can have symmetrical faces and sex icons like Cindy Crawford and Marilyn Monroe both had moles which made them unsymmetrical. Anyways, check out this project and submit your photo. No photos of your asses please.
No commentsProject 2 - Proposal & Comps
The requirement for project 2 is to have users upload an image. Now make something cool with that.
My project will have two stages, the second one will be implemented based upon time to complete the first one. Additonally , stage 2 requires stage 1 to be in operation on the web for some time. My idea is that users first upload a image of their face, taken straight on, not on an angle. Then they place markers on certain features. Such as first they mark where the top of the head is, the chin, and left and right cheek. Then, they mark the right and left corner of each eye, followed by the top of the nose and left and right side, and the right and left side of the mouth. (More might be added if data is needed, such as the tip of the nose, or bottom of lip, etc)
Then the image is uploaded with all these coordinates to the database to be used later. Now an image image is drawn based on the points using Flash’s drawing API, specifically the curveTo() function. This is an abstract image that is built each time someone wants to view it. The user can browse other people’s face maps, and search for their own. (Perhaps based on name of ID in database).
Stage 2 can only work once there are probably thousands of images and data uploaded. Once the user submits their data, the database spits back all the other data from other users. Flash then takes some time, and goes through each one and looks for similarities, such as the spacing between the eyes (left eye - right point and right eye - left point) and a bunch of other criteria, and then display similar faces.
![]()
after the user has uploaded an image
![]()
drawing the image (flash can do it nicer)
