Unosquare is a bi-national corporation providing software development, testing, and support for a set of highly valued customers. We serve North American clients from offices in Oregon and our Nearshore delivery center in Guadalajara, Mexico.

Sunday, May 9, 2010

The SessionManager pattern revisited

NOTICE: This blog entry was imported from our previous blogging platform.
The real entry date is November 25, 2009

Here's the new and improved SessionManager pattern. I thought I would blog it because it looks so elegant and useful. Here it is:

namespace Unosquare.Patterns
{
    public static class SessionManager
    {
        private enum SessionKeys
        {
            User,
            IsAuthenticated,
            ClientEntity,
            ClientEntityId
        }

        private static T GetSessionProperty(SessionKeys key) where T : new()
        {
            var sessionKey = key.ToString();

            if (HttpContext.Current.Session[sessionKey] == null)
            {
                HttpContext.Current.Session[sessionKey] = new T();
            }
            return (T)HttpContext.Current.Session[sessionKey];
        }

        private static void SetSessionProperty(SessionKeys key, T value) where T : new()
        {
            var sessionKey = key.ToString();
            HttpContext.Current.Session[sessionKey] = value;
        }

        public static bool IsAuthenticated
        {
            get
            {
                var value = GetSessionProperty(SessionKeys.IsAuthenticated);
                return value.HasValue ? value.Value : false;
            }
            set
            {
                SetSessionProperty(SessionKeys.IsAuthenticated, value);
            }
        }

        public static User User
        {
            get
            {
                return GetSessionProperty(SessionKeys.User);
            }
            set
            {
                SetSessionProperty(SessionKeys.User, value);
            }
        }

        public static ClientEntity ClientEntity
        {
            get
            {
                return GetSessionProperty(SessionKeys.ClientEntity);
            }
            set
            {
                SetSessionProperty(SessionKeys.ClientEntity, value);
            }
        }


        public static Guid ClientEntityId
        {
            get
            {
                var value = GetSessionProperty(SessionKeys.ClientEntityId);
                return value.HasValue ? value.Value : Guid.Empty;
            }
            set
            {
                SetSessionProperty(SessionKeys.ClientEntityId, value);
            }
        }


    }
}

We are going Azure!

NOTICE: This blog entry was imported from our previous blogging platform.
The real entry date is November 2, 2009
We have been having talks with Microsoft Mexico to port one of our client's products to SQL Azure (http://www.microsoft.com/windowsazure/sqlazure/) The integration starts today! This is hopefully our path to become a Microsoft Partner.

Microsoft and PHP

NOTICE: This blog entry was imported from our previous blogging platform.
The real entry date is October 21, 2009
Last night I tried something called "Windows Cache Extension for PHP". In the world of PHP, accelerators are extensions which cache script opcodes in either the file system or memory so that the next time the script is requested, it won't need to be checked, parsed and converted into opcodes. Accelerators significantly increase response times, especially in large PHP applications and libraries (such as our PHP framework, WebCore 3x). So far I had been using eAccelerator fairly successfully. The problem with eAccelerator is that sometimes it will make Apache crash for no apparent reason. Well, Microsoft just realeased their own PHP accelerator extension and guess what? It works amazingly well. I'm testing the extension with IIS 6.0 + FastCGI + PHP 5.2.10 and so far, in terms of speed and reliability, I am very happy with it. This is the third time I've been surprised by Microsoft's work towards integrating with PHP. The first time I saw this, was when I discovered they were offering a SQL Server Driver (extension) for PHP. Then, Microsoft integrated PHP within their free Web Platforms Installer. This made it very simple to install PHP on IIS 6 or 7 and bundle it wih FastCGI. Finally, and most amazingly, thier new Windows Cache Extension for PHP really shows some interest from Microsoft to winning a large PHP user base over to IIS. I can't wait until Microsoft goes beyond the Phalanger project and creates a PHP compiler for the .NET framework as they did with Ruby and Python. I guess that with the DLR and the new "dynamic" C# 4.0 keyword, we will be seeing support for PHP.NET soon enough.

Worship Kitchen 2.0 Launched!

NOTICE: This blog entry was imported from our previous blogging platform.
The real entry date is June 25, 2009
Worship Kitchen is one of the digital distribution channels of Integrity Media. What makes it different is that you can get extended content such as split-tracks, orchestrations, transposable music sheets, lyrics and so much more than your regular music provider. We had been working extremely hard to get the next iteration of Worship Kitchen out the door. It was not easy and we had to learn many things along the way but we finally did it. We ended up with a rock-solid product. We’d like to thank the team at Integrity. They gave us all the right direction, hard work and resources we needed to complete this iteration. There’s a lot more coming though. I’ll keep you posted

The story behind our logo

NOTICE: This blog entry was imported from our previous blogging platform.
The real entry date is May 25, 2009
Defining the logo for a new company is always hard and our case was definitely not an exception. Our first approach to the logo was completely related to the square. After that approach, we moved towards something very similar to our final logo, we wanted to focus on the entire name, while still keeping focus on the Spanish/English part of the Company’s name – at that time we were also focused on colors, and we came with something like this:


Short after that Lorena Navarrete designed a different set of logos that actually looked more like real logos and not our “first-approaches”. Lorena, we are thankful for your all your help!


From this set of logos we really liked the following one – although none of our friends and family seemed to like it.



Finally we came up with the idea of leveraging the power of social networks to decide on our logo, and this became in quite an experience. We had people from everywhere giving opinions about this. People keep asking us which Logo won as if it was some sort of contest. To do this, we did an online Poll using Zoho Polls, which aside from the fact that it doesn’t manage comments well, did the trick for deciding on our logo.
Link to the original Poll
The winner was one of Lorena’s original designs - #4 on the Poll!

 
Although something quite interesting happened; when we analyzed the audience that voted, we realized that Executives preferred the more formal and simpler design while younger generations preferred the modern/colorful approach.
At the end, we decided for the formal logo, I think that it is just as dressing for a meeting with a CIO/CTO. Honestly I could just wear jeans and a t-shirt, after all, what matters is what we know and how well we can do it, but the bottom-line is that I wear a suit for those meetings. I want the person that is meeting me to focus on what I say and not how am I dressed. As for our logo, we want them to focus on our company’s services and not in how modern/colorful we look.
The final logo actually is quite smart; it allows us to do branding: unosign, unosap, unoblog, etc. It is formal, and the best, we can write it using True Type Fonts! So much for embedding images…

About Unosquare

My photo
Portland, OR, United States
Unosquare provides US based IT consulting and Mexico based software development and testing.