.info(programming); //

Celebrate #GeekPrideDay! Save 50% on 10 *new* ebooks covering a wide-selection of geeky topics

O'Reilly Media O'Reilly Deal of the Day

View the ebooks now >

Realm of Racket

webmaster@oreillynet.com (O'Reilly Media, Inc.) O'Reilly Media, Inc. Upcoming Titles

In Realm of Racket you'll learn to wield Racket's mighty yet mind-bending power by reading comics and programming games.

#Ebook Deal/Day: Web Performance Daybook Volume 2 - $7.99 (Save 50%)

Use code DEAL

O'Reilly Media O'Reilly Deal of the Day

Get "Web Performance Daybook Volume 2" today using code DEAL and save 50%!

This sale ends at 2:00 AM 2013-05-25 (PDT, GMT-8:00).

The Morning Brew #1363

Chris Alcock The Morning Brew

Update: I clearly don’t know what month it is, the Brew will be back this coming Tuesday, and not in 11 months as previously typed!

Monday is a Public Holiday here in the UK, so in keeping with tradition there will be no Morning Brew on Monday, and I shall return on Tuesday 28th AprilMay. Enjoy the Weekend.

Software

Information

Community

JavaScript is Web Assembly Language and that's OK.

Scott Hanselman Scott Hanselman's Blog

Some years ago I said that JavaScript is the Assembly Language of the Web. In fact, lots of people said it, because it's true. Later, some folks disagreed, saying that this is an inaccurate analogy. Of course, it is inaccurate because it's an analogy. That said, as analogies go, it's pretty good. Sure, assemblers are architecture and processor specific. Maybe "JavaScript is the Web's Bytecode" is better. At the very least, JavaScript is a totally reasonable compile target.

Given that (using Wikipedia as a dictionary here and has a decent definition:

An assembly language is a low-level programming language for a computer, or other programmable device, in which there is a very strong correspondence between the language and the architecture's machine code instructions.

It's initially not clear that JavaScript is a good assembly language as it's a high-level programming language that is itself interpreted, then JIT-ted, then turned into machine instructions. Phrased differently, JavaScript floats pretty high in the stack. Certainly every processor has its own assembler and they are very specific, but the browser's JavaScript VM is what runs the "new machine code." There's only one processor architecture. The Web. (again, analogy!)

JavaScript remains a popular transpilation/compilation target. From Google's GWT to Clojure to TypeScript to CoffeeScript, it all stops at JavaScript because JavaScript is the ubiquitous virtual machine that we already have installed on our machines.

Google Native Client (NaCl) is great and will likely have a role to play, but there's only one language that works everywhere without installation or trouble and that's JavaScript.

asm.js compilation & execution pipelineWe don't all have x86 machines. We don't have have machines that we could feed assembler or C. Certainly not in a portable way. JavaScript is the great portable equalizer.

There's languages that transform to JavaScript like TypeScript and CoffeeScript and HAXE and so many more, but many of these are arguably transformations, not compilations. They also tend to compile to lots of different kinds of JavaScript.

Enter asm.js. Why not take the sprawling language that is JavaScript and pick just the subset that one would want if one were to compile something to it? Why not take the assembly-esque parts of JavaScript and formalize it? Mozilla is doing this with the clear goal to compile things to JavaScript and make it perform well. Their FAQ says they're seeing slowdowns around a factor of two, which is amazing, in case you're wondering. It's also worth noting that I, as a user, don't care if you compile your C to JavaScript. I just want a great experience on the open web, and that's anther reason that targeting JavaScript moves the web forward.

Working in tandem, there's emscripten, a LLVM bitcode to JavaScript compiler. We can take C/C++ and compile it to JavaScript. Don't buy it? They ported Unreal Engine 3 in 4 days with asm.js as the target.

You can argue that JavaScript isn't the x86 or Assembly of the web. You can argue all you want. It's still happening.

As our great philosopher Kosh from Babylon 5 once said: "The avalanche has already started. It is too late for the pebbles to vote."

The avalanche has already started. It is too late for the pebbles to vote.

It's not clear that JavaScript is the end state. In fact, if anything it's clear there is no end state. But along the way we will - actually are - passing though the JavaScript as Assembler part of the trip.


Sponsor: Big thanks to SoftFluent for sponsoring the feed this week! Less Plumbing, More Productivity! Generate rock-solid foundations for your .NET applications from Visual Studio and focus on what matters!



© 2013 Scott Hanselman. All rights reserved.
     

Reviews of Super Weird Mice:The Microsoft Arc Touch and Wedge Mouse

Scott Hanselman Scott Hanselman's Blog

I'm always on the lookout for the perfect mouse. I don't think it exists, yet, frankly, but we're getting close. I've got two notebook mice I'm bouncing between while using my new ultrabook, the Lenovo X1 Carbon Touch. I'm using the Microsoft Arc Touch Mouse and the Microsoft Wedge Mouse.

I'm classifying both of these mice as "weird" because, well, they are. They aren't classic-looking mice and each one has garnered the occasional double-take from passersby. Each has an unusual design for a reason: portability.

The Wedge Mouse

That's a tiny-ass mouse

The Wedge is tiny. Like, really tiny. The idea appears to have been to remove the back half of the mouse completely (the part that usually gets cupped in your palm) and instead make just the fingertips part. There's a AA battery that goes in the round part (the butt) and underneath there's a single button for on/off/Bluetooth sync and a battery door switch. Oddly, the battery door switch looks like an on/off switch also so I ended up flicking that a few times before I learned.

The Wedge is a Bluetooth mouse, and getting a good Bluetooth mouse was my goal. This Ultrabook only has two USB ports and that's one port too few. I'll often find myself with a hard drive plugged in, then want to add one more item (USB key, presenter remote, smart card) and with most mice I'm stuck because the other USB port already has that mouse's transmitter.

The mouse uses the capacitive touch technology that we're seeing in a lot of mice lately. See that vertical line that separates the two mouse "buttons?" Stroke that and it's the "scroll wheel." It feels odd initially but ends up quite comfortable. Speed of scrolling is also easily changed. There's no middle mouse button, but that hasn't been an issue for me.

Shown actual size. Tiny.

My Right-Clicking Issues

Now here's an odd one. Every once in a while I do what, in my mind is a CRYSTAL clear right-click and it registers as a left-click. I've tested it. Click hard with the right and it got picked up as a left. What the heck? I searched around and found a few people in the forums with the same issue so I assumed it was a driver issue. However, I have the latest drivers. What's going on?

Well, it's actually obvious and a little funny if you give it some though. Occasionally when I right click I end up right-clicking the FAR TOP EDGE on the right. Looking at the picture below, I'm pushing with my finger ABOVE the right-side blue square. This is outside the touch area but is registered with the mouse's mechanical click. Since there's no right-touch, there's no right-click.

Stated differently, there's a touch area with clear left and right areas delimited. If I mechanical click the mouse - remember, there's just one click...the whole mouse goes down - then the mouse decides if it's a left or right by seeing where your finger is that moment. If it's on the far top edge then it can't see your right finger, so....left click from the right.

Don't click the top top top edge.

Call it an oddity, call it a design flaw, call it "you're holding it wrong." Regardless, as soon as I figured this out, it stopped happening. I just assumed initially that the touch area wrapped around the front of the mouse. It doesn't. Once my subconscious heard about this from my conscious mind, I can right-click like a champ, but it was quite confusing for a minute there. Be aware.

Bluetooth Disconnecting

I thought that Bluetooth aspect of this mouse would be pure win, but even after using it for a few hours it stopped responding at least a half dozen times. I would have to lift the mouse up and put it down again. The word on the street and in the forums is that this a power management issue and that you should go into Device Manager and check the properties of the mouse and change the setting that allows the operating system to, well, turn it off. Of course, this setting is not checked and not available.  The takeaway here as far as I'm concerned is that while the dream of a Bluetooth mouse is a great and valid one, it's just not ready. Whether is it's the tech or the stack or the mouse itself, I dunno. I tried an Apple Magic Mouse for a day this week and had the same issue, but worse. The Magic Mouse wouldn't go 10 minutes without just stopping - and this was with new batteries. The Wedge has turned off maybe twice a day, so enough to be annoying but not enough to kill the deal. That said, there's lots of anecdotes from folks who LOVE this mouse and haven't had this issue, so I'm assuming it's my Bluetooth driver stack.

All in all, I haven't decided if I'm going to keep this mouse. It's small, which is great. It's Bluetooth which is super great until it's totally not-great. I will give it a 7 out of 10. It's small. So, um. Ya

The Arc Touch Mouse

I love this mouse. It's darn near perfect. The only mouse I love even more is the original Microsoft Arc Mouse which is equally brilliant in different ways.

Nice stock photo of the Arc Touch Mouse

The gimmick of the Arc Touch Mouse is that it folds flat. This isn't a cute gimmick, it actually works and works well. Given that my Lenovo is so small and flat, it's nice to have this mouse slide into my backpack and lay flat against the laptop. They kind of match, too.

The ArcTouch Mouse folks super flat

It arcs with a reliable and satisfying snap. The back is rubber and the top is glossy plastic.

The ArcTouch Mouse arches nicely

The scroll area has a wonderful haptic feedback (that's geek for "it vibrates when you scroll with it") that is adjustable with drivers. This attempts to simulate the "scroll-wheel nubbins" that regular mice have. It's a great little feature and I appreciate it. It gives you a sense of "it's working" without having to look at the mouse.

 

The ArcTouch Mouse matches my Lenovo

The ArcTouch Mouse and the Wedge next to my hand

The Arc Touch Mouse is also a very comfortable size even for my giant lobster hands. It is tiny and portable, but it supports and cups the inside of your palm in a stable and reliable way.

The only thing this mouse needs is optional BlueTooth. Instead the Arc Touch Mouse uses a nano-transceiver which I just keep plugged in all the time. When it's not plugged in, it attaches rather sturdily to the base of the mouse with a magnet. It just snaps into place and stays there. Very cool.

While it's not Bluetooth, it's absolutely reliable. I haven't had any communication issues with the transceiver and it never loses connection with the mouse.

For now, the Microsoft Arc Touch Mouse is my travel mouse of choice and I get give it a 9.5 out of 10.



© 2013 Scott Hanselman. All rights reserved.
     

Beginning Windows 8 Application Development Coding Skills Kit e-book and training software powered by InnerWorkings Set

István Novák Wrox: All New Titles


Presenting the most innovative way to learn Windows 8 development

If you’re a developer who loves to read books and learn new skills by solving coding problems, we’ve brought the best of both worlds together. Presented by Wrox and InnerWorkings, this value-packed e-book and training software kit offers you an effective hands-on learning environment. The bundle consists of a DRM-free version of Wrox’s Beginning Windows 8 Application Development paired



Read More...

#Ebook Deal/Day: Linux System Programming - $19.99 (Save 50%)

Use code DEAL

O'Reilly Media O'Reilly Deal of the Day

Get "Linux System Programming" today using code DEAL and save 50%!

This sale ends at 2:00 AM 2013-05-24 (PDT, GMT-8:00).

The Morning Brew #1362

Chris Alcock The Morning Brew

Software

Information

On the history of the question of whether natural language is “illogical”

(author unknown) Lambda the Ultimate - Programming Languages Weblog

A nice essay from Barbara Partee on the origins of formal semantics of natural languages and Montague Grammar.

Not directly programming language material, the topic is likely to interest many here. I think several interesting previous discussions related to Montague can be found by searching the archives.

#Ebook Deal/Day: Save 50% - Produce Picture-Perfect Images with GIMP 2.8

O'Reilly Media O'Reilly Deal of the Day

View the titles now >

The Morning Brew #1361

Chris Alcock The Morning Brew

Information

How to setup a Load Balanced Web Farm of Virtual Machines (Linux or otherwise) on Windows Azure (command line)

Scott Hanselman Scott Hanselman's Blog

A buddy of mine was thinking to move some of his Linux-based website to Azure. If you're running a Web Site that this node.js, ASP, ASP.NET, or PHP, it's easiest to use Azure Web Sites. I showed how to do setup Azure Web Sites in minutes with Git in this post. They hide the underlying OS from you, are automatically updated, scale easily, and share disks.

However, he likes VMs and the control they give him, plus he can run whatever he wants, move things around and generally control his world.

I'll be using the open source (GitHub) cross platform CLI tools (command line interface) for Azure. If you have node package manager you can "npm install azure-cli --global" then import your subscription. You can also get the command line tools by downloading and installing from www.windowsazure.com.

Setting up a Linux VM

We'll create a the initial VM using the Portal (I'll show you how to do it from the command line in a minute). This virtual machine will be for setting up a template VM image. I'm going to create an Ubuntu 13.04 server, then add Apache and PHP. Then I'll capture a generic image of my now-set-up machine and use it to create copies that I'll add to a farm. This image will show up later in "My Images" in the Azure Portal.

NOTE: There's an amazing community-driven category of prepped and ready Virtual Machine images at the Open Tech VM Depot. It's like the Azure's best kept secret. I'll do a post on it later but it's really deep and broad and worth checking out.

From within the Azure Portal I'll go New | Virtual Machine | and select Ubuntu Server 13.04.

Selecting Ubuntu from the Azure Gallery

The name doesn't matter, but I'll setup a user name and password (or use a SSH key):

Creating a VM

Note I'll create a stand-alone Virtual Machine:

Making a Stand-Alone VM

TIP: If I didn't want to use the Portal at all to make this VM, I could even find a VM image programmatically, then create a VM instance, all from the command line. Using "azure vm list" would get me the list of VMs to choose from. The Ubuntu one I wanted is "Ubuntu-13_04-amd64-server-20130501-en-us-30GB" (with a guid in the name as well) so I'd just "azure vm create MyDNSName ImageName [options]" and then proceed from there.

Once this Linux VM has started up, I'll SSH into it. You can see that Azure has mapped a random high number public port to the VM's internal SSH port 22.

My VM's IP Address

I SSH in. I'm gonna add Apache, PHP, restart apache, then add a test.php that will show PHP is working as well as output the current IP address so I can tell which machine served the request.

sudo apt-get install apache2

sudo apt-get install libapache2-mod-php5 php5

I'll add a test.php

sudo nano /var/www/test.php

and put in

<?php echo gethostbyname(trim(`hostname`)); ?>

<?php phpinfo(); ?>

Then I'll exit SSH. VMs are locked down by default, so to test this I need to add an endpoint. I can do that via the Portal but I'd like to see what I can do from the Azure command line.

Run vm endpoint create to map external 80 to internal 80.

azure vm endpoint create mylinuxtemplate 80 80

At this point I should be able to hit mylinuxtemplate.cloudapp.net:80/test.php and see it work.

My VM's test.php page

Cool. So I've got my Linux VM template the way I want it. Now I want to "capture it" as an image so I can stamp out more of them. This "waagent" on Linux is like "sysprep" on Windows.

From within a SSH session, run waagent -deprovision.

~$ sudo waagent -deprovision

scott@mylinuxtemplate:~$ sudo waagent -deprovision
WARNING! The waagent service will be stopped.
WARNING! All SSH host key pairs will be deleted.
WARNING! Nameserver configuration in /etc/resolvconf/resolv.conf.d/{tail,originial} will be deleted.
WARNING! Cached DHCP leases will be deleted.
WARNING! root password will be disabled. You will not be able to login as root.
Do you want to proceed (y/n)? y

WINDOWS PEOPLE: If you're a Windows person, you can setup your Windows VM just as you like it, then run %windir%\system32\sysprep.exe on it, capture an image of the VM and do everything described in this post as well!

I could shut it down and capture an image from the Portal, but again, it's command line fun today. Note that shutting down can take a little while.

azure vm shutdown mylinuxtemplate

azure vm capture mylinuxtemplate hanselmanlinuxwebfarmimage --delete

The capture command will DELETE the Virtual Machine. Remember that it was just a template. However, how I have a reusable image! I can see the images available to me, both user images and gallery images with "azure vm list."

NOTE: When you delete Virtual Machines, you're just deleting the "configuration" of the VM. You're not deleting the disk that was associated with it, as it's possible you might want to start that VM up again. If you're really trying to remove things, make sure you delete the instance of the VM and then delete the disk, too.

Creating a Linux VM Farm from the command line

Now I have an image sitting in my storage account that I can use to make "n" VMs from. I'll make one VM to start. I can watch it startup with "azure site list" after making it. When it's ready, I can make more! Make sure you use the --ssh switch or you will NOT be able to SSH into the machine!

C:\> azure vm create hanselmanlinuxfarm hanselmanlinuxwebfarmimage scott MyPassword123 --location "West US" --ssh

info: Executing command vm create
+ Looking up image
+ Looking up cloud service
+ Creating cloud service
+ Creating VM
info: vm create command OK
C:\> azure vm list
info: Executing command vm list
+ Fetching VMs
data: DNS Name VM Name Status
data: ------------------------------- ------------------ ----------
data: hanselmanlinuxfarm.cloudapp.net hanselmanlinuxfarm CreatingVM
info: vm list command OK
C:\> azure vm list
info: Executing command vm list
+ Fetching VMs
data: DNS Name VM Name Status
data: ------------------------------- ------------------ ---------
data: hanselmanlinuxfarm.cloudapp.net hanselmanlinuxfarm ReadyRole
info: vm list command OK

WEIRD: Azure has a concept called a "Cloud Service" which is a lousy name, IMHO. For us, let's consider it a "container" for our VMs. It's a logical container that will hold and associate all our VMs (and other cloudy stuff) together. When you have one VM you have one cloud service associated with it, but you can't see it in the Portal but because it doesn't really provide value...yet. When you have TWO VMs in the same container, then you'll see that cloud service "container" appear in the Portal.

I've made a hanselmanlinuxfarm VM now so there's a hanselmanlinuxfarm cloud service 'container.' Now, I'm going to make a few more VMs but I'll connect them to the first VM. There's two ways to do this. First, the --connect option from the command line. Note that you don't have control over the name of your VM this way, if you care. If you have hundreds, you likely don't.

The command will find the existing cloud service (again, 'container') then make a new VM. I'm going to run this command twice so I'll have three VMs total.

SO IMPORTANT: It's the --connect used on this second call that is the key. It makes the second (and then n+1) VM and adds it to the same cloud service "container." It seems the VMs associated with each other. The name of the next VM will be whatever-2, then -3, etc but they will also use the same external name, like hanselmanlinuxfarm.cloudapp.net.

I'll do this twice, each time using a different high SSH port number that will map to 22 internally. If I don't want SSH expose externally, I can delete the public endpoint later.

C:\> azure vm create --connect hanselmanlinuxfarm hanselmanlinuxwebfarmimage scott MyPassword --ssh 12345

info: Executing command vm create
+ Looking up image
+ Looking up cloud service
+ Getting cloud service properties
+ Looking up deployment
+ Creating VM
info: vm create command OK

When creating a Linux VM you MUST add a --ssh flag to the command line or you'll not be able to SSH into the box. Make sure to add a high port number so you'll get a mapping from that port to 22, so maybe 12346 -> 22, etc. If you make these VMs from the Portal, it will pick a random port for you. When you do it from the command line, you need to choose.

At this point, azure vm list says I have three. Two are ready and the last is being created now. You can tell these VMs are running in the same Cloud Service "container" because the DNS name is the same. These VMs are officially a "farm."

C:\> azure vm list

info: Executing command vm list
+ Fetching VMs
data: DNS Name VM Name Status
data: ------------------------------- -------------------- ----------
data: hanselmanlinuxfarm.cloudapp.net hanselmanlinuxfarm ReadyRole
data: hanselmanlinuxfarm.cloudapp.net hanselmanlinuxfarm-2 ReadyRole
data: hanselmanlinuxfarm.cloudapp.net hanselmanlinuxfarm-3 CreatingVM
info: vm list command OK

OK, now here's making a fourth VM from the Portal, just as an FYI.

Creating a Linux VM and adding to the Farm from the Portal

Just so you know, you can add VMs to your farm from the Portal also.

Now I can reuse this VM image

Give your new VM a name, then "connect it to an existing virtual machine." I don't like this phrasing, and I'm curious what you think. Basically it's "add this VM to this collection of VMs." It doesn't matter which one you select from this dropdown, as long as you pick one that's in the Cloud Service "container".

Connecting to an existing VM within a Farm

I won't click OK, but if I did, at this point I've would've a fourth VM, this one via the Portal.

Load Balancing my Linux VM Farm

I have three identical VMs running Apache and PHP and my test.php page.

C:\> azure vm list

info: Executing command vm list
+ Fetching VMs
data: DNS Name VM Name Status
data: ------------------------------- -------------------- ---------
data: hanselmanlinuxfarm.cloudapp.net hanselmanlinuxfarm ReadyRole
data: hanselmanlinuxfarm.cloudapp.net hanselmanlinuxfarm-2 ReadyRole
data: hanselmanlinuxfarm.cloudapp.net hanselmanlinuxfarm-3 ReadyRole

info: vm list command OK

Let me open up port 80 on all three.  Since I want them load balanced I can't do this, as this is how you map single non-load-balanced ports.

azure vm endpoint create hanselmanlinuxfarm   80 80

azure vm endpoint create hanselmanlinuxfarm-2 80 80
azure vm endpoint create hanselmanlinuxfarm-3 80 80

For load balanced ports I need to use "create-multiple." Not only may I want to open multiple ports all at once, but also since I want load-balancing, I also may want a probe set up. For example, since I'm using HTTP, if there's a result other than 200 returned from test.php then I'll want that VM pulled out of the farm. It will also pull the VM out of rotation if it doesn't hear back in 30 seconds.

Here I'm creating those 80 to 80 maps, but also watching test.php for anything other than an HTTP 200.

azure vm endpoint create-multiple hanselmanlinuxfarm   80:80:HttpTrafficIn:http:80:/test.php

azure vm endpoint create-multiple hanselmanlinuxfarm-2 80:80:HttpTrafficIn:http:80:/test.php
azure vm endpoint create-multiple hanselmanlinuxfarm-3 80:80:HttpTrafficIn:http:80:/test.php

In this case "HttpTrafficIn" is what I am calling the Load Balancing Set Name.

NOTE: I'm doing a pull request now to add the ability to see the ProbePath from the endpoint command but for now you can see it with "azure vm show" like this:

C:\>azure vm show hanselmanlinuxfarm

info: Executing command vm show
+ Fetching VM
data: DNSName "hanselmanlinuxfarm.cloudapp.net"
data: VMName "hanselmanlinuxfarm"
data: IPAddress "100.68.xx.xx"
data: InstanceStatus "RoleStateUnknown"
data: InstanceSize "Small"
data: InstanceStateDetails ""
data: OSVersion ""
data: Image "hanselmanlinuxwebfarmimage"
data: DataDisks ""
data: Network Endpoints 0 LoadBalancedEndpointSetName "HttpTrafficIn"
data: Network Endpoints 0 LocalPort "80"
data: Network Endpoints 0 Name "endpname-80-80"
data: Network Endpoints 0 Port "80"
data: Network Endpoints 0 LoadBalancerProbe Path "/test.php"
data: Network Endpoints 0 LoadBalancerProbe Port "80"
data: Network Endpoints 0 LoadBalancerProbe Protocol "http"
data: Network Endpoints 0 Protocol "tcp"
data: Network Endpoints 0 Vip "137.135.xx.xx"
info: vm show command OK

Cool, so now let's see if I have a load-balanced farm.

PERF NOTE: In order to get the best performance from your Azure VMs (or any cloud VM) considering putting things like MySQL/PostgreS databases on a separate disk with different caching semantics. You want the OS disk and the Data Disks to be separate. For example. I have a Windows VM running MySQL. The OS is on a standard 30 gig disk, but the MySQL Database is alone on a 5 gig disk that's attached. It keeps things separate and tidy, plus it performs better

Checking on my new Farm

If I log into the Portal, I can look at each individual VM or I can look at the farm as if it's one 'cloud service.' Get it?

My Linux Farm working as a team

All three VMs are "running"

Making my Farm more reliable

I want to make sure my new VMs are all on different racks in the Azure Data Center. I know they are in "West US" because I put them there, but I'm not sure if they are together on the same rack or near each other or what.  Since a rack is within a "fault domain" meaning that a Rack could, I dunno, spontaneously explode, then I want to tell Azure that all these VMs are part of an "availability set." This is a name I apply to the VMs that says "make these more available by keeping them apart."

From the Portal I'm going to pick the first VM and select Configure, then Create an Availability Set. I'll name it "hanselmanlinux" but it can be anything.

I'm making an availability set

Adding an Availability Set can involve Azure moving my VM somewhere else within the Data Center and it may need to restart it if it does. Sometimes this is fast, other times it takes a minute or 10 as it's a big deal initially, so be aware. Once everyone's in the set, it's less of a big deal.

When it's done, head over to the other VMs and add them one at a time to the same availability set. The result looks like this in the Portal, and now I'm assured that my three VMs are all in different Fault Domains (and racks).

All my VMs are in one Availability Set now

Hitting my Web Farm

Now I can hit hanselmanlinuxfarm.cloudapp.net/test.php and see the IP changing (as well as the CPU% changing in my portal!) or even watch HTOP over SSH and get a live view. Hey, I've got a little Linux farm!

My tiny farm has three machines

Here's my SSH'ed into one of them, looking at htop (it's better than top!)

SSH'ed into a Linux machine on Azure looking at CPU time with HTOP

My Complete Script, Summarized

Here's my complete script. I used azure vm image list | find /I "13_04" to find an Ubuntu image. I could have done this with bash as well.

C:\>azure vm image list | find /i "13_04"

data: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-13_04-amd64-server-20130423-en-us-30GB
data: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-13_04-amd64-server-20130501-en-us-30GB
data: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu_DAILY_BUILD-raring-13_04-amd64-server-20130511-en-us-30GB
data: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu_DAILY_BUILD-raring-13_04-amd64-server-20130515-en-us-30GB
data: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu_DAILY_BUILD-raring-13_04-amd64-server-20130517-en-us-30GB
data: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu_DAILY_BUILD-raring-13_04-amd64-server-20130518-en-us-30GB
data: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu_DAILY_BUILD-raring-13_04-amd64-server-20130521-en-us-30GB

Once I've found an image, I create my first VM from the command line in a location of my choice. Again, it's Linux, don't forget the -ssh.

azure vm create mylinuxtemplate b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-13_04-amd64-server-20130501-en-us-30GB scott MyPassword --location "West US" --ssh

Get it how you like it. SSH in, set it up, run the waagent to prep it. Shut it down and capture it.

azure vm shutdown mylinuxtemplate

azure vm capture mylinuxtemplate mylinuxfarmimage --delete

Finally, here's a basic batch file to make 5 VMs. Note the first command is different from the Nth. Of course, with bash you could make a script like "spinup 5" and automate to your heart's content. The HTTP probe is optional on the endpoint creation.

azure vm create hanselmanlinuxfarm hanselmanlinuxwebfarmimage scott password --location "West US" --ssh

azure vm create --connect hanselmanlinuxfarm hanselmanlinuxwebfarmimage scott password --ssh 12345
azure vm create --connect hanselmanlinuxfarm hanselmanlinuxwebfarmimage scott password --ssh 12346
azure vm create --connect hanselmanlinuxfarm hanselmanlinuxwebfarmimage scott password --ssh 12347
azure vm create --connect hanselmanlinuxfarm hanselmanlinuxwebfarmimage scott password --ssh 12348
azure vm endpoint create-multiple hanselmanlinuxfarm 80:80:HttpTrafficInLhttp:80:/test.php
azure vm endpoint create-multiple hanselmanlinuxfarm-2 80:80:HttpTrafficInLhttp:80:/test.php
azure vm endpoint create-multiple hanselmanlinuxfarm-3 80:80:HttpTrafficInLhttp:80:/test.php
azure vm endpoint create-multiple hanselmanlinuxfarm-4 80:80:HttpTrafficInLhttp:80:/test.php
azure vm endpoint create-multiple hanselmanlinuxfarm-5 80:80:HttpTrafficInLhttp:80:/test.php

After it ran, I went in to the Portal and set up Availability Sets manually. That's only available in PowerShell today, but setting availability sets is coming soon to the cross-platform tools!

Next time, maybe I'll try"azure vm scale" to move these tiny VMs into 8 processor 56 gig monsters.


Sponsor: Big thanks to SoftFluent for sponsoring the feed this week! Less Plumbing, More Productivity! Generate rock-solid foundations for your .NET applications from Visual Studio and focus on what matters!



© 2013 Scott Hanselman. All rights reserved.
     

Visual Intelligence: Microsoft Tools and Techniques for Visualizing Data

Mark Stacey, Joe Salvatore, Adam Jorgensen Wrox: All New Titles


 

Go beyond design concepts and learn to build state-of-the-art visualizations

The visualization experts at Microsoft's Pragmatic Works have created a full-color, step-by-step guide to building specific types of visualizations. The book thoroughly covers the Microsoft toolset for data analysis and visualization, including Excel, and explores best practices for choosing a data visualization design, selecting tools from the Microsoft stack, and building



Read More...

#Ebook Deal/Day: The Art of Multiprocessor Programming, Revised Reprint - $37.48 (Save 50%)

Use code DEAL

O'Reilly Media O'Reilly Deal of the Day

Get "The Art of Multiprocessor Programming, Revised Reprint" today using code DEAL and save 50%!

This sale ends at 2:00 AM 2013-05-22 (PDT, GMT-8:00).

The Morning Brew #1360

Chris Alcock The Morning Brew

Software

Information

Community

#Ebook Deal/Day: UX for Lean Startups - $11.99 (Save 50%)

Use code DEAL

O'Reilly Media O'Reilly Deal of the Day

Get "UX for Lean Startups" today using code DEAL and save 50%!

This sale ends at 2:00 AM 2013-05-21 (PDT, GMT-8:00).

The Morning Brew #1359

Chris Alcock The Morning Brew

Software

Information

Stumbling Into the Cold Expanse of Real Programming

James Hague Programming in the 21st Century

This is going to look like I'm wallowing in nostalgia, but that's not my intent. Or maybe it is. I started writing this without a final destination in mind. It begins with a question:

How did fast action games exist at all on 8-bit systems?

Those were the days of processors living below the 2 MHz threshold, with each instruction run to completion before even considering the next. No floating point math. Barely any integer math, come to think of it: no multiplication or division and sums of more than 255 required two additions.

But that kind of lively statistic slinging doesn't tell the whole story or else there wouldn't have been so many animated games running--usually at sixty frames-per-second--on what appears to be incapable hardware. I can't speak to all the systems that were available, but I can talk about the Atari 800 I learned to program on.

Most games didn't use memory-intensive bitmaps, but a gridded character mode. The graphics processor converted each byte to a character glyph as the display was scanned out. By default these glyphs looked like ASCII characters, but you could change them to whatever you wanted, so the display could be mazes or platforms or a landscape, and with multiple colors per character, too. Modify one of the character definitions and all the references to it would be drawn differently next frame, no CPU work involved.

Each row of characters could be pixel-shifted horizontally or vertically via two memory-mapped hardware registers, so you could smoothly scroll through levels without moving any data.

Sprites, which were admittedly only a single color each, were merged with the tiled background as the video chip scanned out the frame. Nothing was ever drawn to a buffer, so nothing needed to be erased. The compositing happened as the image was sent to the monitor. A sprite could be moved by poking values in position registers.

The on-the-fly compositing also checked for overlap between sprites and background pixels, setting bits to indicate collisions. There was no need for even simple rectangle intersection tests in code, given pixel-perfect collision detection at the video processing level.

What I never realized when working with all of these wonderful capabilities, was that to a large extent I was merely scripting the hardware. The one sound and two video processors were doing the heavy lifting: flashing colors, drawing characters, positioning sprites, and reporting collisions. It was more than visuals and audio; I didn't even think about where random numbers came from. Well, that's not true: I know they came from reading memory location 53770 (it was a pseudo-random number generator that updated every cycle).

When I moved to newer systems I found I wasn't nearly the hotshot game coder I thought I was. I had taken for granted all the work that the dedicated hardware handled, allowing me to experiment with game design ideas.

On a pre-Windows PC of the early 1990s, I had to write my own sprite-drawing routines. Real ones, involving actual drawing and erasing. Clipping at the screen edges? There's something I never thought about. The Atari hardware silently took care of that. But before I could draw anything, I had to figure out what data format to use and how to preprocess source images into that format. I couldn't start a tone playing with two register settings; I had to write arcane sound mixing routines.

I had wandered out of the comfortable realm where I could design games in my head and make them play out on a TV at my parents' house and stumbled into the cold expanse of real programming.

(If you liked this, you might enjoy A Personal History of Compilation Speed.)

#Ebook Deal/Day: Blackhatonomics: Inside Look at the Economics of Cybercrime - $19.98 (Save 50%)

Use code DEAL

O'Reilly Media O'Reilly Deal of the Day

Get "Blackhatonomics" today using code DEAL and save 50%!

This sale ends at 2:00 AM 2013-05-20 (PDT, GMT-8:00).