Multicolored feather and text: "The Apache Software Foundation"

100 Days of Code, Day 3: Fighting Apache and Using Git with BitBucket

Day 3: December 29, 2017, Friday

Today’s Progress

When I worked on WordPress sites in the past, I didn’t follow best practices – or even good practices, for that matter. Instead of working on a local copy and pushing my changes to deployment after making sure everything was good, I worked on the live code. It always ended up working out for me in the end, but since I wasn’t even using source control at that point, I was playing with fire.

So since I’m building my portfolio site in WordPress, and since I think I’ll be using it for a potential client’s website, I’ve decided to start out the right way by building the site locally, accessing it for testing via a local Apache server. I installed MySQL, PHP, and Apache from scratch (rather than packaged together as one product) and everything looked good; I was able to pull up the home page with no issue. But then I tried clicking through to another page on the site and received a server error.

Googling gave me answers, but none that seemed to work for me. I ensured that mod_rewrite was enabled on my local Apache server. I added a chunk of code to the WP installation’s root folder .htaccess file, then deleted the file together; neither of these actions got the site to load. I finally determined (thanks, as per usual, to a StackOverflow answer) that I had to edit a core Apache configuration file by adding a bit of XML. While hunting for a solution, I read that .htaccess files hurt performance and should not be used when you have access to the server’s root files (but are perfect for a situation such as shared hosting). In the end, I got my local installation running smoothly with more SEO-friendly permalinks and learned a bit more about Apache in the process.

For the first time, I’ll be tracking my progress on this site via Git on a private Bitbucket-hosted repo. I’ve used it previously for one other repo, but haven’t messed with it in months. I’m initially impressed with the interface and the ability to connect a Trello board so you can access it from within the app without needing to switch tabs. Of course…you can always just switch tabs, so you can have Bitbucket open on one monitor and your Trello board on a second. Realistically, I figure I’ll keep a Trello tab open, but I’ll give the built-in version a try to see if it offers any benefits.

Thoughts

I am now becoming familiar with how to restart Apache, because I’ve done it about 500 times at this point. My progress lately has been at a low point, but I’m still committed to furthering my education and increasing my competency as a developer. I’ve got a quote due to a client next week; I’ll be so excited if I get the contract, but won’t let it get to me if I don’t. The whole process of consulting and researching and setting the groundwork for processing future projects has inherent value, I think.

On a side note, one of the real bonuses I appreciate about logging on the WordPress platform is the word counter at the bottom right of the browser window. It was much easier to get lost in a long-winded rant when I was writing my posts entirely in a text editor. Even if I run long in what I’m saying sometimes, it’s nice to be able to just gauge at a glance the length of the content I’m currently working on. Sometimes I wish I had the time to write more well-researched posts, but that takes a good chunk of time, and it’s difficult enough for me to crank out these mostly off-the-cuff posts. I’m aiming for as daily as possible (I’m missing the mark so far), and spending too much time on a post would end up in me posting only once every week or two. Time spent writing is time I could be spending coding or learning. It’s a balance I have to strike.

Link(s) to Work

Still none!

Advertisements
Vue.js logo

100 Days of Code, Day 2: Vue, me, and PHP

Day 2: December 25, 2017, Monday

Today’s Progress

I’m part of a Discord group of developers where people talk about coding things and collaborate on one another’s projects. I messaged asking if anyone needed help with JavaScript stuff, and one of the members responded with a project in PHP that he needs to convert to JS, using the Vue framework. I admittedly have almost no experience with that framework, but I decided I’d give it a shot anyway.

In the process of trying out Vue, I decided to also give JSFiddle (rather than CodePen) a try. I’ve seen it mentioned quite a bit, but never really used it. As it turns out, I much prefer it. Simpler, better interface, more responsive. As of now, it’ll be my default web-based editor when I’m working on little ideas that don’t warrant a full repo or directory on my local machine. I thought Emmet was one of CodePen’s killer features, but JSF features it, too. For how I use it, I just think CodePen is a bit much.

The PHP to JS conversion project is not the most complex thing I’ve ever seen, but it’s a solid intermediate level of coding. I’m familiar with PHP, but not intimately so, especially when it comes to PHP authentication. In order to work on this project, I cloned a Git repo to my machine and started digging through the code. I’ve cloned my own projects before, and a few repos owned by others, but those were usually for the purpose of having my own copy rather than modifying the code to check back in via pull request.

The experience of working with Vue has, so far, been a pleasure for me. I’ve had a minimal amount of experience working with React and Angular; it seems most comparable to Angular upon initial evaluation, and I just enjoy the process of writing with it better than React. That said, the extent of what I’ve written so far has strictly been limited to their demo examples (with some modifications for experimentation purposes). I’m especially interested in the Vue v-model attribute, which allows for two-way data binding similar to Angular. For example, you could have a text input field which is echoed elsewhere on the page as you type rather than upon pressing submit. Very cool.

When thinking about potentially having multiple clients with multiple WordPress installations to periodically update, I started thinking about how to unify them all on one page. This led me to the ManageWP product, which in turn led me to the WordPress CLI (Command Line Interface) utility. I haven’t spent much time with it, but I can envision incorporating it into my workflow in the near future.

Thoughts

I like Vue, so far, but I’ve got a lot of reading and practice to do before I incorporate it into a legit app. One step at a time. PS: Merry Christmas, if you’re into that!

Link(s) to Work

Still none yet, but soon.

Close-up photo of Nintendo Gamecube reset button

100 Days of Code, Day 1: Hitting the Reset Button

Sometimes you need to unwind and hit reset.

I’ve been feeling the creeping sensation of burnout lately. For months, I’ve been spending the majority of my waking hours listening to podcasts, reading articles and tutorials, watching videos, taking courses, talking about, and thinking about coding – when I wasn’t actually coding. I’ve learned an immense amount and feel pretty confident in my abilities, but I haven’t allowed myself much breathing room. I felt the burnout coming, and I knew I needed to give my mind a rest.

This was a little bit of a bummer because I missed over a week of 100 Days of Code logs, but I’ve been sporadically missing logs and generally playing by my own rules rather than Alex Kallaway’s official version. I kept the count going because the challenge often really pushed me to sit down and code even on days when I just wanted to be lazy and mindless. I figured, once I’d unwound a little and rebooted my mind, I’d come back and resume the 100 Days challenge where I’d left off (over 80 days in).

But I felt disconnected from my last update (because I’d done quite a bit worth writing about in the meantime, whether I’d been logging it or not), and the time gap was so large that I decided to do what I’d been thinking about doing anyway – switch back to my WordPress blog for logging my progress – and restart the challenge on this platform rather than a Markdown file on Github.

So without further ado, here’s my log for the 100 Days of Code, try number two, day number one.

Day 1: December 21, 2017, Thursday

Today’s Progress

There’s a lot I’ve done that I haven’t logged about, and I don’t particularly feel like backtracking to catalog it all (which demonstrates the value in logging daily/more regularly), so I’ll just start with my most recent updates.

I’m currently focusing on learning MySQL. I tweeted about this and received a response from a couple of followers suggesting that I should opt for another database, namely PostgreSQL. I definitely want to learn it, especially after reading a comparison of the two databases’ features, but I’m currently working in WordPress, which is based on MySQL. Even if I end up relying on another database in the future, I do believe that having MySQL skills in my tool kit will benefit me.

On a related note: after much deliberation on the matter, I’ve decided to base my portfolio in WordPress. I feel kind of like a traitor, since I’m currently learning how to code in scratch HTML/CSS/JS, but past experience with the platform leads me to believe it’ll be faster and easier to get running and maintain, even if I intend on hand-coding websites for clients otherwise. Shouldn’t I  be showing off the kind of work I’ll actually be doing? Well, maybe. But in the real world, most clients won’t be inspecting my source code to detect whether my content is WordPress-based. The most important things, I believe, are presentation and results. Furthermore, there will likely be many clients for whom WordPress is a more suitable option than a hand-coded site which I’ll have to update for them whenever a change needs to be made (though I’ll still need to check in periodically to update WordPress and fix any issues caused by potentially breaking changes, one of the clear downsides of the platform).

I may, at some point, decide to overhaul my site by hand. For right now, I just need something that’s live. I want to have some business cards printed, but I first need to have a website I can put on ’em. WordPress is going to help me achieve that goal much more quickly, even if it makes me feel like a phony.

Those who have been following my logs may remember me talking about my first potential client in half a decade (a friend who saw me cursorily post on Facebook that I’m back in the development game). I consulted with her via phone, sent a quote for a redesign, and then she notified me that her company had decided to put the project on hold. I was a bit dismayed, and I wondered if my pricing had something to do with it. I quoted a much higher price than I ever have before, but I was previously quoting such a low rate that I was lucky to scrape by at minimum wage after taxes and other expenses were taken into account. I felt that the price I presented was both fair and lower than most other developers/agencies (outside of Upwork) would offer. She actually admitted to me that the quotes they’d received were in the tens of thousands of dollars, which gave me confidence when I presented my own.

Earlier this week, she emailed me again to get a quote on building a new site for another branch of her organization. We had a brief phone call yesterday to talk about some of the details, and I’m waiting on her to get back to me with information she promised to provide to aid in generating my estimate. She also said that one of her coworkers may be contacting me separately for a personal website. I don’t want to get my hopes up, but this is a very promising lead (two, actually). I’ll keep you guys posted.

Thoughts

It’s good to be back logging, especially on WordPress. The process is still a pain in my ass, because it’s time taken away from doing actual coding/research stuff. But I do believe in the value of reflecting on what I’ve done for my personal benefit, and I’m hopeful that the people who read my logs will be able to take something away from them (assuming said readers are on the same journey into developerhood that I’m on). Soon I’ll return my focus to freeCodeCamp to finish styling my weather app for submission. I can’t wait to finish up that curriculum, close the chapter, and get my front end certification.

Link(s) to Work

None yet, but soon.

Breaking Linux and returning to Windows

For the past couple of months, I’ve been using Ubuntu Linux. I love it. I’ve been using Windows almost exclusively since 3.1, but I’ve found that Ubuntu 16.04 LTS is amazingly good for development purposes, and so good that I’ve been using it for everything else, too (even though I have my machine set up to dual boot with Windows 10).

I decided I’d try switching from the default Unity GUI to GNOME, which is older and preferred by quite a few longtime Linux users. I used it for a few days and just didn’t get a good feeling from it, so I tried switching back…but I did something wrong and am currently unable to access my Linux installation via GUI (and when I use recovery mode to login as root, it keeps automatically running and returning to the recovery menu). I’m sure I can fix it with enough time and energy, but for the time being I am back on Windows. Oh well. It’s not as fast or convenient, but it works well enough. I already find myself missing Linux’s terminal.

I haven’t been blogging as frequently lately, but I haven’t fallen off on programming. Save for about a week where I was temporarily dealing with Hurricane Harvey (which, thankfully, I made it out of without loss of life or property), I’ve still been working on something code-related every day. I’m about 26 days into the 100 Days of Code challenge as of writing this post, and that’s the primary reason why I haven’t updated here more.

Between logging my progress for that project (which you can read here), actual coding, reading, raising a baby, applying for jobs, interviewing for jobs (not code-related, at least not yet), and doing everything else required of me in the Real World™, it’s hard for me to get around to posting here as often. Speaking of which, I’ve got a third interview today with a law firm (following a positive phone interview and in-person with the firm’s owner and associate attorney). After three months of unemployment and a diligent effort to get a job in an unfamiliar city, I’m hopeful that this will be my way back into the work force. The good part about it is I’ll no longer be stressed out about having no income; the bad is that I’ll have less time overall to devote to advancing my skills, but I’ll still try to squeeze in at least an hour a day. I’ve developed a pretty good habit of near-daily learning and I wish to keep that going so I can achieve my ultimate goal of breaking into development as a professional.

I’ll write a post in the near future detailing what I’ve done on my first game, Chicken vs. Egg!, but in the meantime you can catch up via my 100 Days log or try it out yourself via Github. It’s bare bones, but as it stands it’s an actual playable game. I’m pretty proud of my progress so far, but there’s still quite a lot of stuff I’d like to improve upon.

I’ve got to go get ready for my interview now, but I’ll be back with more updates soon!

P.S. Fun fact: WordPress just informed me that this is my 10th post!

Chicken vs. Egg! v0.1: Now with MORE movement!

It’s been several days since my last post, and I’ve been up to quite a bit – I don’t think I can cover it all in this post, but I’ll hit on the main points.

I took a little break from Chicken vs. Egg! to return to a website I first discovered probably a decade back when I was first learning Python – it’s called Python Challenge, and it ate up a lot of my coding time since I last posted. It’s a very basic-looking website with levels you can only clear by implementing a programming solution – for example, one level has a picture which links to another page when you click it. That page contains a picture which links to yet another page, and so on a couple hundred pages deep until you finally reach the solution. Sure, you could spend a decent chunk of time clicking through manually – but the idea here is to learn how to load up the pages via a script and click through automatically so the program does all the work for you. It truly is challenging, and I enjoy it quite a bit. That’s only one example; it gets steadily more challenging as you progress. I highly recommend it if you’re looking to increase your working knowledge of Python when applied to semi-real problems.

chicken-movement-demo-3

I ended up falling asleep early a few nights ago and broke my 100 Days of Code streak, but I got right back to it (here’s a link to day 15). Well, I’ll clarify – I’ve still been working on code every day, but I forgot to log and upload yesterday and didn’t feel like backtracking, so I just decided to write it off as a free day. Today I made some good progress on CvE! – I started refactoring the code into much-needed OOP format, starting with creating a class for the Chicken. I still need to handle the Egg, but now that I’ve got the Chicken class working, I think it’ll be a piece of cake.

Once I merged the branch I’d made for writing the chicken OOP code, I moved on to adding vertical movement for the chicken, which I was able to implement in no time (I’ve added a new GIF for your viewing pleasure). The program is still a baby, but it’s really starting to take shape. I decided to go ahead and call it v0.1 – the first program I’ve ever tagged with a version number! It’s something I want to get in the habit of doing.

In addition to learning how to tag the version on git, I also learned how to reset to a previous commit, how to compare code at various points (rather than the currently staged version vs. the previous commit), I’ve been getting better at branching regularly, I learned how to push a branch to Github (which I didn’t realize hadn’t been happening automatically), and I learned how to correct a prior commit message. I’m pretty amazed at the depth of this tool, and equally amazed that it’s available for free. It’s becoming less scary to me as it becomes less and less of an unknown quantity.

Tonight I finished refactoring my code to make the Egg class and an eggs array, where I should be able to store all of my eggs (once I have multiple flying across the screen at any given point). Next, I plan to work on collision detection, random generation of the eggs, and getting them to fly across the screen (perhaps with rotation). I also want something more than just a black background, but I’ll save that for the polish phase. I’ll check back within a few days to let you guys know how it’s going. In the meantime, you can check out the repo on Github here, if you’d like.

Chicken vs. Egg!: Now with movement!

The latest evolution of Chicken vs Egg! (yes, the exclamation point is part of the title!) sees the game’s protagonist – the humble chicken – gaining the ability to move about in two directions. (You can find CvE on Github here)[https://github.com/jaredcaraway/chicken-vs-egg].

I’m pretty excited about this development, because it works pretty well. I’ve detailed the latest changes in my 100 Days of Code log for today, which you can read here. Since I’ve got a separate branch aimed at setting it up in OOP mode, I went ahead and removed the unused classes from this branch, which I’d set up with the intent of getting the chicken to change direction according to corresponding arrow key presses). In my last blog post, I talked about a very simple text-based demo I wrote to practice some basic OOP concepts using dogs as my gimmick. My main goal at present is to just get this thing working, but I may find in the near future that I need to go ahead and refactor my code to provide for OOP functionality. For now, I think I’ll proceed procedurally.chicken-movement-demo

If I’m being honest, the main purpose of this post was to show you a GIF of my chicken in action (which I created using a nifty Linux tool I discovered tonight called Peek; couldn’t have been simpler to use). And so here you are: here’s my chicken in action, neatly constrained by the bounds of the window within which it lives.

Upcoming features I hope to implement soon include (but are not limited to):

  • Up/down movement
  • Sprite animation
  • Basic egg movement in a straight horizontal or vertical line from one offscreen side to the other
    • Make those eggs rotate, eventually
  • Collision detection
  • Background
  • Onscreen counter
  • High score functionality
  • Power-ups

As a side note, I wanted to say how much I appreciate you guys checking in to read my posts. I’d honestly be doing this anyway even without an audience, but knowing that I’ve got people out there who are actually interested in what I’m saying is a great motivator to keep doing it. It keeps me accountable. My audience is still relatively small, but it’s been growing steadily. So thanks, my dear reader friends (if you’re reading this right now, I’m talking to YOU)!

I’ll be back soon, probably with more GIF goodness.

 

Further experimentation in Python and OOP

While there are no notable updates regarding my first game, Chicken vs. Egg, I did write a new Python script today in an effort to hone some of the skills I’ll need to use as I move forward.

It’s called “Dogs,” and it serves no real purpose aside from being a teaching tool for myself. It’s a command line-based demo which works like this:

  1. It prompts you to enter a dog breed and a name
  2. It creates an object instance of the Dog class using the provided parameters and adds it to a list of dogs you’ve created during the program
  3. A menu prompts you to list all created dogs, to create another dog, or quit

You can check it out on Github if you’d like. There’s no real-world application for this program that I can tell, but it was a valuable learning experience that helped me work through a problem I encountered when thinking about the CvE source: how to create an undefined number of objects without explicitly declaring a variable in which to store each one. What I mean is, using the Dogs program as an example, I wanted to find out how to avoid doing something like dog1 = Dog(“collie”, “Sparky”) for each dog I wanted to create.

It turns out that the solution is to create a list and append a new class instance to the list each time it’s created. This will be indispensable as I develop CvE – I have no idea how many different eggs I’ll need to create for any given game, so it would be impossible for me to manually instantiate the various Egg objects. However, if I can populate them into a list as they’re created, I can easily cycle through and update their positions, check for collision, check when they’ve gone offscreen, and remove them once they are no longer needed.

I’ve been missing JavaScript these past few days, but I think it’s best for me to focus on one thing at a time. I’ve made some good progress in JavaScript in the past month or so, and now my goal is to make a game. I do want to continue my journey toward JS mastery, but I think the path of least resistance for my current goal will be Python using Pygame. If I decide to create another game after that, there’s a really cool JavaScript game framework called Phaser which I’m interested in trying out; it would allow me to make a browser-based game using HTML5’s canvas, but I think it would also require a lot more overhead to learn.

Before I wrap up the post, I’d like to add that I’m 10% of the way through my 100 Days of Code challenge (I just posted the log for day 10 here). I’ve still got a long way to go, but I’m encouraged that I’ve made it as far as I have already.