Showing posts with label adventofcode. Show all posts
Showing posts with label adventofcode. Show all posts

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.

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.

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.


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:


Sunday, December 11, 2016

State of the Mission: Sunday, 11th December 2016

Week 50 of 2016


Mission DevOps

Work Completed

I started Learn Ruby the Hard Way, got up to Chapter 40, and have been posting about my learning along the way.

Plans for Next Week

Focusing on Learn Ruby the Hard Way is proving as beneficial as I had hoped, and I have every reason to complete it by the end of Week 51 of 2016.  Thereafter, my focus will be on PROJECTS, i.e. something to show for all my efforts.
  1. Transferring my Pastebin to Gist using APIs.
  2. The Toy Robot Challenge
  3. Advent of Code
  4. Starting my job research web scraper and analysis tool.
There is every reason for me to get started on substantive projects that I can put on Github and then direct all and sundry to.  Owing to the paucity of code in my Github, I have been reticent to contact potential recruiters and apply for jobs, but come the last of December, business shutting down notwithstanding, I should have every reason to send out missives and apply online. 

Special Project

My super-special-but-perhaps-not-so-top-secret project is ticking along on schedule.  I have a few more weeks to go, so that's all I've got to say about it for now.

The Odessia

Not much progress on the Odessia this week, but my schedule will permit a lot more creative writing time soon.

Personal Matters

Just the usual washing, cleaning, tidying for the most part.  I have been in touch with uncle, who has been unwell, and attended to the usual bits and pieces that crop up.  One day, when I'm very wealthy and successful, I will have a secretary to handle these matters.





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 ...