Rails derailed again (and again)

Executive summary (aka TL;DR)

  1. Rails docs suck… erm, no. I mean they are great but are most probably written by people who never actually had to use them.
  2. If you want to follow Rails Guides and install a fresh Rails environment on a vanilla Ubuntu 16.04LTS you need at least the following dependencies installed before you start:
    • ruby-dev
    • zlib1g-dev
    • libsqlite3-dev
    • gcc
    • make
    • g++

The full rant

When the first Rails happened to Ruby, it was a pure revelation. A big gulp of fresh air after all the Java stuff we had to deal with for years. First Rails was something to be truly happy with. At freakin’ last building a simple web application became actually, well… simple. One could spawn a simple CRUD webapp in a timespan narrower than it would take to configure only the most vital XMLs for an application in one of the prominent Java Application Servers of the time. And I don’t even want to mention the dreadful experiences of pre-V5 PHP. Rails was different in a most positive way. Also because it was using a beautiful, “post-modernistic” language of Ruby. I quickly became “early adopter” as well as “advocate” of RoR (Ruby on Rails).

Still – at some point – realities started to get through the cloud of excitement. Like “OK – I have my beautiful application but where am I going to host it?”.  Ruby aware hosting services were scarce. Terribly scarce. You can imagine they were not the least expensive either. With some notable exception all the typical hosting companies of the time (of Rails 1 & 2) neither supported nor allowed self-installation of non-supported software. Things changed with the advent of VPS solutions but even today a typical, shared  LAMP hosting with everything you need to run your PHP/MySQL thing, costs about one tenth (if not less) than a minimal VPS capable of running your Rails. Yes, I know that there are some companies that specialise in Rails applications deployment and hosting without VPS, yet this doesn’t change the big picture much. The working ones are more expensive and not necessarily have the local reach a client needs. P. S. I know there is Heroku. I do🙂

Another thing, and probably one of the reasons it’s always been hard to sway hosting companies to support Rails: Rails evolved, Ruby evolved, but it seems that both Ruby and Rails communities follow the “We are opinionated – deal with it” attitude and don’t really care about making it easy for a company that would be willing to host and support Rails. The stubborn refusal (quote: we know Ruby better than any package maintainer and we know better how Ruby stuff should be installed and managed) to find a solution for proper inter-working between major OS distributors (Debian/Ubuntu/RedHat/..) packaging systems and Ruby made it a PITA for anyone trying provide this kind of support. Gosh, it became non-trivial even for developers to create and maintain development environments for different versions of Ruby/Rails, which led to creation of specialised tools just for this purpose. Summing up – it became increasingly difficult to sell Rails development. “Why would I use this if I can have half the costs, more choices and far less vendor lock-in with PHP based solution?!”

I remember I kept saying “if there is one language that I loathe more than PHP, it would be Javascript” and guess what (fate – it seems – is not without a sense of irony™) I ended up building applications using PHP and Javascript for several years after using Rails 1 and Rails 2. I still kept an eye on Rails’ development though and things didn’t change much in terms of “installability”, “maintainability” and “sellability”. One still couldn’t do a simple “apt-get install ruby” followed by “gem install rails” to have a ready Rails environment.

Years kept passing and an all new Rails 5(!)  is out there. Since the customer is going to use a VPS anyway – let’s try it. I am sure things must have changed since I left! I use the all fresh installation of Ubuntu’s 16.04LTS server distribution – something I humbly believe that lots of people are going to use for server-side development efforts over the next couple of years. The official guide located at:

http://guides.rubyonrails.org/getting_started.html

states that I need to verify the version of Ruby installed. OK – obviously I need to install Ruby as the vanilla Ubuntu server installation doesn’t include any.

silverdr@ubuntu:~$ sudo apt-get install ruby

does the trick. Now:

silverdr@ubuntu:~$ ruby -v
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

Looks good enough, doesn’t it? As next I should verify my sqlite3 version… WTH? I am not planning to use sqlite! So..? All right – let’s do the

silverdr@ubuntu:~$ sudo apt-get install sqlite3

just not to let anyone tell me that I didn’t follow the official guide…

silverdr@ubuntu:~$ sqlite3  --version
3.11.0 2016-02-15 17:29:24 3d862f207e3adc00f78066799ac5a8c282430a5f

And this is all what the official guide says about prerequisites. Having both of those in place I should be ready to roll [the installation of Rails]. The guide says:

To install Rails, use the gem installcommand provided by RubyGems:

Since I don’t want to install things system-wide, I don’t use sudo…
$ gem install rails
Fetching: i18n-0.7.0.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.3.0 directory.

Uh, oh… OK – let’s retry – surely nobody can account for every possible distribution and its configuration idiosyncrasies, can anyone? <sarcasm>Obviously Ubuntu is one of those obscure ones nobody uses for anything serious</sarcasm>. I give up my non-system-wide requirement and go with:

silverdr@ubuntu:~$ sudo gem install rails
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: concurrent-ruby-1.0.2.gem (100%)
Successfully installed concurrent-ruby-1.0.2
Fetching: activesupport-5.0.0.gem (100%)
Successfully installed activesupport-5.0.0
Fetching: rack-2.0.1.gem (100%)
Successfully installed rack-2.0.1
Fetching: rack-test-0.6.3.gem (100%)
Successfully installed rack-test-0.6.3
Fetching: mini_portile2-2.1.0.gem (100%)
Successfully installed mini_portile2-2.1.0
Fetching: pkg-config-1.1.7.gem (100%)
Successfully installed pkg-config-1.1.7
Fetching: nokogiri-1.6.8.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
 ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20160804-3182-eo1yhv.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out

Uh, Oh… (2)… Let’s see what happened…

[…] mkmf.rb can’t find header files for ruby at /usr/lib/ruby/include/ruby.h […]

Seems having Ruby installed is not enough? Seems I still need something like Ruby development files, even if I don’t plan on developing anything compilable in Ruby dev-space? Let’s try:

silverdr@ubuntu:~$ sudo apt-get install ruby-dev

and let’s retry

silverdr@ubuntu:~$ sudo gem install rails
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20160804-3300-15qeff1.rb extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
 --with-opt-dir
 --without-opt-dir
 --with-opt-include
 --without-opt-include=${opt-dir}/include
 --with-opt-lib
 --without-opt-lib=${opt-dir}/lib
 --with-make-prog
 --without-make-prog
 --srcdir=.
 --curdir
 --ruby=/usr/bin/$(RUBY_BASE_NAME)2.3
 --help
 --clean
/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
 from /usr/lib/ruby/2.3.0/mkmf.rb:571:in `block in try_compile'
 from /usr/lib/ruby/2.3.0/mkmf.rb:522:in `with_werror'
 from /usr/lib/ruby/2.3.0/mkmf.rb:571:in `try_compile'
 from extconf.rb:138:in `nokogiri_try_compile'
 from extconf.rb:162:in `block in add_cflags'
 from /usr/lib/ruby/2.3.0/mkmf.rb:629:in `with_cflags'
 from extconf.rb:161:in `add_cflags'
 from extconf.rb:414:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out

Huh… ?

[…] You have to install development tools first.[…]

OK – which development tools? Since it says “Building native extensions” – then (probably!) it wants some kind of C compiler? Why not a Pascal or Fortran one? Don’t know – just guess.

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/mkmf.log

The said file contains:

"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC  conftest.c  -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic     -lruby-2.3  -lpthread -lgmp -ldl -lcrypt -lm   -lc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

Which obviously doesn’t say a thing about “why this extension failed to compile” but at least gives a hint that it tried to use gcc. Nice – gcc has support not only for C but also for Pascal and Fortran if that happens to be the case🙂

silverdr@ubuntu:~$ sudo apt-get install gcc

and let’s retry

silverdr@ubuntu:~$ sudo gem install rails
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20160801-7575-t98pm.rb extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
 --with-opt-dir
 --without-opt-dir
 --with-opt-include
 --without-opt-include=${opt-dir}/include
 --with-opt-lib
 --without-opt-lib=${opt-dir}/lib
 --with-make-prog
 --without-make-prog
 --srcdir=.
 --curdir
 --ruby=/usr/bin/$(RUBY_BASE_NAME)2.3
 --help
 --clean
 --use-system-libraries
 --enable-static
 --disable-static
 --with-zlib-dir
 --without-zlib-dir
 --with-zlib-include
 --without-zlib-include=${zlib-dir}/include
 --with-zlib-lib
 --without-zlib-lib=${zlib-dir}/lib
 --enable-cross-build
 --disable-cross-build

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out

Uh, Oh (3)…

"zlib is missing; necessary for building libxml2"

Ok, at this moment I have no damned idea what nokogiri is but I am sure I shouldn’t need to build libxml2!

But since I have no idea how to work this around, I guess I need to install zlib.

silverdr@ubuntu:~$ sudo apt-get install zlib1g
Reading package lists... Done
Building dependency tree
Reading state information... Done
zlib1g is already the newest version (1:1.2.8.dfsg-2ubuntu4).

Uh, Oh (4) – but zlib is there. Can’t you see that? Maybe (since it wants to build libxml2) it wants not only zlib but it’s dev files as well (Yeah, I should have guessed but why not to say that explicitly?).

silverdr@ubuntu:~$ sudo apt-get install zlib1g-dev

and let’s retry

silverdr@ubuntu:~$ sudo gem install rails
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20160801-9086-36hu2y.rb extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.4.
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process andreinstall nokogiri as follows:

   gem install nokogiri -- --use-system-libraries
       [--with-xml2-config=/path/to/xml2-config]
       [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.4.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.4... OK
Running 'configure' for libxml2 2.9.4... OK
Running 'compile' for libxml2 2.9.4... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)2.3
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
/var/lib/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:344:in `spawn': No such file or directory - make (Errno::ENOENT)
from /var/lib/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:344:in `block in execute'
from /var/lib/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `chdir'
from /var/lib/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `execute'
from /var/lib/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:111:in `compile'
from /var/lib/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:150:in `cook'
from extconf.rb:364:in `block (2 levels) in process_recipe'
from extconf.rb:257:in `block in chdir_for_build'
from extconf.rb:256:in `chdir'
from extconf.rb:256:in `chdir_for_build'
from extconf.rb:363:in `block in process_recipe'
from extconf.rb:262:in `tap'
from extconf.rb:262:in `process_recipe'
from extconf.rb:555:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out

Uh, Oh (5)… after going through the tons of useless information, the only one that seems to make some sense in the context of this particular failure is:

"2.1.0/lib/mini_portile2/mini_portile.rb:344:in `spawn': No such file or directory - make (Errno::ENOENT)"

Ah, obviously. It’s only my fault that I’ve been so braindead…

silverdr@ubuntu:~$ sudo apt-get install make

There are also some other pieces of information:

Building Nokogiri with a packaged version of libxml2-2.9.4.
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you […]

Of course it is a concern, isn’t it? Because of lack of a solution for inter-working between system  packages and Ruby gems I need to follow security updates on two levels and within two environments instead of one for the same piece of software. And obviously I have no idea what “doing their best” means to Team Nokogiri and how long is this Team Nokogiri going to be around having any interest in providing security updates.

[…] and want to use the system library instead; abort this installation process andreinstall nokogiri as follows:
[…]
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.

Hello? Anybody home? That’s what versioning is about, isn’t it? How about the good, old way of checking for a compatible library version and using it if available, falling back to an own one only when compatible version is not present in the system and only when requested by the user/administrator to do so, NOT the other way around?

Anyway – let’s retry (again)

silverdr@ubuntu:~$ sudo gem install rails
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.6.8
[…]

Whoaaah!

Done installing [...]  rails after 58 seconds
28 gems installed

Whoa… (well) it took 58 seconds to install rails (after many times too many more of them trying to do so…). The “Getting Started” guide now says:

To verify that you have everything installed correctly, you should be able to run the following:

$ rails –version

If it says something like “Rails 5.0.0”, you are ready to continue.

silverdr@ubuntu:~$ rails --version
Rails 5.0.0

Yesss!! I finally have a working Rails installation and am ready to continue! Hoorray! Now, let’s rock the world!

silverdr@ubuntu:~$ rails new myworldrockingproject
 create 
 create README.md
 create Rakefile
 create config.ru
 create .gitignore
 create Gemfile
 create app
 create app/assets/config/manifest.js
 create app/assets/javascripts/application.js
 create app/assets/javascripts/cable.js
 create app/assets/stylesheets/application.css
 create app/channels/application_cable/channel.rb
 create app/channels/application_cable/connection.rb
 create app/controllers/application_controller.rb
 create app/helpers/application_helper.rb
 create app/jobs/application_job.rb
 create app/mailers/application_mailer.rb
 create app/models/application_record.rb
 create app/views/layouts/application.html.erb
 create app/views/layouts/mailer.html.erb
 create app/views/layouts/mailer.text.erb
 create app/assets/images/.keep
 create app/assets/javascripts/channels
 create app/assets/javascripts/channels/.keep
 create app/controllers/concerns/.keep
 create app/models/concerns/.keep
 create bin
 create bin/bundle
 create bin/rails
 create bin/rake
 create bin/setup
 create bin/update
 create config
 create config/routes.rb
 create config/application.rb
 create config/environment.rb
 create config/secrets.yml
 create config/cable.yml
 create config/puma.rb
 create config/spring.rb
 create config/environments
 create config/environments/development.rb
 create config/environments/production.rb
 create config/environments/test.rb
 create config/initializers
 create config/initializers/application_controller_renderer.rb
 create config/initializers/assets.rb
 create config/initializers/backtrace_silencers.rb
 create config/initializers/cookies_serializer.rb
 create config/initializers/cors.rb
 create config/initializers/filter_parameter_logging.rb
 create config/initializers/inflections.rb
 create config/initializers/mime_types.rb
 create config/initializers/new_framework_defaults.rb
 create config/initializers/session_store.rb
 create config/initializers/wrap_parameters.rb
 create config/locales
 create config/locales/en.yml
 create config/boot.rb
 create config/database.yml
 create db
 create db/seeds.rb
 create lib
 create lib/tasks
 create lib/tasks/.keep
 create lib/assets
 create lib/assets/.keep
 create log
 create log/.keep
 create public
 create public/404.html
 create public/422.html
 create public/500.html
 create public/apple-touch-icon-precomposed.png
 create public/apple-touch-icon.png
 create public/favicon.ico
 create public/robots.txt
 create test/fixtures
 create test/fixtures/.keep
 create test/fixtures/files
 create test/fixtures/files/.keep
 create test/controllers
 create test/controllers/.keep
 create test/mailers
 create test/mailers/.keep
 create test/models
 create test/models/.keep
 create test/helpers
 create test/helpers/.keep
 create test/integration
 create test/integration/.keep
 create test/test_helper.rb
 create tmp
 create tmp/.keep
 create tmp/cache
 create tmp/cache/assets
 create vendor/assets/javascripts
 create vendor/assets/javascripts/.keep
 create vendor/assets/stylesheets
 create vendor/assets/stylesheets/.keep
 remove config/initializers/cors.rb
 run bundle install
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies......


Your user account isn't allowed to install to the system Rubygems.
 You can cancel this installation and run:

 bundle install --path vendor/bundle

 to install the gems into ./vendor/bundle/, or you can enter your password
 and install the bundled gems to Rubygems using sudo.

 Password:

Errmm… what? I thought I was already done “installing to the system Rubygems” after those “58 seconds”. Now I am no longer the admin. I am a developer that wants to use what the admin has already installed and verified according to the “Getting Started” guide. What else do I have to install to “system Rubygems” in order to get the thing create the basic application structure?! Oh, boy… I give up and give down [the administrative password].

Installing rake 11.2.2
Using concurrent-ruby 1.0.2
Using i18n 0.7.0
Installing minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using rack 2.0.1
Using nio4r 1.2.1
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 7.1.1
Using bundler 1.12.5
Installing byebug 9.0.5 with native extensions
Installing coffee-script-source 1.10.0
Installing execjs 2.7.0
Using method_source 0.8.2
Using thor 0.19.1
Installing debug_inspector 0.0.2 with native extensions
Installing ffi 1.9.14 with native extensions
Installing multi_json 1.12.1
Installing rb-fsevent 0.9.7
Installing puma 3.6.0 with native extensions
Installing sass 3.4.22
Installing tilt 2.0.5
Installing spring 1.7.2
Installing sqlite3 1.3.11 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

 current directory: /tmp/bundler20160804-25167-125cccxsqlite3-1.3.11/gems/sqlite3-1.3.11/ext/sqlite3
/usr/bin/ruby2.3 -r ./siteconf20160804-25167-cc2c7o.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
 --with-opt-dir
 --without-opt-dir
 --with-opt-include
 --without-opt-include=${opt-dir}/include
 --with-opt-lib
 --without-opt-lib=${opt-dir}/lib
 --with-make-prog
 --without-make-prog
 --srcdir=.
 --curdir
 --ruby=/usr/bin/$(RUBY_BASE_NAME)2.3
 --with-sqlite3-dir
 --without-sqlite3-dir
 --with-sqlite3-include
 --without-sqlite3-include=${sqlite3-dir}/include
 --with-sqlite3-lib
 --without-sqlite3-lib=${sqlite3-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

 /tmp/bundler20160804-25167-125cccxsqlite3-1.3.11/extensions/x86_64-linux/2.3.0/sqlite3-1.3.11/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20160804-25167-125cccxsqlite3-1.3.11/gems/sqlite3-1.3.11 for inspection.
Results logged to /tmp/bundler20160804-25167-125cccxsqlite3-1.3.11/extensions/x86_64-linux/2.3.0/sqlite3-1.3.11/gem_make.out
Installing turbolinks-source 5.0.0
Using tzinfo 1.2.2
Using nokogiri 1.6.8
Using rack-test 0.6.3
Using sprockets 3.7.0
Using websocket-driver 0.6.4
Using mime-types 3.1
Installing coffee-script 2.4.1
Installing uglifier 3.0.1
Installing rb-inotify 0.9.7
An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
 run bundle exec spring binstub --all
Could not find gem 'sqlite3' in any of the gem sources listed in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.

Uh, Oh (6)… I mean – really? Couldn’t you guys *really* check all the dependencies for a *working* installation when I first issued “gem install rails”? Something like: “this, this and that is missing on your system” and stop? Couldn’t you install all the stuff when doing “gem install rails”? Really? Couldn’t you do that so that once the administrator is gone home (or doing other important stuff) the developer can just follow your guide and have things *working*?

Well, at least here (among tons of other things) you tell me what I need to install without me doing much guessing.

silverdr@ubuntu:~$ sudo apt-get install libsqlite3-dev
silverdr@ubuntu:~$ rails new myworldrockingproject
 create 
 create README.md
 create Rakefile
 create config.ru
 create .gitignore
 create Gemfile
 create app
 create app/assets/config/manifest.js
 create app/assets/javascripts/application.js
 create app/assets/javascripts/cable.js
 create app/assets/stylesheets/application.css
 create app/channels/application_cable/channel.rb
 create app/channels/application_cable/connection.rb
 create app/controllers/application_controller.rb
 create app/helpers/application_helper.rb
 create app/jobs/application_job.rb
 create app/mailers/application_mailer.rb
 create app/models/application_record.rb
 create app/views/layouts/application.html.erb
 create app/views/layouts/mailer.html.erb
 create app/views/layouts/mailer.text.erb
 create app/assets/images/.keep
 create app/assets/javascripts/channels
 create app/assets/javascripts/channels/.keep
 create app/controllers/concerns/.keep
 create app/models/concerns/.keep
 create bin
 create bin/bundle
 create bin/rails
 create bin/rake
 create bin/setup
 create bin/update
 create config
 create config/routes.rb
 create config/application.rb
 create config/environment.rb
 create config/secrets.yml
 create config/cable.yml
 create config/puma.rb
 create config/spring.rb
 create config/environments
 create config/environments/development.rb
 create config/environments/production.rb
 create config/environments/test.rb
 create config/initializers
 create config/initializers/application_controller_renderer.rb
 create config/initializers/assets.rb
 create config/initializers/backtrace_silencers.rb
 create config/initializers/cookies_serializer.rb
 create config/initializers/cors.rb
 create config/initializers/filter_parameter_logging.rb
 create config/initializers/inflections.rb
 create config/initializers/mime_types.rb
 create config/initializers/new_framework_defaults.rb
 create config/initializers/session_store.rb
 create config/initializers/wrap_parameters.rb
 create config/locales
 create config/locales/en.yml
 create config/boot.rb
 create config/database.yml
 create db
 create db/seeds.rb
 create lib
 create lib/tasks
 create lib/tasks/.keep
 create lib/assets
 create lib/assets/.keep
 create log
 create log/.keep
 create public
 create public/404.html
 create public/422.html
 create public/500.html
 create public/apple-touch-icon-precomposed.png
 create public/apple-touch-icon.png
 create public/favicon.ico
 create public/robots.txt
 create test/fixtures
 create test/fixtures/.keep
 create test/fixtures/files
 create test/fixtures/files/.keep
 create test/controllers
 create test/controllers/.keep
 create test/mailers
 create test/mailers/.keep
 create test/models
 create test/models/.keep
 create test/helpers
 create test/helpers/.keep
 create test/integration
 create test/integration/.keep
 create test/test_helper.rb
 create tmp
 create tmp/.keep
 create tmp/cache
 create tmp/cache/assets
 create vendor/assets/javascripts
 create vendor/assets/javascripts/.keep
 create vendor/assets/stylesheets
 create vendor/assets/stylesheets/.keep
 remove config/initializers/cors.rb
 run bundle install
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies......
Using rake 11.2.2
Using concurrent-ruby 1.0.2
Using i18n 0.7.0
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using rack 2.0.1
Using nio4r 1.2.1
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 7.1.1
Using bundler 1.12.5
Using byebug 9.0.5
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using method_source 0.8.2
Using thor 0.19.1
Using debug_inspector 0.0.2
Using ffi 1.9.14
Using multi_json 1.12.1
Using rb-fsevent 0.9.7
Using puma 3.6.0
Using sass 3.4.22
Using tilt 2.0.5
Using spring 1.7.2
Installing sqlite3 1.3.11 with native extensions
Using turbolinks-source 5.0.0
Using tzinfo 1.2.2
Using nokogiri 1.6.8
Using rack-test 0.6.3
Using sprockets 3.7.0
Using websocket-driver 0.6.4
Using mime-types 3.1
Using coffee-script 2.4.1
Using uglifier 3.0.1
Using rb-inotify 0.9.7
Installing turbolinks 5.0.1
Using activesupport 5.0.0
Using loofah 2.0.3
Using mail 2.6.4
Installing listen 3.0.8
Using rails-dom-testing 2.0.1
Using globalid 0.3.7
Using activemodel 5.0.0
Installing jbuilder 2.6.0
Using rails-html-sanitizer 1.0.3
Installing spring-watcher-listen 2.0.0
Using activejob 5.0.0
Using activerecord 5.0.0
Using actionview 5.0.0
Using actionpack 5.0.0
Using actioncable 5.0.0
Using actionmailer 5.0.0
Using railties 5.0.0
Using sprockets-rails 3.1.1
Installing coffee-rails 4.2.1
Installing jquery-rails 4.1.1
Installing web-console 3.3.1
Using rails 5.0.0
Installing sass-rails 5.0.6
Bundle complete! 15 Gemfile dependencies, 63 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
 run bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted

Admittedly at this point I feel a little tired and a little too suspicious to say “Hoorray! My world rocking project using Rails 5 is ready to rock!!” Let’s see if I can at least see the congrats page about me riding Rails…

According to the “Getting Started” guide I should:

silverdr@ubuntu:~$ cd myworldrockingproject

followed by

silverdr@ubuntu:~/myworldrockingproject$ bin/rails server

Guess what? Yes, you guessed right. Instead of seeing the message where I should direct my browser to, I see:

silverdr@ubuntu:~/myworldrockingproject$ bin/rails server
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:89:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/var/lib/gems/2.3.0/gems/uglifier-3.0.1/lib/uglifier.rb:5:in `require'
/var/lib/gems/2.3.0/gems/uglifier-3.0.1/lib/uglifier.rb:5:in `<top (required)>'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
/home/silverdr/myworldrockingproject/config/application.rb:7:in `<top (required)>'
/var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `require'
/var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `block in server'
/var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `tap'
/var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `server'
/var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
/var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
/home/silverdr/myworldrockingproject/bin/rails:9:in `require'
/home/silverdr/myworldrockingproject/bin/rails:9:in `<top (required)>'
/var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
/var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
/var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
/var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
/var/lib/gems/2.3.0/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
/var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
/var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/silverdr/myworldrockingproject/bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Bundler Error Backtrace:
 from /var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:85:in `block (2 levels) in require'
 from /var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
 from /var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
 from /var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
 from /var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
 from /var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
 from /home/silverdr/myworldrockingproject/config/application.rb:7:in `<top (required)>'
 from /var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `require'
 from /var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `block in server'
 from /var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `tap'
 from /var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `server'
 from /var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
 from /var/lib/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
 from /home/silverdr/myworldrockingproject/bin/rails:9:in `require'
 from /home/silverdr/myworldrockingproject/bin/rails:9:in `<top (required)>'
 from /var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
 from /var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
 from /var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
 from /var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
 from /var/lib/gems/2.3.0/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
 from /var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
 from /var/lib/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
 from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /home/silverdr/myworldrockingproject/bin/spring:13:in `<top (required)>'
 from bin/rails:3:in `load'
 from bin/rails:3:in `<main>'

And you know what? At this point I start feeling like I’ve got enough of all the errors and stack traces. I mean – WTF (no, not “WTH” – it’s “WTF”) – everything should have been installed already. And if I wanted to have server-side “JavaScript runtime”, I would go for Node and Sails, rather than Ruby and Rails. And if you need all those things for something, then why on Earth can’t you put up a list of prerequisites / dependencies to follow before even starting to try to guess “why [TF] did it break again this time?”.

Do I have to show how little compared to this does it take to have a working application stub with PHP5 and Laravel (probably the best PHP based Rails copycat) on the very same server?

And now what? I already have tons of stuff I don’t want. I installed tons of packages I shouldn’t need to install – we are talking about server environment here, where every unnecessary piece of code can at some point turn itself into an attack vector and now I seemingly should install another heavyweight because people around the net say that I need to install node.js – damn, NO!

Fortunately not everyone suggests installing Node:

In your Gemfile, you’ll notice that there is the therubyracer gem referenced (but commented out). It is one of the supported runtimes.

Thus, you could just uncomment this gem, run bundle install and be set.

I uncommented the gem in my Gemfile (no further comments on why on Mother Earth do I need to do this kind of things) and ran bundle install:

silverdr@ubuntu:~/myworldrockingproject$ bundle install
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies...
Using rake 11.2.2
Using concurrent-ruby 1.0.2
Using i18n 0.7.0
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using rack 2.0.1
Using nio4r 1.2.1
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 7.1.1
Using bundler 1.12.5
Using byebug 9.0.5
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using method_source 0.8.2
Using thor 0.19.1
Using debug_inspector 0.0.2
Using ffi 1.9.14
Using multi_json 1.12.1


Your user account isn't allowed to install to the system Rubygems.
 You can cancel this installation and run:

 bundle install --path vendor/bundle

 to install the gems into ./vendor/bundle/, or you can enter your password
 and install the bundled gems to Rubygems using sudo.

 Password: 
Installing libv8 3.16.14.15
Using rb-fsevent 0.9.7
Using puma 3.6.0
Installing ref 2.0.0
Using sass 3.4.22
Using tilt 2.0.5
Using spring 1.7.2
Using sqlite3 1.3.11
Using turbolinks-source 5.0.0
Using tzinfo 1.2.2
Using nokogiri 1.6.8
Using rack-test 0.6.3
Using sprockets 3.7.0
Using websocket-driver 0.6.4
Using mime-types 3.1
Using coffee-script 2.4.1
Using uglifier 3.0.1
Using rb-inotify 0.9.7
Installing therubyracer 0.12.2 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

 current directory: /tmp/bundler20160804-29493-jefatxtherubyracer-0.12.2/gems/therubyracer-0.12.2/ext/v8
/usr/bin/ruby2.3 -r ./siteconf20160804-29493-1ejo91s.rb extconf.rb
checking for main() in -lpthread... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

 /tmp/bundler20160804-29493-jefatxtherubyracer-0.12.2/extensions/x86_64-linux/2.3.0/therubyracer-0.12.2/mkmf.log

current directory: /tmp/bundler20160804-29493-jefatxtherubyracer-0.12.2/gems/therubyracer-0.12.2/ext/v8
make "DESTDIR=" clean

current directory: /tmp/bundler20160804-29493-jefatxtherubyracer-0.12.2/gems/therubyracer-0.12.2/ext/v8
make "DESTDIR="
compiling accessor.cc
make: g++: Command not found
Makefile:207: recipe for target 'accessor.o' failed
make: *** [accessor.o] Error 127

make failed, exit code 2

Gem files will remain installed in /tmp/bundler20160804-29493-jefatxtherubyracer-0.12.2/gems/therubyracer-0.12.2 for inspection.
Results logged to /tmp/bundler20160804-29493-jefatxtherubyracer-0.12.2/extensions/x86_64-linux/2.3.0/therubyracer-0.12.2/gem_make.out
Using turbolinks 5.0.1
Using activesupport 5.0.0
Using loofah 2.0.3
Using mail 2.6.4
Using listen 3.0.8
An error occurred while installing therubyracer (0.12.2), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.2'` succeeds before bundling.

Nice. Do I really still want to rock the world with Rails 5 based project?

 

Posted in Rails, Rants | Tagged , , , , | Leave a comment

PHP’s “associative array”: removing blacklisted or keeping whitelisted keys

Yup, if there is one language I loathe more than PHP, it’s Javascript… but this here is about PHP and how to either remove unwanted keys from an “associative array” (as they call it in PHP world) or leave only those, which you want to stay – in one shot.

Remove unwanted keys:

$my_cleaned_array = array_diff_key($my_dirty_array, array_flip($array_of_blacklisted_keys));

Keep welcome keys:

$my_cleaned_array = array_intersect_key($my_dirty_array, array_flip($array_of_whitelisted_keys));
Posted in Coding, php | Tagged , | Leave a comment

openvpn inactivity timeout (–ping-restart) restarting

So, there’s a nicely configured OpenVPN server, there is the client config that is proven to work with all your colleagues around and everything “just works” … or maybe, rather “just needs more work”? was it?

If you happen to suffer from irregular but painful unreliability of your OpenVPN connection on a perfectly reliable network link and in the logs you regularly happen to see something like:

 [server] Inactivity timeout (--ping-restart), restarting

chances are that you have fallen into the same trap as me, and another OpenVPN user. What trap? I happily tried to use the same config (including my certificate) on three machines… nothing wrong you say? Sure, I can use it on both my desktop and laptop and everything should be fine! True, I thought so too. Until I left my work desktop on and connected in the office, I connected my desktop at home and then, since thing didn’t look nicely I tried on the laptop too… then I went to the office to check how it works there (hint: stopped working too) and…

Yes, as one user called ‘krzee’ wrote:

your clients are fighting each other for the right to be [your CN]
there is a command to let the same cert connect multiple times… but it was only intended for testing purposes, or when using username auth in addition to certs. making certs for each client will fix your problem

So – if you use the same certificate on multiple clients, be sure to disconnect before leaving the machine unattended. Or – better – create and sign different certificates for every client / machine you intend to connect from.

Posted in Coding, DevOps | Tagged | Leave a comment

How come this crap creeps in for so many years?!

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LC_CTYPE = "UTF-8",
 LANG = "en_US.UTF-8"
 are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

First of all I really have a hard time getting around the fact that I see this on every default installation of Ubuntu (I bet I saw this on Debian too) for so many years and versions…

And I’ve seen a number of useless suggestions on how to fix it. dpkg-reconfigure this, dpkg-reconfigure that, install this, remove that. Generate this, edit that. And so on.

$ sudo echo 'LC_ALL="en_US.UTF-8"' >> /etc/environment

fixed the crap at last… at least for me… YMMV…

P. S. You can possibly use other values, like “C” or whichever locale you are using instead of “en_US.UTF-8”, which may make some more sense your particular environment.

Posted in Coding, GNU/Linux, Rants | Tagged , , , , | 3 Comments

Raspberry Pi, hub USB 3.0, error -71

If you have a USB 3.0 hub connected to your Pi and devices plugged into this hub are not configured properly, you check the logs and you see something like

device descriptor read/64, error -71

around USB activity – chances are that you ran into the same problem as several people, including the author of these words.

The conclusion is that USB 1.1 devices, connected to USB 3.0 hub are not working correctly in such configuration, due to a bug here or there, even if the very same hub, with the very same devices works well when connected to something else than Raspberry Pi. A workaround to this is to add an entry inside /boot/cmdline.txt

dwc_otg.speed=1

which forces the whole bus to 12Mbit/s USB 1.1 speed and lets you configure and use the devices.

Posted in GNU/Linux | Tagged , , , , | Leave a comment

Fix Finder’s contextual “Services” menu

I sometimes add or remove “services” to my ~/Library/Services directory. Unfortunately this alone doesn’t make the changes being reflected in the menu…

It might be caused by the fact that I keep things I want to have on all machines in a Dropbox folder and link to it. Or it may be due to some other reasons. In any case. I am not alone as this old hint shows. It was posted in the times of the OSX version 10.6. At the time of writing I use 10.9 and the problem remains. Luckily almost the same solution applies. The only difference is that one has to add an option to the command:

/System/Library/CoreServices/pbs -flush

should do the trick and bring your “Services” menu back to what you want it to be.

From the

$ man pbs

pbs is an agent for the Services menu.  It scans for and vends available Services, to populate the Services menu [and] is NOT related to the pasteboard.

Who would have guessed?

Posted in OSX | Tagged , , , , , , | Leave a comment

HTTP query strings in Laravel routes

So you read the documentation back and forth, and again, and even more again. And you still can’t make your

Route::get('myroute?querystring=myquerystring', function()

work?

Well – you don’t find it in the docs but what you have to do is:

Route::get('myroute', function()
{
    $myvariable = Input::get('myqueryparameter');
    // do whatever you want with the variable now
});
Posted in Coding | Leave a comment