Scott Hanselman

Simulating an iPhone or iPad browser for ASP.NET Mobile Web Development with WebMatrix 2 or Visual Studio 2012

June 11, '12 Comments [27] Posted in Apple | ASP.NET | Tools | WebMatrix
Sponsored By

I mentioned the Electric Plum Mobile Simulator as a nice way to check your site on an iPhone while using a Windows machine in my post called "Create a great mobile experience for your website today. Please."

Microsoft WebMatrix 2 RC is out this week and has a nice feature included - support for the Electric Plum Mobile Simulator for iPhone and iPad built right in. WebMatrix is Microsoft's lightweight editor for ASP.NET, PHP and node.js, as well the best way to install open source applications. It's a bit of a playground for the team. Features can be tried out in WebMatrix, and if they pop, we can move them into Visual Studio. I've been singing about Electric Plum for months, so I'm happy to see it in WebMatrix.

Here's how to use the iPhone simulator there, and how to add an iPhone Simulator to Visual Studio 2012 RC's list of browsers manually.

First, install WebMatrix 2 RC. You'll want this even if you're going to add Electric Plum to Visual Studio. From the Run menu, select Add new...

Adding iPhones to the WebMatrix run menu

From here, you'll go to the Browser Extension area where you can add not only iPhone and iPad but also the Windows Phone 7 emulator.

New Mobile emulators in WebMatrix 2 include iPhone

Now the Run button has more browsers as a choice. Here I've left the iPhone as the default choice.

My Run button now has an iPhone picture on it

And when I run it, I get the nice Electric Plum iPhone simulation with my current site loaded automatically. (Did you notice that WebMatrix used NuGet to install this feature? All these extensions are buried in C:\Users\YOU\AppData\Local\Microsoft\WebMatrix\Extensions\20RC currently)

Electric Plum Mobile Simulator

To add this browser to Visual Studio 2012 RC, go to the new browser button (integrated with the Debug button) while in a web project and select Browse With... and add in C:\Users\YOU\AppData\Local\Microsoft\WebMatrix\Extensions\20RC\iPhoneSimulator\ElectricMobileSim\ElectricMobileSim.exe. For arguments put in 1 for the iPhone.

Adding Electric Plum's iPhone simulator in my Visual Studio

Now, make another entry for IPad and use arguments "2" for iPad. Your VIsual Studio 2012 RC menu should now look like this.

Look, iPhone's in my Visual Studio Menu

Now, this is just using the basic version of Electric Plum that you can download inside WebMatrix. You can get a MUCH more functional version for $29.99. It will give you a developer console, GPS support, accelerometer and some additional HTML5 support like local storage, etc. If you're seriously doing iPhone websites on a Windows machine, it's a bargain and you get both iPhone and iPad plus a load of features.

(NOTE: I am NOT affliated with Electric Plum nor do I sell their products. I just think they are cool folks.)

Have fun! Do you want to see stuff like this in VS? Tell me in the comments and I'll make sure the right people see your voice!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

ConEmu - The Windows Terminal/Console/Prompt we've been waiting for?

June 11, '12 Comments [86] Posted in Open Source | Tools
Sponsored By

I have long sung the praises of Console2, an alternative Windows Command Prompt. In fact, I declared in 2004 that Windows was (and is) missing the boat when it comes to Text Mode. A kick ass terminal is exactly what Windows needs. I'm not talking about PowerShell, which many agree is crazy powerful, but rather the Terminal itself. We want tabs, we want control, we want better full screen, we want themes, we want more.

While I love Console2, I think I'm ready to switch as I've just been turned on a NEW contender in the Windows Console Wars. It's ConEmu and it's insane (in a good way.) It's also actively developed.

I haven't even begun to scratch the surface as ConEmu is one of those applications that is so configurable that you can become lost in the flexibility.

Here's some of ConEmu's fantastic improvements to the Windows terminal experience.

Jump Lists

Of course! So obvious it should have been done before. Now I can have all my favorite commands and configurations in a one click location. Best yet, these are actual commands, not just shells, so I can pin batch files, common commands (deploy, etc) or whatever I like.

ConEmu adds Jump Lists

Status Bar Details

There's a hundred little details that make ConEmu fun to explore. This details also show ConEmu was created by a developer. ;)

ConEmu Console App

Running as Administrator

Check out the status bar there. You've got the current process id, as well as the status of your CAPS, NUM and SCRL locks. You can quickly change your transparency and smoothly resize your terminal.

Running as Administrator

Check out the tabs. See how one of my Tabs is running as Administrator? It's the little details, my friends.

You can even "attach" or suck in existing console that are already running into ConEmu.

Configuration

Literally everything is configurable. Each time I find myself wishing for a specific feature, I find it somewhere in the settings. For example, I wanted to change the behavior of the console (colors, fonts, etc) when a specific application was running. Turns out that feature exists and you can set distinct preferences for specific executables.

ConEmu Settings

You can even get applications like putty.exe to startup inside a tab with the -new_console switch or run obscure DOS applications inside the ConEmu using DosBox.

Progress Bars

The feature that really blew me away was Progress Bar integration. If you're familiar with Windows 7 you are likely familiar with the way that progress bars are overlaid over a Windows 7 Taskbar button. ConEmu looks at the current application running and some heuristics and overlays progress. Madness. Do a chkdsk and watch the progress bar. Love this little detail.

ConEmu Progress Bar

FarManager

Not enough awesome? OK, add in the FarManager text-based File Manager (ala Norton Commander) and watch ConEmu light up even more. It also includes FarManager plugins for drag and drop within the text mode app.

FarManager DragDrop

I've gone and customized my Windows 7 task list to include Azure PowerShell, Git Bash in Cygwin, Far and Visual Studio's command prompt.

menus

Go and download ConEmu and try it for yourself. There's a few obscure things, and you'll want to spend some time customizing it, updating the jump list manually, checking all the settings as well as changing some of the hotkeys, but in the end you'll have the best Console application Windows has to offer.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Visual Basic 6, Ruby and Getting Off My Lawn

June 9, '12 Comments [45] Posted in Musings
Sponsored By

Why hate on Visual Basic? Because it's successful.David Platt has a great article called The Silent Majority: Why Visual Basic 6 Still Thrives. Even though I studied C++ in school, my first corporate job was in Visual Basic 2, then quickly VB3. By the time VB6 came out it's fair to say I could make that thing sing. It's funny how the older and more successful a language is, the more likely the language literati are to bash it. Bigger targets are, well, bigger.

Visual Basic 6 first shipped in 1998, so its apps will have at least 24 years of supported lifetime. Contrast that with the Microsoft .NET Framework 1.0 (2002), which is incompatible with Windows 7 (2009). - David Platt

You could get SO much work done SO quickly in Visual Basic 6 and that itself made the experience of coding in it fun. Once you added in some of the advanced techniques with tools like Dan Appleman's SpyWorks and other comparatively low-level API tools, it was arguably near as powerful and productive as its more advanced brother, MFC and C++.

Another key to the success of Visual Basic 6 was the much shorter learning curve demanded by its limited feature set. Learning to drive a bus takes much less time than learning to fly a fighter jet. Becoming a good Visual Basic 6 programmer took much less time than becoming a good C++ programmer, the primary alternative at the time. - David Platt

A Hacker News discussion started up around this article and one HN'er said what I've been saying for years (emphasis mine):

For those who have never used it, VB6 syntax is actually very similar to Ruby. It uses English language words instead of braces, does not require parentheses, and uses dynamic typing.

VB6 is also quite fast, all things considered, and runs on lots of fairly old hardware.

Don't get me wrong, I'd never choose to use it, but for those who use it day to day it offers overall simplicity and flexibility that few mainstream languages can match. - grandalf

and the obvious followup...

The irony is, [today's] Ruby "rockstar ninjas" are doing exactly the same work that used to be done with VB and Access. - gaius

This is true...20 years later and it's all still text boxes over data. Even the most advanced client side JavaScript single page apps are often shadows of their terminal and text mode grandparents.

Ruby does feel in some ways like the VB of two decades ago. Quick, is this Ruby or VB6?

class MyClass  
def describe
print self.class
end
end

What about Fibonacci?

Public Function Fib(ByVal n As Integer) As Integer
If (n < 2) Then
Fib = n
Else
Fib = Fib(n - 1) + Fib(n - 2)
End If
End Function

Of course, Ruby can do it with a ternary operator.

def fib(n)
n < 2 ? n : fib(n-1) + fib(n-2)
end

And VB6 has only IIF() for that so we get this

Public Function Fib(ByVal n As Integer) As Integer
Fib = IIf (n < 2, n, Fib(n-1) + Fib(n-2))
End Function

Sure VB6 had/has its problems, but this was a great environment a LONG time ago and even though a lot of unskilled people created a lot of crap, a lot of skilled people created a lot of useful apps that are still running today. And I understand why.

The things that Visual Basic 6 did still need doing. - David Platt

Disclaimer - I currently work for Microsoft on the Web Team but this post has nothing to do with that. I have worked here about 5 years but I worked elsewhere for much, much longer. I dabble in Ruby and other languages on the side so don't get my grudging respect for Visual Basic 6's special brand of cheesy pragmatism twisted.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Windows Azure - No Kidding

June 7, '12 Comments [51] Posted in Azure | Open Source
Sponsored By
Last year when ScottGu moved over to the Azure group and brought the ASP.NET and IIS teams with him, I'll be frank, I wasn't a fan. I didn't really appreciate Azure or its first iteration. The management portal was obtuse and confusing to use, the service was primarily a PAAS (Platform as a Service) offering and focused on (I thought) confusing terms like Cloud Services and slow deployments. The underlying infrastructure was strong but the developer experience didn't feel "right" to me. I really wasn't feeling it.

So I continued to work on ASP.NET and Visual Studio 2012 and the things that were interesting to me. Then, some months ago Scott and some folks showed us the concepts for the new experience and the new management stuff. It clicked. I saw that Scott and his team "gets" it. I started working with it, giving feedback and filing bugs. We had weekly full-day long team app-building sessions. One particular day I sent 52 different pieces of feedback to the Portal team.

I've talked before about how sometimes development on a platform can be "death by a thousand tiny cuts." It doesn't hurt in general but the little things poke at you. That's not the case with Windows Azure and this release. I'm not embarrassed to say I work for the Azure Team now, as it is pretty darned sweet.

Check out Scott's post but I'll mention a few things that are new just to make the point for you that Azure is something you'll want to check out now.

New Administration Portal and Tools

The management portal has been completely redone with a focus on usability and speed. It works on all browsers but the best part is that it's actually using a REST-based management API so anything you can do on the portal you can do from the API.

There are command line tools to talk to the REST API so you can automate anything you like from both PowerShell on Windows or Bash on Mac and Linux. If you go to the Downloads page on the Azure site you can get .NET, node.js, PHP, Java or Python tools for Windows, Mac and Linux.

Just to make the point, I'll use my Mac and download the Mac SDK on a fresh system. You can do anything from the command line be it in PowerShell or Bash. If I'm on Linux and I have npm, I can just

sudo npm install azure -g

And there's lots of stuff to explore.

The Azure Command Line on a Mac

Freaked out yet? You should be. ;) The Azure SDK is also open source under Apache 2 and available on GitHub.

Azure SDK on a Mac

After the install is done I'm sent to a "what's next" page that shows me how to get node, PHP or Python running (Given that I'm on a Mac). I'll install node.js and git, then I'll make a node.js application on Azure on my Mac.

Now, my point isn't about node nor is it about Macs. It's about choice and it's about the ability to build what you want the way you want it with the tools that make you happy.

I'll make a Web Site...

Creating a node application for Azure

Then I'll setup a git repository along with a name and password for deployment.

My git repository is ready

I'll make a folder, put an app.js in there, initialize the git repo, add "Azure" as a remote repo, and then push. The Azure management site actually notices the push and automatically refreshes without me having to do anything.

I just deployed my node app with git to Windows Azure

Boom, website in the cloud, easy as it should be.

image

Check out the YouTube video I did (embedded above also) on how to do the same thing with .NET and Visual Studio. You can use Web Deploy as I do in the video, Git, TFS or FTP. For example, I can use TFS and do Continuous Deployment if I like.

Virtual Machines

Azure has durable Virtual Machines (VMs) in the cloud now as well. You can make your own image and upload it or you can use a gallery of images that includes not only Windows but also Ubuntu, CentOS and SUSE images.

Linux on Azure. It's freaking me out.

Web Sites

You can make a web site in Azure yourself in a minute. You can make up to 10 small websites for free to play and experiment and then later reserve instances and scale up.

NOTE: To start using Preview Features like Virtual Network and Web Sites, request access on the 'Preview Features' page under the 'account' tab, after you log into your Windows Azure account. Don't have an account?  Sign-up for a free trial here.

Maybe go try one out and create a new Web Site from the Gallery:

You can make a website quickly from the gallery

Feel free to publish in a number of ways as I mentioned, using Web Deploy, TFS, Git or FTP. You can manage everything in the portal or you can automate stuff from the command line.

I like that I have real choice. Use whatever tools I like, whatever OS I like to publish whatever apps I like talking to the backend that I like. I'm personally really happy with the way things are going and I'm looking forward to building all sorts of things with all sorts of tools on Azure.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

ASP.NET for Mobile, One ASP.NET and Realtime ASP.NET with Signalr - Video of Scott Hanselman's talks in Russia

June 5, '12 Comments [24] Posted in ASP.NET | ASP.NET MVC | Javascript | SignalR | Speaking
Sponsored By

Hey that says Scott Hanselman in Russian!I was outside Moscow last week speaking at Microsoft DevCon 12 in Russia. They did a great job with the event and not only filmed everything but did picture in picture as well as real-time translation into Russian. It was also live streamed at the team and later edited for download. Very cool. Big thanks to the team for putting the videos up so fast!

The English versions of my three talks (plus one open Q&A sesssion) are now all up for your viewing pleasure. If it seems I'm speaking ever so slightly slower than usual, that was at the request of the translators, and is a good practice when speaking English to non-native speakers.

You can also download and view the Russian versions if you like as well.

ASP.NET for Mobile Phones and Tablets

The ASP.NET for Mobile Phones and Tablets video

Download links:

SignalR and the Realtime Web

The SignalR and the Realtime Web video

Many problems, many solutions: One ASP.NET

The Many problems, many solutions: One ASP.NET keynote video

Open question and answer session – Ask Scott Hanselman

The Open question and answer session – Ask Scott Hanselman video

Hope you enjoy them!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.