Posts

Fixing iOS build for Flutter

This is for the current first Beta version of Flutter

Flutter build remains a nightmare as a primary linux user, especially for iOS, that I don't use enough to get used to so where all the tools installed are always obsolete when I come back

My recent fix for Cocoapods

If

brew install cocoapods pod update
gives

pod --version /usr/local/bin/pod: /usr/local/Cellar/cocoapods/1.4.0/libexec/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory /usr/local/bin/pod: line 2: /usr/local/Cellar/cocoapods/1.4.0/libexec/bin/pod: Undefined error: 0
Try

gem install -n /usr/local/bin cocoapods
Then

flutter run flutter run --preview-dart-2
should work




build_value dart setup

A quick note to remind me how to use build_value package (2.0.0-dev)

Example here using json serialization

Add json_serializable dependency
Add build_runner dependency (dev)

dependencies: json_serializable: any dev_dependencies: build_runner: "=>0.7.8"
Create 'example/model/basic.dart'. All sections are needed here (library, import, part, annotation)


library my_library.basic; import 'package:json_annotation/json_annotation.dart'; part 'basic.g.dart'; @JsonSerializable() class Basic String name; }

Build


# create alias once alias br='pub run build_runner' # build br build
to see file generated (basic.g.dart)

From then you can add option (fromJson, toJson)

@JsonSerializable(includeIfNull: false) class Basic extends Object with _$BasicSerializerMixin { String name; Basic(); factory Basic.fromJson(Map<String, dynamic> json) => _$BasicFromJson(json); }


Debugging Android Nexus 5X on Ubuntu

After plugging my Nexus 5X (and activating debugging), I did get:

$ adb devices List of devices attached 00d60721d971c30400d60721d971c304 no permissions (verify udev rules); see [http://developer.android.com/tools/device.html]
First i used lsusb to find my vendor id (here I guess google)

$ lsusb Bus 002 Device 002: ID 8087:8001 Intel Corp. Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 8087:8009 Intel Corp. ... Bus 003 Device 011: ID 18d1:4ee7 Google Inc. ... Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
As suggested in https://developer.android.com/studio/run/device.html the solution was to

sudo gedit /etc/udev/rules.d/51-android.rules
Add the following

# Google SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
I simply did:
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules$ adb kill-server $ adb devices List of devices attached 00d60721d971c304

Deploying a static website efficiently on Google Cloud Storage

I have several static websites hosted on Google Cloud Storage for which the only thing missing is the ability to have a custom domain using SSL.

In my deploying process from the local file system I was using the gsutil cp command that enables gzipping the files by extension (html,css,js). However each time every file was copied which was a pain when I was using several unmodified images.

My first experience with gsutil rsync was bad:

I could not gzip the files I neededJust touching a file was causing it to be re-deployed However I was able to find an optimized way for deployment Split my local folder into 2 folders with the same hierarchy, one containing the content to be gzip (html,css,js...), the other the other filesGzip each file in my gzip folder (in place)Call gsutil rsync in for each folder to the same gs destination Of course, it is only a one way synchronization and deleted local files are not deleted remotely For the gzip folder the command is
gsutil -m -h Content-Encoding:gzip…

Test dartlang packages on Chrome using Travis

After giving up using content_shell in travis to test my packages, I was using firefox as it was available and good for basic browser testing. However it did hang on some extensive indexeddb testing or missing some feature like WebSql. And testing my components on a browser was needed

Thanks to Alexandre Ardhuin in issue https://github.com/travis-ci/travis-ci/issues/6683, I was able to setup a solution available here:

https://github.com/tekartik/chrome_travis.dart

Assuming you are familiar with Dart and Travis integration

Include chrome_travis.dart as a development dependencies in your pubspec.yaml file

dev_dependencies: test: any chrome_travis: git: git://github.com/tekartik/chrome_travis.dart
Create the following `.travis.yml` file

language: dart sudo: required dist: trusty dart: - stable - dev before_script: - source $(pub run chrome_travis:env_rc) script: - pub run test -p vm -p chrome
Configure your project to run in https://travis-ci.org

The project uses the solut…

Change WebStorm VCS modified file color

Image
On Ubuntu, using WebStorm 2016.2 (and other Intellij project such as Android Studio) and the standard Dracula theme, I can't barely see VCS (Git, Mercurial) modified files in the project view pane as here:

Hard to find the proper option. Turns out (thanks https://www.jetbrains.com/help/idea/2016.2/file-status-highlights.html) it can be found by typing "file status" in the Settings preferences and looking for the "Modified" entry...
Note that I had to restart WebStorm to see the change

Run appengine endpoint php client sample on windows

I'm no expert in php but i had to setup a simple windows php client for appengine (java) endpoint server. I used the client generator (https://github.com/google/apis-client-generator). While my sample was working like a charm on linux, on windows i had more pain

After installing php5 I had to enable (so uncomment in php.ini)
ssl (php_openssl.dll, php_sockets.dll) In my sample I had to disable gzip...
$client->setClassConfig("Google_Http_Request", "disable_gzip", true)