Plan and done for September-01-2017

What will I learn today?

  1. I am moving towards application to Microsoft LEAP program - http://www.industryexplorers.com/applicants. What should I do to fit better? My deadline is 15 September 2017.
  2. FreeCodeCamp project: Wikipedia viewer.

Done

  1. User Story:
  • I can search Wikipedia entries in a search box and see the resulting Wikipedia entries.
  • I can click a button to see a random Wikipedia entry.

Completed initial search functionality. Wikimedia engine contains tons of functionality. Looks intimidating at first. There is a need for less twisted documentation, something like a roadmap where you can get the overall view before diving into details.

My idea is to display data the user is searching for right on the page. If many pages are found, then give a user the same look as Wiki gives - many topics on one page. But the overall idea is to connect voice recognition engine with wiki search to get all power of current state of AI.

Plan and done for August-27-2017

What will I learn today?

I am moving towards application to Microsoft LEAP program - http://www.industryexplorers.com/applicants. What should I do to fit better? My deadline is 15 September 2017.

Done

  1. How to terminate (stop, interrupt) Chrome session without closing tab? Go to

    Menu → More Tools → Task Manager
    

    find the task hanging, press End process button.

    From here - https://stackoverflow.com/a/27261978/2255031.

  2. How to calculate number of unique words in a file with *nix shell

    cat someFileName.txt | tr ' ' '\n' | sort | uniq -c | awk '{print $2": "$1}'
    

    and you've got your numbers.

Plan and done for August-22-2017

What will I learn today?

I am moving towards application to Microsoft LEAP program - http://www.industryexplorers.com/applicants. What should I do to fit better? My deadline is 15 September 2017.

Done

My resume in md: https://gist.github.com/al1s/d5a3b2fe02eaa4a75e3ab2ed3d2073a8

There are two essay topics in an application form:

Why are you interested in programming? (specify whether you're interested in Dev or PM track)

I'm interested in the Dev track.

About twenty years ago I self-studied Intel assembly language. I wrote simple utilities: a tiny module that did not let the computer slip into a screensaver. And there were many patches to game executables to get immortality or unlimited ammo. It was MS-DOS epoch.

At University I worked in my faculty computer lab as a system administrator and database developer. I took a part in the implementation of the app for monitoring student academic performance. That was the time of Windows 95 and MS Access.

Last 10 years I worked with large scale databases. We processed 2 million financial transactions per day. And there were almost 500 million in an online data warehouse. It was the time of great challenges and accomplishments. I achieved recognition as an application developer, a team-lead, and a solution architect. There I've got experience with MS SQL Server and its analytical, reporting and integration services.

About a year ago I moved from Russia to the USA I set the new goals. And one of it is to deliver value as a professional web developer. I'm stubborn in pursuing my goals so I dedicate all my spare time during the last six months to a self-studying. My accomplishments are in the next section.

Einstein once said, that if the Universe is a friendly place then we would use our technology to create tools and models for understanding this Universe. That's what motivates me - the pure curiosity about the world, about people, and tools. Ultimately all the tools we end up creating are just a way for self-exploring and self-awareness.

My recent progress and perseverance will bring their fruits. Microsoft LEAP program could become a huge leverage towards the chosen goal for me.

What have you done to expose yourself to programming so far? (specify whether you're interested in Dev or PM track)

The first web development experience I've got in 2000. I've built a personal page to satisfy the curiosity about the technologies available and share my notes with friends and family. Then there was nothing of modern stuff like ES5, HTML5, CSS3 available.

Done in the last six months: brushed up HTML skills, studied CSS, practiced Javascript.

I've started my current journey into web development with building replicas. My models were interesting demos of different kinds of page layout. The first was https://al1s.github.io/Futurismo/ where I've practiced CSS flexbox and horizontal spacing in web typography. The next was https://al1s.github.io/Jazz/ where I practiced CSS Flexbox. The model layout was built using CSS Grid, so I was curious how it to achieve the same appearance with older tools.

I spent almost half of a month moving through 30 days javascript challenge (one day, one app). It was challenging and I wrote multiple blog posts about my progress, challenges, and the ways to overcome them. Working demos are collected here - https://al1s.github.io/JavaScript30/. I haven't finished it yet for the reason to concentrate more on solving algorithms' tasks and to lean on a crisper curriculum.

The next step was a fictitious landing page. The goal was to implement it from design layout keeping all sizes perfectly matched to the original. I've practiced BEM CSS methodology, responsive, mobile-first approach. The page was built using Gulp automation and SASS CSS processor.

Along with projects I've already mentioned I'm following Free Code Camp curriculum. I've built WeatherNow app - a local weather informer (https://al1s.github.io/WeatherNow/). My notes made during the implementation I compiled in an article. I published it (https://goo.gl/4DDKes) to share my thoughts about the design process and chosen building tools. Another app is an AskWiki (https://al1s.github.io/AskWiki/). It's a facade to the Wikipedia search engine. Here I practiced working with VS Code as IDE (because Atom glitches finally started to irk and Vim or browser's dev tools are too spartan as JS IDE).

Projects:

Publications:

https://medium.com/@alstof/coding-weather-app-simple-and-fun-61078d3964f5

Certification: Coursera Machine Learning, https://www.coursera.org/account/accomplishments/verify/MBJY4S7WH9H5 Coursera Introduction into machine learning, https://www.coursera.org/account/accomplishments/verify/BWPNGQ6TEG58

Plan and done for August-21-2017

What will I learn today?

I am moving towards application to Microsoft LEAP program - http://www.industryexplorers.com/applicants. What should I do to fit better? My deadline is 15 September 2017.

Done

My tagline is "Let's look how far stubbornness and curiosity would take me". In order to prepare as best as possible I follow the plan:

  • rewrite my resume so it clearly shows my web-development skill;
  • syncronize my Linkedin profile with resume;
  • write an article dedicated to web development;
  • build a portfolio page;

I'm done with the first and just finished the draft of the third. Here is tools I used to write it:

Plan and done for July-26-2017

What will I learn today?

Dive into JS.

Done

Who this article addresses to? - developers who starts they journey. What I want to show? - System approach to an implementation. What is my system of interest? - Users who wants to check current weather condition. We've got user story list.

Implementing the FreeCodeCamp project - Local weather app.

User stories (published on the appointment page - https://www.freecodecamp.org/challenges/show-the-local-weather):

  • I can see the weather in my current location.
  • I can see a different icon or background image (e.g. snowy mountain, hot desert) depending on the weather.
  • I can push a button to toggle between Fahrenheit and Celsius.

I want to mention that I haven't seen example app (https://codepen.io/freeCodeCamp/full/bELRjV) before I've finished my initial working prototype so all considerations below are based on common sense. I want to move along the plan below to demonstrate my implementation process.

  1. Design considerations:
  • pure JS;
  • minimalistic design;
  • a11y is for accessability and it's one of the goals;
  • responsive design;
  1. Plan of the app:
  • fetch data from weather API;
  • prepare visual representation of the page depending on data fetched; * get the photo which reflect the current condition; * get the color depicting current temperature;
  • use HTTP cookie to store user scale preference - celsius or fahrenheit;
  1. Challenges and implementation:
  • CSS variables don't work with CSS SVG styles - solved;
  • Geolocation silently dies on tablets and phones - solved;
  • CORS for WeatherUnderground's autocomplete API - solved;
  • Support for a wide range of browsers - solved.

Design

Frameworks vs. Pure JS

The first thought was to dive into React to wrap my head around its basics. The second one was calm and clear: I have to implement it just with knowledge I've already got, without shiny new and appealing stuff. All new libraries are pleasure for procrastinating mind, it's not the time for it. JQuery? Why do I need it at all - current browser engines has plenty of functionality as is, without additional wrappers.

Minimum page element set

I decided to use as a current weather conditions indicator the destinctive photos of nature: clear - the view where the sky is without any clouds, cloudy - the sky covered fully with clouds etc. The photo goes to the background and above it I want to see only current time, date, location and temperature. I wanted to visually highlight temperature level so I used the box for the text block colored according to the current temperature (there is a bunch of temperature coding examples in google - https://goo.gl/hsnimK). According to the user story the app needs the toggle for different temperature scales. I wanted to see neither additional preferences tab nor a checkbox floating in a space and distracting from the pure functionality. On the other hand I had to present a user with a disctinct temperature scale symbol so why not to use such a symblol as a toggle. I could just add event listener to the sybmol, but the second thought was that it's a poor UI experience. What if I put both letters depicting Celsius and Fahrenheit scales on the page together and make one vivid and another vague to make it clear, which is currently on?

Accessibility

Accessibility aspects of the page include visual, navigation, audible sections. The visual part is about color contrast and there is a great tool from Lea Verou to check whether contrast rate in compliance with WCAG (which is decrypted as Web content accessibility guidlines by W3) - https://leaverou.github.io/contrast-ratio. The navigation part means that page is controlable by a keyboard. All three control elements of the page are native HTML control elements: button for 'Info' and scale toggles which are radio with labels. A user can hop between them with <tab> and press <Enter> or <Space> to make them act. The audible part includes aria-* tags for all elements to make it clear what scale is used now and how contol elements work. I used Chrome WAVE extension as an accessibility audit tool. There are a cople of tools to analyze web pages compliance - https://soap.stanford.edu/tips-and-tools/tools. And I used examples of aria* labels usage from - http://oaa-accessibility.org/.

(Accessibility is an important matter for me. I always notice features of physical accessibility around me and pay attention to color and texture decision in visual media - art, ads, TV. Often I notice thoughts in the background of color contrast in different media. Wish to have an app in my phone which could analize current picture and show it the way people with different visual abilities perceive. I've tried to find something like this in both app stores but didn't find any - I mean not simple color checker against WCAG recomendations but something like vision simulator which would wash out normal color perception and present you with different color world around. Maybe such app needs modern hardware and frameworks for augmented reality - ARKit like...).

Responsiveness

Responsive design means the page suits well to be displayed on any screen or by any screenless devices. The first consideration here whether content is flexible to fit different screen resolution. The second one is whether the page responds to user expectation on loading time. Chrome has built-in audit tool which shows exactly what makes a page load slow. In my case it's a usage of web fonts. Here is a great article by Zach Leatherman about web fonts optimization - https://www.zachleat.com/web/comprehensive-webfonts/#font-display but I didn't follow recomendations because a performance audit shows that the first meaningful element of the page is shown within 2 seconds including web font loading which is an acceptable result.

Through the plan of the implementation

API to get weather

My weather API is Weather Underground (WU) - https://www.wunderground.com/. Why it's not OpenWeatherMap - I use WU everyday for about a year and it provides the consistent reliable result. I've used fetch as a method to get data. But there was a catch. Check challenges section for details.

Visual elements of the page

Photos are taken from Flickr. They all are under Creative Commons licenses. Here is the full list:

Photo of a cloudy winter day Photo of a partly sunny winter day Photo of a mostly sunny winter day Photo of a sunny winter day Photo of a cloudy summer day Photo of a partly sunny summer day Photo of a mostly sunny spring day Photo of a sunny summer day Photo of a partly sunny spring day Photo of a mostly sunny spring day Photo of a sunny spring day Photo of a mostly sunny fall day Photo of a day with flurries Photo of a day with fog Photo of a rainy day Photo of a snowy day Photo of a stormy day Photo of a hazy day Photo of a sunny fall day

As I mentioned above I changed the color of the box where weather details appear according to the current air temperature. The mapping is:

Color temperature mapping
Color Temperature range
#A50021 more than 30
#D82632 between 25 and 30
#F76D5E between 20 and 25
#FFAD72 between 15 and 20
#FFE099 between 10 and 15
#FFFFBF between 5 and 10
#E0FFFF between 0 and 5
#AAF7FF between -5 and 0
#72D8FF between -10 and -5
#3FA0FF between -15 and -10
#264CFF between -20 and -15

User preferences

I don't want to toggle scale all the time from Fahrenheit to Celsius (the last one are natural for me but I use Fahernheit as default scale) so I added cookies to keep user preferences. There are three additional functions to create, read and erase cookie. Functions are taken from QuirksMode - https://www.quirksmode.org/js/cookies.html, but I modified read to use regexp instead of a loop.

Challenges

Two-colored SVG and Chrome.

I had two colored boxes on the page, - the first is for a weather details and the second is for a photo credit - and that was the reason to use CSS variables for font and background colors. It has been working great till I added a Creative commons icon to credit. The icon was an SVG and I wanted it to reflect the main color scheme but instead Chrome made it all black with no distinct of inner element and background.

The problem was that you cannot manage different colors for different SVG inner elements by CSS styles as expected. The solution is to use color and fill properties for an SVG and explicitly apply currentColor attribute to fill property inside SVG code to one of the elements. It will inherit color from color property set inside CSS style. Here is explanation by Fabrice Weinberg - https://codepen.io/FWeinb/post/quick-tip-svg-use-style-two-colors.

Geolocation on mobiles

After I finished initial version of the page I tested it in Chrome, Firefox, Opera and Safari. It worked great with the first three and throws an unknown geolocation error in Safari. My thought was: Ok, let's skip it for a while and switch to mobile devices. I tested the app on an iPad, an iPhone, and an Android phone, with a range of browsers: Safari, Chrome, Firefox. The only combination that worked was Androind + Firefox. All others throw a geolocation timeout error. I digged for a little and found only that there was not only my problem and there was a bunch of advices (the first question I had to answer was whether I worked within secured HTTP or not so yes - the app was deployed on two different services - github.io and codepen.io, both provided secured HTTP). I've tried following advices:

  • use PositionOptions.maximumAge set to Infinity;
  • use PositionOptions.timeout set to long intervals;
  • use PositionOptions.enableHighAccuracy either true or false;
  • use watchPosition instead of getCurrentPosition.

None of these worked for me so as an alternate solution to the problem I added geoIP request as a fallback if original geolocation request was unsuccessful, so everytime the app can't get the location data from a device it asks for the location of IP-adress that a data provider assigned to your device. As a free secured engine I used geoIP API - https://freegeoip.net/json/.

Support for a wide range of browsers

During an initial attempt, I succeed in implementing a working prototype of the app. It worked in Chrome and Firefox (last versions) on a desktop platform and didn't work in Safari (due to lack of support of fetch before 10.3) and on mobile (weird quirks with navigator.geolocation mentioned below). It's not the way I wanted it to be, so I moved my project from plain single html file to gulp-powered workflow to get:

My gulp configuration is available on github - https://github.com/al1s/WeatherNow/blob/master/gulpfile.js.

Cross-domain request fails for WU autocomplete API

As an addition to the pure geolocation based forecast I planned to implement user defined weather request - you provide a city name, the app gives you the current weather. There is an API for searching by city name provided by WeatherUnderground - https://www.wunderground.com/weather/api/d/docs?d=autocomplete-api. Initial attempt showed there is an Access-Control-Allow-Origin error - https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS. Managing Access-Contol-Allow-Origin policy generally is a server-side story. In a couple words - the server returns only what user's browser asks for and if a browser doesn't get in page headers explicit permission to use the page data it returns an Access-Contoll-Allow-Origin violation error. Wiki provides additional details and visual representation of the way CORS works - https://en.wikipedia.org/wiki/Cross-origin_resource_sharing. I solved the problem by adding CORS proxy (https://cors-anywhere.herokuapp.com/) in the middle. It works till there is no sensitive details flow between a user and a server.

Wrap up

There was an interesting journey to coding.

twitter blog github

Plan and done for July-21-2017

What will I learn today?

Dive into JS.

Done

Digged into project of a quotation machine from FreeCodeCamp (here - https://www.freecodecamp.org/challenges/build-a-random-quote-machine). The results are:

Learned/recalled:

Plan and done for July-17-2017

What will I learn today?

Dive into JS.

Done

I've done the first part of algorithm challenges at freeCodeCamp. All code in one place is here - https://codepen.io/alstof/pen/VWNPbM.

Among other challenges there was one which I think will help me with hackerRank's Climbing the Leaderboard. It was about evaluating the place for any number in an arbitrary array. So I can easily apply the same approach to ranking elements of one array among the other.

Plan and done for July-16-2017

What will I learn today?

Dive into JS.

Done

I'm stuck with both challenges on HR - roads and ladder failed performance test and roads failed functional tests. It's very exhaustive to run through the code again and again without success especially in time shortage conditions. Switched to another coding activity - returned to freeCodeCamp curriculum to practice easy steps, to make them smoother. After it I'll plan to be back and crack these nuts.

I've practiced:

Plan and done for July-12-2017

What will I learn today?

Dive into JS.

Done

I've solved Queen attack II. It wasn't hard, but in some way mind bending. The next two challenges are Roads and libraries - https://www.hackerrank.com/challenges/torque-and-development and Climbing the leaderboard - https://www.hackerrank.com/challenges/climbing-the-leaderboard. I solved both, but my solutions didn't meet time complexity criteria, so now I'm in optimization mode.

My approach to Roads and libs is:

  • The idea is to find whether we have a connected graph.
  • If not, then we need at least the same number of libraries as independent graphs.
  • If graph is connected, we build at least one library.
  • If library cost > road cost, fix all roads, otherwise, build a library in every town.
  • In order to find the graph roots and edges I built node adjacency list and all nodes list.

The last two are sources of latency. At first I tried to build all nodes list by concatenating all nodes within forEach loop and then moving the result into a set to get a list of nodes without repetitions. I've got rid of concatenation, and just pushed all nodes into flat array and then copied it into a set. The adjacency list is looked harder. I want to get a list of all nodes with their neighbours for each. I use for it an array and each position is my node number filled with arrays of neighbours. Maybe the better idea is to use object for storing the list.

In order to understand how my solution works under load I use a dataset I've found under the first link here - https://cstheory.stackexchange.com/a/740.

The solution works faster with an object as a storage of adjacency list, but it fails HR performance tests.

Plan and done for July-04-2017

What will I learn today?

  1. Dive into JS.

Done

  1. Moving to another appartment took tons of time and efforts. Now we've settled and I'm able to continue my practice. The last problem was too tough. I'm stuck with all exceptional cases and it still doesn't pass all tests. Let's move on.

    Next problem is Queen attack II - https://www.hackerrank.com/challenges/queens-attack-2. The approach was to take it as a distance appraisal problem. There is only 2d space with relative center of coordinates (which is a queen position) and available routes on it (only vertical, horizontal and both diagonals). And the solution is to find length of each route and get a total:

    • appraise whether an obstacle is on any available route and find distance to each;
    • find distance from queen position to any side of the board in any direction available.

    My first thought was to implement a simple function which would return me a distance in math way - as a square root of the sum of squared differences of respective point coordinates. It's obvious that it won't work - I have longer distances diagonally, than in vertical and horizontal directions. Next move - why not take it simpler: the distance in board squares is already here - it's just any of coordinates (because my diagonals are at 45 degrees to horizontal line).

    The next question was how to find whether an obstacle is on the queen way or not? The solution was to find the angle between two sections. The most obvious way is to find a tangent (because I already know both cathetus - they are just obstacle coordinates) and apply Math.atan to it.