Locked in VR - Walkthrough

Today I decided to try this fun short escape room vr game.

I like the challenge, gameplay is ok,
picking up objects from the floor and open the cabinets are a bit of a problem but no big deal.
The worst part for me that is to press the buttons in the door panel,
but more about that when we hit this part.

You start the game in a room with the phone ringing. You can pick it up, or not. It makes no difference.
But at least it will stop ringing.

First pick up the flashlight. there are extra batteries distributed 2 on top of the little table in the side of the bed. One in the cabinet in the side of the computer and another one in the shelf in the side of the stairs.

now go to the fuse pannel and move the yellow fuse down, like this:
x x x x
o x x x
it will turn the projector on. With this you can pick up the slides and see what is in it.

pick up the red fuse on the floor in front of the panel,
also take the blue fuse on top of the table, and put it in the fuse panel.
go to the clock on the left, take the green fuse and put it in the panel.

go to the clock in the right, and get the crowbar
go back to the projector room and remove the nails from the wood pannel in front of the projector
take the red fuse and the spear you find in it.
There is also an extra battery in floor.

put the red fuse in the pannel, and open the dead guy in the ceiling
it will drop a key, take the key and open the safe

now put the combination
o o x o
x x x x
it will turn on the uv light pannel on top of the bed.
you should point that into the wall, where the arrows are drawn
you will see 43125 written on the wall

o o o o
x x x o
this turn on the door keypad

now this is the part that took me most time to figure out: how to type in this keypad
you have to press the grab button on the button you want to push
now just type the number you saw on the wall in it
it will open the door

there are many doll arms there and the last one in the left is holding a key
pick up the key and go for the door on top of the stairs

done, that is it
Is it a good entertaining?
does it worth the 6 CHF?
not sure, but on the sale it does.



Finally my Asus tinkerboard arrived.

Buy Tinker Board 2 GB, Cortex-A17 Quad-core

Is it awesome?
not sure yet...

Yes, it packs more power than raspberry pi, but it falls behind in so many things

The software is basically inexistent
You get a standar linux and nothing more

With no further ado, lets get it going.

step 1: ssh to it

ssh linaro@your_ip
pwd: linaro

step 2: install go

wget https://storage.googleapis.com/golang/go1.8.1.linux-armv6l.tar.gz
tar -C /usr/local -xzf go1.8.1.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin

... aaaaaaannnd I am out of space :'(

something is not right here, I have a 32gb sd card,
I run fdisk and check that indeed my partition is 29gb
but somehow my /root is locked to 2gb

well, anyway, lost a day playing around with that,
in the end formatted my sd card before loading the image
and it works.


did I run my migrations?

Today I had an error message driving me crazy:
`method_missing': undefined method `export_format' for XXX model

You see, our model is a gem itself, because it is shared by several projects.

When we have something in the schema that is not in  the database, that is the error we get.

Now, I knew this error from previous executions, but my model was in synch with the DB.

I tried to comment out all my changes, without luck.

Until I realized. This error was in my specs.

I had run the rake db:migrate, but not RACK_ENG=test

In this situation I was happy I fixed the issue, but at the same time extremely angry I wasted 1h with that

Mental note: run both friggin migrations together in the future!

This might help:

alias migrate='rake db:migrate; rake db:migrate RAILS_ENV=test'

thanks to Eumir for this post


Go, go, go!

C is fast, but boring,
Ruby is slow, but fun.
Go is right in between

Let's start with the fun bits:
- You don't import just a file, you import a repository.
Reading import "github.com/tiagodll/golib" is beautiful, that alone gets me excited about go.

- Returning multiple values. Yes, finally!
You can set resp, err := MyFunction()
- Ditching the ;. I never got the reason for it, maybe it is because I learned programming with VB, but to me it just doesn't make sense.

Now to the boring
- The name. Seems like nothing, but having a language called go makes google searches useless unless you use golang.
- Not having try/catch. It sucks. Although returning value, error makes up for it quite well.
- Having any not used lib/variable as an error instead of warning. It is ok when you have a final version, but that is really annoying while development phase.
And the worst of all: 
- the insane amount of extra lines to assign a variable such as
temp := MyType{id:123}
Printf("%v", temp)
Instead of a simple
puts get_value_from_mongo(123).to_s

and the grey area
- Not having classes. I like the idea of having all static methods (unless it is really about the object they are in), but not having classes could have some issues, specially because of inheritance.

Regardless, this is my current language of choice.
But this is just the beginning. 
Let's see next what go is all about.


Back in purple, well... that is the elixir's main color, right?

One of my favorite hobbies is to learn new technologies. This means almost anything. I like Languages, patterns, databases, and sometimes even hardware stuff (even though I am very bad at that)

That being said, from time to time I decide to revisit and adopt or abandon that technology.

This time is about Elixir. but not just about elixir, I realised that to properly learn elixir, Erlang is required.
No, you don't have to use Erlang code, but it is more about the programming style (and a bit about the libraries too).

So why to learn that?


Not only that, every time you learn a new paradigm, you bring good knowledge to yours. So learning Erlang might bring you some good improvements even in java. 
But seriously, it is 2014... leave java where it belongs: in the past!


Database evolution

"Someday your little database will grow up. When it hits the teenage years - about two in human years - it will get moody, sullen, and resentful. In the worst case, it will start undermining the whole system (and it will probably complain that nobody understands it, too)."
 Release it
Release It - Michael T. Nygard


Dart + start + polymer = ?

So as I said in my <a href="/2014/07/yeah-about-that.html">Dart, what do we think about it?</a> post, it is an interesting language to look into. It is lacking good libraries, but a problem can also be seen as an opportunity: it is a great time build your own.

Back to the topic, because of the pub system it is very easy to have dart + start <b>or</b> dart + polymer, but not as easy to have both.

There is a teeny-tiny detail it took me a couple of days to realize, but let me save this to the end of the post.

Start is simple, lets begin with that.
first, the pubspec

<code file="pubspec.yaml">
name: onemore
description: A sample Polymer application
  polymer: '>=0.11.0'
  start: any
- polymer:
    entry_points: web/index.html

Then all you need to do is to import the package and create a server side dart file to start it.
In this example I am only serving static files, it would be just as easy to handle dynamic content with the get(url).
<code file="app.dart">
import 'package:start/start.dart';

main(args) {
  start(port: 3000).then((Server app) { app.static('build/web', jail: false); });

Done, you have a web server running in http://localhost:3000 as soon as you run this code.

Now, the polymer part
to have a custom element we need 3 files: the dart, the html and the hosting html file.
this custom element expects a String list, and publish (sends to the client) both lst and plist.
<code file="elementlist.dart">
import 'package:polymer/polymer.dart';
import 'dart:convert';

class ElementsList extends PolymerElement {
  @published String list;
  @published List plist;

  ElementsList.created() : super.created(){
      plist = JSON.decode(list);

Here in the html we can use mustache style expressions
<code file="elementlist.html">
<link rel="import" href="packages/polymer/polymer.html">
<polymer-element name="element-list" attributes="list">
    <div>the list: {{ list }}</div>
      <template repeat="{{elmt in plist}}">
  <script type="application/dart" src="elementlist.dart"></script>

and then your index file you just have to add some references and include the custom element element-list.
<code file="index.html">
<!DOCTYPE html>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sample app</title>
    <script src="packages/web_components/platform.js"></script>
    <script src="packages/web_components/dart_support.js"></script>
    <!-- import the click-counter -->
    <link rel="import" href="elementlist.html">
    <script type="application/dart">export 'package:polymer/init.dart';</script>
    <script src="packages/browser/dart.js"></script>
  <body unresolved touch-action="auto">
    before list<br>
    <element-list id="the_list" list='[{"id":1},{"id":2},{"id":3}]'></element-list>

Now, let me explain the little detail that made me lose so much time: start is just serving the folder specified above. The problem is that all the polymer javascript is generated in the build, and stored there. So our start must serve that folder instead.
to do that, all we have to do is to change the web to build/web in the start method:
app.static('build/web', jail: false);

That is all folks, hope you enjoy it.