RSS

Tag Archives: example

Firebase Unity3D example: a walk through tutorial


image

Read the rest of this entry »

 
Leave a comment

Posted by on January 16, 2017 in Programming, Unity 3d

 

Tags: , , , , , , , ,

Bing Search in C#: A step by step walk-through tutorial


This blog is the 3rd article of the series Search in C# example demonstration. If you are interested in my earlier blogs in this series, please refer to below blogs:

In this blog, I am going to walk through how to do Bing Web Search using the latest v5 API.

BingSearch

Read the rest of this entry »

 
1 Comment

Posted by on December 15, 2016 in Dotnet/C#, Programming

 

Tags: , , , , , , , , , ,

vmware workstation unrecoverable error (vcpu-0)


When you install some virtual OS using vmware workstation or vmware player, if you encounter below error:

unrecoverable error (vcpu-0)

Try below actions:

  • open *.vmx file in the folder where your OS is located
  • append below line to the tail of the vmx file (you can put this line anywhere in the vmx file, and vmx file will be auto-sorted for you)

smc.version = 0

image

That is it! Happy working!

 
Leave a comment

Posted by on December 12, 2016 in General, Linux, Mac, Windows

 

Tags: , , , , , , , , ,

A good tutorial on Builder design pattern


Original article: https://jlordiales.me/2012/12/13/the-builder-pattern-in-practice/

public class User {
  private final String firstName; // required
  private final String lastName; // required
  private final int age; // optional
  private final String phone; // optional
  private final String address; // optional

  private User(UserBuilder builder) {
    this.firstName = builder.firstName;
    this.lastName = builder.lastName;
    this.age = builder.age;
    this.phone = builder.phone;
    this.address = builder.address;
  }

  public String getFirstName() {
    return firstName;
  }

  public String getLastName() {
    return lastName;
  }

  public int getAge() {
    return age;
  }

  public String getPhone() {
    return phone;
  }

  public String getAddress() {
    return address;
  }

  public static class UserBuilder {
    private final String firstName;
    private final String lastName;
    private int age;
    private String phone;
    private String address;

    public UserBuilder(String firstName, String lastName) {
      this.firstName = firstName;
      this.lastName = lastName;
    }

    public UserBuilder age(int age) {
      this.age = age;
      return this;
    }

    public UserBuilder phone(String phone) {
      this.phone = phone;
      return this;
    }

    public UserBuilder address(String address) {
      this.address = address;
      return this;
    }

    public User build() {
      return new User(this);
    }
  }
}
 
Leave a comment

Posted by on November 11, 2016 in General

 

Tags: , , ,

How to use GitStats in Windows: A step-by-step tutorial


GitStats is a handy tool for analysis and statistics for a git repository. It is a statistics generator for git repositories, which produces some interesting statistics from the history of it. Currently HTML is the output format.

gitstats

image

Read the rest of this entry »

 
Leave a comment

Posted by on September 18, 2016 in Programming

 

Tags: , , , , , , , ,

Step-by-Step guide for developing Android Plugin for Unity3D (II)


In previous blog, I have covered how to handshake Native Android code with Unity3D. The example shown therein is pretty simple: how to call a java function in C#!

In this blog, I am trying to step one more stride further: to create and use an Android View in Unity3D. The example shown here is an Android ImageView, however, this approach is generally applicable to all kinds of Android Views, ViewGroups and custom views.

imageAn Android ImageView

imageUse Android ImageView in Unity3D

Read the rest of this entry »

 
8 Comments

Posted by on August 10, 2016 in Android, Programming, Unity 3d

 

Tags: , , , , , , ,

Android: get active, current or foreground Activity


In our recent Android App development, we developed many static utility functions, which needs a Context as the argument:

public static void func1(Context context, …)
public static void func2(Context context, …)
public static void func3(Context context, …)

public static void funcN(Context context, …)

This is very cumbersome. We would like to refactor these utility functions into functions without the context argument/ A natural idea to pass in the application context at the very beginning, e.g. Application.onCreate() function, but not in all cases, can we use the application context. For instance, when you create a dialog or toast window, we need to use Activity as the context. So here comes the function that works:

image

Visit this gist to get the source code.

 
Leave a comment

Posted by on July 13, 2016 in Android, Programming

 

Tags: , , , , , , ,