lundi 1 avril 2013

SQL Server : Autoriser la connexion à distance via SQL management Studio (SMSS) (French)

Bonjour,

On va dire que cet article aura pour but une fonction d'anti-sèche qu'un apport de connaissance.

J'ai souvent eu à travailler sur une base de donnée SQL server (peu importe l’édition) distante. Dans mon dernier projet, j'ai dû me connecter sur mon server via SMSS sur mon pc client et malheureusement j'ai eu un message d'erreur

La solution fut assez simple,  c'est d'enabler et de lancer le SQL brower.

Voici la procédure à suivre :
http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/

Bon travail

mercredi 30 janvier 2013

Windows Phone 8 (WP8) Emulator problems - Virtual switch error (french)

Mise à jour

Bonjour tous,

Suite à cet article, j'ai voulu continuer mon projet WP8. A ma grande surprise, il ne m’était plus possible de lancer l’émulateur WP8!!!

Bon, au lieu de continuer à lutter, je me suis lancer dans une réinstallation de mon Windows 8 (pfffff c'est lourd). Heureusement, Microsoft permet une réinstallation (selon eux) plus aisée sans avoir à utiliser de média (je répété, selon eux)
Voici un article exposant la procédure à suivre.

Apres plusieurs tests, je me rend compte que mon problème vient d'AVAST! 7 internet security.
Pour une raison qui m'est toujours obscure, le firewall bloque toute création de virtual switchs, que ce soit pour WP8 ou pour tout autre machine virtuelle.

Solution

Soit désinstaller Avast! internet security et le réinstaller en supprimant le firewall

Bon travail à tous!

-----------------------------------------------------------------------------------------------

Salut,

Voici un problème sur lequel je suis tombé en voulant tester ma première application WP8.
Je lance l'emulateur, celui-ci me donne plusieurs message d'erreurs:

le 1er



une fois cliqué sur le boutton "retry", une second message s'affiche

Ça prend un peu de temps mais pour finir, j'ai ce troisième message

Impossible donc de déployer mon application sur l’émulateur (génial :-( )


Quelques recherche sur le net et voila les pistes qui m'ont permis de résoudre:

Tout d'abord, vérifiez que vous n'avez pas de connections VPN ou même un autre système de machines virtuelles (VMware par exemple) si oui, malheureusement, il faudra les désinstaller.

Là, les choses deviennent de plus en plus compliquées:

il y a quelques articles en anglais essayant de guider vers une solution, voici les liens:
http://social.msdn.microsoft.com/Forums/en-US/wptools/thread/1734dac7-37a4-4d9a-bf89-42b6d493adda
http://stackoverflow.com/questions/13149509/windows-phone-8-emulator-error-something-happened-while-creating-a-switch

Mais rien n'a marché.

La solution la plus simple fut de re-installer le SDK WP8 avec la fonction "repair",  tout de même un plantage en fin d’opération.
Mais ça fonctionne.

Rien d’inédits, mais j'y ai quand même passé 4h a tout tester avant de décider de réinstaller. Si ça peut vous permettre d'y passer moins de temps.

Bon travail à tous!




mardi 3 juillet 2012

WCF beginner tutorial

For several years, I was looking for a good WCF tutorial.
I read documentation more or less from the time this technology was released (.NET3.0).

But honestly, I was a bit lost with so many ways to configure everything.
I attend a short training and honestly, at the end I was still "offside".

I start to read great books, but something was still missing

Then, I remember some times ago I found interesting webcasts

The first one is in english
webcast from dasblonde.net
this webcast is complete


The second one is in french and i think it's amazing...
Webcast msdn
Quick, complete, simple but crystal clear.


Good work

lundi 25 juin 2012

Conformity : Silverlight 4 Business application (presentation)


This is a post about an application named conformity made for a company. This app manages any non-appliance on the inbound and outbound material.

I’ll dig into the code later in another post but at this stage, I will just explain how it works.
The technology chosen to create this app is Silverlight in the version 4.

It was quite interesting to use this part of the Silverlight development tool but honestly, as worth it is to develop, as complex it is to deploy when you’re a novice on deployment.

I face some small problem during the development, but one of the dumbest was that it was not possible to interop with Outlook. It’s only possible whether you create an “out-of-browser” Silverlight app. So why not use WPF???

If I had to redo the same app, I rather prefer to play with ASP.NET MVC3 (or 4)

Let’s explain some pictures
The first picture shows only the lay out and the menu.
The layout is the classic template that Microsoft offers when a new SLBA (SilverLight Business Application) start.
SLBA 4 offers a mechanism of user management, easy to use. The user just has to click on the login button. A pop up will appear and the user can login or register if it was not done before.



The second picture shows the one of main windows. Some filter, a grid with all the material listed. A small text field with the reason of the non-compliance.
User can create a new non-compliance by clicking on the “new button” or modify an existing non-compliance.


The third picture shows the same info than the second one, but there is only one point that was added: the button report. Actually, the Client N.C. has to generate report.



The fourth picture shows when user modifies an existing N.C. (non-compliance)



 The fifth picture shows when user adds a new N.C. (non-compliance)

 The sixth picture and seventh shows a preview of a report containing info and status about the N.C.




The eighth picture and nine shows the medication name


And the last one shows the  customer name.


Then now, we will have a look to the code and some bugs and tricks I had to face



vendredi 18 mai 2012

xml file to a flatten list using Xlinq (Linq to xml) (+Namespace problem)

Here is once again a simple problem I faced recently.

I had this xml file and I'd like to flatten it to a list of actors in c#




<?xml version="1.0" encoding="utf-8" ?>
<MyDbCollection xmlns="http://www.Example.com">
  <Actors>
    <Actor FirstName="Will" LastName="Smith">
      <birthday date ="25.09.1968"/>
      <Movie name="Men in Black" Date="1999"/>
      <Movie name="Wild wild west" Date="1999"/>
      <Movie name="Ali" Date="2002"/>
    </Actor>
    <Actor FirstName="Jason" LastName="Statham">
      <Movie name="The Transporter" Date="2002"/>
      <Movie name="Revolver" Date="2005"/>
      <Movie name="The Bank Job" Date="2008"/>
      <Movie name="Transporter 3" Date="2008"/>
    </Actor>
    <Actor FirstName="Edward" LastName="Norton">
      <birthday date="18.08.1969"/>
      <Movie name="The Incredible Hulk" Date="2008"/>
      <Movie name="Fight Club" Date="1999"/>
      <Movie name="American History X" Date="1998"/>
    </Actor>
  </Actors>
</MyDbCollection>


There are many reason to flatten a list, so I won't enumerate any one of those.
So lets start:

As I want to use a list of "Actors", I create a class of actor:

 public class Actors
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Name { get; set; }
        public string Date { get; set; }
    }

As you can see, I don't need the birthdate value (for the example purpose)

With a simple Xlinq request, it quite easy to cover the xml file... just make sure to understand between the Descandants() and the Elements() method.


class Program
    {
        static void Main(string[] args)
        {
            string file =
                @"G:\ConsoleApplication1\ConsoleApplication1\bin\Debug\Test.xml";
            ReadXmlFile(file);
        }

        private static void ReadXmlFile(string fileName)
        {
            XDocument indexDoc = XDocument.Load(fileName);
            var reader = from a in indexDoc.Root.Descendants().Descendants()
                         from b in a.Elements()
                         
                         select  new Actors
                                    {
                                        FirstName = a.Attribute("FirstName").Value,
                                        LastName = a.Attribute("LastName").Value,
                                        Name = b.Attribute("name").Value,
                                        Date = b.Attribute("Date").Value
                                    };
            var test = reader.ToList();
        }
    }

If you run this code, you'll get this result:



Actually this code should have been correct whether the node <birthday> was not present in the datasource (xml file)

So, let solve this problem... 
Having a look to the MSDN documentation, we see that by adding the name of the node, we can filter only the nodes that the code need.
But if you try, you'll see in this example that nothing will occur.
The reason is quite simple, the xml file contains a namespace so, an namespace should be added in the code in order to make it run correctly.

So an object XNamespace will help to add a namespace to the XML object. Just add the namespace object to the node to reach.

here is the finale code:



private static void ReadXmlFile(string fileName)
        {

            XNamespace ns = "http://www.Example.com";
            XDocument indexDoc = XDocument.Load(fileName);
            var reader = from a in indexDoc.Root.Descendants().Descendants()
                         from b in a.Elements(ns + "Movie")

                         select new Movie
                                    {
                                        FirstName = a.Attribute("FirstName").Value,
                                        LastName = a.Attribute("LastName").Value,
                                        Name = b.Attribute("name").Value,
                                        Date = b.Attribute("Date").Value
                                    };
            var test = reader.ToList();
        }

Good work ;-)

dimanche 13 mai 2012

Quick extension method to convert a yes/no value to a boolean

Once again, I'm not re-inventing the wheel,
Here are simple code, extension method in order to translate a yes/no (Y/N) value read somewhere to a boolean.



 public static class YesNoToBoolExtension
    {
        public static bool YesNotoBool(this string source)
        {
            return source.ToUpper() == "Y"||source.ToUpper()=="Yes";
        }

        public static bool YesNotoBool(this char source)
        {
            return char.ToUpper(source) == 'Y';
        }
    }

Good work ;-)

dimanche 15 avril 2012

Check if any string starts with any string defined in a string array

Once again, a simple problem

I want to check whether a string starts with any string in a list (it easy to make it with a character ).
My current implementation in C# is as follows, One of the easiest implementation is to create an extension method


Code:
public static class StringExtensions
    {
        public static bool StartsWithAny(this string str,params string[] values)
        {
            if (!string.IsNullOrEmpty(str) || values.Length > 0)
            {
                foreach (string value in values)
                {
                    if (str.StartsWith(value))
                    {
                        return true;
                    }
                }
            }
            return false;
        }
    }

Nothing really hard to understand I think Good work ;-)