Annoucing Swappy Colors

Hi!

Long time, no posts… I Have been quite busy in the past days on some projects.

One of them is Swappy Colors, a game that I developed while learned Unity 3D engine.

Results can be seen here!

Br
PCBL

Announcing cloudbase.io Excel add-in

As I mentioned some a couple of posts ago, I have been playing around with cloudbase.io and I got so excited with it that I decided to help them on one feature that I was missing.

Basically If I want to have a better understanding about my application data I have not much options rather than the “JSON data browser”, which does not help much when we are talking of hundreds of records…

As a database-driven developer I always expect to have a sort of a tool where I can see the data on a tabular way, like the old SQL Query Analyzer (now Mgmt Studio) on MS SQL, or tools like PL/SQL Developer from oracle.

That`s where I wanted to give my 2 cents to cloudbase. Based on some past experiences on MS Office plugins development, I came up with one idea to build one add-in to use Excel as a tool to analyze my cloudbase data. The beta version of the plugin was announced today by cloudbase team.

Once you downloaded the lite edition for free from here, you will get a new tab inside your office(2007,2010 and 2013).

The general idea is that by using the settings window you could add as many applications as you want to have.

To speed-up the authentication procedure, you can give a PIN, which will be required every first time that the plugin is used within an excel session…

Once you have applications configured, you will be able to select them from the Excel ribbon, and for each application you will be able to get data from all collections!

By using the Filter Pane you can define some more precise filter to avoid download massive amount of data.

Another nice feature is the possibility to get cloudbase statistics data(same from the management portal) also straight to your excel!

 

excel01

And last, but not least, there’s an extremely valuable feature which will allow you to do the next step regarding your data analysis. First of all, I must say it works only on Excel 2013… The feature is called Data Analysis and it will basically download the data from all collections of the current selected application, allowing you to make a pivot table with data from different application collections! This is really valuable! It allows this by using a new feature on excel 2013 called Data Model.

072513_0237_Announcingc8.png
072513_0237_Announcingc9.png

If you still did not tried the plugin out, don’t lose this opportunity.

A “Pro” version supporting data update as well is planned! Please let me know if you are interested on it!

Do you know Scratch?

Hi!

I’m gonna start this post by adding some nice text taken from the here:

“Learning to understand dynamic systems is an essential step in understanding the

world around us. However, learning it at university, high school or even middle

school level might be too late. By this age children already develop their own

models of how the world works.”
When I look to my daughter mind-blowing creativity I must agree 100% on what is mentioned above! Right now she is 8 years old and she is always developing models on how stuff works. On this light, after talking to a friend of mine I ended up on Scratch, which is an outstanding MIT Project to introduce children some computational logic in order to support them to be more prepared for the world!

It emphasizes an very nice “Creative Computing” concept. The main target is not to create young programmers, but to introduce “core computational concepts”(loops, conditions,…) to them, allowing them to explore other areas backed up with a solid computational knowledge. Imagine if you could learn some key Math concepts and immediately use them on a sample project?!

Great stuff MIT! Keep up the awesome work!

Are you looking for a database on the cloud for your apps? Cloudbase is a great option!

Hi Folks!

Some time ago I was looking for some kind of “Web Database” where I could build easily a cross platform(iOS, Android, WP, W8) application. Initially I was looking to something like: Host a database or a data file on some storage platform as SkyDrive, DropBox or GoogleDrive… My idea was to have my data there and access it from different platform… But as you might imagine, there are many challenges on this approach. One of the most critical ones is that there`s no easy way to get just parts of the file from this kind of service… We always need to get the whole file content and that’s quite painful. Let`s say I have 10000 records on an XML file… I would need to download the whole file even if I want to access only one record…

Next step I was investigating services like heroku, azure and some other stuff that google found… They were all too much complex/costly to what i was looking for. And on the other hand, they were all quite demanding case I would develop cross platform apps using Native code on each device…

Then, finally I have found two new candidates: Cloudant and Cloudbase. Both services have a lot of similarities. Different than the traditional relational databases, they are NOSQL databases, which I need to do some deeper studies. They both were exactly what i was looking for!! I ended up taking cloudbase as the first steps tutorial were quite exciting and I could see first results with few minutes, accessing same data on Windows 8, windows Phone and iOS! That really excited me!

I see a lot of potential on services like cloudbase because they really make it easy for developers to build much wider experiences across different technologies, delivering a much better user experience to the end-user. It is really a very nice service, which i strongly recommend you to take a look! Right now I am working on a small project to help cloudbase developers… Quite soon I will be announcing it here.

Meanwhile, worth take a look on cloudbase website!

cloudbase-facebook-ad

Have fun!

New Adventure: How to build a game in XNA without any knowledge about it?!

As I said on my previous post, I decided to build one game in order to learn something different and also to keep myself trying the “Monetization path” for my Apps.

I ended up making this tutorial from MSDN site… Really high quality material! If you wanna to learn something about XNA, you have to take this tutorial!

This was a very nice Tutorial and it really helped me to do my first steps on the XNA world. Thanks Microsoft for that. Really good stuff!

As a developer I simply cannot learn things by “reading”/”repeating”(from tutorials…) stuff. I have to do something by myself! Then that’s the time when MathFly came in, after few weeks:

The main drivers of the game were:

  • Have fun and learn (my daughter is just learning Math and the game fits perfectly!)
  • Create a “Competition” environment by creating a worldwide Leaderboard!

The Game just got certified and very soon it will be available on the WP marketplace! Enjoy!

More infos can be found here.

Soon I plan to post also something on a new project coming for Windows 8! Yes! Metro Style Apps Rocks! J

A lot of work, but a lot of fun!!!!

Some News after being so quiet…

Yes! I Know!! That was a long time not posting anything here. This is bad but was needed…

I have been quite busy and did not managed myself to keep the blog up-to-date…

But I have some news! About a month and half ago I started to look for better the possibilities that I can get from Microsoft Advertising when it comes to “making money” with my WP apps. If you are not aware about that, I strongly encourage you to jump on this boat!

As an exercise I have made a very simple App which is bringing a good feedback: Verse Of The Day. The Idea of the application is Very simple… The user would get a daily bible verse on his phone… After a couple of hours I came up with something somehow like this:

 

You can download the App to your phone (IT IS FREE!) by clicking on the image bellow:

A quite interesting feature is the Live Tile feature, which change it to a set of nice pictures and also keep the daily verse updated!

After a nice feedback I ended up releasing an updated version few days ago, this time supporting a feature to Share to the user preferred Social Networks and also one option to get some random verses:

 

I have to confess that I did not get rich with the advertising on this App but it was a very nice exercise! J

By doing this App I realized it was time to make a bigger step and make a GAME!!! That’s where XNA came in!

On the next post I will keep telling the news!!

My Xmas & new Year Votes

So you want to provide a DataSet to your WP7 app?!

Hi folks,

It is not new (wow, more than 2 years) that MS announced that there’s no plan to support dataset on Silverlight (currently WP7 is based on Silverlight 3 based).
http://blogs.msdn.com/b/adonet/archive/2009/05/26/dataset-and-silverlight.aspx

But we all know that life is not so easier and we cannot just change to LINQ to Entities. I’m not even going to jump in this discussion here. Actually I am assuming that you need an alternative. One possible alternative is the SilverlightDataset project, created by Laskarzhevsky Software Inc. I have to be honest that I did not used this solution mainly because at the first moment I’m trying to do something really simple.

My general idea is to create a WCF Service that will expose dynamically new types (POCO) which will be created based on a dataset. I played a little bit with Reflection & Emit to do this job. Here is a code that, given a DataTable returns a dynamically created type:

public class Functions
{
    public static Type CreateType(DataTable table)
    {
        //Obtaining DataContract & DataMember Attribute
        CustomAttributeBuilder dataContractAttribute = new CustomAttributeBuilder(typeof(DataContractAttribute)
                                                      .GetConstructor(System.Type.EmptyTypes), new object[] { });
        CustomAttributeBuilder dataMemberAttribute = new CustomAttributeBuilder(typeof(DataMemberAttribute)
                                                      .GetConstructor(System.Type.EmptyTypes), new object[] { });

        AssemblyName assemblyName = new AssemblyName();
        assemblyName.Name = string.Format("DynamicType.{0}", table.TableName);

        AppDomain appDomain = AppDomain.CurrentDomain;
        //Later you just change it to AssemblyBuilderAccess.Run and remove the file saving process to save some time...
        AssemblyBuilder assemblyBuilder = appDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave);
        ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name,"dynamic.dll");

        TypeBuilder typeBuilder = moduleBuilder.DefineType(string.Format("Data.{0}", table.TableName), TypeAttributes.Public, typeof(BaseType));
        //decorating as DataContract
        typeBuilder.SetCustomAttribute(dataContractAttribute);

        //calling base contructor passing thw datarow to it
        ConstructorBuilder constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[] { typeof(DataRow) });
        ILGenerator constructorIL = constructorBuilder.GetILGenerator();
        constructorIL.Emit(OpCodes.Ldarg_0);
        constructorIL.Emit(OpCodes.Ldarg_1);
        constructorIL.Emit(OpCodes.Call, typeof(BaseType).GetConstructor(new Type[] { typeof(DataRow) }));
        constructorIL.Emit(OpCodes.Ret);

        //Creating one property per column
        foreach (DataColumn column in table.Columns)
        {
            createDataMemberProperty(dataMemberAttribute, typeBuilder, column);
        }

        Type toReturn = typeBuilder.CreateType();
        // Save the assembly so it can be examined with Ildasm.exe,
        // or referenced by a test program.
        assemblyBuilder.Save("dynamic.dll");

        return toReturn;
    }

    private static void createDataMemberProperty(CustomAttributeBuilder dataMemberAttribute, TypeBuilder typeBuilder, DataColumn column)
    {
        string propertyName = column.ColumnName;
        string fieldName = string.Format("_{0}", propertyName.ToLower());

        //Creating Field that will be set/get on the properties                
        FieldBuilder propertyField = typeBuilder.DefineField(fieldName,
                                            column.DataType,
                                            FieldAttributes.Private);
        // The last argument of DefineProperty is null, because the
        // property has no parameters. (If you don't specify null, you must
        // specify an array of Type objects. For a parameterless property,
        // use an array with no elements: new Type[] {})
        PropertyBuilder property = typeBuilder.DefineProperty(column.ColumnName,
                                                    System.Reflection.PropertyAttributes.None,
                                                    CallingConventions.Standard, column.DataType, null);

        //decorating with DataMember attribute
        property.SetCustomAttribute(dataMemberAttribute);

        // The property set and property get methods require a special
        // set of attributes.
        MethodAttributes getSetAttr =
            MethodAttributes.Public | MethodAttributes.SpecialName |
                MethodAttributes.HideBySig;

        // Define the "get" accessor method for CustomerName.
        MethodBuilder propGetMethod =
            typeBuilder.DefineMethod("get_" + propertyName,
                                        getSetAttr,
                                        column.DataType,
                                        Type.EmptyTypes);

        ILGenerator getIL = propGetMethod.GetILGenerator();
        getIL.Emit(OpCodes.Ldarg_0);
        getIL.Emit(OpCodes.Ldfld, propertyField);
        getIL.Emit(OpCodes.Ret);

        // Define the "set" accessor method for CustomerName.
        MethodBuilder propSetMethod =
            typeBuilder.DefineMethod("set_" + propertyName,
                                        getSetAttr,
                                        null,
                                        new Type[] { column.DataType });
        ILGenerator setIl = propSetMethod.GetILGenerator();

        setIl.Emit(OpCodes.Ldarg_0);
        setIl.Emit(OpCodes.Ldarg_1);
        setIl.Emit(OpCodes.Stfld, propertyField);
        setIl.Emit(OpCodes.Ret);

        // Last, we must map the two methods created above to our PropertyBuilder to 
        // their corresponding behaviors, "get" and "set" respectively. 
        property.SetGetMethod(propGetMethod);
        property.SetSetMethod(propSetMethod);
    }
}

The code look a bit scary… And it really is… Use emit is like develop in IL directly… J Anyway, if you give this datatable:

It will return something like this:

[DataContract]
public class Students : BaseType
{
	private int _age;
	private string _name;

    [DataMember]
	public int Age
	{
		get
		{
			return this._age;
		}
		set
		{
			this._age = ;
		}
	}

	[DataMember]
	public string Name
	{
		get
		{
			return this._name;
		}
		set
		{
			this._name = ;
		}
	}
	public Students(DataRow ) : base()
	{
	}
}

You can see that it is deriving from a base type, called BaseType…

[DataContract]
public class BaseType
{
    public BaseType(DataRow row)
    {
        foreach (DataColumn column in row.Table.Columns)
        {
            var field = this.GetType().GetField(string.Format("_{0}",column.ColumnName.ToLower())
                                                ,BindingFlags.NonPublic|BindingFlags.Instance);
            if (field != null && !row.IsNull(column))
                field.SetValue(this, row[column]);
        }
    }
}

As you can see the base type has a constructor that given a dataRow, it will set the fields of the type. I could implement this logic on the Contructor but I was really lazy to find out how to do it using Emit… Could take some hours to find out… Then I just made the easy way… Another thing that you should not is the WCF attributes [DataContract] and [DataMember] that are decorating the types and properties…

Now we want to expose this datatable through a WCF service… The service contract is quite simple:

[ServiceContract]
public interface IDataSetService
{
    [OperationContract]
    [ServiceKnownType("GetKnownTypes", typeof(DataSetService))]
    DataSet.BaseType GetData();
}    

You can see that it returns the BaseType, which is the basetype of my dataset elements. Another important thing to remark is the ServiceKnownType attribute that I’m using to dynamically add KnowTypes(like this Students class that I showed above). Here you can have the service implementation:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class DataSetService : IDataSetService
{

    #region [ServiceKnownType("GetKnownTypes", typeof(DataSetService))]
    /// <summary>
    /// Detects all KnownTypes that should be published by the Service WSDL
    /// Basically we will find all DataContracts, ServiceCommandRequest and ServiceCommandResponses
    /// </summary>
    /// <param name="provider"></param>
    /// <returns></returns>
    public static IEnumerable<Type> GetKnownTypes(ICustomAttributeProvider provider)
    {
        Type dynamicType = DataSet.Functions.CreateType(new Students.StudentsDataTable());
        dynamicTypes = new Dictionary<Type, Type>();
        dynamicTypes.Add(typeof(Students.StudentsDataTable), dynamicType);

        System.Collections.Generic.List<System.Type> knownTypes =
            new System.Collections.Generic.List<System.Type>();
        knownTypes.Add(dynamicType);
        // Add any types to include here.        
        return knownTypes;
    }
    #endregion

    static Dictionary<Type, Type> dynamicTypes;

    public DataSet.BaseType GetData()
    {
        Students.StudentsDataTable table = new Students.StudentsDataTable();
        table.Rows.Add("Pedro", 28);
        DataSet.BaseType toReturn = (DataSet.BaseType)System.Activator.CreateInstance(dynamicTypes[table.GetType()],
                                                                                      new object[] { table.Rows[0] });
        return toReturn;
    }
}

Just to remember, AspNetCompatibilityRequirements is required by the Silverlight 3 Service client. The GetKnownTypes method is doing the miracle to allow me to return dynamic types to my client. Actually when my client generates the proxy classes, the Students class will be available as well! Finally, you can see that the service is returning a created type based on a row with the values “Pedro” and 28.

Let’s add the reference to our Web Service from our WP7 Client…

One you add the Service reference, you can take a look on the generated proxy code

The most important thing to see is that our Students type was created, even if our main WebService API do not refer to it. Actually that GetKnownTypes made this “miracle”!

Now it is time to consume the service from our WP7 app… Look this very simplistic code:

// Constructor
public MainPage()
{
    InitializeComponent();

    // Set the data context of the listbox control to the sample data
    DataContext = App.ViewModel;
    this.Loaded += new RoutedEventHandler(MainPage_Loaded);

    DataSetService.DataSetServiceClient cli = new DataSetService.DataSetServiceClient();
    cli.GetDataCompleted += new EventHandler<DataSetService.GetDataCompletedEventArgs>(cli_GetDataCompleted);
    cli.GetDataAsync();
}

void cli_GetDataCompleted(object sender, DataSetService.GetDataCompletedEventArgs e)
{
    DataSetService.Students students = (DataSetService.Students)e.Result;
    MessageBox.Show(string.Format("{0}, {1}", students.Name, students.Age));
}

Basically this code just call the method GetData from our service… Look that when the GetDataCompleted event we just cast the result to (DataSetService.Students) . Then we just show a messageBox… Really simple… And it worked nicely!

Well… This is it! That was an easy way to expose your dataset to WP7 clients using WCF without bigger issues. Of COURSE this sample is really simplistic but I’m sure that it can handle a lot of situations. In case of some special data editing support we would need some extra code to synchronize the POCO class with the dataset… But you know… this is just the start…. J

DOWNLOAD: Naturally you can have the sourceCode of this sample here.

Moving on…

Hi Folks!

I know I have been away! There are a set of reasons for that. But one thing that I can say is that I’m always taking some free time to play around with the development of TFS On the Road.

Currently I’m working on the possibility to add attachments to Work items but I have found some “challenges”. Therefore I’m in contact with the TFS Odata Service guys trying to help them to simulate the issues that I’m having. I’m sure that we will have a solution to the issues that I’m finding. One big limitation that I see is that I cannot attach files bigger than 64kb at the current version of TFS Odata… So my plan was to allow the attachment of voice notes and this will be difficult with this limitation of 64 kb. But I’m still looking for possibilities. Besides that one of the next features is to support some basic WI edition. A lot of work to do, but I’m sure we will get there, step by step.

I have been using http://www.mopapp.com/ to monitor the market place data. From this site I can get very nice reports from the Market Place data. Take a look on the report print bellow:

As you can see, on average there’s about 9,9 downloads per day of the app since it was launch, number that I consider nice to a very specific niche application like this… 358 downloads so far. And growing!

I have to say a big thank you especially to Brian Keller. He made a blog post that is up for almost a month! J This is really helping on my website traffic and app downloads.
http://blogs.msdn.com/b/briankel/archive/2011/06/07/tfs-on-the-road-a-new-windows-phone-7-app-for-team-foundation-server.aspx

And to make things even better, yesterday Brian Harry also made one post where he mentioned TFS On The road as well!
http://blogs.msdn.com/b/bharry/archive/2011/07/04/odata-access-to-tfs.aspx

The app has been also for a while on the Visual Studio Spotlight sessions of the Visual Studio website (http://msdn.microsoft.com/en-us/vstudio/default) …

This king of so positive feedback from MS and the community itself are the fuel to keep myself moving on with this project! J

Thanks all my friends that tweeted, re-tweeted and posted something else about this app! Nice!

Let’s move on!!!

 

 

TFS On The Road v1.5 just published

Hi Folks,

The v1.5 of the TFS On The Road was just published to the Market Place. This new version holds the interesting feature that I showed on the post Improving TFS On The Road chart capabilities .
Basically this feature will allow you to drill down on your work items through different levels.

Let me show some pictures to explain better. Bellow you can see the stacked chart of WI types per State. Note that there’s a Settings Link up-right of the chart. When you click there you will see one screen to select some chart settings. You can select between a set of chart types. Stacked charts supports two fields.

I will change it to show a pie chart of Work Item states on the project summary, as shown below. As soon as you click on the OK button the chart will be rendered and the settings will be saved for this level (1st level). On tis sample I will drill down to the Active work Items just taping the chart area…

As soon as I do this I will see the list of work items filtered by state=’Active’. Note that you have the option to show a chart for this Work items list as well. Just tap the Chart button(bottom right). First you will see the default chart(stacked by WI type/State). This time I will change to Pie by Iteration Path. Then I can immediately see all Active Wi’s by Iteration Path! Awesome!


And I can always drill down! On the sample I will go to the Yellow Area of the char t(Wave Twelve…)… Then I will get to the work items list again! And if you note on the top part you will see the applied Filter…

And you can take a look on the chart as well for this level (3rd level). It starts with the default chart… Of course you can change it as well. On the last level I Changed to show Bar charts by “Assigned to”.

And Of Course I can move On!!!! I will click on the last bar to drill down again (pedro’s active tasks on the Iteration ‘Wave Twelve’)… Look the list and the applied Filter… And Of course you could drill down again! J But I think it’s deep enough on this sample. Theoretically you could drill down as much as you can.

Really nice, isn’t it? J As you could see, we navigate in 4 drill-down levels:

  1. Pie chart by WI States, selected the Active Work Items
  2. Then Pie Chart by Iteration Paths, we selected “Wave Twelve”
  3. Then we made a bar chart by “Assigned to”
  4. Finally we got to the last level on this sample

What is interesting is that every settings that you defined so far were saved per level! Next time you will not need to configure the chart(by tapping on settings) again! J

Cool!!!

If you still did not got the 1.5 version… Just take it to play around with this feature!

Now I’m preparing myself to start adding support to work items basic edition/creation and also to add attachments…

Let’s move on! I keep you updated! J