Cognitive X Solutions partners with stopabully.ca

By Sebastien AubeJanuary 17, 2013 at 6:36 AM

 

FOR IMMEDIATE RELEASE

Moncton, NB – January 17th 2013 – Cognitive X Solutions Inc., a technology and software solutions company based in Moncton, New Brunswick, is proud to announce it’s partnership with stopabully.ca.

Stop A Bully is a national non-profit organization and Canada-wide anti-bullying program developed in 2009 by a B.C. teacher which allows any student who is a victim or witness of bullying and cyberbullying to be able to safely report the details to school officials.   The Stop A Bully program helps increase bullying awareness & accountability within schools to allow officials to be more proactive in preventing serious incidents of bullying.  Stop A Bully provides schools with critical information to be proactive in assisting all students who are witness, target and perpetrator of school bullying.  Stop A Bully provides assistance to any student in any school in Canada.

“The health and wellness of many students, who are victims of bullying and cyberbullying, depends on the right set of tools to support and denounce bullying incidents. We are proud to offer our technology expertise to this effort which will make a definite positive impact in our local area as well as communities throughout this great nation.“ said Sébastien Aubé, President and CEO of Cognitive X Solutions.

In total, Cognitive X Solutions has committed over 200 hours of free consulting and support. This includes building a “Support Letter System” for the current Stop A Bully web portal as well as providing technology guidance.

“The folks at Stop A Bully have a lot of work ahead of them. I sincerely hope that our contributions will help them streamline their processes in order for them to concentrate on their prime objective – building a top-notch support program for targets and perpetrator of school bullying.” said – Sébastien Aubé

-30-

About Stop A Bully

Stop A Bully is an incorporated national non-profit organization which allows any student in Canada who is a victim or witness of severe bullying to be able to safely report the details to school officials without risk of becoming a target themselves.   The Stop A Bully program helps increase bullying awareness & accountability within schools to allow officials to be more proactive in preventing serious incidents of bullying.  Stop A Bully provides schools with critical information to be proactive in helping all students involved in school bullying - witness, target and perpetrator.

About Cognitive X Solutions Inc.

Cognitive X Solutions Inc. is involved in various facets of information technology and business solutions development. Our services include custom application development including web, mobile and desktop development. Our experienced staff has the ability to solve most IT problems in an intelligent and effective manner.

At Cognitive X Solutions we strongly believe in supporting initiatives that will help improve the lives of all the citizens of our community. Local and across this great nation we call Canada.

 

For further information (media only), please contact

Marc Robichaud

Cognitive X Solutions Inc

Tel: 800-670-2649 ext 106

Posted in: Press Release

Tags:



2012 Greater Moncton Excellence Awards–Emerging Business

By Sebastien AubeSeptember 25, 2012 at 10:16 AM

 

Please join us on Friday October 19th at the Ramada Crystal Palace to honour a number of excellent companies in the Greater Moncton area.

This year we are proud to be nominated in the “Emerging Business category.” We wish our co-nominee, Dr Brent Howley, as well as all other nominees the best of chances on that day.

About Cognitive X Solutions:

Cognitive X is a software solutions provider based in Moncton, New Brunswick, Canada.

Our highly skilled team of passionate professionals are hard-wired for software development and have been plugged into our industry for over 20 years, combined.

We are prepared to handle any project, from basic to complex, ensuring successful completion and delivering solutions which exceed expectations.

Cognitive X serves a wide range of clients including individuals & small business, as well as those in the insurance, education, manufacturing, government and large industry sectors.

Our team is here to serve your specific needs, help you to overcome your challenges and provide you with solutions that are easily adopted and maintainable.

Let us bring your idea to life and put technology to work for you.

Posted in: Awards

Tags:



ASP.NET MVC 4 and Mocking ModelState

By AdamAugust 23, 2012 at 8:37 AM

Actually, mocking isn’t quite the word (but we’ll talk about that in a moment).

At Cognitive X, we specialize in web development using ASP.NET MVC (currently using V4), and we very much love Test Driven Development.  So as part of our development process with MVC, we write tests for our Controller Actions.  One of the problems that we run into with testing controllers outside of the MVC framework is that they are not fully setup and many pieces are missing that allow the controller to function properly.  The biggest one being ModelState.

For example, given the following piece of code, no matter what, it always returns true because the ModelState is actually empty, when run outside the normal MVC pipeline:

if (ModelState.IsValid)
{
    // Perform action
}

So inorder to properly test our controllers, we wrote a method that would take the model and setup ModelState correctly (including running all validations on the model).  It was quite easy with V3 of ASP.NET MVC to do this, but with MVC 4 and the introduction of so many new providers (ModelMetaDataProviders, ValueProviders, etc), the old way no longer worked. I spent a morning chasing ModelStateDictionaries through the MVC code (thank goodness for ILSpy, it made my life so much easier), trying to figure out where it actually got filled out.  What I eventually hit upon was the code hidden within the Controller.TryValidateModel, which did exactly what I wanted it to do. The only problem is that it’s protected internal and no good for a general support extension.  So I pulled the code out, rewrote it a bit, and here it is:

public static void SetupModel<T>(this Controller ctrl, T model)
        {
            if (ctrl.ControllerContext == null)
            {
                Mock<ControllerContext> ctx = new Mock<ControllerContext>();
                ctrl.ControllerContext = ctx.Object;
            }

            DataAnnotationsModelMetadataProvider provider = new DataAnnotationsModelMetadataProvider();

            var metadataForType = provider.GetMetadataForType(() => model, typeof(T));
            var temp = new ViewDataDictionary();

            foreach (var kv in new RouteValueDictionary(model))
            {
                temp.Add(kv.Key, kv.Value);
            }

            DefaultModelBinder binder = new DefaultModelBinder();

            ctrl.ViewData = new ViewDataDictionary(temp) { ModelMetadata = metadataForType, Model = model };

            foreach (ModelValidationResult current in ModelValidator.GetModelValidator(metadataForType, ctrl.ControllerContext).Validate(null))
            {
                ctrl.ViewData.ModelState.AddModelError(CreateSubPropertyName("", current.MemberName), current.Message);
            }
        }

So like I said, Mocking is not really the right word for it, it’s actually setting up ModelState to contain the right validation information / model errors, so that controller actions work as expected.

Posted in: Programming

Tags: