Monthly Archives: September 2007

IIS 7.0 shows muscles

logo IIS 7.0 shows musclesRecently from Microsoft released RC0 build of Windows Server 2008 and IIS 7.0. Scott Guthrie posted about new features of II7, view his post here.

Some of the new features include:

IIS 7.0 Extensibility

One of the major changes we made to IIS 7.0 was to make the system radically more extensible than previous versions of the web-server. This extensibility applies both to the core HTTP processing engine, as well as to the configuration system, health monitoring system, and admin tool architecture. You can now write managed .NET classes to cleanly extend all of these sub-systems.

This is great from a customer perspective (since you can now replace and extend anything in the system). It also enables us to easily ship web-server extensions and additions in a very agile way on the web. Starting this week you are going to begin to see a number of really cool, fully-supported, free features start to be delivered this way.

IIS 7.0 FTP Publishing Service

We are delivering a new modern FTP service implementation that runs on IIS 7.0. This FTP service offers a much improved administration and configuration experience (it uses the same web.config model as IIS7 and ASP.NET, and integrates into the IIS7 admin tool). It now supports FTP over SSL, as well as UTF8 and IPv6.

The FTP server enables you to host both FTP and web content from the same web-site on IIS7 (just add a FTP binding to your existing web-site to enable it). It now provides support for virtual host names, which means you can host multiple FTP sites on the same IP address. It also has built-in user-isolation support, which makes it perfect for shared hosting scenarios.

The FTP server’s authentication system is now pluggable – which means you can add your own username/password store to manage logins. Best of all, you can use the existing ASP.NET Membership Provider model to plug-in your own credential system for logins and user management.

IIS 7.0 Media Pack Bit-Rate Throttling Module

One of the challenges when hosting large videos and audio files on the Internet is that bandwidth costs can be expensive. What is worse is that you often end up having to pay for users to download videos that aren’t fully watched. Specifically, web-servers are by default designed to download content files as fast as possible. So if a user visits your site and starts watching a 50MB video on it, the web-server will by default try and transmit the 50MB file as quickly as possible to them. If the user closes the browser half-way through watching the video, you will end up having to pay for the remaining 25MB of content they had finished downloading – but which they never actually watched.

The IIS 7.0 Media Pack Bit-Rate throttler provides a much more cost-effective way to host video and audio on standard web-servers. When a browser (using a plug-in like Silverlight, Flash, Windows Media Player, iTunes, etc) requests a media file, IIS7 will automatically detect the encoding bit-rate of the file and determine how many bytes per second the player needs to receive to play it continuously.

IIS7 will then “burst” enough of the content (by default 20 seconds of the video/audio file) to ensure that the client player can start playing the video, and won’t ever run into a buffering delay. IIS7 then automatically slows down the file transmission to equal the encoded bit-rate (so if the video is encoded at 400kbs, IIS7 will burst 20 seconds of this, and then slow the remaining transmission to 400kbs of content). If the user closes the browser on the video while it is playing, IIS7 will automatically detect the connection was dropped and avoid sending any more of the content (saving you the remaining bandwidth costs). This module works today with Silverlight, Flash and Windows Media Player – no code changes are required in the players to enable it.

IIS 7.0 Remote Manager Administration Tool

IIS 7.0 ships with a significantly improved administration tool experience. The admin tool is entirely written in managed code (using Windows Forms), and supports remotely administering a web-server over HTTP based web-services (allowing you to use the admin tool to manage servers remotely in a hosted environment through proxy servers). The administration tool supports configuring both standard IIS settings, as well as ASP.NET ones (for example: you can use the tool to remotely manage ASP.NET membership/roles).

FastCGI Support for IIS 5.1 and IIS 6.0

IIS 7.0 ships with built-in support for FastCGI – which is a high performance alternative to using CGI for web-server extensibility. Many popular web frameworks (in particular PHP) use this to integrate with web-servers. In addition to having FastCGI support built-in to IIS 7.0, this week we also shipped a FastCGI ISAPI extension that works on existing IIS 5.1 and IIS 6.0 web servers.

Silverlight в ASP.NET уеб сайт

Въведение

Silverlight е нова технология от Майкрософт предназначена за разработването на RIA. Тя се вгражда във всеки браузър като плъг-ин и е платформено независима. В тази статия ще покажа как се вграждат Silverlight проект в ASP.NET сайт.

Какво е необходимо

Като за начало изтеглете и инсталирайте новата версия на VS 2008 бета 2 от тук. Повече за новостите във Visual Studio 2008 бета 2. За да разработвате Silverlight приложения, също така ви е необходимо и Silverlight Tools Alpha. След като ги инсталирате, опцията за Silverlight проект ще стане активна в VS.
За да виждаме резултата в браузър ни е необходимо Silverlight runtime/plugin 1.1 Alpha

Идеята

Silverlight е базиран на Xaml, което е XML базиран език за UI елементи. С помоща на Xaml е възможно разграничаването на визуалните елементи от програмната част. Това се реализира чрез ‘code-behind’ концепция позната ни от ASP.NET. На всеки Xaml файл съществува C# файл, който съдържа програмната логика за управлението на графичните елементи.
Когато създаваме Silverlight проект използвайки темплейт от VS 2008, някои файлове се генерират автоматично с образователна цел. Xaml файлът е интегриран в примерена HTML страница. В тази статия ще ви покажа как да извадите Xaml от HTML страницата и да го интегрирате в ASP.NET страница.

Проектите

1. Silverlight проекта
Ако сте инсталирали всичко правилно трябва да видите следният екран когато изберете от менюто File -> New Project:

1 Silverlight в ASP.NET уеб сайт

Проекта ще бъде създаден след като натиснете OK. Следните страници са създадени по подразбиране:
- Page.xaml: това е страницата в която описвате UI елементите
- Page.xaml.cs: тук пишете програмната логика. Обикновен C# код
- Silverlight.js: това е javascript файл с който създавате Silverlight контрола в HTML/ASPX страницата за да показвате Xaml съдържанието.
- TestPage.html: HTML страницата която съдържа Silverlight контрола

2. ASP.NET сайтът
Трябва да добавим и асп проектът към общия solution. Add -> New Web Site.

3. Добавяме Silverlight към уеб сайта
Натискаме с десния бутон на прокта на уеб сайта и от падащото меню избираме Add Silverlight Link.

2 Silverlight в ASP.NET уеб сайт

Това беше първата стъпка. Следващата е да разгледаме HTML страницата за да разберем кой код е отговорен за генерирането на Silverlight контрола в testpage.html:

<head>
    <title>Silverlight Project Test Page </title>
 
    <script type="text/javascript" src="Silverlight.js"></script>
    <script type="text/javascript" src="TestPage.html.js"></script>
 
</head>
 
<body>
    <div id="SilverlightControlHost">
        <script type="text/javascript">
            createSilverlight();
        </script>
    </div>
</body>
</html>

Както се вижда, контрола е създаден с javascript функция, която се съдържа в Silverlight.js. Това което трябва да направим е да добавим този файл към асп сайта. После създаваме нов javascript файл, който ще съдържа в себе си кода от testpage.html.js

// JScript source code
 
//contains calls to silverlight.js, example below loads Page.xaml
function createSilverlight( xamlPage )
{
    Silverlight.createObjectEx({
        source: xamlPage,
        parentElement: document.getElementById("SilverlightControlHost"),
        id: "SilverlightControl",
        properties: {
            width: "100%",
            height: "100%",
            version: "1.1",
            enableHtmlAccess: "true"
        },
        events: {}
    });
 
    // Give the keyboard focus to the Silverlight control by default
    document.body.onload = function() {
      var silverlightControl = document.getElementById('SilverlightControl');
      if (silverlightControl)
      silverlightControl.focus();
    }
 
}

С малка промяна(добавен параметър) кодът изглежда по следния начин:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Integrating Silverlight in aspx</title>
 
    <script type="text/javascript" src="Silverlight.js"></script>
    <script type="text/javascript" src="XamlPageCreation.js"></script>
 
</head>
<body>
    <form id="frmMain" runat="server">
    <div id="SilverlightControlHost" >
        <script type="text/javascript">
            createSilverlight( 'Page.xaml' );
        </script>
    </div>
    </form>
</body>
</html>

Какво ще показваме?

Засега имаме работещ ASP.NET/Silverlight пример който не показва нищо. Нека направим TextBlock със съобщение потребителя да избира файлове. При кликване на TextBlock-а се отваря FileBrowse диалог и след селекция на няколко файла, техните имена се показват в TextBlock контрола.

<Canvas x:Name="parentCanvas"
        xmlns="http://schemas.microsoft.com/client/2007" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        Loaded="Page_Loaded" 
        x:Class="SilverlightSamplePrj.Page;assembly=ClientBin/SilverlightSamplePrj.dll"
        Width="400"
        Height="400"
        Background="#EEEEEE"
        >
 
  <TextBlock x:Name="txtFileName"
             Canvas.Top="5" Canvas.Left="5" 
             Foreground="Black"
             Text="Click for OpenFileDialog"
             MouseLeftButtonDown="OnClick"/>
 
</Canvas>

Ето и кода в C# файла:

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
 
namespace SilverlightSamplePrj
{
    public partial class Page : Canvas
    {
        public void Page_Loaded(object o, EventArgs e)
        {
            // Required to initialize variables
            InitializeComponent();
        }
 
        public void OnClick(object o, MouseEventArgs e)
        {
            txtFileName.Text = "";
            string NL = Environment.NewLine;
            OpenFileDialog ofDlg = new OpenFileDialog();
            ofDlg.EnableMultipleSelection = true;
            if (ofDlg.ShowDialog() == DialogResult.OK)
            {
                foreach (FileDialogFileInfo fdFileInfo in ofDlg.SelectedFiles)
                {
                    txtFileName.Text += fdFileInfo.Name + NL;
                }
            }
        }
    }
}

Заключение

Това е достатъчно за начало, очакваме следващите версии на Silverlight където се надяваме да има предефинирани контроли плюс куп други възможности който да утвърдят Silverlight като Технологията за RIA.

jQuery UI: Interactions and Widgets

Picture%204 jQuery UI: Interactions and WidgetsFollowing a very successful release of jQuery v1.2, the jQuery team has just announced the release of their new UI & effects library, jQuery UI.

jQuery UI signals the start of a whole new branch of the jQuery project which will focus on developing high-quality, reusable, components that you’ll be able to drop in your applications. Frequently, these components are coming directly to you from traditional jQuery plugins, but with strict coding, documentation, themeing, and demo standards. We hope you’ll enjoy this new level of quality as much as we do.

Mouse interactions:

resizeables jQuery UI: Interactions and Widgets

Interactive Widgets:

tablesorter jQuery UI: Interactions and Widgets

Effects:

shadow jQuery UI: Interactions and Widgets

Lambda Expressions in MSDN magazine

As I mentioned before one of the new cool features of .Net 3.5 are the lambda expressions. Recently MSDN magazine released its September issue which features an article for the lambda expressions. Its quite extensive as it covers you need to know plus small syntax examples. Here is what you can find there:
- What are Lambda Expressions?
- Lambda Expressions as Callbacks
- Why Add Lambda Expressions?
- Type Inference
- Code Generation under the Hood
- Lambda Expressions and Variable Lifting
- Make the Most of Lambda Expressions

Here is how its starts:

Lambda expressions, new in Visual Basic® 2008, are a handy addition to any programmer’s toolbox. They are callable entities that are defined within a function, and they’re first-class citizens; you can return a lambda expression from a function and you can pass lambda expressions to other functions. Lambda expressions were added to Visual Basic 2008, formerly code-named “Orcas,” in order to support Language Integrated Queries (LINQ), which adds data programmability to Visual Basic (more on that later). As you use lambda expressions, you will begin to see the power and flexibility they promote. I invite you to sample the basic concepts of lambda expressions, explore their benefits, and witness how to use them to write more expressive programs.

Here you can read the rest

Thirteen Simple Rules for Speeding Up Your Web Site

ma devnet 1 Thirteen Simple Rules for Speeding Up Your Web Site
I came across this article on the Yahoo Developer Network. Its from the book “High Performance Web Sites” by Steve Souders. Here is a brief list of what Steve is suggesting and link to the original:

  1. Make Fewer HTTP Requests
  2. Use a Content Delivery Network
  3. Add an Expires Header
  4. Gzip Components
  5. Put Stylesheets at the Top
  6. Put Scripts at the Bottom
  7. Avoid CSS Expressions
  8. Make JavaScript and CSS External
  9. Reduce DNS Lookups
  10. Minify JavaScript
  11. Avoid Redirects
  12. Remove Duplicate Scripts
  13. Configure ETags

jQuery 1.2: Massive NEW Release

jquery jQuery 1.2: Massive NEW ReleaseYesturday was anounced that the latest jQuery version is online. Its marked 1.2 and includes tons of new features. Also features were removed so make sure you read how to upgrade guide.

New Features

  • Selectors
    • :has(selector)
    • :header
    • :animated
    • XPath Selector Plugin
  • Attributes
    • .val() Overhaul
  • Traversing
    • .map()
    • .prevAll() / .nextAll()
    • .slice()
    • .hasClass()
    • .andSelf()
    • .contents()
  • Manipulation
    • .wrapInner() / .wrapAll()
    • .replaceWith() / .replaceAll()
    • Event Cloning
  • CSS
    • .offset()
    • .height() / .width() for document and window
  • Ajax
    • Partial .load()
    • Cross-Domain getScript
    • JSONP
    • .serialize() Overhaul
    • Disable Caching
  • Effects
    • .stop()
    • %/em Animations
    • Color Animations
    • Relative Animations
    • Queue Control
    • :animated
    • step: Function
  • Events
    • Namespaced Events
    • .triggerHandler()
  • Internals
    • Documentation Move
    • Expando Management


Asynchronous File Upload – YUI’s Approach

The guys at thecodecentral.com had developed pretty nice implementation of Asynchronous File Upload. It worked quite smooth as I tested it, here is what they say:

The theory that makes asynchronous file upload work is not complicate, but the code for it to work can be a little bit lengthy if it was developed from the scratch. Since there no reason to reinvent the wheel and YUI’s Connection Manager can take care of most of the dirty jobs for us, in this article, I’ll show you how to use it to do a simple asynchronous file upload. Because XMLHttpRequest object does not support file upload, the Connection Manager uses inline frame approach. Basically what the Connection Manager does is it creates an invisible IFRAME for file upload and parses the server response once the upload is completed. In the end, what you get is an illusion of Ajax-like file upload interaction. However, since this is an IFRAME, some Ajax events such as success or failure are not available in IFRAME method as they are available in regular Ajax request in YUI.

Try their demo example here
Their original post is here

Also check this solution. Its made the old-school-way with separate iframe file but also has implemented progres bar icon wink Asynchronous File Upload   YUI’s Approach

Silverlight 1.0 Released and Silverlight for Linux Announced

Today Microsoft announced the release of Silverlight 1.0, the fully supported version of its cross-browser, cross-platform plug-in for delivering the next generation of media and rich experiences on the Web. Over here you can get started with it.
Also always is good to hear from the core developers so here is what Scott Guthrie says about that:

Silverlight 1.0 and Expression Encoder 1.0 Released

Today we shipped the Silverlight 1.0 release for Mac and Windows. Silverlight 1.0 is focused on enabling rich media scenarios in a browser. Some of its features include:

  • Built-in codec support for playing VC-1 and WMV video, and MP3 and WMA audio within a browser. The VC-1 codec is a big step forward for incorporating media within a web experience – since it supports very efficiently playing high-quality, high definition video in the browser. It is a standards-based media format that is implemented in all HD-DVD and Blueray DVD players, and is supported by hundreds of millions of mobile devices, XBOX 360s, PlayStation 3s, and Windows Media Centers (enabling you to encode content once and run it on all of these devices + Silverlight unmodified). It enables you to use a huge library of existing video content and provides access to the broad ecosystem of existing Windows Media tools, components, vendors and hardware.
  • Silverlight also optionally supports built-in media streaming. This enables you to use a streaming server like Windows Media Server on the backend to efficiently stream video/audio (note: Windows Media Server is a free product that runs on Windows Server). Streaming brings some significant benefits in that: 1) it can improve the end-user’s experience when they seek around in a large video stream, and 2) it can dramatically lower your bandwidth costs.
  • Silverlight enables you to create rich UI and animations, and blend vector graphics with HTML to create compelling content experiences. It supports a Javascript programming model to develop these. One benefit of this is that it makes it really easy to integrate these experiences within AJAX web-pages (since you can write Javascript code to update both the HTML and XAML elements together).
  • Silverlight makes it easy to build rich video player interactive experiences. You can blend together its media capabilities with the vector graphic support to create any type of media playing experience you want. Silverlight includes the ability to “go full screen” to create a completely immersive experience, as well as to overlay menus/content/controls/text directly on top of running video content (allowing you to enable DVD like experiences). Silverlight also provides the ability to resize running video on the fly without requiring the video stream to be stopped or restarted.

Silverlight for Linux Support

Over the last few months we’ve been working to enable Silverlight support on Linux, and today we are announcing a formal partnership with Novell to provide a great Silverlight implementation for Linux. Microsoft will be delivering Silverlight Media Codecs for Linux, and Novell will be building a 100% compatible Silverlight runtime implementation called “Moonlight”.

Moonlight will run on all Linux distributions, and support FireFox, Konqueror, and Opera browsers. Moonlight will support both the JavaScript programming model available in Silverlight 1.0, as well as the full .NET programming model we will enable in Silverlight 1.1.

Link to Soctt’s article

Adobe AIR: 10 reasons to love it, 10 reasons to hate it

Today I came across this post from Tim Anderson at his blog in which he describes the pros and cons of this new technology. Here it is:

In essence, AIR is the Flash player supplemented by additional features to enable applications that are not browser-hosted, but installed as desktop applications. AIR is great for some scenarios, weak for others. Here’s 10 reasons to love it:

1. Fast execution. ActionScript 3.0 has a JIT (just-in-time) compiler, putting it on a par with Java or .NET for raw performance.

2. Cross-platform. AIR apps will run on Windows XP and Vista, Mac OS X (PowerPC and Intel), Linux (though not in the beta).

3. Easy conversion of existing Flex or HTML applications. It’s the same basic runtime. In the case of HTML, AIR apps rely on WebKit, the core component in Apple’s Safari web browser.

4. Easy installation. Provided the runtime has installed successfully, installing AIR applications is likely to be be trouble-free, since all the files go into the application directory.

5. SQLite. AIR applications have use of a fast local database.

6. Synchronization services provided you use LiveCycle. Synchronization is the difficult part of enabling offline support in occasionally connected applications.

7. Rich design and multimedia. This is Flash, so ideal for highly customized UIs, animation, sound and video. Adobe is proving the point by creating a media player built with AIR. Existing Flash developers can easily use their skills to build AIR applications.

8. Great for web vendors who want a desktop presence. For example, one of the demo applications is for buying on eBay. If eBay persuades you to install it, then it is no longer dependent on you firing up a web browser and navigating to its site. It is also a good way to disintermediate Google.

9. Declarative programming via FLEX. Declarative programming is the best way to code a GUI and consume components.

10. ActionScript 3.0 combines the flexibility of JavaScript with grown-up object orientation. Option for dynamic or strict typing according to developer preference.

So is AIR your next development platform? Maybe, but there are some downsides:

1. Limited extensibility. AIR apps have file access, clipboard access, support multiple windows, support drag and drop, and can trigger notifications (”toast” in Windows). If you app needs to interact with the desktop in other ways, the chances are that AIR is not suitable. For example, there’s no access to COM automation, and no way to execute external applications. The reason is to maintain cross-platform compatibility. That’s a worthy goal, but it would be good to have a way out of the sandbox. Unlike Java or .NET, you cannot extend AIR with custom native code libraries. Nor can you call operating system APIs.

2. Database access limited to SQLite or web services.

3. Enterprises need to roll out applications over the network in a controlled manner. AIR has no specific support for enterprise deployment. On Windows, AIR does not use the Windows Installer service. Either Adobe or 3rd parties will need to create deployment wrappers to overcome this.

4. Proprietary technology. AIR applications depend on Adobe’s runtime.

5. No threading support. Architect Kevin Lynch says this is a strong candidate for a future release.

6. No model for commercial components. It is not clear to me how a component vendor could sell an AIR component while protecting it from unlicensed deployment. This may limit the availability of 3rd party components, with a corresponding impact on productivity.

7. Schizophrenic development model. AIR supports either Flex development, or HTML applications which run in WebKit. The ugly side of this flexibility is that there are two SDKs, even two JavaScript virtual machines with different capabilities and characteristics. While it is nice to have a way to render HTML, I am not convinced that the web application model is worth it, given the complications it causes. After all, web applications run perfectly well in the browser.

8. Security concerns. AIR is close to the worst of both worlds, being tightly sandboxed from a developer perspective, but not particularly safe from the user’s perspective. Adobe says it will allow unsigned applications, which I think is a mistake.* AIR has the same access to the file system as the user, which in the case of users running on Windows XP with full admin rights is very extensive. Example bad scenarios would include downloading malware and placing it your startup folder, or searching your file system for bank details and uploading them to some internet location. That said, Adobe says there will be more security features, so conclusions are premature.

9. Synchronization service depends on LiveCycle, the server-side piece which runs on J2E application servers. This is one of the ways Adobe makes money out of AIR, with the other obvious one being design and development tools. A consequence of point 4 above.

10. Lack of UI standards may lead to annoying inconsistencies between AIR applications. We are used to this on the Web; now it is coming to the desktop as well.

Check it out here