Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Adam Speight

Adam Speight Adam​Speight2008 The Bandito Coder

Niner since 2009

  • TWC9: 200! Kinect SDK v1.5, GitHub for Windows, Visual Studio 11 lineup and more

    The infiltration into The Death Star has begun. Bring on the Core and Clint episode.

  • Going Deeper with Project Roslyn: Exposing the C# and VB compiler’s code analysis

    What communication protocol are you using to upload the video bits? Carrier Pigeon?

  • Lucian Wischik: What's New in VB11

    Lucian, I noticed something strange when you did the Hello World part at the beginning. 

    When using the "traditional" methods, the game it background continued to play, but when demo the Async approach, it seem (to me) to run synchronously. ie the Message Popup appeared then the game ran. 

    Was this an artefact of  Async, the rest of code following this is lifted into a continuation?

  • Beckman Meijer Overdrive: LINQ - Composability Guaranteed

    Isn't Mathematica based on Lisp?

  • Working with Depth Data

    What happens at 2000mm? Dan  Wink  Undefined behavior ?

  • Announcing Visual Studio Achievements Beta

    I predict this become the Coder's Version of Farmville. (ie; must people will not two hoots, as to what achievement you've gained)


    Visual Studio's will be forever tarnished, cometh the day when it is a requirement in a job vacancy.

  • TWC9: New Team Members, Win8, C++, SQL 2012, Cloud Numerics

    On the subject of  INotifyPropertyChanged, the Anders Hejlsberg Way.

    The only issue I have with it is that it as to replicated across classes. 

    Now as I see it, if you slightly modify the code you can make it an extension method.

    Different interface, so you raise the event on the correct object. (As I don't no a way to externally trigger them.).

    Public Interface INotifyPropertyChanged_Extd
      Inherits INotifyPropertyChanged
      Sub RaisePropertyChangedEvent(ByVal source As Object, e As PropertyChangedEventArgs)
    End Interface
    
    Public Interface INotifyPropertyChanging_Extd
      Inherits INotifyPropertyChanged_Extd
      Sub RaisePropertyChangingEvent(ByVal source As Object, e As PropertyChangingEventArgs)
    End Interface

    Then you have the following extension method(s).

     

    Imports System.Runtime.CompilerServices
    Imports System.ComponentModel
    Imports System.Collections.Generic
    Public Module Exts
      <Extension> Public Sub SetProperty(Of T, U As INotifyPropertyChanging_Extd)(ByVal obj As U,
                                                                              [property] As String,
                                                                              toValue As T,
                                                                              ByRef usingField As T, Optional ignored As Object = Nothing)
        If obj Is Nothing Then Exit Sub
        If Not EqualityComparer(Of T).Default.Equals(usingField, toValue) Then
          Dim old = usingField
          obj.RaisePropertyChangingEvent(obj, New PropertyChangingEventArgs([property]))
          usingField = toValue
          obj.RaisePropertyChangedEvent(obj, New PropertyChangedEventArgs([property]))
        End If
      End Sub
      <Extension> Public Sub SetProperty(Of T, U As INotifyPropertyChanged_Extd)(ByVal obj As U,
                                                                              [property] As String,
                                                                              toValue As T,
                                                                              ByRef usingField As T)
        If obj Is Nothing Then Exit Sub
        If Not EqualityComparer(Of T).Default.Equals(usingField, toValue) Then
          usingField = toValue
          obj.RaisePropertyChangedEvent(obj, New PropertyChangedEventArgs([property]))
        End If
      End Sub
    
    End Module

     

    Example Class using this extension method.

     

    Public Class Example
      Implements INotifyPropertyChanged_Extd
      Private _Value As Integer
      Property Value As Integer
        Get
          Return _Value
        End Get
        Set(value As Integer)
          Me.SetProperty("Value", value, _Value)
        End Set
      End Property
    
      Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
      Public Sub RaisePropertyChangedEvent(source As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged_Extd.RaisePropertyChangedEvent
        RaiseEvent PropertyChanged(source, e)
      End Sub
    End Class

    And the _PropertyChanged event being handled.

    Class MainWindow 
      Private WithEvents MyExample As New Example
    
      Private Sub MyExample_PropertyChanged(sender As Object, e As ComponentModel.PropertyChangedEventArgs) Handles MyExample.PropertyChanged
        Debug.WriteLine(e.PropertyName)
      End Sub
    
    
    End Class

  • Brian Beckman: Hidden Markov Models, Viterbi Algorithm, LINQ, Rx and Higgs Boson

    What advantages does the MayBe monad have over an Option<T> ?

    Option<T> can be thought as nullable over any "kind" of type (ref or val)

  • YOW! 2011: Mike Lee - The Road to Appsterdam

    Standing Ovation & Cheers or encore! encore!.

    I was like WTF!? before playing the video, by the I'm more MMM!

     

  • GoingNative 4: Jim Springfield on ATL, GoingNative Conference - Register Today!

    ++ is the postfix increment and a unary operator

    So wouldn't C++11 would be a compile-time error?

    Would it be more (C++)+=11?

See more comments…