DCSIMG
April 2010 - Posts - Bnaya Eshet

Bnaya Eshet

Disclaimer

April 2010 - Posts

C# IntelliSense extension for VS 2010 V1.7

 C# IntelliSense extensionnew 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

 

C# IntelliSense extension

 

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

 

kick it on DotNetKicks.com Shout it


New drop of Rx framework is available

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.


Source code for C# IntelliSense extension for VS 2010

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.

 

kick it on DotNetKicks.com Shout it


C# IntelliSense extension for VS 2010 – UPDATE (V1.2)

C# IntelliSense extension for VS 2010 – UPDATE (V1.2)

 

the extension has update.

 

Intellisense, VS2010, Extension



Rx - for beginners (part 14): time based buffering

Rx - for beginners (part 14): time based buffering

IObservable,IObserver,Rx,Observable

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:

IObservable,IObserver,Rx,Observable

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
  1.  IObservable<long> producer = Observable.Interval(TimeSpan.FromMilliseconds(300));
  2.  IObservable<IList<long>> observableBuffer = producer.BufferWithTime(TimeSpan.FromSeconds(1));
  3.  
  4.  producer.Subscribe(value => Console.WriteLine(value));
  5.  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:

IObservable,IObserver,Rx,Observable

 

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.

 

kick it on DotNetKicks.com Shout it


C# IntelliSense extension for VS 2010 - UPDATE

C# IntelliSense extension for VS 2010 – UPDATE

the extension has update and it is include the description.

VS2010, extension, intellisense

enjoy :)



C# IntelliSense extension for VS 2010

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.

 

CSharp,IntelliSense,VS,2010,plug-in,extension

 

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.

 

kick it on DotNetKicks.com


MEF for Beginner (Deployment Catalog) - part 12

MEF for Beginner (Deployment Catalog) - part 12

deployment catalog,MEF,Import,Importmany,export,compose,composition

 

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
  1. private void Application_Startup(object sender,StartupEventArgs e)
  2. {
  3.     InitializeContainer();
  4.     this.RootVisual = new MainPage();
  5. }
  6.  
  7. private void InitializeContainer()
  8. {
  9.     var catalogs = new AggregateCatalog();
  10.  
  11.     var catalog = new TypeCatalog(typeof(PlugIns));
  12.     catalogs.Catalogs.Add(catalog);
  13.  
  14.     // Create deployment catalog
  15.     var deployCatalog = new DeploymentCatalog("PlugIns.xap");
  16.     deployCatalog.DownloadCompleted += OnDownloadCompletedHandler;
  17.     deployCatalog.DownloadProgressChanged += OnDownloadProgressChangedHandler;
  18.     deployCatalog.DownloadAsync();
  19.  
  20.     catalogs.Catalogs.Add(deployCatalog);
  21.  
  22.     // initialize the main application composition host (container)
  23.     CompositionHost.Initialize(catalogs);
  24. }

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
  1. public partial class MainPage:UserControl,INotifyPropertyChanged
  2. {
  3.     public MainPage()
  4.     {
  5.         InitializeComponent();
  6.         this.DataContext = this;
  7.         CompositionInitializer.SatisfyImports(this);
  8.     }
  9.  
  10.     private IEnumerable<string> _plugIns;
  11.     [ImportMany(AllowRecomposition = true)]
  12.     public IEnumerable<string> PlugIns
  13.     {
  14.         get
  15.         {
  16.             return _plugIns;
  17.         }
  18.         set
  19.         {
  20.             _plugIns = value;
  21.             if(PropertyChanged != null)
  22.                 PropertyChanged(this,new PropertyChangedEventArgs("PlugIns"));
  23.         }
  24.     }
  25.  
  26.     public event PropertyChangedEventHandler PropertyChanged;
  27. }

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

 

kick it on DotNetKicks.com Shout it