bloc referral

If you are interested in learning to code with a mentor, try bloc and get $100 off.

Tuesday, October 21, 2014

One Year Into this.


This happens to be a pretty big milestone week for me. This is actually the week I started learning how to program. I remember waking up in the hospital and having the idea of learning how to program.

A year ago I was only in my first class of my MBA and I wrote my first MBA paper on Google. I had recently got interested in them after reading the book In The Plex. The book got me thinking of starting my own journey into programming and thus began my deep dive, feet first.

I had an idea for an application to search churches based on location. I had previously tried to find a church from google but failed to  find any decent results. I had the idea; I jut had no idea where to begin. I thought about getting into iOS but previously attend Android development years ago but lost interest very quickly after realizing you had to learn JAVA. I decided to start in C programming, since it was the most basic, and I used a free course called Computer Science for Everyone. This course seems to be no longer available on the internet, but I do know it is available in questionable places for torrenting, but I rather not link there.

After 2 weeks of that I blew through the basics of C and Computer Science but stumbled upon a video on youtube about learning Ruby/Rails in only a month. I couldn't jump ship any faster, I love this guys drive to learn so quickly and after a quick read on Ruby, I found it to be significantly easier to read. I signed up for his course and that begin my journey with Ruby.

Learning to code is probably one of the best decisions of my life. It not only gave me a new career but also gave an opportunity to use a multitude of my skills.

I have completed an Apprenticeship, started an online community, and even completed the building of applications. I am definitely excited to see what is store for this next year. 

Wednesday, October 15, 2014

Capybara page.save_screenshot('screenshot.png')

I spent a lot of time trying to fix integration test at work and have experience using the `save_and_open_page` command to view the actual page. This has been an awesome addition to my test debugging, but recently I discovered a new command `page.save_screenshot('screenshot.png')`.

The screenshot command only works with pages and test that use Javascript, and are great to check to see if the functionality is really happening in a controlled environment.

I spent the past weeks working on a filtered search using Sunspot/SOLR which is all new stuff for me. SOLR is basically a tool to do searching of the database and Sunspot is the gem that connects Rails to SOLR easily.

SOLR has specific methods that query the database and I spent a lot of time checking out a number of them and testing the UI to be sure the correct data shows.

I am sure I could of spent the entire time in the terminal testing functionality but using my integration test and the Capybara screenshot command to view the actual page was a little more rewarding.

If you have integration test I highly recommend using Capybara to debug integration testing. I wrote this post to remind myself of the syntax, since I literally google it every time I need to use it.

*UPDATE: the screenshot call only works if you enable javascript in your test, with something like selenium:

 `def switch_to_javascript
    Capybara.javascript_driver = :selenium if ENV["FF"]
    Capybara.current_driver = Capybara.javascript_driver
  end
'

Thanks Adam Brice for pointing that out.

Thursday, October 9, 2014

exercism_io revisited

I recently got back into exercism.io. For whatever reason I only completed the first Ruby exercise and never returned, but now I have turned over  new leaf. I have decided that I need to write more code outside of work. Lately I have only been reading books and solving small problems on treehouse.

exercism is an awesome tool that is obtainable for any novice in programming in a multitude of languages.

I feel as if I am a decent Ruby programmer but could use some help in the "Ruby Way" of doing things and best practices. exercism_io will hopefully get me to the next level; the feedback I have already received from my first submission has already helped.

I have also made my first Swift submission which was ok, the actual code did not compile and I couldn't get the test suite to run in xcode. I have been bootstrapping my learning in Swift with the free Swift books offered by Apple on the iBooks app. I highly recommend picking that up.

If you are looking to join a group on exercism, join us on the Ruby Newbie team and if you need help setting up exercism, feel free to reach out.


Thursday, October 2, 2014

Ruby Science

Ruby Science is a book written by the popular Rails shop, Thougtbot. I had the opportunity to try out their upcase program a few months ago but cancelled it because it wasn't what I was looking for.

I however have recently acquired their Ruby Science book and absolutely love it. If you like myself, are newer to programming, Ruby, or just look for better ways to write your code, then I highly suggest this book.

I began reading this book last Friday and accidentally read the whole thing by Sunday, it was that good. I have usually taken the approach of reading books slowly and pondering on the concepts to really get them but this book was just too good. It might be hard to tell but I am pretty excited about this book.

I did not realize at first but the way this book is written is sort of a choose your own adventure style, where the book is broken up in 3 sections., Code Smells, Solutions, and Principles.

The Code Smell section is full of code that looks like what I would write, good code but bad practices, for example a "Long Method." Methods are meant to be short 3-7 lines and if they are larger they can probably be refactored. This chapter was so eye opening I went back to a pull request I created that Friday morning and made tons of changes and got some pretty awesome comments from my coworkers on my abstraction, little did they know it was because me reading this book.

The second section is on Solutions. You hear a lot of talks and know the buzzwords about writing clean code, but this book really breaks it down to the point where you just get it. There is definitely no fluff and extravagant examples but I really enjoyed this approach in the book. To get an idea of what I am talking about, the book is as straight as the front cover, right to the point of everything.

The final section is on Principles in programming. I learned what the Law of Demeter was because of this section, as well some other really big terms. I have heard of so many of the terms but never really knew their meanings. I actually knew of the Law of Demeter Concept but did not realize what it was called. It's the idea keeping your method calls to one and not chaining method onto to method on to method, i.e. `run.forest.run` .
















When I first started this programming journey, I watched a fair bit of conference talks, most that went over my head. I recently was re-watching CatchupConf, specifically Ben Orenstein's talk on Refactoring and found that so many of those concepts explained that I didn't understand, I now understand and even have been using these past 3 months working as a developer.

Here is a sample of the book: Ruby Science


Teaching Github to College Kids

I recently had the opportunity to teach a group of UCF Engineering/Computer Science students how to use git. There is an organization called Engineers Without Borders at the University of Central Florida in Orlando; The president of the organization reached out to a coworker of mine to teach them about Github. My coworker was unable to attend and threw it out there to the team and of course I had to accept.

I truly enjoy teaching others and love taking the opportunity when ever I can.

The meeting was on Monday of this week and I spent the weekend preparing a short slide show on the topic. My understanding that the students need to know how to use git and Github in order to collaborate on group code projects.

The group of about 40 kids were mixed with all different types of engineering backgrounds, some with experience in code and some without.

My approach was to share how git works initially and it's basic commands, Unfortunately the school was not equipped with a thunderbolt to VGA adapter, and I failed to put one of two I owned in my backpacked. So I presented from the limited Windows PC showing git via Nitrous.io, which was quick thinking on my part.

Overall the presentation went ok, despite the technical glitches with the internet. I was actually surprised that a handful (maybe 3-4) of students already knew git and had a github. one student really impressed me and already had a Rails project built (only if I got into to Rails in college, I'd be a baller right now).

Teaching git has actually taught me a few new git commands I have begun using, like `git reflog` which gives you the ability to see all commits on the project. I also learned despite deleting a branch or commits they all live there and are retrievable by their unique commit id.

Remember git saves changes, not files.


Thursday, September 25, 2014

My 37k dollar mistake: ilikerobot.com

If you listened to my interview on the Code Newbie podcast I mentioned briefly that I had a slight debacle with my AWS key to the tune of 37k dollars. I feel like I should write a public service announcement about it to help others, so here it is:

Coming close to almost a year, I started my journey November of last year. I began a few tutorials and online resources, but the first complete tutorial that I finished was One Month Rails and it was an awesome experience. In only two weekends I followed the instructions step by step to create the site ilikerobot.com. I was so excited about it I even convinced others to use it.

At that time I did not use github at all and barely knew how to use git, but fast forward to the beginning of January and I had mastered the process of pushing to github, so much that I pushed all my projects to public repositories. Little did I remember the warnings from the OMR videos to not publicly posting any files with sensitive information.

You see the sample application is a Pinterest clone which requires users to sign in and post a picture of a robot. In order to save these upload pictures, you need a tool like AWS's S3 service to store these pictures. AWS provides a secret key and bucket names and 1 year free access to this. After the year you will need to pay, but at the rate I was using it, it might of been pennies.

When I pushed the repo to github I neglected to hide all the sensitive information and did not realize until I received a phone call from Amazon out of the blue letting me know my keys were published on github, this was back in May at the time I was interviewing for jobs, so my focus was not this project I created months ago. I had the key inactivated and I deleted the specific file on github (this is not enough) and moved on with my day. Little did I know that there actual charges made to the account from an attackers that scrapes github for all sensitive information, actual clever and I am sure very easy due to the amount of new programmers.

I only found out about the charge because I have been making an effort to update all my old apps and bring them up to speed with Rails 4 in addition to writing previously non-existent test suites. I lost access to the photos on the site and could not log into my AWS dashboard. After getting my login access back I noticed the large bill and had a phone call with Amazon the next day.

I am very pleased with their understanding and effort they put in to having the charges reverse. They also protected my account even with the root of the problem actually being my ignorance. I would highly recommend them to others looking for simple cloud hosting, I do recommend a few things below.

My recommendations to protect your projects:

I am still all for making code public in repos on github but I recommend everyone learn about `.gitignore`. This is something I learned about after OMR but did not put into practice with my first app. You simply create the file in the root folder of your app and place all private file paths there. Git will know to never save these files and you will be responsible for saving your login info outside the repo in a secure location.

I also recommend the figaro gem for Rails projects on heroku. Their github readme is more than enough to get started using it, but it is also helpful in protecting sensitive information like API keys.

*Update: I also suggest this GoRails video on Environment Variables


Tuesday, September 23, 2014

Code Newbie Podcast

For those interested, I was on a Podcast call CodeNewbie and shared my story of how I got into web developing in Ruby. The podcast itself is on Itunes or via RSS from the site.

Saron is definitely an amazing host and I am glad I had the opportunity to do this.