sunnuntai 3. huhtikuuta 2016

Associate Chrome with Magnet links

I have been struggling few days because my chrome for some reason didn't open magnet links. So my final solution was:

Uninstall Google chrome
Delete C:/Users/username/AppData/Google
Delete C:/Program Files x86/Google

Then download and install Google Chrome again.

Open search and type: regedit

find: HKEY_CLASSES_ROOT\Magnet\shell\open\command
and set path for your torrent software.
This did the trick for me. Some users might need to check this step, but this should be unnecessary to do after full reinstall of chrome.

Go to start menu > run
type in %LOCALAPPDATA%\Google\Chrome\User Data
Double click the Local State file
select notepad to open it.
search for "protocol_handler" > "excluded_schemes" > "magnet": true
Change true to false.

maanantai 18. tammikuuta 2016

Installing Cordova and Android SDK To Windows

So I have been developing for Android for a while with Cordova in Linux environment and now I wanted to install same environment for my home PC as well, but it was not very easy task. Anyway here is how to accomplish it.

1. Go to http://developer.android.com/sdk/index.html#Other and download the recommended windows package. Other option is to download Android studio, but I am going to use Atom or Sublime text for editing and then just compile with cordova, so I am going to download only the minimum SDK. After you have downloaded, install it. Android SDK may take up to 40 gigabytes, so make sure you have enough disk space.

2. Go to https://nodejs.org/en/ and download either long term or latest features NodeJS and install it.

3. Then search for SDK manager.


4. From SDK manager install the following:
  • Android SDK tools
  • Android SDK platform tools
  • Android SDK Build tools
  • Android 5.1.1 (API 22)
  • Some extras if you want
This is the minimum setup as far as I know. In the picture I have also downloaded other stuff.


5. Then search for AVD manager and create new virtual device


6. Hit create and use following values for example:


7. Then open git bash (if you dont have git bash, you need that also, install it with recommended settings https://git-scm.com/download/win) Right click anywhere and hit "git bash here".

8. Type commands: 

npm i -g cordova
npm i -g phonegap (not really required, optional)

9. Almost done, now its time to setup environment variables. Go to Control panel -> Advanced system settings -> Environment variables

Add new value:

Variable name: ANDROID_PLATFORM_TOOLS
Variable value: F:\Android\platform-tools (AKA your android platform tools installation folder)

Variable name: ANDROID_TOOLS
Variable value: F:\Android\tools (Again your own location for this)

Then edit PATH variable and after npm path variable add:

;C:\Program Files\nodejs%Path%;%ANDROID_PLATFORM_TOOLS%;%ANDROID_TOOLS%

If you already have nodejs in path remove it and start from %Path

10. Close and reopen your git bash window and you should be all set. Create new cordova project and run it.

Using real device on windows



1. First enable usb debugging from your Android device under developer options. (http://www.greenbot.com/article/2457986/how-to-enable-developer-options-on-your-android-phone-or-tablet.html)

2. Attach it to your phone. After that, right click your computer and select manage -> device manager

From device manager select adb device and update driver, you will find it from android SDK folder. (http://developer.android.com/tools/extras/oem-usb.html)

3. I am not sure if you need OEM driver, I installed it also. http://developer.android.com/tools/extras/oem-usb.html#Drivers

4. After this you should be able to use command adb devices


Signing APK files

I also had to sign and zipalign APK file on windows so to use jarsigner use command:

"C:\Program Files\Java\jdk1.8.0_65\bin\jarsigner.exe" -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore yourkeyname.keystore android-release-unsigned.apk username

To zipalign use similar command:

"F:\Android\build-tools\23.0.2\zipalign.exe" -v 4 android-release-unsigned.apk finalappname.apk

tiistai 5. tammikuuta 2016

Git on windows, ssh agent. Do you hate typing git password?

If you are using git bash for windows it will ask you every single time password when you connect to github or similar. Use commands below in your bash terminal to start ssh-agent and add your key to keyring file. ssh-add will ask your git password for private key but after that it wont ask your password anymore!

eval `ssh-agent -s`
ssh-add
if above doesn't start ssh-agent try:

eval $(ssh-agent)
To start the ssh-agent automatically every single time you open your git bash do the following:

create file named .bashrc with the dot to your user home folder. c:\users\username

to bashrc file type: 

#!/bin/bash
eval `ssh-agent -s`
ssh-add
Then go to your home folder and find hidden .ssh folder. There create file named config
To config file type:

ForwardAgent yes
After this your bash will never ask git password until you close the session.


Originally explained here:
http://stackoverflow.com/questions/17846529/could-not-open-a-connection-to-your-authentication-agent