Thursday, March 30, 2017

Rails Day 5: VirtualBox It Is, Then

After a lot of fiddling with Docker, I have decided to stick with a simple development environment in a customised Ubuntu box in Vagrant.  I will get back to Docker, but for now I'll stick to what I know and get on with the business of learning Rails properly.

I find sometimes when I'm learning something new and difficult that I have to bash away at it, fail, and then come back a week later.  The concepts haven't quite come together in my head and my work blocks get chewed up without my having much to show for it.

In the meantime, I have a functional Rails development environment with Postgresql running in Vagrant/VirtualBox:


Wednesday, March 29, 2017

Rails Study, Day 4: Still Working on the Dev Environment

So far I have spent time on the following:

  1. Vagrant
  2. Docker
  3. Digital Ocean Droplet
  4. Heroku
However, I'm going to take a step back and reconsider what I'm trying to accomplish.

What is my deliverable?

I want to build a Rails site, hosted on Heroku, that showcases my solutions to puzzles from Advent of Code.

How is my work supposed to flow?

Images, containers, Atom, etc.
  1. Development environment (DE) is separate from the host operating system. (Docker container or VM)
  2. Text editor (Atom) has read/write access to the code in the DE.
  3. The DE can be easily duplicated for a sandbox server.
  4. Code from the DE can be pushed to Github; from Github, the latest code cloned.
  5. Changes from the DE can be pushed to Docker Hub; from DH the latest version of the DE.
  6. Production code from the DE can be pushed to Heroku; from Heroku, the latest production code, although that should be available in Github.

What are the specifications of my development environment?


  1. Version control of all relevant packages.
  2. Read/Write access to development environment from host.
  3. Access to online platform (Github, 
  4. Available locally, without a constant internet connection.
  5. Totally accessible by Atom text editor on my host machine.
  6. Can upload code to Heroku, pull the latest code from Heroku, and push updated code to Heroku.
  7. Can push updates to the environment to a repository.

What shall be my development environment?

  1. Docker container for the DE, with all the necessary packages installed.
  2. Atom text editor installed on host.
  3. FTP access between DE and host.
  4. Github access from DE.
  5. Docker Hub access from DE.
  6. Heroku access from DE.

Rails Study, Day 4: Docker and Vagrant


I came for Rails, I'm working on DevOps.

The purpose of this post is to give an account of setting up my development environment in order to study Ruby on Rails.

I am already familiar with Vagrant, and initially thought I would spin an Ubuntu 16.04 box and work in that.  However, the obvious and numerous disadvantages of working in a virtual machine on a local hard drive demanded that I find something better.

So I decided to finally invest some time on Docker, and I have to say, once I wrapped my head around the concept of containers, getting started seems fairly straightforward.

Initial Steps:

  1. Install Vagrant on my host
  2. Install Docker on my host
  3. Spin up an Ubuntu box in Vagrant
  4. Install Docker on my VM
  5. Create an account on Docker Hub
  6. Download the Heroku Cedar 16 image
  7. Create a private docker repository on my host
  8. Run the Heroku Docker image
  9. Push a modified Docker image to my own repository
  10. Pull the modified Docker image to my VM
And so forth.


As I want my development environment to mirror Heroku's settings as closely as possible, I decided to see what the Heroku website itself has to say on the matter.

My inclination was to keep it simple by using Vagrant, but Heroku's Cedar stack is available as a Docker image, so I will go with Docker instead.  I've been meaning to familiarise myself with Docker for a while, so this works for me.

Official Notes for Docker are available from Gist.

This videos helps to demystify Docker.



I'm now looking into simplifying it further and using a Droplet from Digital Ocean.

Monday, March 27, 2017

Rails Study, Day 2: Rails Install Fest

I have started a demonstration blog on Rails according to the instructions on the Ruby on Rails Install Fest, my first proper attempt at building something substantial on Rails.  My goal is to build a website that showcases my solutions to Advent of Code, but the first step is to have a site running on Rails, and in my case, hosted on Heroku.

Wish me luck!


Update:


Update:

Had to solve problems with installing the following gems:

  • json
  • pg
The json gem was set to 1.8.3, but I solved it by forcing the version to 1.8.5.
The pg gem was able to install after I properly re-installed Postgres on my machine.

Update:

Now running into problems with Postgresql.

Friday, March 24, 2017

Rails Study, Day 1

Not much to report, got my Rails up and running, and worked through two chapters of Rails 4 in Action.

Rails Up and Running

There's nothing like the hum of a mint Rails installation starting up for the first time.


Silly and Serious with Emojis

Updated my Twitter profile with flag emojis denoting the languages I have at least basic proficiency in.  By all accounts, I'm good with languages; maybe one day I'll work out how to share my method with others.


Thursday, March 23, 2017

Ruby Achievement Unlocked, Time for Rails

Having reviewed my solutions to the first three Days of puzzles of Advent of Code, I am now comfortably proficient in the fundamentals of programming in pure Ruby.



When presented with a problem, I am confident that I can do the following:

  • Define the problem
  • Describe the solution broadly in programming terms
  • Denote the likely classes and methods to be used therein

Thereafter, I am now confident that, given enough time, I can solve the problem.  There is room for vast improvement, but that will come with time.

I really enjoy the daily solution of programming puzzles, and would love to solve all fifty; however, my duty is to prioritise my studies according to optimal employment criteria, and there aren't a lot of jobs going for junior developers who specialise in solving fun puzzles in pure Ruby.

Having passed this milestone in my learning, I am now ready to hit the books again.  My study plan encompasses the following:

  • Build a website in Ruby on Rails to showcase my Advent of Code puzzle solutions.  This includes the following:
    • Deep knowledge of Rails
    • Proficiency in Javascript
    • Proficiency in JQuery
    • Proficiency in HTML/CSS
    • Proficiency in PostgreSQL and/or mySQL
    • Writing automated tests in RSpec (my preference) or Factory Girl
  • Host the website on Heroku
  • Additionally, I will further my knowledge of the following:
  • Coffeescript
  • Haml
  • Amazon Web Services: it would be good to know which services are of the highest priority, as one could spend a lifetime on there.

To gain experience in upgrading older Rails versions, I could probably clone the source code of an existing Rails to a virtual machine, on which an old version of Rails is installed.  However, this is a lower priority.

As all who know me can attest to, I can learn and work quickly and efficiently, and am adaptable and resilient.  I also take pride in managing expectations between multiple clients and communicating with both clients and colleagues.

For the next couple of weeks I will focus primarily on the Rails framework by working through Ryan Bigg's promisingly large tome: Rails 4 in Action.  In this way I expect to establish a thorough grounding in Rails and also a gain a perspective on the changes from Rails 4 to Rails 5, which could come in handy if I ever work on a legacy codebase.

Wednesday, March 22, 2017

Advent of Code, Day 3: Success!

It's been a productive day of coding, although I got off to a late start.

I completed both parts of Day 3 of Advent of Code without too much difficulty.  I knew fairly well what I wanted to do for the first part and misread the instructions for the second part.  Once I understand what I had got wrong, it was simply a matter of jotting down notes and thinking the problem through.  I skimped on the testing for it, which was naughty, so I'll have to be more disciplined in the future.





Tuesday, March 21, 2017

A Work in Progress: The Story of My Journey into Software Development

Since I graduated from university (major in English literature), my work has always been in the orbit of software and IT work: first, as a technical writer, then as a computer technician, and finally as a security technician.

Over the years I tinkered with Linux and spent (too) many hours picking up tips and tricks about how to get my computer to do my bidding, rather than contort my daily use around its default settings.  This involved writing lots of scripts in Python.



However, my journey into software development (a work in progress) started in earnest in June 2016.  After talking about work with my housemate, a business analyst and his brother, a software developer, I initially leaned towards DevOps, and accordingly researched DevOps tools and theory.  I tinkered with AWS, set up LAMP stacks, got the hang of Vagrant, and taught myself elementary PHP.  I sent cover letters and telephoned an array of recruiters for guidance on how to work my way into a starting position in the industry.



After a few months it became clear to me that there is in practice no direct path for me into a DevOps role: even the most junior DevOps role requires professional experience in systems administrations or in a commercial software development environment, neither of which I possessed.



In October 2016, I reviewed my goals and decided to focus my efforts on software development instead.  After years of scripting in Python on Linux, I was already familiar with many of the fundamentals of programming, and although I did not underestimate the enormity of this task, I was confident it could be done.  I considered primarily Python, Ruby, and Javascript, and eventually settled on Ruby on the strength of the work opportunities and the community in Melbourne.  I had always loved open source and Ruby code appeals to my aesthetic sensibilities.


I went to America in November and upon my return, I started the next chapter in my journey into software development.  I completed study modules on Rails, AWS, HTML/CSS, and JavaScript.  On the Ruby side I completed the course at Code Academy, worked through 'Learn Ruby the Hard Way' by Zed Shaw and 'Toy Robot' by Ryan Bigg, and at the time of writing am currently working through the puzzles on Advent of Code.

I also make nerdy t-shirts:



Sales and Marketing

I treat this career change as a full-time job... in marketing.

My job is to get a job, and it is to this end that all my efforts in studying programming, writing code, blogging, planning, and networking are directed.  It is tricky to strike a balance, because what I really want to do is code and study to code better, rather than promote myself.  In order to achieve this balance, I manage my time carefully, work as productively as possible, and prioritise my activities rationally and with discipline.  From day to day, I can give a full account of where I was, what I did, what I got done, how much time I spent on each task, and where I fell short of my goals.  The system I have devised for myself is the fruit of many years of research, trial and error, and it comprises the following:

Mindmaps and charts for setting goals:

Storyboarding and progress charts for reviewing my progress:


Kanban for managing tasks and prioritisation:



A daily schedule:



Pomodoro method for maximising productivity throughout the day


And blogging, of course:



By means of these tools and methods, I generally complete 12-16 pomodoros per day of productive labour across the following categories:

  • Coding
  • Studying coding
  • Blogging and planning
  • Job-seeking
  • Translation from English to Lithuanian
  • Studying Lithuanian grammar
  • Daily exercise
  • Daily strength training
  • Creative writing

In addition to these, I cook all my own food and keep house.

I attend all of the social and networking events related to Ruby and Rails, and make a point of speaking to new people.  Although I prefer to listen to others' stories, I understand the importance of putting myself out there and share my story; I routinely ask for criticism and make a point of highlighting the shortcomings in my approach that I can detect, in the hope of eliciting further constructive criticism.



From 06:00 until 18:00, Monday to Friday, it is a race against the clock to see how many blocks of work I can complete, and within each work-block, that same race is run at a sprint to complete a specific task or solve a problem.  I can say without a doubt that I have never worked so productively and efficiently, although I never give up the pursuit of working smarter and doing things a little better each day.


Friday, March 17, 2017

Inbox Zero

Empty inbox: A sight so rare and beautiful, it must be brought to the attention of all and sundry.


Bask! Bask in its brilliance and know that you too may achieve it one day.

Thursday, March 16, 2017

State of the Mission, Thursday 16th March 2017



I have been busy on the part of my mission that I love the most: coding.

However, it's time for a review and some planning for the weeks and months ahead.

ACHIEVEMENTS


DISAPPOINTMENTS
  • Not making the cut at Zendesk.
  • Not making the cut at Envato.
WHAT I'M DOING RIGHT
  • The quality of my code is rapidly improving, and there is every indication I'm doing all the right things in this regard.
  • Excellent time-management and high productivity during work periods.
WHAT I NEED TO DO (BETTER)
  • Start building sites in Rails.
  • Further my knowledge of Javascript.
  • Further my knowledge of CSS.
  • Further my knowledge of HTML.
THINGS TO CONSIDER
  • Branch out my search to Javascript jobs?
  • React.js?
  • Node.js?
  • Python?

Wednesday, March 15, 2017

4 Stars Won, 46 To Go (Advent of Code)

As it turns out, my code works very well, as long as I remember to make the necessary adjustments in the settings.


Tuesday, March 14, 2017

Advent of Code, Day 2

Today was a fairly productive day.  I got off to a slow start, but I got back into the problem fairly quickly and managed to solve the first of the two puzzles of Day 2 of Advent of Code.  I'm still stuck on the second puzzle, but I believe the key lies in modifying the regex rule that's being applied to the input data.  I expect to get it done tomorrow morning.


Advent of Code: Day 2, Part 1


Tuesday, March 7, 2017

Advent of Code Success!


To a seasoned programmer, it's a simple puzzle, and my solution is more elaborate than strictly necessary, but I set myself a goal and I achieved it!








Source code for my solution is here: https://github.com/clockworkpc/advent-of-code

It draws heavily on the work of Ryan Bigg in the Toy Robot, mentioned before on this blog, but is considerably modified in order to give a full answer to the puzzle.

Today's success coincides with the completion of another progress chart:


Working in pomodoros is hard to sustain all through the day, especially when a tricky problem crops up -- then it's tempting to stay in my seat and stare at the screen while I turn the problem over in my mind.  When I get up, I feel as if I'm wasting time, but that is a misperception.  My records show that I spend very little time between work blocks when I'm working my way through a tricky problem, and exercising the discipline to move away from my desk and scribble on the whiteboard always pays off.

Monday, March 6, 2017

Fairly Productive Day



I climbed back in the coding saddle and finally started Advent of Code in earnest.

The first challenge is to calculate distance using taxi geometry.  To this end, I have drawn heavily from Ryan Bigg's Toy Robot solution in putting together a city grid and defining the behaviour of a city explorer who will follow the instructions.

So far I have the following:

  • City grid
  • Explorer
  • Simulator

I still need to work out the following:

  • Receive command line instructions
  • Convert the directions from the challenge into command line instructions

If all goes well, I should complete the challenge tomorrow.

Had to skip my exercise in the morning, and also no afternoon tea, but otherwise I made fairly good time.

Creating a City Grid with Negative Axis Values



From the Toy Robot solution by Ryan Bigg, I learned how to create a table starting at 0,0 in the bottom left corner, which has valid positive coördinates only:


However, for the solution of Day 1 of Advent of Code, I had to make a modification.  I don't know how big the city grid needs to be, nor whither the explorer will be taken by the directions.

The most practicable solution is to place the explorer right in the heart of the city, but that can be achieved in one of two ways:

Positive Values Only:
  1. Create a city axis that runs (0..latitude) west-to-east and (0..longitude) south-to-north.
  2. Place the explorer at the coördinates (latitude / 2), (longitude / 2)
Positive and Negative Values
  1. Create a city axis that runs (-|latitude| .. latitude) west-to-east and (-|longitude| .. longitude) south-to-north.
  2. Place the explorer at coördinates (0,0)
I opted for the latter, as the first option would could give me awkward starting coördinates such as (250.5, 250.5) if the city grid were initialised with odd numbers. (501, 501)

Also, it seems neater to me that west and south should be negative integer values, east and north positive.

So here it is:


1,050 hours

It took me 13 working days to complete my first 100 "work" pomodoros as a Junior Software Tester at Profectus Group.  Much of ...