Setting up Golang Development Env with Atom Editor

Below blog post does a good job of introducing several Atom addons for golang development

https://rominirani.com/setup-go-development-environment-with-atom-editor-a87a12366fcf#.tux17tlu9

Introduced addons are:

  • go-plus
  • autocomplete-go
  • terminal-plus


Replacing 'terminal-plus' for 'platformio-ide-terminal'

I ran into problems of terminal-plus not responding so replaced it with platformio-ide-terminal

apm install platformio-ide-terminal






vagrant plugin install landrush fails: An error occurred while installing eventmachine (1.0.9.1), and Bundler cannot continue.

Ran into a problem installing 'landrush' with vagrant

OSX 10.11.6

Error with installing a dependency eventmachine (1.0.9.1)

Sample Error:

$ vagrant plugin install landrush
Installing the 'landrush' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

An error occurred while installing eventmachine (1.0.9.1), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.0.9.1'` succeeds before bundling.

...
..skipping...
/opt/vagrant/embedded/bin/ruby -r ./siteconf20160924-85278-6sy73w.rb extconf.rb
checking for main() in -lcrypto... yes
checking for main() in -lssl... yes
checking for openssl/ssl.h... no
checking for main() in -lcrypto... yes
checking for main() in -lssl... yes
checking for openssl/ssl.h... no
checking for main() in -lcrypto... yes
checking for main() in -lssl... yes
checking for openssl/ssl.h... no
checking for main() in -lcrypto... yes
checking for main() in -lssl... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
-----
Found OpenSSL in path /usr/local/opt/openssl
-----
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... no
/opt/vagrant/embedded/include/ruby-2.2.0/ruby/intern.h:454:42: note: passing argument to parameter here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
                                         ^
em.cpp:941:9: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'?
        return EmSelect (maxsocket+1, &fdreads, &fdwrites, &fderrors, &tv);
               ^~~~~~~~
               rb_thread_fd_select
./em.h:29:22: note: expanded from macro 'EmSelect'
    #define EmSelect rb_thread_select
                     ^
/opt/vagrant/embedded/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
    ^
em.cpp:1065:6: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'?
                                        EmSelect (0, NULL, NULL, NULL, &tv);
                                        ^~~~~~~~
                                        rb_thread_fd_select
./em.h:29:22: note: expanded from macro 'EmSelect'
    #define EmSelect rb_thread_select
                     ^
/opt/vagrant/embedded/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
    ^
4 errors generated.
make: *** [em.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/jmatthews/.vagrant.d/gems/gems/eventmachine-1.0.9.1 for inspection.
Results logged to /Users/jmatthews/.vagrant.d/gems/extensions/universal-darwin-12/2.2.0/eventmachine-1.0.9.1/gem_make.out


Found a workaround here

https://github.com/eventmachine/eventmachine/issues/553#issuecomment-218450602

$ brew install openssl
Warning: openssl-1.0.2g already installed

$ brew link openssl --force
Linking /usr/local/Cellar/openssl/1.0.2g... 1588 symlinks created

$ vagrant plugin install landrush
Installing the 'landrush' plugin. This can take a few minutes...
Installed the plugin 'landrush (1.1.2)'!

Clear 301, Redirect Cache from Google Chrome

How to clear the redirect cache in google chrome

Background:
 
I ran into a problem during development of setting an incorrect 301 cache from nginx.
Issue I had was redirecting http to the wrong https server.
Google Chrome cache the 301 redirect and continued to serve the wrong redirect even after I fixed the remote site.

Googling showed me how to temporarily disable the redirect cache by bringing up the 'settings' of the developer tools and selecting to disable cache when tools were open.  That removed the cache...while the tools were open...once I closed the tools the bad cache entry was still present.

Then I found I could clear the cache by:
  1. Visit:  chrome://net-internals/
  2. Click the upper right arrow and select 'Clear cache'

The invalid entry is now resolved :)


Use 'npm install --no-bin-links' to workaround npm issue (ENOENT for various bin files) in vagrant VM with directory on shared filesystem.

Ran into an issue with 'npm install' in a Vagrant VM on VirtualBox.

Issue might be related to running 'npm install' from a shared filesystem.

Error is:

npm ERR! Linux 3.10.0-327.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v5.11.0
npm ERR! npm  v3.8.6
npm ERR! path /vagrant/webui/node_modules/npm/node_modules/request/node_modules/node-uuid/bin/uuid
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/vagrant/webui/node_modules/npm/node_modules/request/node_modules/node-uuid/bin/uuid'
npm ERR! enoent ENOENT: no such file or directory, chmod '/vagrant/webui/node_modules/npm/node_modules/request/node_modules/node-uuid/bin/uuid'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

Attempting workaround with: 'npm install --no-bin-links'

Related github issues:

ENOENT: no such file or directory, scandir '..../node_modules/node-sass/vendor'

$ time ember build
ENOENT: no such file or directory, scandir '/vagrant/webui/node_modules/node-sass/vendor'
Error: ENOENT: no such file or directory, scandir '/vagrant/webui/node_modules/node-sass/vendor'
    at Error (native)
    at Object.fs.readdirSync (fs.js:856:18)
    at Object.getInstalledBinaries (/vagrant/webui/node_modules/node-sass/lib/extensions.js:119:13)
    at foundBinariesList (/vagrant/webui/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (/vagrant/webui/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (/vagrant/webui/node_modules/node-sass/lib/errors.js:45:5)
    at Object. (/vagrant/webui/node_modules/node-sass/lib/index.js:15:28)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)

$ ls node_modules/node-sass/
bin  binding.gyp  CHANGELOG.md  lib  LICENSE  node_modules  package.json  README.md  scripts  src  test

Issue was fixed by running

npm rebuild node-sass

https://github.com/sass/node-sass/issues/1387#issuecomment-185451183

$ npm rebuild node-sass

> node-sass@3.9.3 install /vagrant/webui/node_modules/node-sass
> node scripts/install.js

Start downloading binary at https://github.com/sass/node-sass/releases/download/v3.9.3/linux-x64-47_binding.node
Binary downloaded and installed at /vagrant/webui/node_modules/node-sass/vendor/linux-x64-47/binding.nodede:

> node-sass@3.9.3 postinstall /vagrant/webui/node_modules/node-sass
> node scripts/build.js

"/vagrant/webui/node_modules/node-sass/vendor/linux-x64-47/binding.node" exists.
 testing binary.
Binary is fine; exiting.
node-sass@3.9.3 /vagrant/webui/node_modules/node-sass

Ember.js: Self-referencial (Reflexive) relationship not displaying.

Ran into a problem of ember not display a self referencing relationship.

Below is a snippet of the model for a 'user'
import DS from 'ember-data';

export default DS.Model.extend({
  email: DS.attr('string'),
  name: DS.attr('string'),
  agent: DS.belongsTo('user')
});
The relationship for 'agent' was not displaying in templates, yet occasionally I'd see one of the models render the relationship.
Ember docs now cover this as Reflexive
Fix was to change my model to have an explicit inverse
import DS from 'ember-data';

export default DS.Model.extend({
  email: DS.attr('string'),
  name: DS.attr('string'),
  agent: DS.belongsTo('user', { inverse: null })
});

Ember {{action}} isn't firing on <div> elements in iOS Safari/Chrome

Ran into an issue where an ember.js app was mostly working on Safari/Chrome on iOS, but one of the actions was not firing on a div element.  I couldn't find any errors in the javascript console (after connecting iPad to Mac and using the Safari Developer menu).

Finally figured out issue was the action was never firing...traced that down to learn there are issues with touch events on certain html elements.


An easy work around is to add:

 style="cursor: pointer"

Example:
{{#each sortedFoos as |foo|}}
  
    <div style="cursor: pointer" class="col-md-4 {{if (eq foo.id foo.bar.id) 'highlighted'}}" {{action 'selected' foo }}>
    </div>
{{/each}}
This post from StackOverflow helped:

Ember: Uncaught TypeError: Cannot read property 'shouldSupercede' of undefined

Ran into a problem of "Uncaught TypeError: Cannot read property 'shouldSupercede' of undefined"


Turns out the issue was that my route had a dynamic segment and I forgot to pass in the parameter.

Further, this was a mistake on my part, that I was creating a 'new' route, didn't want the 'new' route to be dynamic.

 I was calling something like {{#link-to "foo.bar.new"}} where foo.bar required a bar to passed to the route.


this.route('foo', function() {
    this.route('bar', {
      path: ':bar_id'
    }, function() {
      this.route('baz');
      this.route('new');
    });
});

Resolved the issue by changing the route from 'foo.bar.new' to 'foo.new' which would create the bar entry

this.route('foo', function() {
    this.route('new'),
    this.route('bar', {
      path: ':bar_id'
    }, function() {
      this.route('baz');
    });
});