Overlooking mistakes pt.2

It really is true what they say when they tell you the majority of your time is debugging code and making it work, what ever it takes. Upon attempting to connect my front-end app to Heroku, I once again ran into a couple of problems. For one, when I tried to add my remote github link to my git remote branch, it wouldn’t work unless I had to clarify it again twice by copy pasting from my actual site. Another one that took me awhile was the fact that I couldn’t deploy my app to Heroku AT ALL. I kept getting the error “heroku pre receive hook declined” and so I had to Heroku log everythinggg to see what was up. I eventually had to get into my logs on my Heroku server and saw that maybe the solution was updating my node and adding the Heroku/node buildpack. And that is what I did.

This time I thoroughly remembered to git push all of my saved files. 2 hours later, deployment successful~ Lesson of the day: trust your logs. Every. Time.

Last but not least was the CORS problem. Knowing that my app is actually LIVE, I can’t just run CORS every time on a separate desktop because…well…that’s all local stuff. And doing that on a browser can lead to hackers invading your privacy and information.

It was an easy fix of adding app.use(cors()) along with:

app.use(function(req, res, next) {
res.header(“Access-Control-Allow-Origin”, “*”);
res.header(“Access-Control-Allow-Headers”, “Origin, X-Requested-With, Content-Type, Accept”);
next();
});

Also installing cors once again to make sure and keep it updated helped.

Advertisements

Overlooking mistakes and logs.

I have been debugging for about 6 hours and was so close to tossing my laptop out of the window. I was following up with the course and eventually hit yet another obstacle: successfully deploying my site on Heroku for the first time. Code was running smoothly, database was successfully in motion, what could go wrong? Well, it looks like I was experiencing a 503 internal server error, as well as a CORS error. 503 internal error meant that my back-end was not connecting to the front end or database at all, and no HTTP requests were successful. CORS error meant a cross-platform domain issue…something I have yet to look into. But I did install CORS package and enabled it within my app, which means I am able to access it on any platform just fine. What happened there?

I’ve been doing heroku logs –tail to trace my logs and see what I can debug. I’ve gotten ALL kinds of HTTP errors. Obviously. Then I made sure to disable CORS by running chrome.exe and disabling it through there. Still didn’t work because 503 server error was still there. What?

 

Fast forward 6 hours later.

I was still scrolling through Stack Overflow, FCC forums, Quora…even asked on Discord to see what’s up. As I was scrolling, I remembered….

“When was the last time I committed a file to my master branch…?”

Well, crap. It’s been awhile since I git pushed recent files.

Lo’ and behold…Server is running smoothly. I am able to create a new user and log in successfully in my app. One little slip up and neglecting to remember to push files onto master branch can really mess you up in the end and make you want to pull your hair out.

My partner was trying to reassure me, telling me that I am more than capable of doing freelancing jobs on the side while looking for an actual job as a full-time developer.

I told him that if I can’t even do something as simple as debug code or even run my app on a server, I am not ready at all.

Ouch. I’m not ready. Far from it.

Back-End nightmare…

Long time no blog post. It’s been awhile. For the past 3-4 months, I’ve been taking The Ultimate Web Developer course by Andre Neagoie. His lectures are on-point and dense, in a good way. I am usually coding with him and would pause in between sessions just to take a good look at code or mull over what I just typed. I have high expectations on this course thus far and so far, so good.

Eventually, I reached a breaking point and a huge obstacle.

Back-end development.

Back-end is a totally different monster. I eventually got to the end of the back-end: database chapter but reached a huge obstacle. Everything was great up until this point. For some odd reason, Postman could not do HTTP requests–however, server was up and running smoothly. Code looked fine. I backtracked a few previous videos to see what I missed. I made sure to catch any internal errors in my server and console.log it in my terminal.

What is going on?

Port is running smoothly. No error in code. Hm. It MUST be an error on MY part. It MUST be the server. But exactly what? I created a database, created a password for authentication, made sure the database is running. However, I was not able to register the user on my app and Postman isn’t able to do HTTP requests…hm. This is my fault.

I went on Zero to Mastery’s discord server to ask for advice. Eventually I learned that pg is running on a different server altogether, with a default port: 5432. THIS I didn’t know! I was never aware of the fact that pg runs on something entirely different. I was negligent of the fact that I had to specify it in my db knex object:

 

aha.png

Literally such a small thing such as specifying port # for something I did not need, threw EVERYTHING off. This shows how much I need to learn about back-end development. A lot.

I had to log this one for the books. I just had to. I’ve been stuck on this for about a week, so much as it was hindering me from my studies. Just being stuck on something for awhile was holding me back. Whew. What an “aha” moment! Kind of. I’m relieved I can continue and press on.

Asynchronous vs. Synchronous

Asynchronous programming consists of when a unit of work runs separately from ts main application thread and notifies the calling thread to its completion, failure or success. JavaScript is a great example of an asynchronous programming language. It can work line by line like how synchronous programming works, but also can be asynchronous in many ways.

Here’s how:

setTimeout(function(){
  console.log('Hey, why am I last?');
}, 0);

function sayHi(){
  console.log('Hello');
}

function sayBye(){
  console.log('Goodbye');
}
sayHi();
sayBye()

 

  1.  JS will parse the entire script as well as search for syntax errors
  2. it sees a setTimeOut function and adds it to the top of the stack
  3. It will get sent to the Web API container and gets popped off the stack
  4. Timer is set to 0 seconds, therefore, Web API queue sends it to Callback Queue.
  5. event loop will check to see it’s empty. it’s not because there are two functions
  6. function sayHi() will execute, it will console.log ‘Hello’
  7. console.log ‘Hello’ will get popped off the call stack
  8. function sayBye() will execute, adding console.log ‘Goodbye to top of stack
  9. That also executes and gets popped off the stack
  10. anonymous function also gets popped off the stack after getting executed.

OC Hacktoberfest;

Last Thursday, I attended my very first tech event celebrating Hacktoberfest 2018. This is my first year attending Hacktoberfest and contributing to open source(which I have yet to make another post about), so I was excited about sharing my latest projects with other people.

The event was held in Irvine, California at AutoGravity headquarters. AutoGravity is an auto-financing company that helps their clients finance cars and connects them directly with dealers/lenders. They also host other Hackathon events every other month or so.

Upon entering the site, I signed in with my information and signed an NDA. There were a few things I could not take pictures of at the event, including the design of this year’s Hacktoberfest shirts and their slideshows, of course. So I just decided not to take pictures at all. Anyway, there were a bunch of people who arrived early and just chit-chatted with each other. It seems that people came with their own groups and just kept to themselves…but little friendly, ol’ me walked up to almost everyone and introduced myself 🙂

The event started around 7pm and we were free to grab some food(yum, kabab! and baklava!) and drinks(Kombucha isn’t entirely cheap…but it was free for us attendees O.O). 10 minutes after settling in, the front-end devs of AutoGravity introduced themselves and started the slideshow. The slideshow pretty much wrapped up what Hacktoberfest is, contributing to open-source, and of course what tonight’s Hackathon entails. There were a few contests going on such as the first person who did the first pull request of the night gets a free Amazon giftcard, and there were others but I can’t remember them at all. They didn’t leave that part of the slideshow on during that time so no one really remembered what the contests were on–just that their goal was to complete the five PRs for this month(Aaand I couldn’t take a picture of the contest information either so…).

What I found pretty cool was that they introduced a workshop for those who have never done their first pull request on Github. This Github workshop helped attendees on creating an account on Github(if they have not done so already) and showed them the steps on creating their first PR. I pushed my boyfriend to attend that workshop with my laptop since he did not bring his. I stayed for a good few minutes to see how it was, then decided to head back and talk with other people. I met a couple of other front-end developers for AutoGravity and talked a bit with Jesse, who was the front-end manager. He gave me some advice on pushing forward with my projects and told me to keep learning no matter how frustrating it can be at times. I also met a couple of people attending Redwood Code Academy, which is a coding bootcamp located in Santa Ana and they all told me they are “coded out”(lol) and are on week 10 of their learning curriculum.

It was a great time talking to people and having a great experience overall at the event that night. I got to meet people with different kinds of learning experience–people who just jumped into learning to code for the first time this year and people who have been at it for years. AutoGravity is hosting an event based on Javascript some time next month so for sure, I am attending that as well.

All the APIs

Some insightful links on learning on API’s:

 

The last link, if anything, confused me more than leaving me with more knowledge on APIs. Given, it was a little early on for me to start learning on the concept of this subject, but other sites were more insightful than the previous. The instructions became more difficult to manage, jumped from one end to another, and left me with more questions than answers.

I’m in!

It’s official! I got accepted into Coding Dojo! It’s actually been a few weeks since I have gotten my results of my application, so I will try and sum everything up in a nutshell…as best as I can.

Actually. I believe it has been a solid month since my interview with the school. I think it was on Feb 6th? Or something. ANYWAY.

Words cannot express how nervous and anxious I was for my upcoming interview, even though it was supposed to just be ‘casual’. I couldn’t even sleep the night before and my heart kept clenching. So yeah the interview time was about 1:30 pm and my interviewer asked casual questions such as…

  • Why do you want to attend this school?
  • What made you get into programming?
  • What was your first programming language?
  • What do you do now(profession)?
  • We have over 100 applications each day for each cohort…what is it about yourself that sticks out? Why should we choose YOU?
  • yadda yadda…

My interviewer really liked me though. He loved the fact that I have been learning how to code since about last fall and already know a couple of languages. He was also thrilled to hear that I already have a Git Hub account and is super active on it. He was also happy to hear that I do exercises on Code Wars just about every day.

“That is the number one thing we advise every student to do DURING our boot camp. But I am so thrilled to hear that you are already getting a head start on this before everyone else. That is amazing.”

And as my friend/mentor/coach, Corey, says:

“That is because no one. NO ONE. Does that shit before attending the program.”

Somewhere around those lines…haha. So yeah, I am super, super, grateful that I reached out to Corey about the idea of attending a coding boot camp. He has always been super helpful and encouraging and I cannot thank him enough for it(especially with his busy lifestyle and all).

But anyways. Like I said. The interviewer told me that it would be WILD–…CRAZY–.. If I were not to be accepted into the program and… by any chance I don’t get in at all–to always feel free to re-apply. After the interview, he sent me an e-mail with the link to the skill assessment I had to take.

The skill assessment was simple. There were 15 questions altogether and was timed. I think I had to finish it within 30 minutes? They were programming questions like…hm. I can’t seem to remember most of them(sorry!). I remember one of them asked me which one out of these programming languages focuses solely on front end. And the last page consists of merely me typing in code and providing answers. I, sadly, do not remember these questions at all. I remember one was reversing a string. Easy-peasy. I was too eager and pressured to finish all of these questions within 30 minutes. And as you can see from my very vague memory…I don’t do so well with finishing up anything in a short time limit. I was just on crunch-time to finish things efficiently, accordingly, and making my code look clean. Oh, and the coding questions were JavaScript based. I’m glad I’m learning Javascript at that time.

After I finished with the skill assessment, I got another e-mail from my interviewer informing me that he will show my application to the higher peers that night for some quick results. That means my application was forwarded before everyone else’s!

Got my results in two days. Boom. Got in!

This is the feeling of accomplishment. When you put so much time. Blood. Sweat. Tears. And much frustration into something and to come out even stronger. I try so hard to make myself stand out and this is the result I have hoped for.

I start school on June 18th. I’m preparing for more frustrations to come, but I know I will learn so much from this amazing experience. There will be tears involved, and much joy. For now, I will learn what I can and most of all, I get to chill. B)

Cheers!