Tuesday, October 30, 2012

Event report on BSI Bekasi Microsoft Technology Update and explaining Asychronous without coding

Hi guys! While I was preparing for Part 4 and 5 of my blog series about F#, MUGI Jadetabek was organizing event at BSI Bekasi about Microsoft Technology update on 13th October, 2012. It is part of MUGI technology community sharing.

The complete event report is already presented by Wakhid Nusa in this blog entry. Now I’ll focus on my participation: acting as MUGI Jadetabek representative and also helping Nicko to deliver presentation of “Introduction to Visual Studio 2012”.

The number of audiences are quite large, it’s about 200 students with roughly equal numbers of boys and girls. The fun side is, the enthusiasm is overwhelming! It’s quite rare to have this rate of enthusiasm, comparing to previous MUGI gathering on other universities/schools.

Other than Nicko from MUGI, we have Agatha Leonita with Office 2013 and Aji Prasetio with Windows 8 respectively.

Here’s the pictures from the event:

Nicko, Agatha, and Aji Prasetio in the pictures below.

WP_000046_5FF63733 WP_000048 WP_000050

I was giving short MUGI history and answering questions about Visual Studio:

WP_000161 WP_000191

Now a picture of all MUGI’s speakers with Wakhid Nusa excluding Aji: (because Nicko and I have to go after my Visual Studio and Office 2013 sessions done)

WP_000051

One notable questions was “what asynchronous is” when Nicko was delivering Visual Studio 2012 introduction. Although there’s a minor difficulty in Nicko in explaining asynchronous, I was helping giving analogy of a customer ordering and waiting for his food in a restaurant.

Asynchronous means A – Synchronous, it’s not synchronous. Usually we code in synchronous way, in a sequences in our code. This means:

  1. Do something and wait until done
  2. After number one done, do something else and also wait until done.
  3. Do other things after number 1 done first, and then after number 2.

It is well explained, but what happens when you are in a restaurant?

Do you have to wait for your other customer’s order finished eaten and paid? If any restaurants are like these, the experiences will be unpleasant!

So, basically a restaurant is asynchronous:

  1. Waiter taking order from customer
  2. Waiter is giving order to the chef
  3. While waiting for the chef to complete cooking, waiter can take other orders from other customers but there is has to be a continuation point to signal/notify that the cooking is complete, see below
  4. Chef is completing the cooking and notifying the waiter
  5. Waiter is taking the cooked cuisine and giving it to the customer in a step one.

So, the experience is pleasant and satisfactory, because the waiter isn’t idle waiting for the cook to be finished and he/she can take other order from other waiting customers!

We have had asynchronous programming model in basic BCL threading, Windows Forms, WPF and ASP.NET. But sadly, it’s not intuitive and easy to write.

Now the horrible experience of writing async code is simplified using async keyword in C# and VB in Visual Studio 2012.

This is a sample of using async to get web content asynchronously: (from MSDN Library)

async_sample01

The code after await getStringTask is the continuation, but it’s quite easier to write because it feel synchronous!

But F# already has this way before VS 2012! It was introduced in F# 1.8 and F# asynchronous workflow was also inspiring async in C# and VB.

This is F# sample from MSDN:

fsharp_async_sample

In the sample above, it’s combined with parallel programming with Async.Parallel! Watch async in action in my next blog series about F#, guys!

For more information about async in C# and VB in Visual Studio 2012, visit:

http://msdn.microsoft.com/en-us/library/hh191443(v=vs.110).aspx

Lastly, keep sharing your knowledge guys! Go MUGI!

Monday, July 2, 2012

Hello and intro to my lonely F# blog

Hi, blog readers! This is Eriawan Kusumawardhono’s blog of F#, although may contain C#, Visual Basic, and other things such as Visual Studio 2010 and above.

This blog can be seen as mirror of my other blog on MUGI (a community website of Microsoft users and developers in Indonesia), http://mugi.or.id/blogs/eriawan because the server of we are using  are undergoing heavy maintenance.

This blog, because of the nature of F#, will also contain some fundamental concept of functional programming.

The next blog series will provide a glimpse of my future ebook on F#.

Enjoy! Smile

Monday, September 5, 2011

Wow! Tool untuk Visual Studio yang keren bulan September 2011 ini: NuGet 1.5

Setelah lama gak ngeblog dan banyaknya kesibukan akhirnya bisa ngeblog lagi.

Setelah lama utak-atik VS 2010, ternyata ada tool yang hebat berupa extension untuk Visual Studio yang seringkali berupa file dalam bentuk vsix. Tool ini seringkali dibahas dan menjadi topik panas sejak awal tahun 2011 ini, dan saya sudah mulai memakai tapi sempat agak kecewa karena agak banyak bugnya bahkan di versi 1.2. Tool apa? NuGet!

nuget-229x64

Untuk saat ini, NuGet telah mencapai versi 1.5. Intinya NuGet adalah tool untuk memudahkan kita untuk melakukan instalasi library atau bahkan dapat berupa javascript agar project di Visual Studio dapat selalu terupdate. Contoh dalam hal ini adalah pemakaian jQuery sebagai library javascript yang sangat mudah dipakai dan sangat membantu memudahkan kita untuk membuat efek-efek animasi sederhana untuk halaman web.

Instalasinya? Mudah! Anda tinggal melakukan instalasi melalui Extension Manager pada Visual Studio 2010:

image_26F9E178

Catatan: semua fasilitas Visual Studio Extension Manager hanya terdapat pada Visual Studio Professional, Premium, dan Ultimate.

Apabila kita telah menginstall NuGet (diatas versi 1.3), maka di pilihan menu Tools ->Library Package Manager->Manage Nuget Packages.. seperti gambar berikut:

image_4FF84477

Berikut ini tampilan package yang tersedia di tanggal 5 September 2011:

image_4607170F

Setelah saya melakukan instalasi Entity Framework 4.1 dan melakukan update dengan NuGet, tampilannya sebagai berikut:

nuget_package_install_ef_64A8DB58

Sangat mudah dan selalu terupdate! Dan tentunya hasil update ini tidak mengganggu project lain, karena file dll EF akan dicopy secara manual ke folder project anda dan secara otomatis semua Reference DLL akan juga diupdate!

Untuk selanjutnya, silakan masuk ke website resmi NuGet: http://nuget.codeplex.com/

Saya usahakan dalam minggu ini akan banyak tutorial NuGet! Nantikan di blog ini! Jangan lupa komentarnya yah?

Tuesday, February 22, 2011

Mau browsing internet sambil belajar F#? Bisa!

Teman-teman, sekarang bisa belajar F# sambil internetan! Dengan memakai IE 7/IE 8/Firefox 3.0/Firefox 3.5/Firefox 3.6 dan menginstall Silverlight 4, anda bisa belajar memprogram F# dengan tampilan yang mendekati tampilan Visual Studio 2010, beserta mode interactive yang sama seperti F# Interactive (seperti scripting).

Silakan masuk ke http://tryfsharporg.cloudapp.net/Tutorials.aspx untuk mencoba!

Ini buktinya:

image_49365AE7

Contoh sederhana, anda silakan coba ekspresi berikut di “canvas”:

let pangkatdua x = x * x

dan tekan “Ctrl”+”Shift”+”Enter” di baris tersebut, maka akan dievaluasi oleh F# interpreter menjadi:

image_2A8201AD

Karena F# adalah functional programming dan merupakan bahasa pemrograman yang memiliki fasilitas “type inference” secara default, maka type parameter x adalah integer. Inetegr dikali integer akan menghasilkan integer ***.

Di “canvas” anda bisa mencoba function di atas dengan memberi nilai pada parameter x, seperti contoh di bawah ini:

pangkatdua 5

kemudian tekan “Ctrl”+”Shift”+”Enter”, maka akan segera dijalankan dengan tampilan sebagai berikut:

image_62596732

Nah, tunggu apa lagi? Silakan belajar F# sekarang juga, dan dimana saja, kapan saja! :)