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

CKoenig

CKoenig CbrAInK Carsten

Niner since 2008

  • Erik Meijer - Functional Programming From First Principles

    I don't think Erik went to the dark ... err imperative ... side - you just have to adapt to your audience: "GOTO Chicago is a premier software development conference designed for team leads, architects, and project managers." Devil

  • JavaScript Variables, Types, Operators, and Expressions - 05

    BTW: in JS "values" got types not the variables - so if you put

    var myVar = "Hello";


    it's not myVar that will have any type - indeed you can just go on and give another value of a different type to the same variable without getting any complaints:

    var myVar = "Hello";
    myVar = 5;


    That is both one of the strenghts (as it gives you lot's of power - like duck-typing) but also one of the biggest weaknesses (as there is no compiler telling you about your type-errors) of dynamic languagues.

  • Understanding Monads with JavaScript

    @philosopher: if you need practical aspects look at any of the LINQ casts here or elsewhere. Other examples would be the asynchronous workflows in F# (you can find a *inferior* version of this in C# too - there it's called await/async Tongue Out), the IO-Monad in Haskell, testing with randomized data with QuickCheck/FsCheck, ...

    That's the fun of this cat.theory stuff: it's so general that it's everywhere around you - even if you don't notice.

     

  • Understanding Monads with JavaScript

    right in the middle you can see why dynamic typed languagues are just a pain. Any strongly typed languague won't have him made smarter about his add/add3 typo but the compiler would have him get it in no time .... and of course you can see the "JOY" of JS by adding and substracting strings and yield some kind of almost sensible output ... god this languagues is so ... argh

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

    finally ... cannot wait to see this ... downloading now - enjoying after work ... thank you guys

  • TouchDevelop - Getting Started

    I would really like to play with this but I've got the (known) install problem (c101b00b) - is there any cure for this ill on the way?

  • Rx Workshop: Schedulers

    Hi - you never have to "foreach" - you can allways use some LINQ-syntax to do the same (and tools like ReSharper even have some automatic code-conversation between the two ways) - it's just a matter of taste and the way the code might look if you use Select/Aggregate/whatever to make it LINQish.

  • Rx Workshop: Schedulers

    Indeed this might be the indented way - thanks.

    But boths of theses seems to me like "breaking the pattern" - if we use a concrete scheduler in the definition of the Observable-Source then what about SubscribeOn (the one with the IScheduler overload)?

    What I had expected was something like Create with "Action<ISubscriber>" or something like

    public static IObservable<tData> ToObservable<tData>(this IEnumerable<Tuple<DateTimeOffset, tData>> source)
    {
    /* feed the data (snd) into a IObsevable and use the fst component for the scheduler, whatever it might be */
    }

  • Rx Workshop: Schedulers

    Well - here is my try.

    I have to say I've got some problems with this. First it took me a horrible long time to realise that Subject can be used as an Observable-Source you can publish values to. And even worse is the way I have to use the Schedule/OnNext - mess.

    Don't know if there is any better way, but why was the way suggested by the video droped?

            IObservable<StockQuote> GetQuotes(IScheduler scheduler, IEnumerable<StockQuote> quotes)
            {
                // Create an observable source of stock quotes
                var sub = new Subject<StockQuote>();
    
                foreach (var quote in quotes)
                {
                    var quote1 = quote;
                    scheduler.Schedule(quote.Date, () => sub.OnNext(quote1));
                }
    
                return sub;
            }
    
            IObservable<object> Query(IObservable<StockQuote> quotes)
            {
                // Write a query to grab the Microsoft "MSFT" stock quotes and output the closing price
                // HINT: Make sure you include a property in the result which has a type of DateTime
                return quotes.Where(q => q.Symbol == "MSFT").Select(q => new {q.Date, q.Close, q.High, q.Low, q.Open});
            }

  • Rx Workshop: Unified Programming Model

    a pitty that nobody posted anything on te challange (or am I missing something?) so here is my *take* on it:

                // Convert txt.TextChanged to IObservable<EventPattern<EventArgs>> and assign it to textChanged.
                var textChanged =
                    Observable
                        .FromEventPattern(addHandler: evHandler => txt.TextChanged += evHandler,
                                          removeHandler: evHandler => txt.TextChanged -= evHandler)
                        .Select(ev => ((TextBox) ev.Sender).Text)
                        .Throttle(TimeSpan.FromMilliseconds(300));
    
                // Convert BeginMatch/EndMatch to Func<string, IObservable<DictionaryWord[]>> and assign it to getSuggestions.
                var getSuggestions = Observable.FromAsyncPattern<string, DictionaryWord[]>(begin: BeginMatch, end: EndMatch);
    
                var results = from text in textChanged
                              where text.Length >= 3
                              from suggestions in getSuggestions(text)
                              select suggestions;
    

    As you might see I took the freedom to change some little pieces.

    First I want to get the text from textChanged (just like in the cast) and second I don't want to fire 7 webrequests in succesion to get the suggestions for "automobile" while typing, so I throttle the textChanged-Observable to 300ms.

See more comments…