Thursday, February 23, 2017

Run tests in background with golang

With the new "gogland" IDE there is no support(yet) for running tests on each save.

However, if you run ubuntu, you could use the following script to continously run the tests in the background and get notified when you a) break the tests b) fix the tests.

download the script:
wget https://gist.githubusercontent.com/nilsmagnus/8d5a431f19760ddcaa5d8c12d22b13f9/raw/c16fba1f9be83c395a3e4e493c72df8c715fe896/continous_gotest_notify.sh 
execute the script:
sh continous_gotest_notify.sh

Wednesday, January 25, 2017

Install ubuntu on lenovo yoga 900


Setting up lenovo yoga 900 with ubuntu is not straight forward. 

Get into bios by pressing the tiny circular button on the right side of the laptop with a toothpick when the computer is off.
  1. Enable back update in bios
  2. Boot to windows, dowload linux-specific bios update from lenovo, install it and follow instructions.
  3. Change configuration in bios under "configuration" from RAID to ACHI.
  4. Boot from your ubuntu usb-stick, pressing fn-f12 during restart.  
Happy linuxing.

Saturday, January 16, 2016

Timely For Android In Beta

After using the web ui for timelyapp for a while, I got fed up with the "IOS only" policy. So I made my own client using the api provided by timely. So if you want to track your time in timely using android, you are more than welcome to join the beta! Get the app using this link:> https://play.google.com/store/apps/details?id=no.bytecode.timelyappsimple Cheers!

Friday, December 4, 2015

Android installation issue, errorcode -505

Recently I have dealt with some installation-issues for an android app:

1st failure, duplicate permission

11-26 17:39:40.730 10166-10166/? E/Finsky: [1] PackageInstallerImpl$2.onReceive: Error -505 while installing com.something.else: INSTALL_FAILED_DUPLICATE_PERMISSION: Package com.something.else attempting to redeclare permission com.something.else.permission.C2D_MESSAGE already owned by com.something.else
11-26 17:39:40.730 10166-10166/? W/Finsky: [1] InstallerTask$3.installFailed: Install failure of com.something.else: -505 null
: This is probably due to an install of the same application on a different profile on your phone. Either make the user uninstall the app for ALL profiles on the phone or rename your C2D permission. This can be done without breaking the gcm-funcitonality by adding a middle-fix between your application-id and C2D_MESSAGE. In my case I renamed "com.something.else.permission.C2D_MESSAGE" to "com.something.else.permission.e.C2D_MESSAGE"

2nd failure, gms bug

 W/PackageManager(1007):  com.android.server.pm.PackageManagerException: Can't install because provider name com.google.android.gms.measurement.google_measurement_service (in package com.something.else) is already used by com.quoord.tapatalkpro.activity
: add applicationId to the main flavour of your build. Even if it is defined in AndroidManifest.xml, other libraries just reads the build.gradle file. If it is empty it will clash with other applications doing the same thing.

3rd failure, same name as provider in other(random) app

INSTALL_FAILED_CONFLICTING_PROVIDER.
: change authorities of your provider since it has the same authority as a random other app you have installed. E.g. add ${applicationId} as a prefix to your authorities where you declare your provider in the manifest like this:
provider
            android:name=".something.CommonManager"
            android:authorities="${applicationId}.commonmanager"
            android:readPermission=".commonmanager.read"
            android:writePermission=".commonmanager.write" /

Thursday, November 19, 2015

gradle maven-publish credentials

Make your gradle script publish to internal repo by setting password and username as follows:
apply plugin: 'maven-publish' 
apply plugin: 'java'

repositories { 
   maven { 
      credentials { 
            username 'myuser' 
            password 'mypassword' 
      } 
      url "http://myinternalrepo.intra" 
  } 
}

Monday, September 21, 2015

assertj java7

Do NOT use assertj v 3.x if you are developing for java 7 or android. You will end up with the error
error: cannot access CompletableFuture
Downgrade to assertj 2.x to fix it if you are using jdk7, use version 1.x if you are developing for android.

Saturday, September 5, 2015

Connecting to redis on heroku with golang

I have an app on heroku using the redis-addon provided by heroku ("Redis Heroku"). To connect to this instance using go-redis, I have found this to be a working solution:
  • The redis url is provided as an environment variable, REDIS_URL
  • To use redis from golang, I use redis-go.  I install this library by typing "go get github.com/gopkg.in/redis.v3"
  • Parse the url and extract the user before connecting(unless, you might end up with the error "dial tcp: too many colons in address redis://...")