Monday, December 19, 2011

Fight the Blacklist ! What you can do

There is a fair amount of talk around the dangerous legislation (aka. SOPA) that is currently in the United States of America congress. The legislation would give the Department of Justice unprecedented power to “blacklist” websites without a trial and give Hollywood copyright holders a new way to shut down a website’s financial services for alleged copyright infrngement. Basically, is an Internet censorship legislation in the hands of the US, which as we all know, is terribly dangerous and potentially catastrophic for all digital professionals.

So, what can I do about it? I can spread the message and tell my friends and colleagues about it. What about you? Here are some ideas on how you can help out. Google, Aol, Facebook and others are already backing up the anti-SOPA movement. Remember, censorship is just another tool for big companies and powerful people to dictate what is allowed and what is not, and generally, that which is allowed is what pays enough ! We don;t want to pay for being able to be creative, innovative and continue the efforts to make technology available to everyone !

Cheers !

Sunday, December 18, 2011

Giant Nokia Windows Phone at Champs-Élysées, Paris

windows_phone_01I was on a vacation trip in Paris last week. I did a lot of museums, walking, sight-seeing, food (lots of cheese) and really good wines.

Among the things I saw, was another giant 30-foot-tall Nokia Lumia 800 Windows Phone along the Marche du Noel in Champs-Élysées.

This wasn’t only a giant ad, it was a functioning interactive screen emulating the actual phone and broadcasting Christmas activities every day, including Santa listening kid’s present wishes. The stand also had several real Nokia devices for people to test and play with.



After seeing the giant 4D projections in London, it was a nice surprise to see something similar in Paris. It seems to me that Nokia and Microsoft are doing a good job creating awareness. The Lumia 800 is definitely the sleekest Windows Phone out there, and I’m sure there are more to come.


windows_phone_02

Playing with Xbox Companion Application


xbox-live-black-bg1

The Windows Ecosystem just keeps getting better and better. This apps works incredible well with the updated Xbox Dashboard which gets the console user interface inline with the Metro Style, which is already implemented in Windows Phone and will be the way to go for Windows 8 applications.
After updating my console, I downloaded and installed the highly expected Xbox Companion Windows Phone Application (you can download it here).
The Windows Phone application allows you to control your Xbox with your phone.
After downloading and installing the application on your phone, you synchronize it with your Xbox console and then you will be able to use it to navigate your content with your phone.

            IMG_3824               IMG_3825                IMG_3827

The configuration process is easy and quick. You need to enable the companion app on your Xbox first, and then run the app on your phone. The console will detect the app and will configure all the settings. Once that is done, you are ready to go.

IMG_3826

The app has two basic modes: Content and Remote. The ”Content Mode” displays links and lists of your favourite content so you can get to it just with a couple of taps on your phone. This includes games, videos, and apps. The “Remote Mode” displays an Xbox remote like interface that you can use to navigate your Xbox interface as you will do with a traditional remote.

     IMG_3828           IMG_3829            IMG_3830

IMG_3833It works really well. The Windows Phone app is responsive, easy to use and quick and the synchronization between the two platforms is neat. The user interface looks cohesive between the two platforms. This is good because it makes it easier for users to learn how to use it. When Windows 8 is released and the Windows Marketplace is in place for native apps, the ecosystem will become complete.


Go ahead and check it out. It might become quite handy and keeps you from having to by yet another remote, which is a nice thing

Thursday, December 15, 2011

Installing Surface 2.0 Development Tools

To get up to speed and start developing Surface 2.0 applications you need to get the SDK, runtime and development tools.
First, you need to have Visual Studio 2010 installed. You can get on your way with the express version, or any other higher license.
After that, you need to download and install the Surface 2.0 SDK on your machine. Once installed, you will need to reboot your machine.
surface_install_01    surface_install_02
After restarting, install the Surface 2.0 runtime. This will install the required assemblies that are normally available in actual Surface units, but that you will need to install for development on your normal machine. You don;t need to reboot after this step.
surface_install_03    surface_install_04
That’s it ! Go ahead and run visual studio. Choose to create a new project, select the Surface templates on the left tree-view, select Surface 2.0 and then the type of application that you desire.
Just for a quick test, add a text greeting and an image and run the project. This will confirm that everything is working and that you are ready to start building the next generation of multi-touch, multi-user Surface 2.0 applications !
   hellosurface_01       hellosurface_02
Happy Surface 2.0 development !

Getting started with Microsoft Surface 2.0

microsoft-surface-logo
Microsoft is about to start manufacturing and releasing to the market the highly expected Surface 2.0 Samsung SUR40 units. The new hardware is sleek and will provide a more engaging experience than its predecessor. The price is still steep for most mortal consumers, but cheaper than its previous version. It will be around $7,600.
A couple of years ago I was able to be part of the development team in several Surface 1.0 projects. They involved really cool interactions between the table, external screens, mobile phones and the use of web services, blue tooth and wireless networks. The work was intended to explore the next generation Surface user interfaces and potential applications.
Back then, the Surface 1.0 table was arguably the most advance multi-touch and multi-user experience out there. Although I have seen really cool experiments with TuIO and out of home experiences, Surface multi-touch contact point and gestures detection was far advanced.
With recent advancements in touch surfaces and underlying technologies, devices like tablets, slates and smartphones have taken the experience far ahead.
popsci_wheaders
Surface 2.0 provides a promising platform for developing multi-touch, multi-user graphic intensive applications. The good news is that the new software development platform is far more aligned with the current state of the Microsoft ecosystem. Surface 2.0 development is based on the .NET Framework 4.0 and uses WPF 4.0 and XAML/C#. It also runs on top of the Windows 7 native touch runtime.
Hero-PurchaseProcess
Now is a good time to take out some rust and dust from the Surface arena, and refresh SDK, development tools and development references. Here are some useful bits:surface-2.0-2011-01-06-600
You will need Visual Studio 2010 (Express version should work) and Expression Blend if you have it, which is the best user interface development tool in the market, no matter what other platforms say. Believe me, I have worked with iOS, Catalyst and Android UI development tools and Blend is far ahead, easier to use and more powerful.

Surface 2.0 is seen with interest by the industry and the progress made from the previous version will make it a very attractive development platform. Remember that if you are already a WPF or Silverlight development, you are virtually a Surface developer too !
What are you waiting for?

Tuesday, December 13, 2011

#RGAMakeDay

rga
Last week we had our first Make Day at R/GA.
The concept of “making things” is wide, complex (or extremely simple depending on the point of view) and can be applied to almost anything on any industry. As a developer, I’m used to make things. As a hobbyist musician and former actor and writer, I’m used to make things….just in a slightly (or not) different way.
However, this is one of the first time that I have been given company resources and office time (real office day hours) to simply “make something” that doesn’t involve any client work and have actual fun with technology.
When the idea was proposed I though it was brilliant. Instead of all the politic and organizational complexity of organizing and assigning R&D time, coordinating projects and measuring results, the company decided to go with a simple two day event where every body could do whatever they want, as long as it involved making something, having fun and of course, presenting the results to the whole office (you won’t believe how competitive people can get, especially tech people). You can read more about the whole thing at Russell Davies blog post.
WP_000072
An ACER Iconia tablet with the Windows 8 Developer Preview on it !
As soon as the idea was proposed, I immediately knew I wanted to make something with the new technologies I have been keeping an eye on: Windows 8 and Windows Phone 7. I also wanted to combine those two platforms and new technology goodies with a real practical and useful data source that could eventually feed any app on any platform.
When?
R/GA Make Day took place from Monday end of day to Wednesday. My worked hours count went to about 20 for the whole event. Basically two days to make things happen, prepare the demo for the whole office (with last minute fix-on-the-spot story).
How?
With passion and dedication. All of us learned new tools, new techniques, new guidelines, new frameworks and in general new technologies and platforms in a few days and put together a working integrated solution.
For Make Day our team consisted of:
Danny Lee - in charge of the Windows Phone and a last minute Silverlight 4.0 out of browser app.
locator_windowsphone_01      locator_windowsphone_02      locator_windowsphone_03
Above, screenshots from the Windows Phone Locator App !
rga-locator-welcomeSilverlight 4 Locator App – The News and Activity Feed !
Sebastien Jouhans - responsible for the cool face recognition open source app integrated with Arduino and including Text to Voice goodies. Seb also published his take on the project on his blog.
Jiri Mocicka, ID ninja putting together the story, design and presentation.

WP_000069
Design sketches and previews on our working wall !
Myself, in charge of putting together the data base using MS SQL 2008, implementing a small .NET 4.0 modular framework with C# and exposing the whole system’s RESTFul services implemented using WCF. I was also the handy Sys Admin hosting all the backend goodness.
The most exciting part was the Windows 8 Metro Style tablet application, which I had been following for a while, but only had less than a day to put together ! All Metro Style, using XAML and C#.
WP_000075
What?
To put it as a simple idea, we wanted to build a platform for face recognition check in, so users can easily find colleagues across offices. Whenever a colleague gets in to the office, the app at the door performs the face recognition process and when the person is recognized it opens the doors and checks in the person at that office communicating with the services. As soon as someone is checked in, the Silverlight app running inside the office shows the person’s information and checking message.
WP_000078 (2)
Then the Windows Phone app and the Windows 8 apps can display the colleagues and different locations information, facilitating finding colleagues across offices. In our case, this is particularly useful since we have two different offices in London and we need to go back and forth for meetings and such, so knowing where a colleague is at any given time is quite useful.
Results?
Unfortunately we didn’t won the first price, but came second. Some simple and practical ideas may be more attractive than complete platform ecosystems ;) But we received good comments and feedback from all the colleagues and that is good coming from such talented people.
WP_000079 (2)
Notes about the core
Finally the RESTFul services allowed me to put together some practical concepts together. I used N-tier module approach, with a central Infrastructure project referenced by all layers, facilitating infrastructure code sharing. I also used the Entity Framework as data model layer since I have mostly worked with LinqToSQL. Then I used WCF to create a SOAP service and on top of it I exposed the REST XML services. This is a really cool recipe, since it allows the backend to eventually integrate with other SOAP based backend services that might required encryption, authentication and other more complex service integration, but at the same time allowed me to expose simple HTTP REST services in XML format. The underplaying code is the same, so is easy to maintain and can easily be enhanced to expose JSON format services.

Another interesting fact is that we managed to integrate open source with closed source applications to achieve a better solution. This is something rarely done and I have seen very few practical examples in my career. People tend to use only one platform and is inclined to be in favour or against one or the other, but we just demonstrated how two different technology philosophies can be combined to created a better, feature rich outcome.
I think that the event was a complete success. It was impressive how some teams came out with awesome finished applications and ideas and how everybody took their two days quite seriously. I believe it really helped to raise the bar and get everyone closer as a team. Hopefully we will some some ideas and projects come to life in the near future.
Until the next Make Day…and if you like the idea, propose it at your company. I guaranty you will at least have some fun learning new cool stuff !
Cheers!
UPDATE:
Check out the R/GA London Make Day Official Video !
R/GA London: Make Day

Latest .NET Snacks


Lots of nice, sweet and delicious snacks from the .NET world recently.
ms-windows-logo-rm-engg
Windows Phone 7 adoption and marketplace continues to grow, specially in Europe thanks to the release of the latest Nokia Windows Phone handset.
Windows 8 development is keeping many in the Windows ecosystem working hard after office hours building cool stuff with the new WinRT framework.
On other news, Microsoft just released Silverlight 5, the latest version of the technology that started as a browser plugin and a subset of WPF, but that has become almost a platform by itself, powering not only the browsers but also the mobile platform and rumours about Silverlight also powering the Xbox Live platform soon !
Regarding tools, there are several previews out there. Starting with Windows 8 Developer preview, you can get the corresponding Visual Studio 2011 and Blend developer previews. However, if you are still hesitating, there are a couple of really cool previews on Win 7 + .NET. Visual Studio 2011 Dev preview is also available for our stable win 7 platform and has a lot of new goodness for everybody. Along with that, check out the Team Foundation Service Preview, which brings you the power of TFS running on the Azure cloud.
All this is part of a huge effort from Microsoft’s part to align and integrate all the different services, platforms and technologies around the Windows ecosystem. Microsoft has tried many times and arguably failed, but for all people looking beyond the brand and stigma, this time it seems that Microsoft is doing the right moves at a steady pace from several different fronts. Consumer success story is what they are targeting in the most ambitious renovation of any of the big tech companies of our times.
This is the Windows Ecosystem and its BIG !
What are you waiting to get on-board?

Monday, December 5, 2011

XBox Live bigger inside the Windows Ecosystem

Along the same lines of my latests posts, today I found out that Microsoft is about to revamp the XBox Live platform to a point where the XBox 360 console will challenge Cable Boxes.

According to this article published by the New York Times, Microsoft will start working on the system to allow users to watch television through the console. On top of that, users will be able to enjoy an enhanced experience through the Kinect, powering users to perform search and browsing to gestures and speech commands.

Users will still need to cover the fees that Cable providers will for sure continue to impose on channels and films watched through the console and also cover the Microsoft Xbox Live membership which at the end might be even less that what you would pay for your cable box, but with the increasing prices of TV packages and the poor service that most of them give to consumers, I'll bet that it might be still a really competitive and satisfactory service.

Microsoft has already made great improvements to the XBox ecosystem including gaming, user libraries, computer interaction and Windows Media Center enhanced experience. It has come from a long road and although it had some bumps along the way, the console and the platform have been doing great in the past months.

Its a truly exciting time for the Windows platform, and honestly Microsoft seems to be putting together all the ecosystem pieces in a way that was not possible before. Although they might not be the first integrating and providing a functional and cohesive ecosystem, they seem to be willing to go beyond what the competitors (Amazon, Apple and Google) are doing on other fronts.

Its a challenge but most of all, a huge opportunity for the technology industry !

Cheers!

Sunday, December 4, 2011

Windows 8 Metro Style Hello World App

Wanted to share my progress regarding Windows 8 and the Metro Style Application development. After installing the Windows 8 Developer preview on a virtual machine I have been playing around with the new WinRT Framework,
Although I have experience developing WPF, Silverlight and Surface applications, I always find interesting and fun to start from scratch with new technologies and frameworks and see how you can progress from the very basic start to more complex ideas and projects.
That being said, I have been coding Metro Style Apps during the weekend following the starter and sample articles published by Microsoft and the Developer Division.
Here is a video of my take of Hello World !

Saturday, December 3, 2011

Installing Windows 8 Dev Preview using VMWare Workstation 8

I have been following Windows 8 news and buzz since its unveiling at the Microsoft Build conference back in September this year. I needed to get my hands on it and start developing apps, but work and family were in the way.

Recently I was able to finally install Windows 8 Developer preview in an old laptop and an Acer tablet to see how it feels and responds. I must say I really like the new touch interface, the cleanness and simplicity and all the new opportunities that will bring to .NET developers like myself.
Anyway, today I wanted to install the OS including the dev tools as a virtual machine on my Alienware M15x laptop (which by the way is now a conspiracy theory )and I run into some issues before I was able to make it work.

Once I manage to install the VMWare Workstation 8 and setup the Virtual Machine for my Windows 8 64-bit installation, I was getting the following error when powering on the VM:

image

There are several posts out there to help you perform the installation step by step. You can take a look here and here.

Basically, I needed to remove and setup the Windows 8 VM specifying that I was going to setup the OS later, to avoid the Product Key and unattended installation error.

image

Then, once the VM setup is completed, VMWare Workstation will try to power on the VM, but since there’s no OS installed it will fail. At that point you need to mount the ISO image to install Windows 8.

To mount the Windows 8 ISO image, click on the tab for your virtual machine in VMWare Workstation window and select:
Removable Devices / CD/DVD (IDE) / Settings


image

Once you configure the source ISO image, restart the VM and that should run the OS installer successfully.

dev_preview_vm2

After that is just a matter of personalizing your installation and done. You will have your virtual Windows 8 Development Preview 64bits with Development Tools ready to go !

dev_preview_vm10

My Windows Metro Style Ecosystem development workshop is ready !

V__2F21
Get on the MS Ecosystem and Happy Windows 8 Development !

Windows Phone 7 Development Resources

winphone
Hi chaps, wanted to share a couple of ‘straight from the source’ really good development sources for windows phone 7 applications and games development with code samples and documentation.

Check it out:
Windows Phone App Code Samples
Windows Phone XNA Code Samples
Also, if you are looking for a good book that cover all aspects of Windows Phone 7 development, including the submission to the Marketplace and helpful practical tip and tricks to further improve your knowledge and skills on the platform, I greatly recommend Adam Nathan’s 101 Windows Phone 7 Apps.
Happy Windows Phone 7 development !
-arbbot

Localization Resource Files in ASP.NET

I have been working on a project requiring localizations for several languages. Content localization was implemented using a third party vendor and content submission and fetching is done through web services.
However, we also needed to localize several HTML templates generated by the system upon request. Since the templates text and layout is pretty much fixed, we decided to go with ASP.NET resource files.
aspnet
Now the basic concept is that you create a default resource file containing all your localized resources and then you create copies of the default resource file for the required cultures and locales. You can create resource files for general languages or specific country locales.
Most of the languages were created without issues. Later I needed to add a new resource file for a new locale, but when after adding the required resource file, I was getting the following error:
Compiler Error Message: CS0101: The namespace 'Resources' already contains a definition for ‘Templates’
This was really annoying because I was sure the resource file name was unique and the file was not duplicated. Refreshing the page sometime gave me variations of the same error, but nothing helpful.
Looking around online for answers, I found almost everybody saying that the problem was for sure that two entries in the same resource folder had the key of ‘Templates’. However, after checking several times, and deleting and re-adding the file, I got the same error message.
Suddenly I realised the true cause of the problem: the culture info suffix I was using for the new resource file was not recognized by ASP.NET and therefor the file was being seen as a duplicate.  When you add a new resource file, I was using the same ‘Template’ naming convention, followed by the culture info (in this case en-HK) and the ‘.resx’ extension. The correct culture info was actually ‘zh-HK’. Once I changed the problematic culture info, the error was gone and the app was working as expected.
Hope it helps if you get into the same annoying situation with ASP.NET resource files !
Cheers!
-arbbot

Tuesday, November 29, 2011

Entity Library Quick Reference

 

images

Once helpful source for quick reference when getting started on the Entity Framework is the MSDN Entity Framework Quick Start.  You will find four concrete sections covering the basics so you can get up and running.

Many information out there talks a lot about the code first features, but I find myself needing to create the .edmx file from an existing database, which could be tricky to find out there.

In the series of posts I’m preparing I’ll share how to use these techniques and approaches on a layered small, but well designed backed app that will empower RESTful services that can be consumed by any device.

In the meantime, have Entity Framework coding !

And no tech posts still…

 

290px-Windows_8_Developer_Preview_Start_Screen

I know….I haven’t been able to post any tech related posts for a while now, and I keep just blogging about how busy I have been and that I will soon start to post something at least remotely interesting….

Well, I’m still on the same position, but finally seeing some free time to work on my blog soon. I have been putting together a comprehensive sample/tutorial for building RESTful services with WCF, C#, Entity Framework and MS SQL. The code samples are already running, so is just a matter of putting together the posts.

Also, I haven been playing around with Windows 8 development preview and Windows Phone, so hopefully I’ll start posting about them too.

For now, it has been about finishing work related projects, enjoying some time off with my wife in Italy and getting used to the cold of London’s upcoming winter !

Cheers!
-arbbot

Saturday, October 15, 2011

London Calling

Long time without writing on my blog, although I have been active on other channels. I recently moved to London after accepting an exciting position as a Senior Developer and Solutions Architect at R/GA leading the .NET team for a big project involving telecommunications and global content management.

Moving to the UK implied some changes in my life and also say goodbye to family and friends for a while, but I'm happy about all the new opportunities. I came to Europe on holidays 10 years ago, and I couldn't wait to see what Europe had to give in my professional career.

It has been great so far, but also very busy. Settling in, arranging all my personal things and get up to speed with the new company, the new team and the new project have kept me away from writing on the blog. However, I hope to start writing more often in the upcoming weeks.

What I'm working, following, reading and playing with lately? Windows 8 for a start, Windows Phone 7, Continuous Integration, Multi-touch experiences, ASP.NET MVC 3.0 to mention just a few.

It has never been a better time to be a .NET Developer & Architect !!!!

Cheers!
-arbbot

Tuesday, February 22, 2011

Kinect Third Party Apps Development will be officially supported by Microsoft

This are great news. Microsoft has announced that it will release an official SDK for Kinect third party development, officially confirming that the use of the Kinect as a third party application development device is being formally encouraged by the software giant !

More info here.

Cheers!

Saturday, February 19, 2011

Factory Pattern Using Unity Application Block

I have been working with the Unity Application Block lately and I keep getting learning new things. I wanted to share with you how you could implement the Factory Pattern when you are working with Unity and how it can make your life easier.

With Unity you can have the interfaces and their concrete implementation mappings in the Unity configuration file, giving you great flexibility to map whatever interface you want to their implementation. This way unity container will be able to resolve any contract you pass along.

     /// encapsulates the instantiation of data provider classes
    public static class Factory
    {
        private static readonly string containerName = "DALContainer";
        private static readonly IUnityContainer container;

        static Factory()
        {
            if (String.IsNullOrEmpty(containerName))
            {
                throw new InvalidOperationException();
            }
            container = new UnityContainer().LoadConfiguration(containerName);
        }

        /// Instantiates a data provider class
        public static T CreateProvider < t >()
        {
            return container.Resolve < t >();
        }
    }

Then the only thing you need to do when you need to instantiate your data provider class ask your factory for it:

IUserProvider dataProvider = Factory.CreateProvider < IUserProvider >()

Notice how less code you need to implement the pattern and encapsulate the functionality with the convenience of leveraging the class resolution into a configuration file, which you can change without having to recompile the application !

Hope the tricks help out there.

Cheers!
-arbbot

Friday, February 18, 2011

What is SOLID

I was reading a few posts about OOP and I wanted to write about what is SOLID and why is so important. Lets start by the formal definition:

SOLID stands for:

S - Single responsibility principle (SRP):
The notion that an object should have only a single responsibility. You know how hard it can be to find the source of a bug/issue. If you encapsulate and abstract the functionality of your object, reducing its responsibilities to a single one, it would be a lot easier to find out if the problem is being generated by that object. The reason it is important to keep a class focused on a single concern is that it makes the class more robust. Look out for the separation of concerns concept, that´s a big deal in software development and software architecture.

O - Open/closed principle (OCP)
The notion that “software entities … should be open for extension, but closed for modification”. OOP basic principles. Inheritance, polymorphism and abstraction. Any good developer should understand and apply this principle.

L - Liskov substitution principle (LSP)
the notion that “objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program”. See also design by contract. Put your interfaces to work dude, make sure you work with contracts, so you can modify, extend or replace implementations without breaking the whole thing !

I - Interface segregation principle (ISP)
The notion that “many client specific interfaces are better than one general purpose interface.” Again, we are trying to encapsulate and abstract functionality. The days of "one big file" are far behind, you should divide and conquer always, and not try to just throw everything in a single place.

D - Dependency inversion principle (DIP)
The notion that one should “Depend upon Abstractions. Do not depend upon concretions.”
Dependency injection is one method of following this principle. Dependency inversion is a very useful concept to understand, although I think is not that easy to master. This has become more important with frameworks and standard libraries and is about reversing the control in a program´s life cycle. Dependency Injections is related to the concept and is one of the methods to achieve it. Check out Enterprise Library and the Unity Application Block for .NET specifics and keep reading and revising general software development articles and documentation about DI. Its worth it.

Cheers!
-arbbot

The Three Laws of the "Indi" Developer

1 - A developer may not injure its Client or, through inaction, allow the client to come to harm.
2 - A developer must obey any orders given to it by the Client, except where such orders would conflict with the First Law.
3 - A developer must protect its own existence as long as such protection does not conflict with the First or Second Law.

Wednesday, February 16, 2011

Unity Application Block Configuration File Setup

Recently I have been working on a C# backend project were we are using the Unity Application Block (Unity) injection features to enable our backend to inject dependency mappings between the Data Abstraction Layer (DAL) and the Business Abstraction Layer (BAL).

"The Unity Application Block (Unity) is a lightweight, extensible dependency injection container with optional support for instance and type interception."

This architecture approach and the use of Unity allow us to completely decouple the BAL from the DAL layer increasing the extensibility and maintainability of the system. We also get the advantage of simplifying object creation when applying the Factory Pattern for dynamic class instantiation/resolution. It also give us greater abstraction and allow different team members to work on different layers reducing the dependencies and increase the flexibility by deferring component configuration to the container.

Configuring Unity is generally straight forward, but your configuration file can become quite big, complex and difficult to manage. What we do to solve this issue, is to separate the unity configuration into a different file, say "unity.config". I wanted to share the tip on how to implement this approach of having multiple configuration files, breaking down the configuration settings and simplifying each of the config files.

First, you need to include the Unity config section in your main configuration file:


And then specify which is the file containing that configuration file:


And voila. Once you have the unity.config file in place everything will work and you will be able to retrieve the Unity configuration settings from the secondary unity.config file.

Now remember that on the unity.config file you need to specify the Unity container. The unity.config file should look something like this:


But since in your application code you will be resolving the container dynamically, you need to be able to retrieve the container configuration. For this, you will need to include the container name in the main configuration file as an application setting:


Then in your code, you can simply retrieve the container name from the configured app settings:

private static readonly string DalContainerName = ConfigurationManager.AppSettings["DALContainer"];

Then to resolve your container when creating the classes on the factory class, you need to declare a unity container and then resolve the container:

private static readonly IUnityContainer Container;
Container = new UnityContainer().LoadConfiguration(DalContainerName);

At this point you have loaded the container specific configuration and dependency mappings, so you can go ahead and resolve the class you need:

        public static T CreateProvider() where T
        {
            return Container.Resolve();
        }

Where "T" will be the interface type (declared in the BAL layer) you need the container to resolve. That will give you the concrete class instance that implements the given interface. Remember that the interface will be declared at the BAL layer while the concrete class implementing the interface will be implemented in the DAL layer.

I hope it helps you out there to get the most of your configuration files, and I recommend keeping an eye on the Unity Application Block for extensible, loosely coupled application development.

Cheers!
-arbbot

Thursday, February 10, 2011

Getting DB project into Visual Studio

Related to my previous post, I had some issues importing the existing DB schema into the Visual Studio 2010 SQL Server 2008 Database project because an unresolved reference between the DB user (database level) and the DB login (server level). I found this issue on a forum and the answer to the problem here which basically indicates that you need to add both a database project and a server project. When you have added both projects and synchronized them with the existing database, you can add a reference to the server project in the database project and voila, issue solved. Hope it helps !

Cheers!
-arbbot

Cannot load file or assembly "Microsoft.SqlServer.Management.SqlParser"

Error: Cannot load file or assembly "Microsoft.SqlServer.Management.SqlParser"
Scenario: Adding a new SQL Server 2008 Database Project in Visual Studio 2010

I wanted to share the issue I found today while trying to create a SQL Server 2008 Database project in Visual Studio 2010. I have an existing database project in SQL Server 2008 and I wanted to include the database project in Visual Studio 2010 for Source Control Reasons. If you want to create a SQL Server 2008 DB Project you need to follow these steps:

1 - Right click on the Solution or Solution Folder where you want your db project to be created.
2 - From the project templates dialog box, go to the Database Node and select the template you want.


You can also find a step by step tutorial on how to create a new DB projects in Visual Studio 2010 here or how to include a existing DB in Visual Studio here.

Now the issue was that when I selected the SQL Server 2008 Database project, Visual Studio game me an error saying that "Could not load file or assembly Microsoft.SqlServer.Management.SqlParser, Version=10.0.0.0...blah blah blah"


This seemed quite estrange since I had SQL Server 2008 with SQL Management Studio and Visual Studio 2010 working just find for all the other tasks I was working on. Doing a little online research the first thing I realized was that getting the right answer for this error was very difficult. Most forums and articles I found suggested that I needed to reinstall Microsoft SQL Server 2008 Management Objects (SMO) components, or reinstall Visual Studio, which I wanted to avoid. I tried to download and install SMO components individually but it didn't work. At last my colleague Herberth Madrigal shared this link on how to install individual Visual Studio components.

Basically I had to first mount my image of the Visual Studio installer and then find the individual installers directories. Most of them are under the "WCU" folder. Then I had to install the following individual components:

SQL Server System CLR Types
SQL Server 2008 R2 Management Objects
Microsoft SQL Server 2008 R2 Data-Tier Application Framework
Microsoft SQL Server 2008 R2 Data-Tier Application Project
Microsoft SQL Server 2008 R2 Transact-SQL Language Service

Note that to install the individual components, you need to open the command prompt window, navigate to the directory where the component installers are located and then enter the install command "MSIExec /i" followed by the specific command to install the component, which you can find in the link mentioned above.

Remember to do all this after you closed Visual Studio and also remember to restart your computer after the install process of all components has finished.

After restart, run Visual Studio and you should be able to add your SQL Server 2008 Database project to your solution.

Thanks to Herberth for the link and the install process help !

Cheers!
-aB




Google Mail Label Filter

Today my mentor and colleague Murven taught me how to use label filters in Gmail, which is something I always wanted to do, but didn't know how. It turns out that is really easy to do.

To filter your inbox using filters, you just need to enter the text "label:" followed by the label you want to filter your inbox by in the search box above your inbox.


Let's say you have emails tagged as "Family" so you can enter the following: "label:Family" and Gmail will filter the emails displayed by the tag "Family". You can also combine tags for filtering, which is very helpful: "label:Family label:unread". You will also notice that Gmail doesn't real time tag checking, so if you enter a tag that you haven't created Gmail will tell you. Also, the label filters are deep linked, so you can actually work out with URLs. In the case I mentioned above, the last part of the URL in the address bar will look similar to this: "?AuthEventSource=SSO#search/label%3Aunread+label%3Ainbox". Nice huh?

Anyways, simple and easy tip but really helpful. I hope it helps you to keep your inbox more organized.

Cheers!

Wednesday, February 9, 2011

2011 Roadmap

As usual, I have been busy with all my professional and artistic activities. Right now I'm finishing my funky alternative band's first album with the independent producer Automata. We are in the final steps before sending the album to England for the masterization work. You can find more details in the band's page.

I have been also reading a lot of new and old books and I have been hearing that little voice in the back of my head telling me to start writing again. I used to write a lot of poetry and short tales when I was in high school studying literature and poetry. My high school is an arts conservatory mixed with all the other traditional academic classes and I dedicated myselft to study painting, poetry and acting.  I stopped writing when I started to study Computer Sciences and act professionally in theaters and television, it was just a switch of my arts field focus. Lately I have been trapped by "The Name of the Wind", first fantasy novel of Patrick Routhfuss and I must say it is a wonderful and totally immersive book that inspires me to go back to writing. We will see how it goes !

Although I haven't been doing much Acting work in recent years, I have been doing a lot of radio commercials and voice over for different agencies, which is always fun.

On the technical field, I left Mysterious Development in December since I got an offer to work on a really big, cool and complex .NET backend project. I really enjoyed working on game development, specially having the opportunity to learn how to develop games with Unity3D and C#/Mono but I love .NET technologies and the current project and team is awesome and with an international quality level, so I'm very happy with the move and the current work. I have been working with WCF, Windows Services, RESTful services, ASP.NET, MS SQL, SQLite, WebORB and LINQ.

I'm planning some big changes soon, so hopefully this year will be full with opportunities, challenges and learning. I'll try to make some time and post some of the things I have been working with and learning during these months.

Cheers!
-arbbot

Monday, February 7, 2011

Good Reads Update: The Name of the Wind by Patrick Rothfuss

The Name of the Wind (Kingkiller Chronicle, #1)The Name of the Wind by Patrick Rothfuss

My rating: 5 of 5 stars


Reading the book right now. Magical and organic, impress by the way the book is written and how the story is told. I read Kafka when I was 12 years old, and The Lord of The Rings when I was 13 years old. I'm 30 years old now, and Rothfuss's book has such power that takes me away from reality and sometimes is very hard to come back. It gives me the same strong feelings of the great books I read more than 15 years ago. Wonderful book from a master writer.



View all my reviews