Showing posts from October, 2015

Dart on AppEngine logging on local dev server

While logging works fine on AppEngine I could not manage to have print or any logging when using local development target. It turns out that stderr output is working fine so the solution I ended up with was to create a logger handler (when running locally) that output logging output on to the console. Below is the simplest hello world app that do log fine both locally and on the server

import 'dart:io'; import 'package:appengine/appengine.dart'; import 'package:logging/logging.dart'; import 'package:args/args.dart'; main(List args) async { Logger _log = new Logger("app"); ArgParser parser = new ArgParser(); parser.addOption("port", abbr: "p", defaultsTo: "8080"); parser.addFlag("help", abbr: "h"); ArgResults results = parser.parse(args); if (results["help"]) { print(parser.usage); exit(0); } // On dev server we have GAE_PARTITION="dev" // Redirec…

Dart on AppEngine experiment 1 - avoid killer prices and use f1-micro instances

My first Dart AppEngine experiment doing a dummy HelloWorld turned out to be super expensive. Monitoring the project, 2 instances were always running, costing several bucks for doing...absolutely nothing...It seems that by default custom vm use a rather big instance.

Event worst, I was not able to stop these instances that kept restarting. The solution I ended up with was to upload a managed VMs (go in my case) dummy project instead where I could then make as the default and stop the previous instances in a proper way

I wanted to try running dart on a micro instance

Locally I managed to run my app using: --custom_entrypoint "dart bin/server.dart --port {port}" app.yaml
and killing my app properly when needed using

pgrep -f | xargs kill -9
dev_appserver is actually detecting changes as I change my dart file and restart my server, however since it binds to the same port, it sometimes fails.

To deploy I can use the following app.yaml

runtime: …

A Contact Form using mdl hosted on Blogger

Getting a contact form on a static website always ends up with an ugly solution (Google sheet form or external website) and using free hosting (wordpress) requires to stick with a given style.

Blogger has a contact form that people manage to use with a personal style. I wanted to try blogger template for a long time and was wondering whether it could play well with Material Design Lite. I created a new "blog" that will only contain the contact form for the sake of simplicity.

The simplest template I ended up with was this:

<html xmlns:b=""  xmlns:data="" xmlns:expr=""  xmlns=""> <head> <title><data:blog.pageTitle/></title> <b:skin></b:skin> </head> <body> <b:section id="main_section"></b:section> </body>
Adding the …

Resolving Dart external name from dependencies in WebStorm

After several months with WebStorm, I was still wondering why sometimes a class or function from an external Dart package was not resolved when trying to go to its definition. It turns out that i need to include the package(s) manually

The simplest I found was to right click on the packages directory at the root and to right click Mark Directory As | Cancel Exclusion, although sometimes selecting only the packages I import was sufficient.

Dart on Google Cloud Shell

Google Cloud Shell is available for free until the end of 2015. Good opportunity to try it! It starts right away from google cloud console

from the Activate Google Cloud Shell icon at the top right

Let's install Dart

$ sudo sh -c 'curl | apt-key add -' # Set up the location of the stable repository. $ sudo sh -c 'curl > /etc/apt/sources.list.d/dart_stable.list' $ sudo apt-get update $ sudo apt-get install dart$ dart --version Dart VM version: 1.12.1 (Tue Sep  8 11:14:08 2015) on "linux_x64" Somehow pub is not symlinked properly so it is needed to symlink it somewhere (I tend to use /usr/local/bin).

$ sudo ln -s /usr/lib/dart/bin/pub /usr/local/bin/pub$ pub --version Pub 1.12.1 yeah! git is (of course) installed so I can checkout any project and work on them from there...…

Dart, travis and content_shell

Up to now I was using for testing my dart packages after a commit. As of today, as dart was stuck to an earlier version (1.10 while 1.13 will soon be out), I decided to try travis. After signin up with my github credentials it proposed me right away all my public projects.

Good surprise, integration is as simple as selecting your project in travis and adding the following .travis.yml at the root of your project

language: dart dart:   - stable   - dev sudo: false script: pub run test
Even better, I was never able to execute my browser test and adding content-shell support is as easy as updating the .travis.yml file with the following content

language: dart with_content_shell: true dart:   - stable   - dev sudo: false before_install:   - export DISPLAY=:99.0   - sh -e /etc/init.d/xvfb start script: pub run test -p vm -p content-shell
The before install steps are puzzling and explained (somehow) here

dart 1.12, boot2docker and ubuntu 15.04

After some successful attempts some time ago using the appengine and dart tutorial. My boot2docker setup seems to be broken.

In virtual box, I deleted the boot2docker-vm

$ docker run google/dart /usr/bin/dart --version Using default tag: latest Error response from daemon: client and server don't have same version (client API version: 1.20, server API version: 1.19) $ docker version Client:  Version:      1.8.2  API version:  1.20  Go version:   go1.4.2  Git commit:   0a8c2e3  Built:        Wed Oct  7 17:53:44 UTC 2015  OS/Arch:      linux/amd64 Server:  Version:      1.8.2  API version:  1.20  Go version:   go1.4.2  Git commit:   0a8c2e3  Built:        Wed Oct  7 17:53:44 UTC 2015  OS/Arch:      linux/amd64
I removed my docker installation (currenly 1.8.2) with
sudo apt-get remove docker docker-engine
Although I might have simply needed to stop the service Since I installed docker using the official installation, I downgrade docker manually
$ sudo rm /usr/local/bin/docker …

Change Intellij source control integration

I use both Mercurial (hg) and git and now switched to WebStorm for Web development and Android Studio for Android. When you want to enable source code integration Intellij asks you which version control system to use (wonder why it does not try to look recursively in parent folders for any .hg or .git folder)

Remove source code integration Go to Settings (or Preferences on Mac) then choose Version Control and delete the offending line  - typically there is only one - in the mapping list using Delete or the "-" buttonIn a terminal or file explorer remove the incorrect .git or .hg folder that intellij might have created (don't delete the correct one if there was one before) Then you can enable source control integration again using VCS|Enable Source Control Integration... and pick the correct version control system!