Learn how to build mobile applications with Xamarin Forms and Amazon Web Services

Early Access to my Xamarin mobile with AWS backend course!

* indicates required




I am currently working on a video course that will be posted on Udemy. I’ll be showing how to build cross-platform applications using Xamarin Forms and (AWS) Amazon Web Services to store data and handle user login. This is going to be an amazing course. I’ll be showing you how to build real world applications.

The full price of the course will be $50. Early Access will start in March of 2017 for only $15 so sign up now!

How to create a bubble sort with Java and Haxe

There are tones of posts online that cover bubble sort. Lately I’ve been brushing up on my Java and also I like Haxe so here are two videos covering bubble sort in each of the two languages.

Java Bubble Sort Algorithm

 

import java.util.Arrays;

/**
 * Created by matthew.wallace on 2/10/17.
 */
public class Main {

    public static void main(String[] args) {

        int[] list = {4,6,2,90,245,3,21,356,42};

        System.out.println("before sort : " + Arrays.toString(list));
        int i,j,temp;

        for (i = 0; i < list.length - 1 ; i++) {
            for (j = 0; j < list.length - 1 - i ; j++) {

                if( list[j] > list[j + 1]) {
                    temp = list[j];
                    list[j] = list[j + 1];
                    list[j + 1] = temp;
                }
            }
        }

        System.out.println("after sort : " + Arrays.toString(list));
    }
}

 

Haxe Bubble Sort Algorithm

 

package ;
class Main {

    public function new() {

        var list:Array<Int> = [7,5,1,2,45,37,42,183,3];

        var temp:Int;

        trace("unsorted list : "+ list);

        for(i in 0...list.length - 1) {
            for(j in 0...list.length - 1 - i) {

                if ( list[j] > list[j + 1]) {
                    temp = list[j];
                    list[j] = list[j + 1];
                    list[j + 1] = temp;
                }
            }
        }

        trace("sorted list : "+ list);

    }

    public static function main() {
        new Main();
    }
}

How do you create a queue from stack algorithm

This will be the first in a series of posts on some common algorithms you can use to solve various problem. I find it super helpful to do one or two of these per day just to keep things fresh in your mind. These are especially helpful to know during coding interviews.

Queue from Stack Java Example.

 

Queue from Stack Haxe Example.

So what is a “Stack”. Well, it’s a container of objects to put it simply. These objects are put in using the last-in first-out out method. To explain this in layman terms lets imagine you have a box and you put in a nickel, a dime, a penny and a quarter in that order. You come back to the box a few seconds later and reach in one at a time to pull out the money that you put in. The order that you can expect the money would be in reverse because when removing from a stack you must remove from the top down. So the first item to leave the box would be the quarter, then the penny, then the dime, then the nickel.

Here is an example of creating and adding items to a Stack in Java.

import java.util.Stack;

public class Queue {
        private Stack<Integer> newStack;
        
     public Queue() {
	oldStack = new Stack<Integer>();
	newStack = new Stack<Integer>();
     }

     public boolean enqueue(int element) {
	  boolean rvalue = true;
		
	  try {
              newStack.push(new Integer(element));
	  } catch (Exception error) {
	       rvalue  = false;
	       System.out.println("There was an error adding the item to the Queue : " + error.getMessage());;
	  }
		
	  return rvalue;
       } 

}

Here is an example in Haxe of a Stack using a typed Array.

package ;
class Queue {

    var newStack:Array<Int> = [];

    public function new() {
    }

    public function enqueue(element:Int):Bool {

        var rvalue:Bool = true;


        try {
            newStack.push(element);
        } catch (error:Error) {
            rvalue = false;
            trace("Something went wrong with added an element to the Queue: " + error);
        }

        return rvalue;
    }

}

Next we talk about the concept of a “Queue”. The Queue is a container that uses the first-in first-out principle. In our example above when explaining what a stack does, in order to implement the same example regarding a queue you would have a box and you would place a nickel, a dime, a penny and a quarter into the box in that order and then when removing them you would expect the money to come out of the box in the order in which you placed it, so you would see a nickel come out of the box first followed by the dime, then the penny, then lastly the quarter.

Here is an example of using some Queue logic with a Java Stack.

import java.util.Stack;

public class Queue {
	
	private Stack<Integer> oldStack;
	private Stack<Integer> newStack;
	private int topElement = -1;
	public Queue() {
		oldStack = new Stack<Integer>();
		newStack = new Stack<Integer>();
	}
	
	public Integer dequeue() {
		topElement = -1;
		if(oldStack.empty()) {
			while(!newStack.empty()) {
				topElement = newStack.peek();
				oldStack.push(topElement);
				newStack.pop();
			}
		}
		
		if(!oldStack.empty()) {
			Integer i = oldStack.peek();
			topElement = i.intValue();
			oldStack.pop();
		}
		
		return topElement;
	}
}

Here is an example of creating Queue logic with a Haxe typed Array.

package ;
import haxe.io.Error;
class Queue {

    var oldStack:Array<Int> = [];
    var newStack:Array<Int> = [];
    var topElement:Int = -1;

    public function new() {
    }

    public function dequeue():Int {

        topElement = -1;

        if(oldStack.length <= 0) {
            while(newStack.length > 0) {
                topElement = newStack.pop();
                oldStack.push(topElement);
            }
        }

        if(oldStack.length > 0) {
            topElement = oldStack.pop();
        }

        return topElement;
    }
}

 

Haxe Video Tutorials

Haxe Examples

If you have followed me for a while then you know that Haxe has always been something I’m interested  in, so I’ve started a new learning site. If you have not yet taken the time to see if it’s a cross-platform toolkit that you would like to use then you should check out the Haxe how to video tutorials that I’m creating over at the Haxe Examples website.

If you are a Haxe developer and you would like to contribute to the community then please hit me up on twitter. I’d like to have more of you contribute videos to the site as well. @matthewswallace

Checkout our first video on how to install Haxe and run your first Haxe program. 

Daily Haxe – October 5th 2016

Join the #dailyhaxe   haxe-logo

Domagoj Štrekelj

I’m working on Mokha (https://github.com/dstrekelj/mokha), which is a small 2D framework for Kha. It’s a pet project, not exactly ready for the public, but I hope others will find it useful in time. Just added a room-by-room camera follow style

Rafael Oliveira
I’m working in a 3d engine for Kha, there is no name yet (I’m not good at choosing lib names), but for now it’s just Sd3 (https://github.com/RafaelOliveira/Sd3). The objective is to create a simple engine that can run in mobile browsers. screenshot: http://1.1m.yt/GBwaglO.png Two demos: http://sudoestegames.com/play/3dtesthttp://sudoestegames.com/play/race in desktop the two demos uses a shader with lights, but if you open in a mobile browser, it will use a shader with no lights (for a better performance), and it will use the whole screen of the device. There is no touch controls yet.

YellowAfterlife
I wrote a GML->JS transpiler in Haxe which produces code compatible with what GameMaker itself outputs, therefore making it possible to make something similar to try.haxe but for GM and with client-side compilation.
http://yal.cc/r/gmlpen/


Matthew Wallace
Currently I’m creating the first of many courses on Haxe that I’ll be publishing to Udemy https://www.udemy.com/user/matthewwallace/

Daily Haxe

Join the #dailyhaxe discord channel!

discord  haxe-logo

Let’s show off what we are all up to in the Haxe community. Join the #dailyhaxe channel on Discord and I’ll pick the most interesting of what is going on and post it for you guys. It will be a great way to meet the community and start conversations about what people are working on or looking to do in the Haxe community.

FBSDKCoreKit/FBSDKCoreKit.h not found error after updating CocoaPod to 1.0.0

I recently updated to CocoaPods 1.0.0 and also updated the FacebookSDK for an app that I am working on. Well needless to say things broke. For whatever reason Xcode started complaining that it couldn’t find the FBSDKCoreKit frame work.

Well never fear my fellow iOS developers. I found the answer on Stackoverflow. http://stackoverflow.com/a/37329239/339427

Here is a look at what’s in my pod file.

platform :ios, '9.0'
use_frameworks!

target "MyTarget" do
    pod 'FBSDKCoreKit'
    pod 'FBSDKLoginKit'
    pod 'FBSDKShareKit'
end

Here is the answer I found in the stackoverflow post that helped get things working again. 

Answer from: Mihriban Minaz
After updating Cocoapods 1.0.0, I deleted pod.lock and installed the current stable pod versions (4.7.0 to 4.11.0) of FBSDKCoreKit, FBSDKLoginKit, FBSDKShareKit

Then i encounter the same error. What i did was:

  1. Added Header Search Paths Build Settings in Xcode:

    "${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK\"
    "${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK/FacebookSDK\"
    "${PODS_ROOT}/Headers/Public/FBSDKCoreKit\"
    "${PODS_ROOT}/Headers/Public/FBSDKCoreKit/FBSDKCoreKit\"

Then i still had error for another file. Because XCode is using prebuild frameworks.

FBSDKCoreKit/FBSDKCopying.h not found

  1. Clean Build -> ⇧⌘K (Shift + Command + K) – to clean builded frameworks.
  2. Clean Build Folder -> ⌥⇧⌘K (Option+Shift+Command+K)
  3. Close Xcode // important! – Otherwise it recreate the DerivedData for the current open project automatically
  4. Run this command in terminal

    rm -rf ~/Library/Developer/Xcode/DerivedData
  5. Open XCode and build successfully

 

Don’t just do something, stand there

The worst thing I ever did for my back was become a full time Software Engineer. It’s a constant battle because for that long is not good for you. The last few years I make sure and drink a lot of water and coffee so I’m forced to leave the desk to go to the rest room or fill up my cup to keep the justices flowing. Another thing that has really help is getting an adjustable desk and chair. This way I can stand for 20 – 30 mins and then take a break.

Here are 5 health benefits to having this setup as sited by Smithsonian.com

  • Reduced Risk of Obesity
  • Reduced Risk of Type 2 Diabetes and Other Metabolic Problems
  • Reduced Risk of Cardiovascular Disease
  • Reduced Risk of Cancer
  • Lower Long-Term Mortality Risk

Needless to day … get a standing desk. I also find that it helps me focus more on the task at hand.

Below I’ve shared the “electric” adjustable standing desk that I use every day, the chair that I use when I do sit and the computer monitor arms that I bought. They won’t break the bank and the quality is good enough that you can rely on them to work for you for a long time.

LexMod Attainment Drafting Stool, Brown
ApexDesk 71
Loctek Heavy Duty Gas Spring Dual Arm Desk Mounts Fits 10