Travis CI + Windows Azure App

For one of my open source projects( I ended up setting travis CI to build a windows azure application ( and I wanted to record my findings since some of the problems are not very descriptive.


To start you go to and make and account then you have to basically mark your project active and submit a .travis.yml file to get it running.

I suggest you start with this:
language: csharp
solution: debesalgo.sln
– latest

Once you save that into your file your build will attempt to run and you will see and error about tools not matching and the version not being supported this happens if you are using VS2015 and anything above framework 4.5 So let’s downgrade our application to 4.5(Note further released of xbuild will solve this).

Now the next error will mention System.Web.Entity for some reason this file does not download from Nuget so add it to you bin and make sure you force commit it into git.

Once that step is done they build will kick once more and you will be at the point that it says there is an error with your pdb go into your project settings and compile your release version without pdb’s (Note you can use EmitOptions to do a portable pdb also) that will clear this error and get the build phase of this project done. It should look green and building.

Unit Test

Go into your test project remove the reference to the Visual studio quality tools since those are not supported in mono. Add the nuget reference nunit (I’m using 3.0.1) and to the Nunit.VisualStudio.TestAdapter package. Once that is done go and make a test case that we know will always pass. I tend to do this:

public class SampleTest
public void Empty()
//Sample test for those joining the project.

Once we got this we are ready to go modify our travis file to run our unit test we will do this by scripting so it downloads the runner console and additionally makes a call to the compile dll.

My final code for the .travis.yml looks like this:

language: csharp
solution: debesalgo.sln
– latest
– nuget restore debesalgo.sln
– nuget install NUnit.Runners -Version 3.0.1 -OutputDirectory testrunner
– xbuild /p:Configuration=Release debesalgo.sln
– mono ./testrunner/NUnit.Console.3.0.1/tools/nunit3-console.exe ./debesalgo.Tests/bin/Release/debesalgo.Tests.dll

This configuration assumes a new azure project but it works and it will compile. If you want to add test code coverage SharpCover is a great tool to use on this stack the big difference is that you will need to use a debug build.

Thanks for reading and remember to add your build badge to your page.

Finding All empty tables in SQL db

Had to do this at work figured this script might be useful to some around here. If you are and tester and gets a new system is a good way to find out what tables are getting no activity.

Name nvarchar(100)
Name nvarchar(100)
DECLARE @AlmostNoRowsTables TABLE
Name nvarchar(100)


DECLARE @controlVariable nvarchar(100)
DECLARE @counter int
DECLARE @rowsleft int
SELECT Top 1 @controlVariable = Name FROM @Tables

Declare @SQL nVarChar(1000)
Declare @ex nVarChar(1000)

WHILE(@rowsleft > 0)
SELECT @ex = @SQL + @controlVariable


if(@counter = 0)
SELECT ‘Empty Table’ +@controlVariable

if(@counter > 0 AND @counter <10)
SELECT ‘Table has almost no rows’ +@controlVariable
DELETE @Tables WHERE Name = @controlVariable
SELECT Top 1 @controlVariable = Name FROM @Tables
SELECT @rowsleft = COUNT(*) FROM @Tables
PRINT @rowsleft

What To Do When Inheriting A Code Base: Part 2 Understanding The System

Alright Last Article we got the code base working and now we are ready to actually understand what our system does. The first step that I take is to not look at the provided Diagrams for the project. Why you may I ask because I have found that most of the time they are not completely correct which only causes confusion when you don’t know the system. So what would I do:

First check if I have a functional environment that I can thinker with. If I do then I try to figure out what is the main point of entrance for the main function of this system and what is the output the orange boxes. After Identifying that I try to find Where does the workflow happen and this I what I really care about.


By Watching the Workflow happen slowly either debugging or reading a log in verbose you can get a pretty good picture of what goes on in the system. This is really easy to do on WCF service and SQL in particular. In SQL people have a task table which is a common pattern well lets place the profiler to see the changes then make sense of what all that means. On the WCf service watching the messages come in and the responses it gives should give a fairly clear idea of what the routing it looks like.

After you understand the system routing is easy to dissect what happens in each component in a need to know basis.

Normally after I understand this I look at the documentation and see how close it is to what I understood from analyzing the system.

To understand the support system to me is important to isolate them and see them individually to be able to gather the reason for them and not just the side effects they cause or the support they give.

This is a really time consuming action and you should document everything you find during this for your own sake.

-Alfredo Out

What To Do When Inheriting A Code Base: Part 1 Inspecting the code

Hey Everyone,

I’ve been on more than one occasion on the situation in which I inherit a gigantic code base and its my job to support it and write some new functionality for it. I want to outline a few steps and practices I like to follow in order to get to the point that I’m confident making changes to the system in place. Note is that I use MS products in most of my development so I’m doing the article with those in mind.

My Steps are the following and I will discuss them in different articles.

1.Inspecting the code

2.Understanding the system

3.Preparing to make changes.

1.Inspecting the code base
A.Create A New Branch

Making a new branch allows you to be able to check out files and work with them in a manner that is easy to see the changes you have done. When you actually got something that is worth you can reverse integrate into the main branch and delete yours.

B.Make sure the code compiles on the first download or lets you know how to set up the machine.

If the projects has a dependency check script run it. If it does not this is the first thing that needs to be done create a script that looks into the build machine and makes sure that all the dependencies that are needed for compilation are install and in the right place in reference with the script. By dependencies I mean libraries or GAC dll’s or simply cross compile configurations in your settings. In the case that the script is not provided a bit of investigative work will have to occur inside of the compilation errors which leads to the next point.

Make sure that all the projects that I have been given compile. It’s my practice to actually have a local compile script. This script just makes an entire build of all the project one for VSTF using batch could look as follows:

  for /R %%i in (*.sln) DO (
REM echo %%i
msbuild /clp:ErrorsOnly /nologo "%%i"

In the case that compilation is not occurring I make a list of all the problems and try to see which ones group together for example a library is missing. An important part during this step is to look out for orphaned solutions. If proper procedure are not followed sometimes in the branch you can find solutions that are no longer used. There is no easy way of finding this out. Except opening the projects and see duplicated projects in a solution.

C.Make sure that the leftover solution bindings in visual studio are correctly installed.

Try editing a file in each of the projects that are relevant and see if you get auto check out in the IDE if it does not work. You need to refresh the bindings.
Todo this follow this steps :
Open the solution
Go File>SourceControl>Change Source Control Remove the bindings
Then Go back to the same location and on the screen that lets you bind per project do binding for each one of them and the solution

D.Make sure the unit test runs
You can do it by following the steps to compile but using the mstest tool on the mstest projects the files should be the same is normal that some dependencies on the test project might be broke and some investigation will need to happen.

E.Create a dependency script Now that you went through all the work and figure what needs to be installed in a machine make it easy for everyone else. My example of that script in batch checking for Pex to be installed.


SET /a NumberOfErrors = 0

SET /a NumberOfErrors +=1

Echo %NumberOfErrors%

del temp1.txt temp2.txt


reg export HKEY_CLASSES_ROOT\Installer\Assemblies\Global temp1.txt

find "Microsoft.Pex" temp1.txt






SET /a NumberOfErrors +=1


del temp1.txt temp2.txt

In the next part I will address how to find information about your system when no documentation is there.

Handling the back button & the game crash


The game crash issue was simply that I was not handling the condition when the game money was Zero. That was solved easy and not worth mentioning.

Handling the back button In the case of my game I do this in a fairly trivial way and I’m only going to post it for the sake of completeness. Basically I handle scenes by using the following interface in all the class that hold a window:

public interface IScene
      void Draw();
      IScene Update();

      IScene Back(Game g);


In the update method I handle all the interactions that would move you from one page to another and in the back method I return a pointer to whatever scene called before.

The submitted screenshots appear to be graphically enhanced.

I got this because I used the snipping tool but left the red border option on. I later removed the red border which apparently counts has alteration therefore here are the steps to correctly do it.

First step is to open your snipping tool. It looks like that is on the accessories part of the menu.


Step 2 is to turn off the red borders to do that click on option and you will see the image below. Unmark show selection ink after snips are captured.


Step3 involves using the window snip to actually photograph your emulator:

Click on new –> window snip –> then the window for the emulator.


Hope this was helpful happy snipping and attached is the screenshots I got for my app.


The applications background music overlaps the users selected music

To solve this issue this was the approach that I took. I added code in the constructor for the game to call the guide and ask a what music he wants. There is a boolean to control which sound is played.

if (askForMusic && !MediaPlayer.GameHasControl)
               if (!Guide.IsVisible)
                   Guide.BeginShowMessageBox(“Select Music Of Choice”, “Do you want to play the game music”,

                   new List<string> { “Yes”, “No” }, 0, MessageBoxIcon.Alert,

                   asyncResult =>

                       int? returned = Guide.EndShowMessageBox(asyncResult);
                       if (returned == 0)
                           playMusic = true;
                   }, null);
               askForMusic = false;

How to add volume control


I had to add volume control to my application in order to comply with the marketplace review from the first time I sent it this was the solution I decided upon to have a scroller with 4 levels for audio and just modify the SoundEffect.MasterVolume to match the scroller. I’m going to post the code since it might help people implement a scroller or implement their own window. The code will be below.



using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using AvatareGameLibrary;
using Microsoft.Xna.Framework.Input.Touch;

namespace NoPlaceForGnomesLibrary
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class VolumeControl
        GlobalResources resources;
        GraphicsDevice device;

        private int volumeLevel;

        public int VolumeLevel
            get { return volumeLevel; }
            set {
                if (volumeLevel >= 0 && volumeLevel <= 3)
                    volumeLevel = value;
                    throw new ArgumentException(“Volume Out Of Range”);
        private bool isShowing = false;

        public bool IsShowing
            get { return isShowing; }
            set {
                if (!value)
                    alpha = 0;
                isShowing = value; }

        public VolumeControl(GraphicsDeviceManager game, GlobalResources resources)           
            device = game.GraphicsDevice;
            this.resources = resources;
            notchControl = (int)(SoundEffect.MasterVolume * 240);

        int width = 340;
        int height = 400;
        float alpha = 0f;
        int notchControl = 0;

        public int NotchControl
            get { return notchControl; }
                if (value < 0)
                    notchControl = 0;
                else if (value > 240)
                    notchControl = 240;
                notchControl = value; }
        string VolumeLevelText = “”;
        public void Draw(int left, int top, SpriteBatch batch)
            batch.Draw(resources.ScoredBoardBack, new Rectangle(left, top, width, height), Color.White*alpha);

            //Draw the TExt of the current musci Status
            Vector2 wordSize = resources.ScoreBoardFont.MeasureString(VolumeLevelText);
            batch.DrawString(resources.ScoreBoardFont, VolumeLevelText, new Vector2(left + (width – wordSize.X) / 2, top + 40), Color.Gold * alpha);
            //Drawing line with notch to move
            batch.Draw(resources.ScoredBoardBack, new Rectangle(left + 40, top + 210, 260, 15), Color.White * alpha);
            //Draw the Notch
            notchRectangle =  new Rectangle(left + 55 + notchControl, top + 195, 15, 45);
            batch.Draw(resources.ScoredBoardBack, notchRectangle, Color.White * alpha);
            int center = (width – 160) / 2;
            okButton = new Rectangle(left + center, top + 270, 160, 80);
            batch.Draw(resources.Ok, okButton, Color.White*alpha);
            wordSize = resources.ScoreBoardFont.MeasureString(“OK”);
            float secondCenter = (160 – wordSize.X) / 2;
            batch.DrawString(resources.ScoreBoardFont, “OK”, new Vector2(left + center + secondCenter, top + 288), Color.Gold*alpha);
        Rectangle okButton;
        Rectangle notchRectangle;
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name=”gameTime”>Provides a snapshot of timing values.</param>
        public void Update()
                if(alpha – 1 < 0)
             TouchCollection collection = TouchPanel.GetState();
                if (collection.Count > 0)
                    foreach (TouchLocation tl in collection)
                             IsShowing = false;
                             SoundEffect.MasterVolume = notchControl / 240f;
                         else if(TouchDetector.HasBeenTouched(Swipes.GetFirstLocation(tl) , notchRectangle ))
                             Swipes s = new Swipes(0);
                             notchMoved = true;


                if(notchControl >=0 &&  notchControl <60)
                    VolumeLevelText = “OFF”;
                else if(notchControl >= 60 && notchControl <60*2)
                    VolumeLevelText = “Low”;
                else if (notchControl >= 60*2 && notchControl < 60 * 3)
                    VolumeLevelText = “Medium”;
                else if (notchControl >= 60*3 && notchControl <= 240)
                    VolumeLevelText = “Max”;
                notchMoved = false;

        private bool notchMoved = true;

12 Hours of my life building a video game

Alright here goes my Story last saturday I took the challenge of building a video game in 12 hours started at 1:30 worked till 12:30 which was 11th hours but it was a ton of fun. Below are my email reports to my friends while this was going on. Btw this started with a conversation in  a bar like most things worth doing.

Note: Info on white is my reports to my friends
Info on blue is my thoughts narrated.
Red is the time for the next status


At 1:00 I was like I need to find out what I’m capable of doing in 12 hours lately i‘ve not been forcing myself at all. At 1:32 I’m going to use Expression Design and Xna let me start drawing and see what I want to make the game about. Hmm Gnomes sounds like a good idea.

Time 2:10

Like I said yesterday I’m going to try an attempt to make a game today so that I can feel a bit less useless in life. So far this is what I got:


Get Off My Lawn!


They are Gnomes in Your lawn you need to toss them out for points. Some of them give more points depending on their hat colors.

Building on C# for the windows 7 phone.

Time started:

1:37 PM


1:37 AM

What I got currently:

I drew the Gnome:


Next Task:

Make the loading screen And make the board

Next Report at 3:00

After sending the report is well I’m committed at this point if I don’t do it everyone is going to laugh at me what is the game going to be about hmm maybe whack a mole clone. I’m going to keep drawing so I can get a better idea.

Time 3:02

What Got Accomplished in the last Hour:

-Created the gnome as an asset

-Decided on the title used Cute blonde friend suggestion

-Created the starting screen

-All the art assets for the board.

P.S. this is the last msg with a ton of images.

The images are attached.

Next Task:

-Create Project In Visual Studio and follow a scene pattern to make the 3 scenes and load all the Assets

Next Report at 4:30

Seems like drawing took a ton of time I’m also going to need to get something to eat this kinda sucks I already sinked in 2:00 hours. I’m going to keep going and see where does it goes.

Time 4:33

What Got Accomplished in the last Hour:

-Created the scene pattern for the project

-Made Starting screen

-Got interrupted by the SLk test team

-Realized I need to make some library to handle the touch controls for my app

The images are attached.

Next Task:

-Working on the touch input library for the application and the actual game screen.


Next Report at 6:00

The progress in the last block off time was pretty incredible at this point im fully into this note I have still not gotten any food so I was starving but wanted to keep going and see if I was really finishing this.

Time 6:07

What Got Accomplished in the last Hour:

-Got the Game screen done(Looks kinda Icky I think im deleting the border

-Selected the music for the game

-Created library for swipes

Next Task:

-Working on classes to handle the apparition of gnomes in the scene.


Next Report at 8:00

I decided that it was worth paying 25 dollars and buy the music. Took a break from the coding which at this point I was sure that I could finish the game functional even if it would need a ton of polish and that became the goal something. Got a visit from a friend and I was explaining to him what I was doing an in my mind I was like he must think I’m crazy. But to myself I was thinking this is awesome I haven’t this into something in a long time.

Time 8:13

From: Sexy Redhead

Can I be the end boss?

Maybe  But you would need to draw Yourself

What Got Accomplished in the last two Hours:

-The gnomes dance now and got a score board

Next Task:

-Making so u can actually kick the gnomes off the lawn

-Adding dying animations.

-Figure out if I want to pay $25 for music or make my own.

Next Report at 10:00

I had a score system and you could loose but could not actually play I started feeling tired and wanted to go home got up for a bit and decided on some cookies and some milk after all I haven’t had any food so far.

Time 10:11

What Got Accomplished in the last two Hours:

-Got the end screen working

-Finished the Swipe controls

Next Task:

-Making so u can actually kick the gnomes off the lawn ( Got bugs in here)

-Adding dying animations. (This is sorta working)

-Figure out if I want to pay $25 for music or make my own. (I’m probably going to buy them)

Only missing the ability to play the game properly it felt like a monumental task at this point but it was the only thing missing also in my mind I was so undecided about the music this game was just me testing myself why would I spent some money on it ?

Next Report at 12:00

Time 12:13

What Got Accomplished in the last two Hours:

– Finished the Gameplay WOOT Everything works

– Bought the music

Next Task:

-Missing adding the music and the gnome screaming sound when they die.

-Eta to finish 30 mins 😀

Next Report When I’m Done with screenshots 😀

Bought the music from It feels like done I tweaked the little things like the music and decided to make a video to show it out also a reddit post. So late and I just want to go home.

Time 12:44

It’s done The game works

Attached is the video in case anyone is interested in seeing it

Woot Heading home.

Completed the mission. Decide to do a video so the gameplay could be seen that took me 30 more mins but I was done and immense sense of satisafction while I headed to the car Open-mouthed smile

Expression Design: Step By Step Designing my Dragon icon

kick it on

This article is not exactly about programming or photography. Is about a tool that i enjoy a lo when designing icons or creating UI interfaces for XAML and silverlight. Or simply a vector image. I’m going step by step through the process i followed while creating this draconic symbol when i was imagining a logo for myself. First step open expression design this is what the program looks like:


We are going to continue by drawing a black square on the board by selecting the square tool and dragging the mouse it should look like this:


Now we draw the shape that we want to cut from the square to begin giving it shape in order to cut the shape from the box in order to start making the design you want to end up with. In my case I’m trying to remove a part of the square to create a snout for the dragon icon. I made the shape then go to Object > Path operations > Back minus front. It ended up looking like this:


I repeat the step to create the small bump on the dragon head it starts to look as follows:


In the next steps i want to design the left side of the design my idea is to make it look like butterflies wings to make an E like the one in the middle name and be connected to the back of the dragon. The first step of this was to do a circle in a color that contrast with the color I’m using for my design. I elongated the circle to look like the top part of the wing using the direct selection tool the white arrow in the tool box and select an anchor to elongate it and make it look like below:


In order to create the bottom of the wing i selected the shape and made a copy of it afterwards i reflected it horizontal and align them then removed the circular parts of the shape using a square and the Object > Path operations > Back minus front. This is what i ended up with6

For the next step we wanted to hollow the wings in order for it to look the way that i envision it. I copied the wings and change their size to fit the one i wanted. At this point it looked like this:7

To Remove the red filling we use the same technique as before Object > Path operations > Back minus front. Making the wing look as follow:


With the wings ready we need a back of the dragon in order to attach them. I created shape using the pen tool that would cut the way i wanted it looked like this:9

I repeated the step before until i got the back that i wanted and it ended up looking like this:10

Now it is ready to attach the wings to the back in order to do this i grabbed the wings objects and place it in the position that i want it. Afterwards pressed Object > Path Operations > Unite. To make it all into one image it ended up as follows:


After this i decided to work on the eye i created a circle again of a color contrasting with the background then using the direct selection tool made it have the shape of an eye by placing the circle inwards toward itself.


Next i wanted to give the dragon piece the shape of A therefore i needed to cut the innards on that shape. After creating the original shape it went like this :13

I used the direct selection tool to make it exactly the way that it would cut. This was the way that it look:


After this we needed to shape the bottom and it was done in a similar fashion, Created a new shape and distorted till it would eliminate the bottom in the shape. It looked like this at this point:


The next steps was to create the claw of the dragon shape procedure like the one used in the steps before was followed and it looked like this :


Afterward we created the last leg by cutting and uniting again and ended with the final product that was the following :


Hope that this helps anyone interested in starting to use Expression Design.