1. A JustInTime class

    I discovered in my code a redundant pattern :

    private SomeType _something;
    private SomeType something { get { if (_something == null) _something = new SomeType(....); return _something;} }
    

    Usefull in Silverlight, when your Blender always say "Can't compile ! Strange errors ! but compiles when i comment your WebClient... in ctor of that class..." So i use …

    read more
  2. The art of Events

    The art of using events to build more independent classes. /* Found a better example */ Imagine you have a class A and a class B. A builds B, and B have to communicate with A (call methods ... ?) Some developers (Boooo (I've done it ... (Booo >> me))) will pass a reference of A …

    read more
  3. Howto invoke an event via reflection

    Why this article ? Because of this note found on the MSDN's EventInfo page:

    EventInfo is not intended to be used to raise events. An object raises events as dictated by its internal state.

    Let's try to raise an event with reflection ... Firstly, let's search, but not in GetEvent, in GetField …

    read more
  4. Javascript Foncteur

    I just discovered, this morning, how to create a Visitor in Javascript: A visitor is an objet who can be used like a function:

    var my_foncteur = new A_Foncteur();
    my_foncteur.can_have_methods(42);
    my_foncteur("Can be called like a function");
    

    Implementing it in C++ is extremly easy, using operator overloading, so overloading …

    read more
  5. Cisco CheatSheet

    Misc

    Get privileges

    router>enable
    router#
    

    Enter configuration mode

    router#configure terminal
    Enter configuration commands, one per line.  End with CNTL/Z.
    router(config)#
    

    Reset

    router#copy flash:clean-config startup-config
    router#reload
    

    Configuration

    router(config)#router <protocol> <nbr>
    router(config)#show ip protocols
    router(config)#show running-config …
    read more

« Page 4 / 4