Color Gradient Generator

Tuesday, November 12, 2013

A while back, I created a WPF Mandelbrot Set program with zoom abilities. I demonstrated the use of async/await for writing code that works asynchronously (to keep the UI responsive), but is easy to write as synchronous code. Here’s a sample image:The image is grayscale, so I wanted to make it use colors, to indicate the level of “being part of” the Mandelbrot set. The problem here is how to create a nice color gradient that moves smoothly from color to color.One possible option might be to leverage an existing class, such as WPF’s LinearGradientBrush, set up a bunch...

Extreme DevCon 2013

Monday, July 15, 2013

Next week, John Bryce Training, along with some of its partners, set up a two day conference named Extreme Dev Con 2013, on the 22nd and 23rd of July in Hertzliya (Israel). The conference consists mainly of full one-day seminars, several happening at the same time (naturally).I will be presenting a full day seminar, titled something like “.NET deep dive for performance”. The rough topics are listed in the above link, but basically I will cover various topics that somehow relate to that elusive thing called “performance”. From process and AppDomains, through the garbage collector and friends, threads and...

WDCIL Presentation and Demos

Tuesday, June 18, 2013

This evening I gave a talk on the Task Parallel Library (TPL) and the asynchronous programming features of C# 5.0 & .NET 4.5 at the Israeli Web developers user group. Thank you all for coming, I had a lot of fun!Although the TPL has been around in release for for more than 3 years, I’m still surprised to find developers who know little about and don’t use it. This is unfortunate, as I consider the TPL one of the best parts of .NET. I wish more developers learn it and use it. The same goes for C# 5.0. For...

My C# 6.0 Wish List

Wednesday, June 5, 2013

I’m on a wish list streak, so why not wish myself new features in C# 6.0?There has been no public talk about C# 6.0 (or the next version of .NET, for that matter). Still, I imagine someone is working on that at Microsoft (maybe not Anders, who seems to prefer the JavaScript world, with his TypeScript language); hopefully, others have taken the lead for the future of C#.Firstly, it must be well understood that adding features to a language is a big deal. Once added, these can never be removed. Whereas features to the .NET framework itself can be...
10 comments

Windows Phone 8 Dev Camp

Monday, April 22, 2013

A few hours ago, Ariel Ben Horesh and myself presented two sessions for Windows Phone 8 development at Microsoft offices in Ra’anana (Israel). Thank you all for attending! It was fun – it was the second time I presented with someone else (Ariel) at the same time… we had no time to rehearse, but it was great! The code we showed can be found on github at https://github.com/arielbh/RightMyGuide.The slides links are below.Enjoy!BTW, the IMDB service I created to run on Azure will not be up forever… I will probably shut it down (it’s in on private Azure account) in a...

Task and TaskCompletionSource

Friday, April 12, 2013

The Task and Task<T> classes have been around since in .NET 4, and are fairly well known. In .NET 4, the typical usage of a Task is to run some code on a separate thread (by default using the thread pool), as a better alternative to the raw thread pool. Task has a multitude of constructors, but all of them expect a delegate that is the code to be run when the task is executed. Task provides methods such as Wait, so that code can continue when a Task finishes, and powerful continuation model with ContinueWith, that provides easy...
no comments

C# Extension Methods and Fluent Interfaces

Thursday, February 7, 2013

The idea of fluent interfaces is not new, and has many forms. The basic idea is to use a single statement to encompass a series of operations that are natural, or at least simple, to use. There are very few fluent interfaces in .NET – the most well known, which has some fluent interface semantics, is the System.Text.StringBuilder class. Here’s a simple example: public static string BuildInfo(Process process) { return new StringBuilder("Process ") .AppendLine(process.ProcessName) .Append("Started at ").AppendLine(process.StartTime.ToLongTimeString()) ...
one comment

C# 5.0: await and Reentrancy

Monday, January 28, 2013

The relatively new async/await keywords in C# 5.0 are truly great. I’ve been using them for a while now, and I always contrast these to the way things can be done in C++11; and even with the help of PPL tasks – it stands out as clearly victorious, with its ease of use and lack of verbosity.In fact, it’s so easy to use that I find myself creating new methods that are mostly “Async”, even if the benefit may not be that great – just because it’s easy to do.For example, suppose there is a method that does some...

Making HTTP calls in WinRT with C++

Monday, January 14, 2013

When working with Windows Store applications (“metro”), it’s sometimes necessary to make HTTP calls. one classic example is to register for push notifications. After obtaining a unique channel URI, the app needs to send that URI to its application server, as that particular URI is the one to use by the application server to execute a push notification against the Windows Notification Service (WNS).Getting the channel URI is fairly simple, with a call to the static PushNotificationChannelManager::CreatePushNotificationChannelForApplicationAsync method. Now comes the tricky part: how to send the resulting URI to the application server?In .NET, things are relatively easy. Just use...

Windows Phone 8: Integrating with the Wallet

Thursday, November 8, 2012

Earlier this week, Microsoft held the Discovery event in Tel Aviv, Israel, with a distinguished guest, Steve Ballmer. In the event, Microsoft has officially launched Windows 8 and Windows Phone 8 (and XBOX 360 and Kinect…) in Israel. During the presentations, a wallet application on Windows Phone was shown, which was developed by us, CodeValue (and specifically by me ). This article and this one describe something about the app (in Hebrew). Here are some screenshots (some text is in Hebrew): In this post, I’d like to show the basic steps to integrate an application with the built-in Windows Phone...
no comments