Two Track Coding (ROP) For Dummies – Part 2

Hello World!

Welcome to Part 2!  Hopefully you made it through part 1 with no issues.  In this part, I will discuss Applicatives, in this scenario, we are doing validation of an entire type, however you can use this method for any sort of processing in the system that returns a result or failure and takes n parameters.

Part 1: Bind
Part 2: Applicatives
Part 3: Options

Continue reading

Two Track Coding (ROP) For Dummies – Part 1

Hello World!

So if you made it to this article, that means you probably have seen this already.  If you haven’t, you really need to.  That is really step one to this whole thing.  Scott wrote a fantastic article there and I finally understand how it works after weeks of studying and coding and working on a new F# project.  This article series is meant to take what Scott and others have written and break it down such that mere mortals and dummies like myself can grasp on to.

Before we get too far, I need to explain a little bit about what Two Track Coding, Railway Oriented Programming (or for short here on out ROP) is and why it is great.  Coding without ROP yields code that can have tons of if/then/else, try/catch nests and is an absolute bear to read, write, understand, debug and also ensure all cases are caught.  Go to http://fsharpforfunandprofit.com/rop/ for more.

Part 1: Bind
Part 2: Applicatives
Part 3: Options

Continue reading

Manage Azure Blobs with F#

Hello World!

So you are going to notice a slight shift in this blog to start incorporating not only video game development, but hardcore data analytics.  As part of that shift, I am going to start incorporating F# into my standard set of languages as it is the language of hardcore data analytics if you roll with the .NET stack.

This particular article is about building a console based blob manager in F# instead of C#.  The very first thing I noticed about using F# to manage my blobs as opposed to C# is just the sheer reduction in lines of code.  The code presented here is a port of the C# article located here.  This code will eventually make its way into a production system which is part of a big data solution I am building.  New data sets that we acquire will be uploaded into blob storage, an entry stored into a queue, with a link to the data set.  Once a job is prepared to run, the data will be moved to Hadoop to do the processing and then stored in its final location.  So step 1 is…Store data in Blob storage.

Continue reading

Why you should use Event Systems

Hello Readers!

So I have received a ton of questions about event systems from both C# classes I teach as well as from Unity game development classes I teach.  So I have decided to build this blog post generically enough to apply to both.  If you aren’t using event systems, your code probably looks a lot like something below…

    /// <summary>
    /// Moves the character on the ladder
    /// </summary>
    /// <param name="position">place touched.</param>
    /// <param name="other">the object that collided with us.</param>
    private void MoveOnLadder(Vector3 position, Collider2D other)
    {
        GameObject profSuite = other.gameObject.transform.parent.gameObject;
        //I used 10 because that is how far the camera is from the scene
        Vector3 worldPos = Camera.main.ScreenToWorldPoint(new Vector3(position.x, position.y, 10));
        Vector2 touchPos = new Vector2(worldPos.x, worldPos.y);
        Collider2D col = Physics2D.OverlapCircle(touchPos, 0.2f, this.whatIsInteractive);
        if (null == col)
        {
            //they didn't touch the ladder, don't move.
            return;
        }
        //double check make sure they didnt cheat and did click on this ladder
        if (col.gameObject.transform.position == this.gameObject.transform.position
            || col.gameObject.transform.position == this.parent.transform.position)
        {
            //move the player to the top
            Vector3 nTansform = profSuite.transform.position;
            nTansform.x = this.top.transform.position.x;
            nTansform.y = this.top.transform.position.y + 5;
            profSuite.transform.position = nTansform;
            profSuite.GetComponent<Rigidbody2D>().AddForce(new Vector2(0.0f, this.HopUpPower));
        }
    }

Continue reading

Develop In the Cloud!

Hello Readers,

This particular article goes out to a few of my students.  I teach C# at a local community college during my Thursday evenings.  One of the things that happens, especially at community colleges, is that you get all sorts of different people from various walks of life.  These walks of life do not always come with laptops with i5 processors and 4gb of ram and 500gb hard drives.  These students only have access to library computers, or computers that are left over from a previous owner that are good for little else than checking email and browsing the internet.  Which in this day and age is perfect for doing hardcore development, but you have to do it in the CLOUD!

alive

Continue reading

Functioning with Tasks, Async, Await and the Core Dispatcher

Hi All,

This Blog article is written for the explicitly purpose of getting functional with Tasks, Async, Await and the Dispatcher.  It will discuss the basics as well as a few more advanced scenarios.  It is not intended in anyway to provide in depth knowledge on any of these topics, it is purely a How-To in 10 minutes Guide written with minimal technical jargon.  The article does however assume some programming knowledge with C# and Xaml.

Continue reading

Intro to XAML Part 2 – Challenge Solution

Hi All,

So this is a solution to the challenge from Windows 8 Introduction to Xaml – Part 2.  Hopefully you were all able to get it in some fashion.  What I am posting below is just a single answer to the problem.  I would not recommend using this solution as a basis for how to code, I broke it out in an attempt to demonstrate each point as best as possible in a way that is conducive to your learning.

Continue reading

Windows 8 Introduction to XAML – Part 2

Hi All,

To start, lets recap what was covered in Part 1.  In Part 1, we discussed what you get out of the box in the Blank App Template from a XAML standpoint.  This included MainPage.xaml, App.xaml, and StandardStyles.xaml as well as how they interact together through extensions.  In this part of the series I will be covering layout, content, controls and some of their properties and attributes.  So start by loading up the Blank App with the single button from the previous part, and lets start there.  Be sure to save your progress as we will be using this App throughout the entirety of the series.

Continue reading