Tuesday, May 28, 2013

Addressbook App

The current project that I've been working on is the addressbook app to become more familiar with the structure of Ruby. This exercise proved to be effective as it opened my understanding of it. I did have an issue at first on how to display all the entries at once. I eventually got it and was surprised at how simple it was. I grouped all the variables of the class Entry into an array in .erb, which I have never done. I didn't expect to be able to do that in the views folder, but hey I learned something new. I can honestly say that it sucks when I have a problem, but it feels rewarding after solving it. Just like now: I am trying to insert images for each of the variable entries, however it's currently not working.

Sudden realization why I was having issues with inserting images earlier, which is because I was using Rails Ruby rather than Sinatra Ruby. The difference is because the library in rails is not in the Sinatra framework. The "image_tag( )" is something that works in rails and not applicable in Sinatra. Now I'll have to find a way for images to be displayed. Probably similar to my zoo app.

The class exercise "Classercise" we did on the day of this post is to review last week's lesson on "Classes" and how to create objects from them as well "Instance methods" and "Instance variables." By calling the class.new in views and assigning it to a variable. This results in an instance object with the initialize variables that we set. In the initialize method, we set parameters and assign it to the initialize variables (Ex: @title = title). A cool trick to call the initialize variables and have them behave as methods without actually having to write out "def method_name, end" is the "attr_accessor" method. This acts as the setter and getter method and it makes life easier.I think I have more confidence now, but still feel like I only scratched the surface. Somehow, the more I learn, the less I know. Why is that?

Tuesday, May 21, 2013

Scraping

For my latest app on sinatra, I have decided to scrape restaurant menus in NYC and apply the inspection results. An issue I've had while applying the inspection results was that the file is really large, so it took a while to convert the file to ".json." BTW, the source for the data was provided by NYC Open Data. I'm still looking for another data file to super-impose with the inspection results to see if I get an interesting result that provides some kind of function. Who knows?... Been refreshing a little bit on ruby this weekend as well. To add more detail on the scraping lesson for future reference: my teacher Ashley invited Tom Levine to teach us about scraping. Just thought of using DSNY Collection Tonnage to super-impose with the inspection results. The two types of data have some degree of relevance to one another. Not sure exactly what yet, however.

Currently, I am satisfied with the apps I have, so I plan on leaving them alone (FOR NOW...). This will allow me to focus on the scraping app solely. I still feel uncomfortable with my skills and that's probably because I haven't immersed myself with the resources. I believe I'll get there eventually. Alright, going to end this post here.

Tuesday, May 14, 2013

weekend trap..

This weekend began hopeful, then ended up being unproductive. I would really benefit from better work habits. What I did do was read up on some ruby-doc.org's classes and why I would need three arrays for my Where's Waldo app. Each array would be as the source, aux and destination. The aux would transport the elements, one at a time from source to destination. More work needs to be done, so that I can apply what I'm learning. The Zoo app is ALMOST done. The functionality is where I want it to be at and all that's left is working on the CSS. Getting more content is another thing I need to do, like  download the Geico advertisement. Let's hope no weekend is this unproductive.

Wednesday, May 8, 2013

Arrays, Methods and SPAs

The past two weeks, I've been working on single page applications with sinatra's micro framework. It wasn't always simple, but that's because I needed to improve on those areas. I have two apps:
  • First one is a "Where's Waldo?"app, which is supposed to play a sound and load a new picture when you find and click on Waldo
  • Second app is called "Brand'D Zoo," that shows a random animal with matching animal sounds and description (the description is random, but the animal is relevant).
There were definitely some features or functions that I wanted in my apps and haven't gotten the down yet; either because I don't understand it or I'm not exactly sure what I want. I used external resources that I was given in my web dev class and also googled some issues, which I found promising as a way to sort through my issues. Originally I was hesitant about posting issue on StackOverflow, but I have actually found it to be a major resource. Although I am afraid of the easy "copy and paste," I do try to spend sometime trying to understand the code. I was taught to get the functionality down before worrying about the minor details like layout and placement. Alright it's beginning to feel stale writing this post, so here it is.