Microsoft’s Bing

Microsoft’s new search engine ‘Bing‘ unveiled by Microsoft CEO Steve Ballmer on May 28, 2009. Bing went fully online on June 3, 2009. It is a replacement for Live Search(Windows Live Search, MSN Search).

The homepage is crisp and clear and the image will change daily. The Bing interface is refreshingly clean and results are displayed by helpful categories. For example, I type books and results are grouped by History, Electronic, Best Sellers, Publishing and Writing. “Simple Organized System, thats Bing”

The Indian version currently doesn’t have the full functionality.

The Indian version doesn’t Have Search History And The Image On The Bing Home Page Here Is Not Interactive As In The Us Version To Explore The Full Version Of Bing. You can change the Indian version to the US version by clicking on the ‘India’ link at the top right of the page and selecting the United States from the country list.

Some of the interesting features that you will notice at first glance:

When you hover on a search result, you will see the orange icon – which gives you a quick preview of the site (text preview). Very useful, if you are still not sure of clicking.

Just search for any video on Bing Videos and hover the mouse over any of the video thumbnail to watch a short clip.(WOW!)

Bing is such a decision engine. It provides an easy way to make more informed choices. It organizes popular results by category to help you get the answers you’re looking for without having to guess at the right way to formulate your query.

Now is Bing a real competitor for Google? Check the here to get a comparision of Bing with Google

Read Data From an Excel File in ASP.NET

The following example shows how to display data from an excel spread sheet in a GridView. We will connect to a Microsoft Excel workbook using the OLEDB.NET data provider, extract data and then display the data in a GridView.

In the aspx page;


<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true">
        </asp:GridView>
    </div>
    </form>
</body>

In the aspx.cs page;


using System.Data.OleDb;

    protected void Page_Load(object sender, EventArgs e)
    {
        string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;data source=E:/DummyProject/Excel/Contacts.xlsx;Extended Properties=Excel 12.0;";
        OleDbConnection objConn = new OleDbConnection(strConn);
        //You must use the $ after the object you refer in the spreadsheet
        string strSql = "Select * From [Sheet1$]";
        OleDbCommand objCmd = new OleDbCommand(strSql, objConn);
        try
        {
            objConn.Open();
            GridView1.DataSource = objCmd.ExecuteReader();
            GridView1.DataBind();
        }
        catch (Exception exc)
        {
            Response.Write(exc.ToString());
        }
        finally
        {
            objConn.Dispose();
        }
    }

As you see in the connection string ‘Microsoft.ACE.OLEDB.12.0′ is the new Access database engine OLE DB driver and is also capable of reading Excel 2003. For older versions of excel files, you can use the connection string ‘Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:/DummyProject/Excel/Contacts.xls;Extended Properties=Excel 8.0’


FLV video not streaming

In one of my web application, there was one FLV file that has to be shown when the home page is viewed in a browser. During the development time it was working fine. However when I put the files in the server and tried to access the home page, then the flv file didn’t show up. Instead it showed the space for .flv file with black color.

After some googling I found the reason: ‘With IIS 6.0, Microsoft changed the way streaming media is handled. Previous versions of IIS did not require any modification to stream Flash Video. Microsoft IIS 6.0, the default web server that ships with Windows 2003, requires a MIME type to recognize that FLV files are streamed media.’
To overcome the above difficulties just follow the blow steps;


1. On the Windows 2003 server, open the Internet Information Services Manager.
2. Expand the Local Computer Server.
3. Right-click the local computer server and select Properties.
4. Select the MIME Types tab.
5. Click New and enter the following information:
    o Associated Extension box: .FLV
    o MIME Type box:flv-application/octet-stream
6. Click OK.
7. Restart the World Wide Web Publishing service.

Note: These files work correctly if tested on other operating systems. The issue affects all FLV files played via Windows 2003 server, including files made with the Flash Video Kit for Dreamweaver MX 2004.

Server Application Unavailable

Some times the ASP.net developers come across the error below:

Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable. Please hit the “Refresh” button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.

It might work when you try some asp/html page in the browser.

If you google with the error, you can find a lot of forums discussed this issue.

This can happen for several reasons. An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Open the Event Viewer and see the error message reported (Start -> Programs -> Administrative Tools -> Event Viewer (Application) for ASP.NET). Review this log entry to find out what caused this error.

In some cases you cannot find any error message detailing the cause of this specific request failure in the event log. Once I come across such situation and below given how I managed to resolve this issue.

The reason was there was some mixing of asp.net 1.1 and 2.0 in the same application pool.

Solution:

“In IIS, right click on the domain and choose Properties, the go under the Home Directory tab. If the “Application Pool” reads anything other than the domain you are looking at (like for example “DefaultAppPool”) then you probably have another website using that application pool. You need to change it.

In IIS, expand Application Pools, and create a new one. Call it whatever you want, although I would recommend calling it the name of the domain that you want to use the pool. Then go into the properties of the domain as described above, and change the application pool to the new one you created.”

AccessKey property

Keyboard shortcuts are well known facility in Windows desktop applications. Shortcuts can increase efficiency and usability of your user interface.Keyboard shortcuts are not used that much on Web applications.

One of the most popular shortcuts used on web pages is using an Enter keyboard key to submit a web form.

One more common shortcut on web pages is using a TAB key to move focus between a controls on a web form.

You don’t need to be limited to this two cases only. You can implement shortcuts in your ASP.NET Web application like it is a classic desktop application.

Access Keys [Alt + Key]

Use the AccessKey property to specify the keyboard shortcut for the Web server control. This allows you to navigate quickly to the control by pressing the ALT key and the key for the specified character on the keyboard. For example, setting the access key of a control to the string “D” indicates that the user can navigate to the control by pressing ALT+D.

Only a single character string is allowed for the AccessKey property.

Both ASP.NET 1.1 and ASP.NET 2.0 provide AccessKey property for buttons and text boxes. ASP.NET 2.0 has additional AssociatedControlID property, used in Label control to specify which control will be clicked or get focus.

Here is an example given which shows how to use AccessKey property on Textbox, Label, CheckBox, RadioButton, Button and LinkButton controls.

<%@ Page Language="C#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>AccessKey example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" AssociatedControlID ="TextBox1"><u>N</u>ame</asp:Label>
<asp:TextBox ID="TextBox1" runat="server" AccessKey="N" ></asp:TextBox>
<br /><br />
<asp:Label ID="Label2" runat="server" AccessKey ="A" AssociatedControlID ="TextBox2" ><u>A</u>ge</asp:Label>
&nbsp;&nbsp;
<asp:TextBox ID="TextBox2" runat="server" ></asp:TextBox>
<br /><br />
<asp:CheckBox runat="server" ID="CheckBox1" Text="<u>S</u>ubscribe News Letter" AccessKey="S" />
<br/><br />
<asp:RadioButton runat="server" ID="rd1" Text="<u>Y</u>es" AccessKey="Y" GroupName="Yesno"/>
<asp:RadioButton runat="server" ID="rd2" Text="N<u>o</u>" AccessKey="O" GroupName="Yesno"/>
<br /><br />
<asp:Button ID="Button1" runat="server" Text="Click" AccessKey="C" />&nbsp;&nbsp;
<asp:LinkButton ID="LinkButton2" runat="server" Text="Link Button" AccessKey="L" />
</div>
</form>
</body>
</html>

So, in example above, button TextBox1 will be clicked when ALT + N is pressed.
Similerly, TextBox2 will be clicked when ALT + A is pressed;
CheckBox1 will be selected when ALT + S is pressed;
Radiobutton rd1 will be selected when ALT + Y is pressed;
Radiobutton rd2 will be selected when ALT + O is pressed;
Button1 will be clicked when ALT + C is pressed;
LinkButton2 get focues when ALT + L is pressed;

AccessKey

AccessKey

Note: The accesskey only gives focus to a linkbutton, it doesn’t execute the onclick. This is also the same for radiobutton and checkbox, even though their states change.

The AssociatedControlID property of the Label web control

In ASP.NET 2.0 the Label web control exposes a new property, AssociatedControlID.

In web application, we mostly use label control to specify a heading to an input control. The AssociatedControlID property of the Label will take an input control ID as its value. Hence, the Label is associated with the input control. Association means, when the page is executed and if we click on the Label Text the focus will be returned to the associated input control.

Consider, we have a form to get input from users. Every input control like textbox should have a heading text. For example,

<asp:Label ID="Label1" runat="server" Text="Enter your Name" AssociatedControlID="txtName"></asp:Label>

<asp:TextBox ID="txtName" runat="server"></asp:TextBox>

In the above code, Label1 is associated to the TextBox “txtName”. When executed and the focus will be returned to the TextBox if we click on the label text “Enter your Name”.

When the property is set, the rendering of the Label switches from a simple <span> tag to a <label> tag, whose for attribute assumes the client-side ID of the associated control as the value.

An example to clear things up

<asp:label ID="Label1" runat="server" Text="Label" />
<asp:TextBox ID="TextBox1" runat="server" />

becomes:

<span id="Label1">Label</span>
<input name="TextBox1" id="TextBox1" type="Text" />

While

<asp:label ID="Label1" AssociatedControlID="TextBox1" runat="server" Text="Label" />
<asp:TextBox ID="TextBox1" runat="server" />

becomes:

<label for="TextBox1" id="Label1">Label</label>
<input name="TextBox1" id="TextBox1" type="Text" />


New Windows website

Check out the new Microsoft Windows website. They took all the geek stuff out. Now its more clean.
http://www.microsoft.com/windows/default.aspx?icid=winvan