Software

FileZilla Server and Windows Azure

I was setting up a new virtual machine in Windows Azure today and wanted to host an FTP server. Having spent most of my career isolated inside corporate environments and largely disconnected from server administration this was fairly new ground for me.

I knew going into it that I was going to have to tweak some firewall rules and whatnot but establishing communication was a bit more involved than I initially expected.

The FTP solution I selected was FileZilla Server. It’s a rather robust solution that provides the security I wanted with minimal configuration. Getting the server components installed was effortless as was creating the security groups and users. Once I had everything configured the way I wanted I created the rules to allow traffic to hit ports 21 and 990 on the server through the Windows Firewall with Advanced Security control panel.

For my first test I simply tried to FTP to localhost on the server itself. Both accounts I’d configured worked perfectly. Then, to test the firewall rules I tried to connect from my development workstation but was unable to connect.

After scratching my head for a bit I remembered seeing endpoint configuration in the Azure portal. I added two endpoints, one for port 25 and one for port 990 and was then able to connect but the FTP client kept failing to retrieve a directory list. The log showed that the client was attempting to use passive mode which requires additional ports. I quickly found the passive mode settings in the FileZilla server options. From there I was able to specify a custom range which I could then allow to pass through the firewall. The other thing I needed to change was the IPv4 specific setting to force the server to use the server’s public virtual IP address as listed on the VM’s dashboard in the Azure Portal.

FileZilla Passive Mode Settings

FileZilla Passive Mode Settings

Just as before, simply adding the firewall rules wasn’t enough to allow communication. I had to add the passive mode ports as endpoints as well. I initially found this to be more than a bit tedious but fortunately the Add-AzureEndpoint PowerShell cmdlet eased some of the pain.

Azure FTP Endpoints

Azure FTP Endpoints

Once all the rules and endpoints were in place I was able to successfully connect from my development workstation to the server and get directory listings.

Resources:

Advertisements

Building Strings Fluently

Last night I was reading the second edition of Effective C#.  Item 16 discusses avoiding creation of unnecessary objects with part of the discussion using the typical example of favoring StringBuilder over string concatenation.  The tip itself was nothing new, StringBuilder has been available since the first versions of the .NET framework, but it did remind me of something I “discovered” a few months ago.

Back in late July Esther and I took a week vacation.  We rented a two story loft on a marina in southwest Michigan.  It was incredibly relaxing and apparently more refreshing than I realized at the time.  When I returned to the office the following Monday I was looking at a block of code that was doing a lot of string concatenation and decided to rewrite it to use a StringBuilder instead.  When using a StringBuilder I follow the familiar pattern seen in most books and even in the MSDN documentation:

var sb = new StringBuilder();
sb.Append("Hello, Dave");
sb.AppendLine();
sb.AppendFormat("Today is {0:D}", DateTime.Now);
Console.WriteLine(sb.ToString());

For some reason though as I was writing code this particular Monday I noticed something that I hadn’t noticed before.  I realized that StringBuilder, a class I’ve been using for nearly 10 years, implements a fluent interface!  All of those familiar methods like Append, AppendFormat, Insert, Replace, etc… each return the StringBuilder instance meaning we can chain calls together!

Armed with this new knowledge I started thinking about all the places that code can be simplified just by taking advantage of the fluent interface.  No longer do I need to define a variable for the StringBuilder and pass it to something.  Instead, I can create the instance inline, build it up, then pass it along.

Console.WriteLine(
		(new StringBuilder())
		.Append("Hello, Dave")
		.AppendLine()
				.AppendFormat("Today is {0:D}", DateTime.Now)
		.ToString()
);

Hoping I hadn’t been completely oblivious for so long I hopped over to the .NET 1.1 documentation and what I found was astonishing – this functionality has been there all along.  I asked a few trusted colleagues if they knew about it and incredibly none of them had realized it either!  How did we miss this for so long?

Using Live Writer on Multiple Computers

I’ve really come to like Live Writer for writing blog posts since I started using it a few months ago.  I’ve been especially happy since upgrading to the beta release of Live Writer 2011.  Not only does Live Writer support a much larger set of formatting capabilities than the WordPress editor but it also allows editing posts using the blog’s theme giving a fairly accurate preview when composing new posts.  I have a few minor gripes about how it handles adding categories and the limited selection of HTML styles but so far it’s my favorite blog editor.

The real problem I have is that I have a tendency to jump between three computers.  I have a personal laptop I travel with and use for some development work and light photo processing.  I have a desktop PC I use for development, gaming, heavier photo processing, and some video processing.  Finally, I have a work laptop that I use for well, work.  There are plenty of times that I start a post on one computer and would like to continue it on another.

Ideally Live Writer would make better use of the blog system for saving and retrieving drafts and provide an option for working offline but instead it stores everything locally.  There is a “Post draft to blog” option and Live Writer can pull down the drafts from the blog but saving it as a draft again creates a new post rather than replacing the earlier one.  Using this technique for switching computers really just creates more work.  I don’t want to jump through hoops to write a blog post, I just want to write.

Luckily there’s a workaround.  Live Writer stores its post data in %userprofile%\My Documents\My Weblog Posts.  I decided to use another tool from Live EssentialsLive Sync (or Live Mesh, or whatever it’s called this week) to synchronize this folder across each of my computers.  Once I included the folder in Live Sync and selected the target devices I was able to switch to a different computer and pick up right where I left off.

I used Live Sync because I already had it installed and configured but I’m sure other synchronization packages would work equally well.  Hopefully a future release of Live Writer will eliminate the need for manual synchronization but for now this seems to be a workable solution.

IE9 First Impressions

Like many others I downloaded and installed the Internet Explorer 9 beta when it was released.  I had taken a look at a few of the technical previews so I was pretty excited about the chance to finally see the real browser.  Now that I’ve used it for a few days I thought I’d share my initial thoughts.  I haven’t spent any time developing for IE9 yet so my comments will be solely from a user experience perspective.

My experience started by watching most of the beta release keynote.  I was really excited about many of the changes coming to bing and I wanted to see them for myself.  Wouldn’t you know that the changes really are “coming” so they’re not available yet.  I tried pinning bing to my taskbar and there isn’t even a jump list yet!  I fail to understand why so much of the keynote was spent talking about things that aren’t available yet.  Disappointed in what I found, or rather, didn’t find at bing I went over to the showcase site: Beauty of the Web.

The Experience section at Beauty of the Web has a ton of examples showcasing IE9s features.  I clicked through probably half of them and was underwhelmed.  Most of the examples were showing how various sites were using pinning and jump lists.  The examples I found most interesting were the pure demo sites such as the Psychedelic Browser Demo and the IMDb Video Panorama.

The UI itself is pretty clean and it is definitely fast.  It feels like an evolution of the IE8 interface with some features “borrowed” from other browsers, Chrome in particular although I’m sure many of the features are available in other browsers as well.  The redesigned and repositioned home, favorites/history/feeds, and tools buttons seem much more obvious than before.  I like how the clutter is reduced by keeping the Favorites and Command bars hidden by default.

Address BarMy favorite feature has to be the smart address bar.  The integrated address and search bar was one of the reasons I switched to Chrome.  IE9 takes the concept and builds upon it by adding things like weather reports.  Being able to quickly switch between search providers is nice but I’d really like to be able to get results from multiple providers at the same time rather than switching between them.  Given that weather is integrated into the suggestions I was a bit surprised that movie times and stock quotes weren’t.  Perhaps the feature will be expanded to include those types of searches later but it seems like a miss.

New TabAnother feature that seems to be borrowed from Chrome is the new tab page.  Opening a new tab in Chrome shows a listing of your eight most visited sites along with a thumbnail screenshot of the page.  Chrome’s new tab page also allows reopening recently closed tabs.  Again, IE9 takes this and expands on it.  Instead of eight sites IE9 shows ten.  Rather than using a screenshot with a small caption IE9 uses the site’s favicon and displays the site title a bit more prominently.  Each of the ten sites includes a bar indicating how frequently the site is accessed.  There are also ways to reopen recently closed tabs, restore the previous browsing session, or open a porn-mode an InPrivate instance.  In many ways I prefer the IE9 implementation.  I find that the favicon with the title makes it easier to identify a particular page than screenshots.

For me, IE’s tabbed browsing experience has been an annoyance since it was introduced.  Opera has had a really solid tabbed browsing experience for several releases and Chrome’s has been a treat as well.  Although I’m happy to say that the tabbed browsing experience in IE has improved with IE9 I still don’t particularly like it.

The highlight of the tabbed browsing experience in IE9 is that tabs can now be torn off.  Other browsers have had this feature for a while but none of them have worked with Aero Snap.  Tearing off tabs is also one of the ways to pin a site to the taskbar (more on pinning later).  The Aero Snap integration and pinning still aren’t enough to make me like the experience though.  As far as I’m concerned there are still two things that Microsoft needs to do before I’ll actually like the tabbed browsing experience.

First, allow closing inactive tabs.  Currently only the active tab can be closed.  In order to close a different tab users must switch to the tab then click the close button.  Alternatively they can close a tab through the Live Taskbar Preview but that’s even more cumbersome.  I’ve gotten used to this behavior in Chrome so requiring two clicks for something that should only require one is an unnecessary distraction and a pointless waste of time.

Second, automatically restore the last browsing session.  This one irritates me to no end.  If I have multiple tabs open and close the browser I want it to take me back to where I was when I reopen it.  The browser is already remembering what was open when the last session ended since it can be restored from the new tab page so why can’t it just do that automatically?  Better yet, why not give users the option to control this behavior like Chrome does?

A new feature that I’ve really come to like is the Notification Bar.  The Notification Bar essentially replaces the Information Bar and a number of dialog boxes.  I’ve found the Notification Bar to be a great improvement over previous releases.  I don’t know how many times I didn’t immediately notice the Information Bar or had to stop to satisfy some screaming modal dialog asking if I wanted to save my password.  The Notification Bar doesn’t suffer from those problems.  When IE wants to ask something the bar is noticeably displayed at the bottom of the browser window but is never intrusive nor blocking.

Jump ListFinally, we get to one of the big selling points for IE9 – Pinning.  I have to admit that this feature is pretty cool and I can see it being really useful for some sites.  Sites can define links that will appear as items in jump lists enabling quick access to parts of that site.  For instance, WordPress.com has enabled jump lists for pinned blogs.  Blog owners can quickly jump to their stats, comment moderation, media upload, and new post pages.  Other sites such as twitter, facebook, amazon.com, and LinkedIn are among the many sites that have already enabled jump lists.

Docked and UndockedPinning a site can also changes some browser elements.  Opening a site through its pinned icon can, depending on the site, change the appearance of some UI elements to follow the site design.  The screenshot to the left shows two IE9 instances both pointed to bing’s home page.  The background instance shows the default browser instance while the foreground shows the site opened through the pinned item.  Notice how the back and forward buttons have been themed in the foreground instance.  Also notice the favicon added to the left of the back and forward buttons.  Clicking the icon will always navigate back to the pinned “Home” page.

Overall, my experiences with the IE9 beta have been positive.  It’s disappointing to see that the tabbed browsing experience is still lagging behind other browsers in some important ways but the inclusion of Aero Snap, pinning, and jump list support are pretty important innovations.  Given the state of the Web and how few sites are actually taking advantage of the more interesting features like HTML5 and hardware acceleration I don’t know if there’s any compelling reason to change my default browser from Chrome to IE9 but time will tell as sites begin adopting those technologies.