April 2010 - Posts
new release to my C# IntelliSense extension.
this is a major release that include many UX and usability improvements.
some of the improvements is listing below:
- Select best suggestion
- On going changes filters (the filters will changed according to the current typing)
- Remembering last state of the documentation and single/multi selection options
previous post:
http://blogs.microsoft.co.il/blogs/bnaya/archive/2010/04/07/c-intellisense-extension-for-vs-2010-update-v1-2.aspx
http://blogs.microsoft.co.il/blogs/bnaya/archive/2010/04/15/source-code-for-c-intellisense-extension-for-vs-2010.aspx
you can download the new version from here.
the drop include the following changes:
Build 1.0.2441.0 04/14/2010
Rx .NET
- Added BufferWithTimeOrCount.
- Changed ForkJoin to take the last value from each source.
- Peformed FxCop naming cleanup work.
- Removed FutureDisposable in favor of MutableDisposable.
- Added Sequential operators like While, If, Case etc…
- Added SkipLast & TakeLast.
- Made fixes to CurrentThreadScheduler & NewThreadScheduler.
- Added Scan0.
- Made Sample fire last sample area on Oncompleted & have abort semantics on Error.
- Made Buffers have abort semantics on Error.
Rx JS
- Changed distribution from MSI installer to ZIP file
- Added BufferWithTimeOrCount.
- Added ForkJoin.
- Added SkipLast & TakeLast.
- Removed FutureDisposable in favor of MutableDisposable.
- Breakout support for html api into separate file (rx.html.js).
- Added jQuery support (rx.jquery.js).
- Added dojo support (rx.dojo.js).
- Added MooTools support (rx.mootools.js).
- Added Prototype support (rx.prototypel.js).
- Added ExtJS support (rx.extjs.js).
- Added Yui3 support (rx.yui3.js).
- Added aggregates such as Sum, Count, IsEmpty etc… (rx.aggregates.js).
- Added joins support (rx.joins.js).
- Changed default schedulers for various API.
- Made List implementation public.
- Made several to TakeUntil, Scan1,Take, SkipWhile, Repeat, Retry, Catch, StartWith, Subjects, ToAsync, Start.
- Make schedulers have own notion of time (Now()).
- Added Scan0.
- Made Sample fire last sample area on Oncompleted & have abort semantics on Error.
- Made Buffers have abort semantics on Error.
- Fixed Aggregate, Count, Sum & Average behavior on empty observables.
- Added Samples for all different library integration points
- Added readable (debug) version of library integration points.
the Source code for C# IntelliSense extension for VS 2010 is available
at codeplex under the following link: http://csharpintellisense.codeplex.com/
the current version is 1.5
you can send improvements to bnayae@sela.co.il so I can make it available to the public.
see previous post on this subject here, and here.
C# IntelliSense extension for VS 2010 – UPDATE (V1.2)
the extension has update.

Rx - for beginners (part 14): time based buffering
this post is the 14th in a series of posts about the new Reactive Framework (Rx).
the series TOC can found here.
in this post we will focus on the BufferWithTime operator.
the code for this post available here.
What does BufferWithTime operator do?
the buffer with time operator is buffering values that occurs within specific
time windows, and then publish the buffered values whenever the time period ends.
Marble diagram
the marble diagram for the BufferWithTime operator:

as we can see the BufferWithTime operator slice the origin stream into time period sections
and buffer the produced value occurs during each period.
when the period elapse it publish the buffer.
Code Sample
the following code demonstrating 1 second buffering for values that produced at rate of 300 milliseconds.
Code Snippet
- IObservable<long> producer = Observable.Interval(TimeSpan.FromMilliseconds(300));
- IObservable<IList<long>> observableBuffer = producer.BufferWithTime(TimeSpan.FromSeconds(1));
-
- producer.Subscribe(value => Console.WriteLine(value));
- observableBuffer.Subscribe(values => Console.WriteLine("SUM: {0}",values.Sum()));
line 1, create observable producer, that produce value each 300 milliseconds.
line 2, buffer the producer under 1 second time window.
line 4, subscribe to the origin producer, and project it values.
line 5, subscribe to the buffered observable and project the sum of the values that was buffered during the 1 second period.
the output of this code will look as follow:
Summary
the BufferWithTime operator may be very useful in scenarios
when we want to aggregate or manipulate values under specific time period,
or do batch operation at wider frequency.
just think of scenario when you having high frequency rate producer (let say 1 event every 1 millisecond)
and you should persist the event's data into database.
it may be wiser to use batch update or bulk insert every
slightly longer period of time.
the code for this post available here.
Point of interest (BufferWithCount)
BufferWithTime operator has close relative operator named BufferWithCount,
and as you may already guess, it buffer the result by counting instead of time period.
C# IntelliSense extension for VS 2010 – UPDATE
the extension has update and it is include the description.
enjoy :)
C# IntelliSense extension for VS 2010
the C# IntelliSense extension is now available at the Visual Studio Gallery.
the extension is adding filtering capability to the VS IntelliSense,
so for example when you are looking for methods you can filter out the namespace, fields, events and properties.
Credits
this work is heavily based on the Xaml IntelliSense extension that was written by Karl Shifflett.
Download
you can either download the extension from Visual Studio 2010 (tool->Add-in manage…
and search for CSharp IntelliSense).
or directly from Visual Studio Gallery site here.
Point of interest
you may also want to check the Spell Checker extension.
MEF for Beginner (Deployment Catalog) - part 12

this is the 12th post of the MEF for Beginner series, the series TOC is available here.
this post will focus on Deployment Catalog.
the code sample for this post can be found here.
What is MEF Deployment Catalogs?
the deployment catalog is actually a redesign of the older package catalog.
it enable to load parts from xap packages a-synchronically.
Code sample
the following code sample depend on 2 assembly that should be added to the project:
- System.ComponentModel.Composition
- System.ComponentModel.Composition.Initialization
at the startup (app.xaml)
Code Snippet
- private void Application_Startup(object sender,StartupEventArgs e)
- {
- InitializeContainer();
- this.RootVisual = new MainPage();
- }
-
- private void InitializeContainer()
- {
- var catalogs = new AggregateCatalog();
-
- var catalog = new TypeCatalog(typeof(PlugIns));
- catalogs.Catalogs.Add(catalog);
-
- // Create deployment catalog
- var deployCatalog = new DeploymentCatalog("PlugIns.xap");
- deployCatalog.DownloadCompleted += OnDownloadCompletedHandler;
- deployCatalog.DownloadProgressChanged += OnDownloadProgressChangedHandler;
- deployCatalog.DownloadAsync();
-
- catalogs.Catalogs.Add(deployCatalog);
-
- // initialize the main application composition host (container)
- CompositionHost.Initialize(catalogs);
- }
line 3, initialize MEF before the creation of any windows that depend on MEF.
line 9, define aggregate catalog (this is basically a catalog collection).
lines 11-12, create type catalog for plug-ins within the main xap (plug-in within the main xap
can be assess directly) and add the catalog to the aggregate catalog.
line 15, create deployment catalog (it get the xap relative path as parameter).
lines 16-17, register for xap download process events (optional).
line 18, start downloading the xap.
line 20, add the deployment catalog to the aggregate catalog.
line 23, initialize the composition host with the aggregate catalog (so
latter using CompositionInitializer.SatisfyImports will operate against the aggregate catalog).
at the MainPage.xaml the code will look as follow:
Code Snippet
- public partial class MainPage:UserControl,INotifyPropertyChanged
- {
- public MainPage()
- {
- InitializeComponent();
- this.DataContext = this;
- CompositionInitializer.SatisfyImports(this);
- }
-
- private IEnumerable<string> _plugIns;
- [ImportMany(AllowRecomposition = true)]
- public IEnumerable<string> PlugIns
- {
- get
- {
- return _plugIns;
- }
- set
- {
- _plugIns = value;
- if(PropertyChanged != null)
- PropertyChanged(this,new PropertyChangedEventArgs("PlugIns"));
- }
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
- }
line 7, asking MEF to satisfy any import of the current instance (in our case the PlugIns property).
lines 11, decorate the PlugIns property for being assigned by the MEF composition.
notice that the decoration define AllowRecomposition = true, this is very important
because the deployment catalog is a-synchronic, therefore we do not control the exact time of the assignment.
Summary
deployment catalog is the current way for delay composition from xap packages.
it is a-synchronic and it will notify the catalog upon the download completion.
the code sample for this post can be found here.
Learn more