Archive for May, 2007

Object Databind is Great

No needs to rename every control from something like textBox1 to txtTitle :) , because no more code like:

txtTitle.Text = article.Title;
article.Title = txtTitle.Text;

How much time can we save if there are 20 controls on the screen?

Add comment May 20th, 2007

Data Extraction / Screen Scraping Using XPath

Google AJAXSLT is an implementation of XSL-T in JavaScript, intended for use in fat web pages, which are nowadays referred to as AJAX applications. Because XSL-T uses XPath, it is also an implementation of XPath that can be used independently of XSL-T.

Selenium Core uses AJAXSLT’s XPath function to locate element on plain html. Selenium IDE can generate the XPath very much same as Solvent.

Here is a sample to extracting data from a web page using XPath using AJAXSLT.

<html><head>
<title>XPath-Test</title>
<
script language=”JavaScript” type=”text/javascript” src=”xpath/misc.js”></script>
<
script language=”JavaScript” type=”text/javascript” src=”xpath/dom.js”></script>
<
script language=”JavaScript” type=”text/javascript” src=”xpath/xpath.js”></script>
<
script language=”JavaScript” type=”text/javascript”>
function
findElementUsingFullXPath(xpath, inDocument) {
 
var context = new ExprContext(inDocument);
 
var xpathObj = xpathParse(xpath);
 
var xpathResult = xpathObj.evaluate(context);
 
if (xpathResult && xpathResult.value) {
    return xpathResult.value[0];
  }
  return null;
};
function start() {
  alert(findElementUsingFullXPath(
“//*[.='b']“, window.document).innerHTML);
}
</script>
</
head>
<
body onload=”start()”>
<
div><p>aaaaa</p>test<div>bb</div><a>b</a></div>
</
body>
</
html>

 

Add comment May 16th, 2007

SQL CE database and ClickOnce Deployment

My default SQL CE database was deployed to ClickOnce Data Directory. If changed the database schema, ClickOnce will deploy the new database and keep the old database file (in .pre folder). Here is the psuedo code to migrate schema:

if (IsFirstRun)
{
   if (customMigrationORMergeNeeded)
   {
      string dataFolder = call the API
      // Database from V1 of the    app
      string oldDatabase = Path.Combine(dataFolder,”.pre\db1.db”);
      if (File.Exists(oldDatabase))
      {
         string newDatabase = Path.Combine(dataFolder,”db1.db”);
         //perform the task needed with old and new one
         DoPerformCustomMigrationORMergeAsNeeded();
      }
}

What about removed the program from control panel? Data are all gone.

Looks like better to copy database file to the application data folder.

Add comment May 15th, 2007

VBx - Visual Basic as Dynamic Language

One of the Mix07 presentation mentioned VBx along the Ruby and Python. I realized immediately it must be something interesting.

While searching related staff, I also found this diagram.  

Add comment May 6th, 2007

Web Service Description: RSD and RDF

Most popular blog servers/engines such as WordPress, Drupal, Neclues and etc. are using RDS (Really Simple Discovery) to help client software like WB Editor to find the services that can be used to retrieve, modified and delete the blog posts.

Those blog servers/engines are also generating RDF (Resource Description Framework) for each blog post to give more information about the post, e.g. track back url. But not enough. I am looking for,

  • RDF extension that describes the blog service API lisk WSDL dose for SOAP, so that WB Editor can generate dynamically proxies to the service.
  • RDF extension that describes which HTML elements can WB Editor extract data from and then send to the blog service.

Here are some interesting references:

Add comment May 6th, 2007


Calendar

May 2007
M T W T F S S
« Oct   Jun »
 123456
78910111213
14151617181920
21222324252627
28293031  

Posts by Month

Posts by Category


1