Use Windows Desktop Search API Inside of Managed Code

April 17th, 2007 No comments
Starting from Windows Desktop Search (WDS) 3.0, a new helper API ISearchQueryHelper is added to help simplify the construction of index OLE DB connection string and search queries. The search service is implemented and the API is exposed as COM objects. Fortunately, there is a way for managed code to invoke the WDS too.
Download the Windows Search SDK. After unzip the package, the search interop assembly (Microsoft.Search.Interop.dll) is in the "Managed" folder. Add it to the reference inside of your solution and put “using Microsoft.Search.Interop; ” at the top of your C# code. Now it’s ready to write C# code and make use of WDS API. Some of the unmanaged and managed counterparts of classes are the following:
Unmanaged
Managed
ISearchManager
CSearchManager
ISearchCatalogManager
CSearchCatalogManager
ISearchQueryHelper
CSearchQueryHelper
 
The following sample code constructs a search query using ISearchQueryHelper to display the sender, recipients, and summary of the first 100 emails that contain a particular keyword (“share” in this example).
int maxSumLength = 100;
 
// Setup the catalog and search query helper
CSearchManager srchMngr = new CSearchManager();
CSearchCatalogManager srchCatMngr = srchMngr.GetCatalog("SystemIndex");
CSearchQueryHelper srchQueryHelper = srchCatMngr.GetQueryHelper();
 
// Assemble the query
srchQueryHelper.QuerySelectColumns = "System.Message.FromAddress, System.Message.ToAddress, System.Search.AutoSummary";
srchQueryHelper.QueryWhereRestrictions = "AND CONTAINS(System.Kind, ‘\"email\"’)";
string sqlQuery = srchQueryHelper.GenerateSQLFromUserQuery("share");
 
// Setup the OLE DB connection
OleDbConnection conn = new OleDbConnection(srchQueryHelper.ConnectionString);
conn.Open();
 
// Execute the query
OleDbCommand cmd = new OleDbCommand(sqlQuery, conn);
OleDbDataReader srchResult = cmd.ExecuteReader();
 
// Process the search result and send to output
for (int i = 0; (i < 100) && srchResult.Read(); ++i)
{
                string fromAddr = "";
                string toAddr = "";
                string sumAddr = "";
 
                if (null != srchResult.GetValue(0) && !(srchResult.GetValue(0) is System.DBNull))
                {
                    string[] addrs = (string[])srchResult.GetValue(0);
                    fromAddr = "From: " + System.String.Join(",", addrs);
                }
                if (null != srchResult.GetValue(1) && !(srchResult.GetValue(1) is System.DBNull))
                {
                    string[] addrs = (string[])srchResult.GetValue(1);
                    toAddr = "To: " + System.String.Join(",", addrs);
                }
                if (null != srchResult.GetValue(2) && !(srchResult.GetValue(2) is System.DBNull))
                {
                    sumAddr = (string)srchResult.GetString(2);
                }
 
                textBox1.AppendText("(" + i + ") ");
                textBox1.AppendText(fromAddr + " " + toAddr + " ");
                textBox1.AppendText("Content: " + (sumAddr.Length <= maxSumLength ? sumAddr : sumAddr.Substring(0, maxSumLength)));
                textBox1.AppendText(Environment.NewLine);
}
 
srchResult.Close();
conn.Close();
           

Live Maps launches new version with Firefox support for 3D

April 3rd, 2007 No comments

clipped from liveside.net

A new major revision of Live Maps was released today, with a number of new features and enhancements. At the top of the list is Firefox (v 1.5 or later) support for 3D mapping. In addition, memory management and cache performance has been improved for the IE version. 3D support is now also included for the Space Navigator, a 3D controller made by 3dConnexion, a Logitech company.

  powered by clipmarks blog it

This release really has a few very desired new features. Not being compatible with Firefox is a popular complaint about Microsoft’s web services products. This is a good answer. Hopefully, the browser compatibility issues could be addressed at the very beginning of the future new product release, so that the public image of being IE-biased can be wiped off and gain more traction over the net.

This new release also enables inserting maps and driving directions into the emails and meeting appointments created in outlook. It is even considerate to block the driving time for the meeting too.

A feature that I have been longing for is the organization of scratch pad. However, still doesn’t seem easy to move the push pins over to a different collection.

InfoNow switches to Microsoft’s Virtual Earth

March 29th, 2007 No comments

This is an important step of Microsoft’s Virtual Earth improving its branding awareness and could also potentially lead to more value added features to live local search. Virtual Earth comes later than MapQuest, Yahoo maps, and Google Maps, but it does has some nice features like 3-D view, 3-D building model, birds eye view, and my favorite feature Scratch Pad where you can store your favorite locations of restaurants, stores, and so on under different categories. This way you don’t have to type in addresses you may check on the map from time to time and you can also conveniently share interesting locations with your friends through email or blog posts. It also showes real time traffic data and road incidents, which could be viewed on your cell phone or GPS to optimize your driving. The push pin is a cute tool too to enable you to mark any location where there is no valid address. There are lots of aspects that Virtual Earth maps needs to improve too though. For example, once I check the driving direction. The route Virtual Earth gave me looks optimal and shorter than the the one I got from Google maps, however in reality the shorter route is mostly through very narrow streets with lots of stop signs. Obviously, the "convenience" of the the streets that are picked for the routing is not weighted enough in Virtual Earth. By the way, if you are interested you can try out the Virtual Earth plugin for MovableType. It’s fun to play with the 3D map on your blog.

read more | digg story

Categories: Web Tags: , , , ,

Zimbra – Offline Web Office and Collaboration Suite

March 28th, 2007 No comments

Zimbra Goes Offline With Zimbra Desktop

The history is once again recurring. Off-line application, then online application, and then "off-line application" again. But rather than circling, this is an evolution in a rising spiral style. When Google online web applications take on Microsoft Office and there is heated discussion about their comparison, this third approach is emerging. Although Google enjoys the buzz of its branding and pricing, web apps still has many limitations like rich UI, performance, security, difficult admin maintenance due to frequent incremental software change, and so on. Off-line ajax solution answered some very important challenges of web apps. For example, the not yet pervasive and stable Internet connection, page latency, and UI responsiveness. This helps narrowing the gap between the web apps and traditional desktop apps.

From server client model’s point of view. The same recurring phenomenon is going on. Single machines, main frame, distributed systems, peer to peer systems, web applications running on central servers, and now off-line web applications. The big difference is the placement of software components and the global computing environments and infrastructure – majorly Internet.

From hierarchical architecture’s point of view, the off-line web application is a more sophisticated caching model which involves not only static data like web pages and cookies but also software components and application states that run independently on the client machine without any help from the mother ship – servers. This has a load of benefits. For example, performance will improve a lot. "Off-line" is not only used when the network connection is off. Software components and state is cached locally and reduced a large portion of the server-client interaction round trips, especially those bulky post backs. Users data are better maintained locally and is immune to page load failure due to temporary connection problems.

Off-line mode is a significant innovation, but most of the rest of the system is more or less copy from Microsoft Office and/or Google Apps. But it’s always like that, new startups who come up with a product, 10% of which are new ideas, are regarded innovative, but the big guys who come up with a similar product are still regarded as copy cats :) The expectations for them are quite different. The world is flattening and so does the computer software industry. These emerging new products are pushing the software moving forward faster.

Categories: Web Tags: , , , , ,

Microsoft’s Vista-Live Strategy Already Impacting Google

March 22nd, 2007 No comments

Windows Vista is finally out and along with that Microsoft seems to have kick-started its Vista-Live joint initiative. This initiative aims to push Microsoft’s new web properties in tandem with their dominant Windows operating system – and so become a leader in the web industry as well. Basically this means that Microsoft makes its Windows Live web properties the default in Windows Vista PCs, where possible – for example Live Search is the default search engine in IE7 on new Vista machines.

 

Measuring Vista’s impact on Microsoft web properties

 

Live.com:

 
 

MSN.com:

 
 

Measuring Vista’s impact on Google web properties

 
 

As a final note, Alexa competitor Compete’s results are in parallel with ours. According to Compete, these giants all have an increasing trend in page views, but Google’s slope is apparently lower than those of MSN and Live.

  powered by clipmarks blog it

The users of Vista or IE7 not only can install the google tool bar with a single click when going to the google homepage, but also can easily add google as the default search provider without even visiting the google homepage or installing the google tool bar. As shown on the picture in this article, click the little drop down right next to the search button and you can "Find More Providers…", in which google is there. Simply click it and google is added and you can also set it to be default.

In terms of search relevancy, I still think google is better, especially when I look for coding related reference materials. Google is faster in the time it takes to index a newly created web page and more frequent and sensitive in adjusting the rankings. Live search however is better in the overall search experience. For example, the color theme looks more comfortable. The "related searches" on the right side of the result page is very helpful. The image search is very nice with infinite scrolling bar and scratch pad. In the academic search, users can adjust the level of detail in snippets. The 3D map is also impressive. (try adding 3D maps to your Movable Type blog using my plug-in) At this moment, for average users, a little bit less performance in relevancy might not be that obvious but the overall search experience and the richness of the features might be more attractive.

It will be a very tough job to compete with google in search engine market. They quietly accumulated 5+ years of experience before they became the hot company and search is their major business. Brand recognition is also on google’s side. Keep up improving, Live Search! Competition makes the industry advance more rapidly. If you are interested, you can check my Internet Dashboard page where I’ve aggregated some search engine comparison real time diagrams and I’ll keep adding more related charts and diagrams there.

AddThis’s bookmarking products user engagement data, clipmarks missing

March 21st, 2007 No comments

clipped from www.techcrunch.com

This is a really smart idea that produces very interesting data. Unfortunately, clipmarks, a favorite bookmarking tool of mine, is not measured, because it requires a client browser plug-in to be installed and thus can’t be included by the AddThis widget. A surprise is that google bookmarks is as popular as del.icio.us, but its functionality and usability is far behind del.icio.us, digg, and clipmarks.

From the user experience point of view, the AddThis button could be more dynamic. The icons on the button could be clickable, so that there is no need to pop-up another window to choose the bookmarking site. This makes the bookmarking experience more convenient. For example, the small bookmark icons on the button could be displayed based on the user’s profile, current bookmarking choice, and aggregated popularity. If the user logins to AddThis, the user’s preferred bookmarking sites’ icons will be on the button as shortcuts. Otherwise, the last bookmarking sites that were chosen on this browser session will be on the button. The "…" icon will pop-up a window that contains all other icons that are not directly accessible on the button.

  powered by clipmarks
Categories: Web Tags: , , ,

Movable Type plugin of Virtual Earth maps

March 18th, 2007 No comments

There are some great map plug-ins from Nick Punter and Stefan Dembowski.  I implemented this new one based on Virtual Earth.  Some new features in this plug-in are:

Give it a try at the map test page.
Screen Shot:

Download:

VirtualEarthMaps-0.6.zip

Installations and Instructions:

# Virtual Earth Maps
# (Movable Type Plub-In of Virtual Earth http://maps.live.com/)
#
# Author: Stanley Yao (http://stanblog.jojoyao.com)
# Created: March 10, 2007

Files in this plugin package
============================
-+
 +–plugins
 |   +–VirtualEarthMaps
 |       +–VirtualEarthMaps.pl
 +–mt-static
     +–plugins
         +–VirtualEarthMaps
             +–js
                 +–virtual_earth.js

Installation
============
* Copy the VirtualEarthMaps.pl file into <MTROOT>/plugins/VirtualEarthMaps/
  Create sub-directories as necessary.
  <MTROOT> is where your Movable Type software is installed.
* Copy the virtual_earth.js file into <MT_STATIC_ROOT>/plugins/VirtualEarthMaps/
  Create sub-directories as necessary.
  Here the <MT_STATIC_ROOT> (usually named "mt-static") is not necessarily
  inside your <MTROOT> directory.

Tags to be used to insert maps in your blog
===========================================
<$MTVirtualEarthMaps address="<ADDRESS>"
                     latitude="<LAT>"
                     longitude="<LONG>"
                     info="<INFORMATION>"
                     zoom="<ZOOM>"
                     style="<STYLE>"                     mode="<MODE>"
                     width="<WIDTH>"
                     height="<HEIGHT>"$>

"address" OR ("latitude", "longitude") specifies the location you want to map.
"info" is the extra description (e.g., restaurant name)
"zoom" is how detail the map is.  It can be from 1 through 19, the bigger the more detail.  Default is 15.
"style" can be "r" – "road view", "a" – aerial view, "h" – hybrid view, and "o" bird’s eye view.  Default is "r".
"mode" can be "2D" or "3D".  "3D" requires IE.  Default is "2D".
"width" and "height" specifies how big the map is.  Default is 300px by 300px.

Examples:
<$MTVirtualEarthMaps address="525 Bellevue Sq, Bellevue, WA"$>
<$MTVirtualEarthMaps address="525 Bellevue Sq, Bellevue, WA" info="P F Chang" zoom="16" style="r" width="500" height="400"$>
<$MTVirtualEarthMaps latitude="47.604439" longitude="-122.330081" style="r" zoom="15" width="400" height="400"$>
<$MTVirtualEarthMaps latitude="47.620858" longitude="-122.348891" info="Space Needle" style="h" mode="3D" zoom="15" width="500" height="400"$>

Showing maps in your blog entries
=================================
You need "Process Tags" plugin http://kalsey.com/2002/08/process_tags_plugin/.
See more details in Stefan Dembowski’s explaination http://www.sixapart.com/pronet/plugins/plugin/mtyahoomaps.html.

Thank:

The following resources have been very helpful:


Bug Report:

You can report bugs by either comment on this entry or send me email at email.GIF .

Categories: Web Tags: , , ,

Test my new Virtual Earth Maps plugin

March 18th, 2007 2 comments

This is a road-view 2D map:
<$MTVirtualEarthMaps address="525 Bellevue Sq, Bellevue, WA" info="P F Chang" zoom="16" style="r" width="500" height="400"$>

This is a hybrid 3D map of Space Needle viewing at 35 degree angle:
<$MTVirtualEarthMaps latitude="47.620858" longitude="-122.348891" info="Space Needle" style="h" mode="3D" zoom="15" width="500" height="400"$>

Categories: Web Tags: , ,

Possible Google Phone?

March 14th, 2007 1 comment

More Pictures Of Possible Google Phone?

Wireless platform would be the next battle field of searching. The day of "technology" is past. In those days computers and software were invented to help people do more things faster. Those things is mostly about information processing. Given a bunch of input and the computers will follow the instructions embedded in the software and produce the expected results. When network was invented to connect computers, it was about transmitting information faster on a much wider scope.

Today, with the already advanced computing and world wide web as the infrastructure, almost all computer technologies are about information and people. Finding the right intelligence and talents. Sitting in front of a desktop or looking for a Wi-Fi hot spot for laptop connection is not efficient enough. A more mobile and slim device is more desirable, so that information is right at the tip of people fingers. Integration of wireless devices and Internet services would be really attractive. I’m imaging the future information searching is pervasive. For example, when you are talking with your friend on the phone and trying to set up a time to go lunch together in a new restaurant. The wireless phone will extract keywords and address from your conversation and you could ask the phone to create this appointment by either pressing a button or saying some voice command. After confirming this appointment, map and driving direction is created too. And you could use it as a GPS to guide you to the venue.  With search-enabled wireless phone, you can also ask the phone to find the closest drug store or coffee shop just by talking.  The search-enabled phone could also be your assistant when you are talking with your friends.  When you do not agree with some ideas in your conversation, ask the phone to do a search on the fly and join your conversation by telling you what it found.

Like partnering with computer manufacturers to pre-install search tool bars on the new computers. Wireless is another competition field. Moto Q with Microsoft Windows Mobile is out there. But I think there is still a lot that can be improved to integrate with Internet services. I look forward to seeing what google phone will bring us.

Categories: Tech Tags: , , , , ,

Display multiple virtual earth maps on the same web page

March 12th, 2007 No comments

Playing with mapping service API is a lot of fun, especially the Virtual Earth 3D maps, on which you can adjust altitude, heading, pitch and so on and pan through the city downtown over the skyscrapers.  Google map and Microsoft Virtual Earth has similar JavaScript/AJAX interfaces.  Tried the MTGoogleMaps plug-in and it’s quite good and easy to use.  There is one problem though when displaying, on IE, multiple maps by using multiple template tags on the same page.  The problem the tag will generate the same script-lets each time it appears on a page.  So there are multiple pairs of <div id="map"> and <script> in the resulting page, and the element ID of them are all the same – "map".  Although the element IDs are supposed to be unique across the page, but the browser will still try to render the page when there are ID collision.  However the result is not consistent on IE and Firefox.  Look at this example:

Element ID Collision
    <div id="Div1" style="width: 100px; height: 100px">d1</div>
<script type="text/javascript">
var v = document.getElementById("Div1");
alert(v.innerHTML);
</script>

    <div id="Div1" style="width: 100px; height: 100px">d2</div>
<script type="text/javascript">
var v = document.getElementById("Div1");
alert(v.innerHTML);
</script>

The above script-let will show "d1" and then "d2" on firefox, which suggests the space locality.  The closer element is picked when there are multiple elements with the same ID.  But on IE, "d1" will show up twice.

To fix this issue, firstly we need to move the <div> tag (hosting the map) generation into the client script so that we can generate tags with different IDs.  Secondly, use an array to keep track of all the map objects in case we need them later to further manipulate the maps.

Dynamic Map Object Generation without ID Collision
function CreateMap(width, height)
{
    // If there is no maps on this page at all, initilize the map array
    if (!maps)
    {
        maps = new Array();
        mapId = 0;
    }
   
    // Create a new map and append it to the array
    var nextIdx = maps.length;
    var nextDivId = "mapDiv" + nextIdx;
    document.writeln(‘<div id="’ + nextDivId + ‘" style="position:relative; width:’ + width + ‘; height:’ + height + ‘;"></div>’);
    var map = new VEMap(nextDivId);
    maps[nextIdx] = map;
    ++ nextIdx;
   
    return map;
}

function GetMapByCoordinates(latitude, longitude)
{
    // …
    map = CreateMap(width, height);
    map.LoadMap(new VELatLong(latitude, longitude));
    // …
}

Categories: Web Tags: , , ,