Tuesday, 26 July 2016

Android.Content.ActivityNotFoundException: No Activity found to handle Intent

I you get the following error message when trying to email using an Android emulator:
Android.Content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND_MULTIPLE typ=text/plain flg=0x10000000 (has extras) }
Then you most likely do not have email setup in the emulator.  Install Google Play on the emulator and setup an email account.

Wednesday, 20 July 2016

DefaultFilterProvider

If you need to apply a FilterAttribute to all your MVC controllers and actions, but still be able to override the default behaviour, then you can use the following:
FilterProviders.Providers.Add(new DefaultFilterProvider<NoAuthorizeAttribute, AuthorizeUserAttribute>());

Saturday, 9 July 2016

Debug Android applications over Wi-Fi


Note to self:
  • Connect your Android device via USB, and make sure that USB debugging is working.
  • Open the Android Adb Command Prompt
  • Enter the following:
adb tcpip 5555

  • Find the IP Address of the device:
adb shell netcfg

  • Now connect to the device 



    adb connect <device.ip.address>:5555

    • You should now be able to disconnect the device from USB and be able to debug over Wi-Fi 

    Sunday, 29 May 2016

    java.lang.OutOfMemoryError. Consider increasing the value of $(JavaMaximumHeapSize). Java ran out of memory while executing 'java.exe'

    I was getting a java.lang.OutOfMemoryError while trying to compile a Xamarin Android application after adding HockeyApp.

    I found to ways to resolve this.

    The first option is to add a Environment Variable called _JAVA_OPTIONS and set it to -Xmx1g.  This sets the JVM heap size to 1GB.  You can either do this from the commandline by calling
    SET _JAVA_OPTIONS = -Xmx1g
    Or you can edit your system environment variables:



    The second and my preferred option was to to update the Java Max Heap Size in the Advanced Android Options tab in the Xamarin Android Visual Studio project:


    Wednesday, 18 May 2016

    The specified solution configuration “Debug|X64” is invalid

    I have a build script that finds all the solutions in a version control repository and builds them.  I do not specify the platform as many of the solutions and projects have different platform settings.

    Today in one of the branches my script started giving me the following error:
    The specified solution configuration “Debug|X64” is invalid
    Adding the following to the start of my build script solved this issue:
    SET PLATFORM=

    Tuesday, 17 May 2016

    TFS: Undo checkout of unmodified files

    Here is another one of those shortcuts I have not been aware of. :D

    I hate TFS version control.  There are many reasons, but one irritating thing is that it is incapable of detecting if a file has actually changed or not.

    Here is a little commandline script you can run in your project to undo all unchanged files:
    tfpt uu . /noget /recursive
    Note: You need to install Team Foundation Server Power Tools.

    Thursday, 31 March 2016

    Prefix.io

    I've been using Prefix.io on my development machine at work for about 3 weeks now.  It has been pretty amazing the insights it gave me to what the code base I am working on is doing.

    After an early hiccup, which was quickly resolved by the awesome Matt Watson, the installation is a breeze, and it just works, with no perceived impact on CPU or memory usage.

    I have not had the opportunity to use Stackify APM yet, but if it is half as good as Prefix then everyone should be using it.

    Great job Matt and thank you for a fantastic tool!

    Monday, 11 January 2016

    How to setup Node.js and npm behind a corporate web proxy


    Proxy with no authentication:

    npm config set proxy http://proxy.com:8080
    npm config set https-proxy http://proxy.com:8080

    Proxy with authentication:

    npm config set proxy http://username:password@proxy.com:8080
    npm config set https-proxy http://username:password@proxy.com:8080

    These examples use proxy.com as the proxy server url and 8080 for the port number.

    Monday, 4 January 2016

    How to install Android Studio in Ubuntu

    sudo apt-add-repository ppa:paolorotolo/android-studio
    sudo apt-get update
    sudo apt-get install android-studio
    Reference

    Thursday, 24 December 2015

    Using multiple commands and conditional processing symbols

    Holy cow, I've been using windows since, well forever and I did not know you could do this:

    Using multiple commands and conditional processing symbols

    You can run multiple commands from a single command line or script using conditional processing symbols. When you run multiple commands with conditional processing symbols, the commands to the right of the conditional processing symbol act based upon the results of the command to the left of the conditional processing symbol. For example, you might want to run a command only if the previous command fails. Or, you might want to run a command only if the previous command is successful.
    You can use the special characters listed in the following table to pass multiple commands.
    CharacterSyntaxDefinition
    & [...]
    command1 & command2
    Use to separate multiple commands on one command line. Cmd.exe runs the first command, and then the second command.
    && [...]
    command1 && command2
    Use to run the command following && only if the command preceding the symbol is successful. Cmd.exe runs the first command, and then runs the second command only if the first command completed successfully.
    || [...]
    command1 || command2
    Use to run the command following || only if the command preceding || fails. Cmd.exe runs the first command, and then runs the second command only if the first command did not complete successfully (receives an error code greater than zero).
    ( ) [...]
    (command1 & command2) 
    Use to group or nest multiple commands.
    ; or ,
    command1 parameter1;parameter2
    Use to separate command parameters.