Monday, December 11, 2017

Unity 3D Adding MouseLook from Standard assets gives error - The script needs to derive from MonoBehaviour

You get this error trying to add MoseLook from Assets\Standard Assets\Characters\FirstPersonCharacter\Scripts
Can't add script behaviour MouseLook. The script needs to derive from MonoBehaviour!

You can use the alternative SimpleMouseRotator from Assets\Standard Assets\Utility

Sunday, December 3, 2017

Adjusting vim window size for higher resolutions (ex: 4k monitors)

vim loads with a tiny window screen by default in a 4k monitor.



To fix,

  1. Pick a font with right size using Edit --> Select Font you like so the window looks nice. 
  2. Once the window looks good, use below to find the current font settings
  3. Press Shift and :
  4. Type in set gfn? and hit Enter
  5. You should see the current font setting. For example, I got guifont=Consolas:h10:cANSI:qDRAFT
  6. Press Shift and :
  7. Type in e $MYVIMRC and hit Enter
  8. You will now be eiditing your _vimrc file. In windows you can find this file in "C:\Program Files (x86)\Vim" assuming default vim installation options
  9. Note: You may not have permission to write this file. If this is the case, please launch with Admin privileges or open the file in your favorite text editor with Admin privileges
  10. Enter Line from (5) as the first line of the file after adding set to the front. Example set guifont=Consolas:h10:cANSI:qDRAFT
  11. Note: if there are spaces, make sure to add a slash \ just before it.  
  12. Save the file and restart it
My _vimrc after update below

Friday, December 1, 2017

C# how to initiate a List via constructor

Example of a string List initialization in one line below


//Create list strCollection and assign string A, B, C & D to it!
List<string> strCollection = new List<string>() { "A", "B", "C", "D" };


Convert C# foreach loop to process in parallel

Note: this is a C# 4.0 feature

The first loop run in a serial matter, and the second one parallel. First one is guaranteed output ABCD, but the second write these characters in a random fashion

List<string> strCollection = new List<string>() { "A", "B", "C", "D" };
// Process one at a time
foreach (string str in strCollection)
{
    Console.WriteLine(str);
}
// Process in parallel
System.Threading.Tasks.Parallel.ForEach(strCollection, str =>
{
    Console.WriteLine(str);
});


Friday, October 27, 2017

Unity 3D freezing on launch splash screen, and subsequently showing a grey screen (after a while)


I have faced this issue on a fresh install, version 2017.2. Uninstalling everything and installing fresh did not help at all.

Logs here %localappdata%\Unity\Editor\ shows something like below
Error loading file:///C%3A%2FUsers%2FYOURUSERNAME%2FAppData%2FRoaming%2FUnity%2FPackages%2Fnode_modules%2Funity-editor-home%2Fdist/index.html#/login

To fix  
go to C:\Program Files\Unity\Editor\Data\Resources\Packages

You can see 4 tgz files

 1. unity-editor-home.0.8.30.tgz
 2. unityeditor-cloud-hub-0.0.15.tgz
 3. unityeditor-collab-history.0.6.14.tgz
 4. unityeditor-collab-toolbar.0.7.15.tgz

Use an unarchive program (I used 7-zip file manager) to open each one of these and extract contents (dist folder and package.json file) to your Roaming folder
C:\Users\YOURUSERNAME\AppData\Roaming\Unity\Packages\node_modules

After extract, the folder looks like this.. 
..\AppData\Roaming\Unity\Packages\node_modules\unity-editor-home 
..\AppData\Roaming\Unity\Packages\node_modules\unityeditor-cloud-hub 
..\AppData\Roaming\Unity\Packages\node_modules\unityeditor-collab-history 
..\AppData\Roaming\Unity\Packages\node_modules\unityeditor-collab-toolbar 

and as an example, unity-editor-home like below (one level subfolders shown)
..\AppData\Roaming\Unity\Packages\node_modules\unity-editor-home\dist 
..\AppData\Roaming\Unity\Packages\node_modules\unity-editor-home\package.json 
..\AppData\Roaming\Unity\Packages\node_modules\unity-editor-home\README.md

Monday, August 14, 2017

Manually creating a skype for business meeting without outlook plugin

Need to create a Skype for business meeting without access to outlook or outlook plugin? Follow these steps... The screens were captured from Skype for Business 2016.


1. Click the meet now button on Skype last tab (calendar)


2. The meeting window opens. In bottom right corner, click the round button and select “Meeting Entry Info”


3. Meeting Entry info popup now shows. “Click Copy All Info” and paste into an email or the meeting invite body text


Wednesday, May 24, 2017

Configure Jenkins to run on SSL port (HTTPS)

By default Jenkins is configured to start on HTTP port 8080 after install

Instructions to change this to use a HTTPS/SSL port with a custom certificate explained below.

These steps were followed on a windows machine.
The assumption at this point is Jenkins is up and running, and you already have an SSL certificate available in the default windows certificate store (or already have a pfx handy).

Tips:
To find JENKINS_HOME, go to dashboard and follow path
In Menu, Jenkins, Manage Jenkins, system Information (or visit in browser http://yourserver:8080/systemInfo)
Scroll down and make a note of JENKINS_HOME

To restart Jenkins, you can issue a command like
http://yourserver:8080/restart
or issue below from command line (assuming default install path in windows - JENKINS_HOME - is C:\Program Files (x86)\Jenkins)
"C:\Program Files (x86)\Jenkins\jenkins.exe" restart

Watch for any errors at
C:\Program Files (x86)\Jenkins\jenkins.err.log

Steps to run on SSL/HTTPS with custom certificate

Step A: Fix the URL Jenkins is running

  1. Navigate to Jenkins, Manage Jenkins, Configure system (or go to http://yourserver:8080/configure)
  2. Scroll and find "Jenkins URL" and fix this. ie; change from localhost correct server name


Step B: Export your pfx certificate from windows (skip if you already have a pfx available)

  1. In windows having the certificate you need to use, Start, Run, mmc, hit Enter
  2. File, Add Remove Snap-in, certificates, Add, Computer Account
  3. Locate the certificate you want to use and right click on it
  4. All Tasks, Export, next, select option "yes, export the private key", next, select option .PFX, "Include all certificates in the certification path if possible", "Export all extended properties"
  5. Next, Password, set something you remember, next and save the file.
  6.  Lets assume the exported pfx is called myCustomCert.pfx & password is MyPass#436


Step C: Convert PFX to java keystore

  1. Start, Run, cmd
  2. In command line, naviage to the folder you have saved the pfx file
  3. Use java keytool to convert the certificate. Note: if you are running Jenkins with 32 bit java, you have to use 32 bit keytool to generate the certificate. To be on safer side, we will use the jre that comes with Jenkins assuming this is the one that's used to run Jenkins. Additionally, you can see I am using the same password again for import and exporting to new keystore. This was because I was running into trouble with jenkins not loading the file if I use a different password
  4. "C:\Program Files (x86)\Jenkins\jre\bin\keytool" -importkeystore -srckeystore myCustomCert.pfx -srcstoretype pkcs12 -srcstorepass MyPass#436 -destkeystore myCustomCert.jks -deststoretype jks -deststorepass MyPass#436
  5. Copy the generated myCustomCert.jks to JENKINS_HOME (in the default case C:\Program Files (x86)\Jenkins)
  6. Edit jenkns.xml from JENKINS_HOME (C:\Program Files (x86)\Jenkins). I have used Visual Studio Code as notepad is not able to read the file properly (formatting mess)
  7. Find line like below -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"
  8. Change as below (changes bolded) -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=-1 --httpsPort=8080 --webroot="%BASE%\war" --httpsKeyStore="%BASE%\myCustomCert.jks" --httpsKeyStorePassword=MyPass#436
  9. Restart Jenkins
  10. After restart you should be able to access Jenkins via the https protocol; (eg. https://yourserver:8080)

Sunday, April 16, 2017

Game maker Android plugin, getting application context

Game maker Android plugin java code,

Application Context is available as part of RunnerJNILib that you normally include

Sample code accessing context below

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
package ${YYAndroidPackageName};

import android.content.Context;
import android.app.Application;

import ${YYAndroidPackageName}.R;
import com.yoyogames.runner.RunnerJNILib;

public class MyClassName {
 private Context mContext;
 public  MyClassName() {
  mContext = RunnerJNILib.GetApplicationContext();
 }
}

Sunday, March 19, 2017

Gamemaker 1.4 android publishing for IAP requires read_phone_state permission

When you add in app purchasing, and start using "Google Play Licensing" you will notice that the app now requires read_phone_state, which do not look good on app installs

To remove read_phone_state from the android apk please do below


  1. Goto YourProject.gmx\extensions\GooglePlayLicensingAsExt\AndroidSource\Sdk\library
  2. Edit AndroidManifest.xml
  3. Add xmlns:tools="http://schemas.android.com/tools" to manifest header
  4. Add <uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" /> in the body
  5. Save and compile project
The file in the end will look like below -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.vending.licensing"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="2"
android:versionName="1.5">
<!-- Devices >= 3 have version of Android Market that supports licensing. -->
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="15" />
<!-- Required permission to check licensing. -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
</manifest>


Tuesday, January 24, 2017

Connect Visual Studio code to github

First go to github and locate the project you are going to work on.
Copy the URL of the project, for example https://github.com/myuser/myproject.git

now, in your laptop, go to command prompt, and the folder you want to check out and work on the project

lets say
c:\projects\

Create your project folder myproject

go to myproject
now your command line should be on
c:\projects\myproject

To get the project locally (from github), run first
git init
and then
git clone https://github.com/myuser/myproject.git
on the command line
that's all to it. Now we can close the command line

Open up Visual Studio code and open folder c:\projects\myproject
You can now start making changes to your project and also check in checkout from VS Code itself. Look for Git on the tab on left (third button down)

Sunday, January 1, 2017

Serif PagePlus, merging multiple documents (.ppp) together into one (single) document

Say you have two or more Serif PagePlus (*.ppp) files and want to merge them together into one file. You can accomplish this with the below steps

1. Open the first document in PagePlus (this will be your final merged document)
2. Go to the last page in the document
3. From menu option choose, Insert and then Publication
4. Select your second document and click Open
5. Select option "After the current page" and click OK
6. Repeat steps 2 to 5 as much as you need (ie; for all your rest of the docuuemnts that need merging)
7. Use File, Save As option to Save the new merged document to disk




Turn on Windows 11 Fast Boot

If windows starting is slow, to enable windows 11 fast startup/boot,  Press Windows + R, type powercfg.cpl, and hit Enter.  This will direct...