Videos from ALT.NET Sydney Usergroup, 30 July 2013

Continuing my experiments of recording the few events I attend in Sydney using a simple Galaxy S4 phone, this time I’m posting videos from Sydney ALT.NET usergroup gathering in July.

Of course if you are interested in all the videos I put online, including a few tutorials I have created myself instead of just recording, check out my channel on YouTube.

Now to the videos…

Applications of the Reactive Extensions framework

By Niall Connaughton, @nconnaughton on twitter

Moving to HTTPS

By James Crisp, @jtcrisp on twitter

Final Note

Please let me know if you find these videos useful. I may not be able to do much about the quality in the short term, so, it’s worth knowing if the videos as-is are helping, or I need to pause until I get better tooling than just my phone camera and a simple webcam.

So, check out all the videos on YouTube, leave comments ion them, and let me know the topics that interest you, which may in the future turn into tutorials I create myself, or suggestions to ask usergroup leaders to look for presenters to talk about.

Python, Ruby, or PHP? (My Take On Answering The Question)

A friend I know has been developing desktop applications with .NET for quite long time. He wanted to improve himself even more by going out of his comfort zone learning more stuff he’s not familiar with. So, he spent some time learning client side web technologies and wanted to add some “non” .NET server technologies to the mix. He emailed me asking for recommendations on what to learn,: “Ruby, Python, or PHP ?”.


After sending the answer, as with other previous emails, I thought maybe I’d share it with you here.


Let’s start with Python, since it’s the language I know least about (take that as a disclaimer against everything I claim about it next). Note that Python also has similar options to Ruby (maybe even earlier than Ruby had for some of them) even the MVC application frameworks (like django), but they aren’t booming as much as, say, Ruby..

Python’s real power is that it’s one of the old languages with great standard library doing networking and several pieces of functionality, in a way closer to C++ than it is to .NET or Java. I think also it’s runtime is historically has better performance and wider platform support than, Ruby.

I’d argue though that those benefits are usually less important in the web world, where you worry about web specific features (templates, personalization, AJAX support, etc…), than library features really, and only have a known set options for the platform hosting the web app/.


Here Ruby comes to play, with similarly old-enough-to-be-mature age, more web friendly (ex: white-spaces significance is optional), and generally getting a sense of dynamic features with C#/Java familiar syntax as "option" syntax style (rarely used). The ease of catching calls to non-existent members by one handler (method_missing or something) inspired a lot of nice syntax APIs.


The key attraction around Ruby world is not Rails. It’s actually Ruby gem, the "package manager" inspiration for NuGet and alike.This made sharing Ruby libraries and frameworks really easy, like other scripting languages, they allow you to extend the console features as well and add commands that perform repetitive tasks and code generations and so, which is an area .NET capability is still lacking much in.


Another killer thing about Ruby is the integrated eco-system. People would be using Git, github, Ruby, Ruby Gem, Rails, MongoDb, SASS (for CSS), CoffeeScript (for JavaScript), Heroku (cloud hosting),… and al of them have a specific workflow (or series or workflows) that make development much easier. This is also one main area in addition to console extensions that you’ll be blown away with.


Obviously, most people working with Ruby use Rails, the MVC framework for it, which has its own common workflows using specific options for ORM, mails, and other common tasks. It’s the opposite of .NET where we care about multiple options, they "do" have multiple options, but they care about the awesomeness of the experience with the option they choose rather than the ability to replace this option in the future. Quite another mindset shifting.


I’d suggest you don’t start with Rails. Start with Sinatra instead. Sinatra is like a basic web framework that just handles routes and templated views and few other things. People loved it for its simplicity and a lot of people build proof of concept and prototype startup ideas using it, especially when things don’t involve DB, or a lot of DB work. It’ll also introduce you to the way you depend on scripting a lot to perform various tasks in development.


Don’t get too deep into Sinatra, once you get to the point you think you understand its pieces well, move on to the next level, Rails (next in terms of number of features built-in, not in terms of better). Build something with it, usually people choose to create To-Do list or a Blog as those are the hello-world apps in web world, right? Try to discover which gems most Rails developers use most and really teach yourself to follow the workflow most tutorials and users will suggest. Expect a lot of "you are doing it wrong" times :)


A note on PHP: The reason PHP is still strong and won’t die any time soon is the amount of awesome web apps built with it over the years. WordPress, Drupal are the obvious names, but hey, the examples are uncountable. PHP has been trying to adopt to recent trends and copy features from other languages (like everybody else do), but I think it’s just causing it to lose it’s original power, which is being a simple lightweight language.

Modern PHP developers have created their own common workflows as well and those moved beyond going MySQL-PHP to REST and MVC framework and more, but the workflow for something like Ruby feels more "natural" rather than "addition" and hence makes more sense the more you apply it in your coding practices.


Another option you haven’t mentioned is NodeJS, or server-side JavaScript.A lot of people who do Ruby for long time mix bits of other languages in their workflows, like Scala and Clojure and others. So, being used to this, many Ruby guys actually turned to become NodeJS guys.

They copied the usual workflows pieces to their usage of Node, like git, and NPM (the Node equivalent of Gem or NuGet), and even equivalents of Sinatra (which is almost standard, called ExpressJS) and Rails (various options). Some mix it with CoffeeScript and DB tools (although JavaScript doesn’t have special features to create ORMs like Ruby method_missing and mixins), and it’s quite booming recently.


It’s also a good time to consider it since Windows support just recently became good enough to use (earlier it didn’t have NPM support for example, which is like Ruby without gem, pure key piece of the workflow missing and making the platform pretty much useless).


I think Node will bring you some of Ruby workflows via ExpressJS and brothers, and make you more fluent in JS (which is becoming THE universal language of the web), and blow your mind in the special way it handles creating the web app (although ExpressJS makes it more like just handling routes in ASP.NET MVC or Sinatra).


So, I’d go for long term spending on Ruby then Rails (going a b it of Sinatra), or do some plain Node stuff for a while and then start learning ExpressJS. Whatever you do, keep an eye on what’s usually called "workflow" in these areas, which is like "best practices" in our own terms. Whenever you do something and it feels harder than it should, it’s likely because you are not following another piece that makes it easier for other people who do both.

Small Tip: Using #Console2 With #PowerShell

Lately I have been doing more stuff on the Console as getting to Ruby and messing a bit with Git and stuff.

Generally speaking the default Windows Command Prompt is really fine for my needs, but I sure would love to see more possibilities. PowerShell was a great scripting / tooling addition but not much of “Editor” / “Environment” improvement. PowerShell ISE (integrated Scripting Environment) is really so nice and powerful, but it doesn’t feel exactly like my usual Console. I tried Console2 and was really impressed with how similar and different it is in the same time.

Surely, it didn’t mean I have to lose PowerShell features in there!

Get Console2

Just grab it from

By the time of writing v 2.0 was the latest. I just went to that folder and got the latest Zip in there. Yeah. No install, just a Zip file, so, you may need to make a shortcut for it on your own and / or place it in somewhere that’s already in your Windows ENVIRONMENT variables.

Find the Path To PowerShell

The way I did it was go to Start menu, type in PowerShell in the search box, and right click the PowerShell icon, and choose Properties.


Then as you saw me do in many other posts, just copy the “Target” value:


Keep that value somewhere. We’ll need it.

Configure Console2

Now open Console2, Edit menu, “Settings…”


Then in the Settings “Console” section, set the value for “Shell” to the value you copied in previous steps.


Press OK, then the very left icon in toolbar to get new tab.


We get our PowerShell prompt as expected!


Pretty easy, ha?



I realize the default font doesn’t look too good. In Settings, you can go to “Appearance” section, Font –> Name, press the “…” button next to that (not the “Size” text box in there. It will not work). and change the font name and size in there.

Unicode / Arabic Support in Ruby / Rails

Personal Intro (For frequent visitors of this blog only)

Yes, I’m checking out Rails. Mainly to see what ASP.NET MVC is missing. Very initial impressions, A Lot!

Anyway, this post is intended to be found by new visitors who already know a little Ruby, so, no introductions for this time. Maybe a different post.


Just to set expectations, there are only 2 lines needed for getting it to work. This post is just to encourage myself to keep writing…



So, let’s assume a simple website that ha a single controller “Say” with only one Action “Hello”.

<span style="color: #0000ff">class</span> SayController < ApplicationController
  <span style="color: #0000ff">def</span> hello
    @name = "<span style="color: #8b0000">محمد</span>"
  <span style="color: #0000ff">end</span>
<span style="color: #0000ff">end</span>

The first time you try to add an Arabic word to any Ruby string, you’ll get the error:v

invalid multibyte char (US-ASCII)

syntax error, unexpected $end, expecting keyword_end

@name = "محمد"

To fix this, you need to tell Ruby that this file is written in Unicode.

This is done by adding the underlined text as the “first” line in the file:

<strong><span style="border-bottom: #008000 1px solid; color: #008000"><u># encoding: utf-8</u></span></strong>

<span style="color: #0000ff">class</span> SayController < ApplicationController
  <span style="color: #0000ff">def</span> hello
    @name = "<span style="color: #8b0000">محمد</span>"
  <span style="color: #0000ff">end</span>
<span style="color: #0000ff">end</span>

Note that this works for all strings either you use single quotes or double quotes to construct the strings.


Interestingly, you don’t need to do this in views!

Here is how my /app/views/say/hellohtml.erb file looks like:

<span style="color: #0000ff"><</span><span style="color: #800000">h1</span><span style="color: #0000ff">></span>Hello From Rails<span style="color: #0000ff"></</span><span style="color: #800000">h1</span><span style="color: #0000ff">></span>
<span style="color: #0000ff"><</span><span style="color: #800000">p</span> <span style="color: #ff0000">style</span>=<span style="color: #0000ff">"direction: rtl"</span><span style="color: #0000ff">></span>
    أهلا بك مرة أخرى يا <span style="background-color: #ffff00; color: black"><%</span>= @name <span style="background-color: #ffff00; color: black">%></span> .
<span style="color: #0000ff"></</span><span style="color: #800000">p</span><span style="color: #0000ff">></span>

You realize of course the editor is not used with RTL support (which i different than the RTL of the rendered HTML, I’m here talking about the mark-up code itself). That’s fine for our example though.


Ideally, this should be enough, however, sometimes the Windows OS Console (if developing on Windows like me) gets it wrong and still causes the Arabic text when firing the server to get Arabc text omitted from response.

The solution to this is also another one line:

x:RailsTest> chcp 65001
x:RailsTest> rails server