Saturday, October 31, 2015

Those self-study dips, tho.

This past week hasn't been all that great. I've been coding a little, but not much. Mostly watching tutorials in an attempt to keep my motivation to learn new things up.

I'll admit, getting stuck on this timer project hasn't been the best for me. I started looking for examples to see what I'm missing, and every one I found did it in Angular. Fucking Angular. So it looked like a busy pile of something that resembled javascript.

Maybe that's the only way they got it to work or they were copying the example page down to the last detail, who knows. But money and life took priority for a bit and I had to get that under control. 

I started looking for Angular tutorials to see if I could learn enough to read the samples I found. It's not going to be that easy, I don't think. But Angular does seem interesting. From the little bit I've seen it might help make this type of thing easier (once you know how to use it).

I could go to the chat room and ask but at this point in my project I feel like I'm just asking "How do I do it?" The last time I worked on it I thought I might have to completely erase the JS and rethink things. I got the timer to  stop at zero most of the time, but switching to the break timer wouldn't do what it was supposed to. I was setting the session to one minute so I wouldn't have to wait that long (I waited that 60 seconds so many damn times...) but if I stored the break variable at the same time I stored the work session variable...it turned the timer into 5:59 instead of :59 followed by 5:00. They have different names, I have no idea why it wants to combine them like that.

I'm considering doing other things on FCC map until the logic for this timer makes sense. I'm missing a skill somewhere. I hope it doesn't take long to find.

Sigh. I've got a headache that won't go away. It's almost November. Sigh.

Sunday, October 18, 2015

Pomodoro: Started the Start button

I didn't do a lot of coding today. I still feel bad from the day before. And money is on my mind.

Instead, I worked through more of my Git Basics course, and I started on giving the Start button some functionality. So far it changes the timer to a minutes and seconds format, with a colon. 

The rest of the time was spent writing out pseudo code for this button, writing out my steps in plain English. I wrote down the questions that came up, such as "Do I update the entire countdown area or break it up into minutes and seconds sections and update them separately?" This came up because I wondered if redrawing the whole thing every second, going from 25:00 to 24:59 for example, might actually throw off the time...I don't think it would but it seems a waste to reprint the minutes section to the screen every second when you could do it every 60 seconds. So I thought I might have to add more HTML areas that can be written to separately:

<span id="minutes">25</span><span>:</span><span id="seconds">00</span>

If things go the way I think they will I'll have to try both. The project looks less daunting now that my mind has been working on it. I just need the parts to put it together. I need to read the details on setInterval and whatever else I'll need. The rest seems to be basic calculations: check a condition, decrement a number, show it on the screen. It's GOT to be that simple. I'm amazed that a couple of days ago the problem seemed too much for me. The level doesn't seem quite as high this session.

Other details popped into my mind, like making sure the numbers 1-9 have a leading zero on them, how much this will be broken down into functions versus just throwing it all into the event, and if my code will start over with the same time if the user chooses to repeat. I did spend some time wondering if I need to add more variables, but I didn't spent too much time on that part because it's late. 

I'm glad I did that much tonight. I could have blown the whole day off and threw off my momentum, but I kept going. Write code every day.

Saturday, October 17, 2015

Small Pomodoro gains today: Real Life strikes again

It was a rough day. This place makes me sad.

All I did on the timer code was revise the Bootstrap a little (I think the centering is okay now; I hope I didn't jinx it), added a reset button and wrote the code for the reset button. Click Reset and you get the default 25 minute session with a 5 minute break. Oh, and the thing that formats the timer to MM:ss format.

I just realized I need to add Break and Session labels to the page. Hopefully that won't take all day to position properly.

In other web dev learning news I tried to configure ESlint to throw up a few less errors. It's still nitpicking me even though I changed some things (after reading some of that mind-numbing documentation), but it took 10 errors out of my sight. I wanted it to skip the double/single quotes and what it thinks are the right amount of indents. It still counts the damn indents and I'm not going through each line if it's not affecting the operation.  I had a curse laden paragraph here, but I erased it and put this here instead.

That's all I've done. I just want to recover.


Friday, October 16, 2015

Pomodoro Clock, Scope, and knowing it's not just you

I've made some progress the past couple of days. The page itself doesn't look that hot, but it's giving me something to test my javascript code on.

I coded the click events for the increase and decrease buttons. I wanted to get those number values to use later in the script, but I couldn't get it because you can't return a value from a click handler (not in the normal way, anyway). I googled a while trying to find the answer, but the results didn't apply to my situation.

Eventually, I thought maybe I didn't declare my variables in the right place, because I was thinking "if they're in the global scope the values should update, right? Heey, wait a minute.." 

Ends up the variables weren't global but inside the jQuery function. I guess this was a scope/hoisting problem. 

I put them outside of the main jQuery function and bam, I can get my numbers back. Grr.

I (thought) learned this lesson a while ago, and also forgot it since I was out of the habit of hacking away at projects like this. Basic Intro to Programming taught me declare your variables and functions first and the the program instructions go after that. This might not be the hard and fast rule anymore but it's what my program needed. So I did it!

During daylight hours I got to go into the Free Code Camp chat room and after a while some people showed up that were working on the same project, so I got some hints on what direction to go into. I also had a short chat on Twitter with a follower (ugh, that sounds so pretentious) about the learning process. She said she felt better knowing that other people have that "I SHOULD KNOW THIS BY NOW" moments when they're working on stuff and that people's ability to work through a problem seems to ebb and flow. Some days you're hot, some days you're not. I wondered, because most of the people I see online portray it as this smooth, steady climb up instead of a series of hills and valleys. Which I hate because I feel like I'm not doing enough. Maybe they're telling the truth, but if that's the case everyone on Instagram has a charmed life full of adventures.

Good times.

Wednesday, October 14, 2015

Free Code Camp Pomodoro Clock

On to the next project. It might be a doozy.

FCC changed the lesson plan again so the weather app got moved on to a more advanced stage. I might end up doing it anyway after this, but considering I was a little flustered on starting that, I'm glad to have the change in focus to a timer. Not necessarily better but different.

The past couple of nights I was thinking about where to start. I'd opened up a bunch of articles about JavaScript dates and build a timer tutorials but didn't know what to look at first. My cold was still going pretty strong and I fell asleep trying to get the foundation laid in my mind. Which was a good thing because I woke up feeling better.

You get put out for a week and feels like an eternity when you try to get back into things. But tonight I talked through some of it out loud and the problem started to become more simple. Breaking things down to pseudocode in my head. Basic things like "I have to convert the minutes to seconds", "I have to display those seconds on the screen...some sort of function that will decrement the number then write to the screen in real time, yeah?" Things like that. Getting to the heart of the matter instead of being overwhelmed by the fancy looking finished page I have to reverse engineer. 

I typed out what I need to do, possible functions, variable names. I got over some small hills and that felt good. Then I started laying out a simple form and that got hairy. I worked up something that looks like it will be functional for now in that divtastic Bootstrap way. It took a while, as usual but the cosmetics will come at the end.

I'm giving it a rest for now so I can end on an up note. I have something in print, which is better than having nothing. I hope to start the Javascript next session.

Sunday, October 11, 2015

Colds suck. Plus a list of random home remedies.

Last week, I caught my mom's cold. And that's after avoiding her plague like the plague and listening to her cough and hack for a week. Still got that telltale tickle in the back of my throat that wouldn't go away. I hadn't been sick for about 5 years. This year just stomped all over that legacy. And now it's back for more.

This past spring my workout regimen was disrupted by a six week long coughing fit. I was afraid it would happen again. I hoped for the best and started drinking hot liquids and bottles of water in bulk. Lots of tea, including good old ginger and lemon infusions. Honey for the throat, bought cayenne pepper and put on it on everything I could think of (my appetite is pretty low, so sometimes...I mixed it with the honey and shot it down) to keep the gunk level low. Neti pot twice a day. Bundling up and sweating. Good old sweating. No fever, just sweating.

I also bought some cold meds, hoping that they would work this time. I bought some generic Theraflu, the powder that you mix with hot water. It seemed to work in the past. I look forward to them almost. They're not as strong as they were when I was a kid, but it still does something. 

I'm still coughing, but it's not keeping me awake and things seem to be turning around. I slept in for about three days, not because I really wanted to (I was going to watch tutorials if I couldn't sit in the chair to code but I only got a couple in before I drifted off the first day) but rest is part of the equation. Sometimes you're  forced to stop and take a break. 

It's been about six days since that first itchy throat and I feel better. Trying to catch up on my learning and keeping things quiet. I may have nipped this thing in the bud. Hopefully this coming week I wake up with that suddenly normal feeling again. Mom's still hacking up her lungs from time to time, but I'm glad I'm fighting whatever this is off. 

Walking Dead season premiere is tonight and that's probably all I have to look forward to, besides more waking up and not knowing what time it is.