It’s been about 3 weeks since I last blogged. I put my head down and sprinted towards the finish line. I can’t say that I’m 100% done, yet, but I will be soon. I have completed my final portfolio project and have my assessment for it tomorrow. I must say, Redux threw me for one while working on this project. I hit many stumbling blocks building this project. I think my sprint was a little ambitious and I ended up not knowing the Redux stuff as in-depth as I wanted to. I definitely created some of my own frustration because of this. However, I hacked away at it and got it. I watched YouTube videos, Wes Bos’s Redux Course, and I even used HackHands a couple times thanks to the Github Education Student Developer Pack $25 credit I received.
Continue reading “So Close to the End”
Category: Flatiron Blog
Sometimes The Logic Is Flawed
So I’m banging away at my jQuery project. I got hung up on some code tonight but got it working right before I stopped for the night! I was stoked! So what was I stuck on? In my app a user can create as many places as they want. Each place can have as many items as they want. A user can look at a specific item and see the name of it, the rating they gave it, any notes they wrote about it and where the item is available (the places they’ve added it to). I wanted to implement a “Next Item” button/link that when clicked will load the next item for the current user.
Continue reading “Sometimes The Logic Is Flawed”
Did I Really Finish Rails?
My Rails project is officially done! Well, it officially fulfills all the requirements that Flatiron School has for it. I definitely have more to do with it. However, considering that I’m done almost a day and a half before my self-set deadline I’m happy. Some minor things in my views (like showing just a user’s items instead of all items), building out a more robust navbar, filling out my readme, and I should be good. I also want to change my Oauth login into a button with a logo on it. I’m trying to no code “raw” HTML but I’ll probably end up doing it for that. Using Font Awesome and Bootstrap inside and ERB tag is just a pain haha.
My largest hangup was my nested forms and getting them to work properly. Although, I felt better this morning when I reached out to a public Ruby Slack room and a guy who’s a boot camp instructor (not at Flatiron where I attend) said,
yeah, that’s the worst. Dealing with nested forms is always something I have to go back and read the manual on.
I felt a lot better about the struggle life.
Check out the repo here. I’ll share the link tomorrow when I get it deployed (hopefully). I’m hoping that deploying is more straightforward since I used PostgreSQL. Not sure how well dotenv is going to play with Heroku. I know others said Figaro made it dead simple to deploy with so I might do that if I hit any snags. I wish I had more to talk about with my process but I think it’s all there is the 100+ commits lol. That and I have tacos waiting for me as soon as I finish this blog post up, get it posted, link to it on my project page, and officially submit my project.
It feels good to be at this point. Even if a little surreal at how far I’ve come in <3 months.
Time spent today: 8:27
Time spent total: 317:08
Lessons completed today: 1
Lessons completed total: 519
I Deployed My Sinatra App To Heroku
MY SINATRA PORTFOLIO PROJECT IS DONE!!!
You can say I’m pretty stoked. This blog is part of the requirements though so get ready :-). Actually, I didn’t take enough notes to really get into the code in this blog. I did hit some solid stumbling blocks and there is some major refactoring of code needing to happen but I’m overall pretty happy. A large part of the time I spent was making the app look good utilizing Bootstrap.
Something that definitely needs to be refactored is one of my helper methods:
def current_user_parents
parents = []
current_user(session).houses.each do |house|
Parent.where(house_id: house.id).each do |parent|
parents << parent
end
end
parents
end
It’s sandwich code (starts with a variable set to an empty array, fills that array, returns that array) so I know I can most likely eliminate two lines from that or even three if I’m not pushing onto that parents
variable anymore. We’ll see. I’m interested to pick the brain of the instructor that goes over the project with me.
You can see what I’ll call v0.8 (I figure it’s close to v1.0 but not yet lol) at https://your-neighbors.herokuapp.com/. I feel like the code is solid but still some functionality and visual things that need to be resolved.
- I’d like to add a static footer to the site.
- If a house is deleted the parent and children remain in the database but can never be accessed again because of how I list them in relation to the house they’re in.
- When there are no parents or children I need to add a link suggesting to create some.
- When a user tries to access the info for something they didn’t create (ie. they created house 8 but try and go to the link for house 5) the error page tells them to log in even though they are logged in. I need to create a different error page for logged in users trying to access stuff that isn’t there’s vs. the error page when a person isn’t logged in.
- Add some color!
I’m sure I could find more. Feel free to check out the app. Sign up, use it, and report issues to the GitHub link at the top right on every page of the application.
It was interesting deploying to Heroku as well. There isn’t a solid guide on deploying a Sinatra app with a DB to Heroku. Through Heroku’s docs and this Get Started with Sinatra on Heroku from 2013, I got it up and running though. The biggest thing was setting up Postgres and what to put in the Procfile
. Let me see if I can remember what exactly I did:
- Add
gem 'pg'
to your Gemfile. Also, define your version of ruby, ie.ruby '2.4.1'
in your Gemfile. - I changed the sqlite gem to development like this
gem 'sqlite3', :group => :development
. - I added a
config/database.yml
because the Heroku docs said to but I don’t know if it’s needed. I’ll probably delete it and see what happens in the near future. The Heroku docs have an example that I used and just changed thedatabase:
names. - I think
config/environment.rb
is where the magic happened. I kept the:development
environment using sqlite3 because I read in some of the docs that you needed to know the host, username, password, port and something else to make it work locally. I figured if I could get it to work without figuring that out I would do that. I got this working locally runningshotgun
and on the Heroku server too. With the changes it now looks like this:require 'bundler/setup' Bundler.require configure :development do ENV['SINATRA_ENV'] ||= "development" ActiveRecord::Base.establish_connection( :adapter => "sqlite3", :database => "db/neighborhood#{ENV['SINATRA_ENV']}.sqlite" ) end configure :production do db = URI.parse(ENV['DATABASE_URL'] || 'postgres://localhost/mydb') ActiveRecord::Base.establish_connection( :adapter => db.scheme == 'postgres' ? 'postgresql' : db.scheme, :host => db.host, :username => db.user, :password => db.password, :database => db.path[1..-1], :encoding => 'utf8' ) end require_all 'app'
- The
Procfile
was something I couldn’t figure out. The SitePoint article I linked above had this line for it and this is what made it all workweb: bundle exec rackup config.ru -p $PORT
. - For the rest I followed the Ruby docs on Heroku here and the SQLite doc here.
- If you get db migration errors you can run rake tasks on Heroku.
heroku run rake db:migrate
was one that I needed to do. More in depth docs about it here.
Hey, look at that. I remembered way more than I thought. Hopefully, this was helpful to someone somewhere. Probably a student coming behind me who is going to pull their hair out trying to get their app to work on Heroku.
Time spent today: 8:32
Time spent total: 198:13
Lessons completed today: 1
Lessons completed total: 406
One Way To Pair Program
Tonight a couple people were wanting to know the best way to pair program together. They had both done the beginning parts of the Tic-Tac-Toe with AI project (the one I’m getting ready to start) and wanted to work on the AI part together. The exact question was:
Hey @*** and I are doing parallel pairing :slightly_smiling_face: what is the best way to go about this, to work on the same repo on separate branches or just copy on paste. She is on IDE, I’m on local. Any help muchly appreciated!
The always awesome and helpful instructor Cernan Bernardo quickly gave a how-to that I knew others could use. I’m just going to abbreviate what he said and turn it into a numbered list.
- Grab each other’s SSH URL for your respective GitHub repos.
- In your respective terminals (local or IDE) you would each run the command
git remote add upstream *copy_ssh_url_here*
. - After running those commands when you run
git remote -v
you will see two remotes…one for your origin which is your respective GitHub repo and one for upstream which is your partner’s repo.
Now the setup is done, here is the work flow to be done before either starts working on the app:
- Run
git pull upstream master
…this will pull down any code your partner has added to the app and pushed up to their GitHub. - Work on your part of the app.
- Run
git push
orgit push origin master
…this will push your new code to YOUR repo.
With that work flow you will each have your code in sync. Just remember to pull before you push.
So there you have it. Questions feel free to ask and I’ll ask Cernan 😉
Why Software Development?
So as part of my bootcamp experience Flatiron School requires me to write blog posts. This is a feature that I don’t think all bootcamps have but is smart. If I can write about coding then I show a deeper understanding about why I am a job ready developer. We all know that our online presence is part of our “resume” now as more and more hiring managers are looking at social profiles when making job decisions (even if it’s a legal slippery slope…).
So I have assigned topic of, “Why did you decide to learn software development?”
There are many reasons I decided to learn software development. Initially, it was because it is the “cool” thing to do these days. Demand is > Supply when it comes to people in the tech industry and overall everything we do now is being run by a computer. The Internet of Things (IoT) needs to be programmed. I truly believe that we are moving to a knowledge economy and very soon (on the grand timeline) most repetitive jobs will be replaced by robots, including driving. See a great post on automation here. However, people will need to program these things.
Things like bootcamps are popping up like crazy as people are making the jump to be developers. The potential pay and benefits are attractive too. We’ve all seen images of massive tech companies and their offices where you can take a break from your bean bag workstation and get a massage from the in-house masseuse while listening to a private live Billy Joel concert streamed to your company provided Bluetooth Beats headphones. Okay, maybe not that extravagant but you get the idea. Or the person who travels the world making 6 figures and all they need is a laptop and internet. Having that remote work freedom at some point is also attractive. Who wouldn’t want this life?
Another driving force is that I was in hospitality. An industry that is NOT family friendly. 55+ hour weeks are required for salary managers in most instances and nights, weekends, holidays are the busy time. I kept with it by saying I would eventually be in a high enough job title where I would be doing more strategic planning and thus work a more typical 9-5 schedule. I still believe that to be true. Once a person gets to District Manager or F&B Director you check in on early morning and closing operations occasionally but you could care less how the money is counted at close, just that it’s counted correctly. If it isn’t counted correctly there’s always a manager below you to push that to anyways. Something I rarely speak about but through my 10 years in the restaurant business I was laid off 4 times. I was paid severance a couple times and a couple times just collected unemployment but the lack of job stability paired with seeing people 2 years into a tech career making 2x what I was making cemented my interest.
So I dabbled while still working my restaurant job. I learned from freeCodeCamp the most among many other places. Knowing that I could work on a project for hours without taking a break, then stop for the day, then pick it up two days later, then stop, then get stuck the next day and make zero progress, then two days later finish it off, and LOVING that process cemented in me this is something I wanted to do.
I also realized that on the intellectual front I would always be challenged and have something to learn when it came to software development. I’ll never know it all and that is a bonus.
So how could I make this career transition with a mortgage and 3 kids? In person bootcamps were out of the question. There are two in Nashville (that I know of) and I know people who have graduated from each. First, Nashville Software School is an awesome program. However, it takes 6 months and we didn’t have 6 months of me not working to spare. The other is The Iron Yard and while they have a solid reputation the approximately $1000/week tuition was not going to work. In addition, I knew I couldn’t be out of pocket completely for 12 weeks, my family life would fall apart. So I came across the Flatiron School Online Web Developer Program. Work at your own pace when you have time, job guarantee, a solid curriculum, and high praise from people in the industry I spoke with. The work at your own pace is what sold me the most. I could code before the kids got up and after they went to bed and all weekend long when my wife was home. I could still take care of my kids all day M-F and we wouldn’t have to pay for a nanny. I could potentially finish in 12-15 weeks (they say the curriculum takes ~800 hours) just like a more traditional bootcamp but spend $6000 instead of $10k+. Boom, now to get in. I applied, did some coding, and got accepted (acceptance rate is ~8% so it’s competitive).
So ultimately I decided on software development for a few reasons:
- It genuinely interests me outside of doing it as a career.
- The pay ain’t bad.
- More “normal” schedule so I’ll be home for dinner, off on weekends and holidays.
- The possibility of working remotely.