Linux Virtual Server Running ASP.NET

This morning I have found a way, the way how to let my linux virtual server running ASP.NET.

http://web.qxinnet.com/aspnet/index.aspx

This server actually is in apache version and only support PHP and not support ASP.NET. But I have tried to make a engine to let the ASP.NET live on.

image

You can try to navigate to that page and view source.

As a beginner learner of ASP.NET I will try to learn to make the Form submitter inside later.

Thanks to support me, if you have problem please give me a reply.

Binary Tree in Java

I have learnt binary tree in Mathematics Computing last two semester in universities. And after I have completed the double module of Java, I know a little knowledge of Object-oriented Programming, so as I have tried to build a Java program which using object-oriented concept to construct a binary tree in Java.

This is my source code which written by me, fyhao.

  1. class Node {  
  2. public Node parentElement; // parent element of the node
  3. public Node leftElement; // left child element of the node
  4. public Node rightElement; // right child element of the node
  5. public String value; // the value of the node
  6. }  
  7. public class TestNode {  
  8. public static void main(String args[]) {  
  9. //String sentence = “The fox is jump over that fence”;
  10.         String sentence = “The three fox are jump over that fence”;  
  11. // Break each word into array
  12.         String word[] = sentence.split(” “);  
  13. // Initialize the main tree
  14.         Node node = new Node();  
  15. // SetTree
  16. for(int i=0; i<WORD.LENGTH; {<br i++) />  
  17. if(i == 0) {  
  18.                 node.value = word[i];  
  19.                 node.parentElement = null;  
  20.             } else
  21.                 setNode(node, word[i]);  
  22.         }  
  23. // GetTree
  24.         System.out.println(“Demonstration of Mathematic for Computing: Tree”);  
  25.         System.out.println(“Sentence: ” + sentence);  
  26.         System.out.println(“Height of tree: ” + getNodeHeight(node));  
  27.         System.out.println(“Leaf: ” + getLeaf(node));  
  28.         System.out.println(“Parent of jump: ” + getParent(node, getNode(node, “jump”)).value);  
  29.         System.out.println(“Parent of fence: ” + getParent(node, getNode(node, “fence”)).value);  
  30.         System.out.println(“Height of sub-tree on fox: ” + getNodeHeight(getNode(node, “fox”)));  
  31.     }  
  32. // Set the structure of the tree on each node
  33. // @param Tree of node, word (value)
  34. public static void setNode(Node node, String word) {  
  35.         Node childNode;  
  36. if(node.value != null) {  
  37.             childNode = new Node();  
  38.             childNode.parentElement = node;  
  39.             childNode.value = word;  
  40. // compare ignore case
  41.             word = word.toLowerCase();  
  42.             node.value = node.value.toLowerCase();  
  43. if(word.compareTo(node.value) == 0)  
  44. return; // if equal, break out of method
  45. else if(word.compareTo(node.value) < 0) {  
  46. if(node.leftElement != null)  
  47.                     setNode(node.leftElement, word);  
  48. else
  49.                     node.leftElement = childNode;  
  50.             } else {  
  51. if(node.rightElement != null)  
  52.                     setNode(node.rightElement, word);  
  53. else
  54.                     node.rightElement = childNode;  
  55.             }  
  56.         }  
  57.     }  
  58. // Get node by value
  59. // @param Tree of node, value
  60. // @return the node want to get
  61. public static Node getNode(Node node, String value) {  
  62.         Node targetNode = null;  
  63. if(value.equals(node.value))  
  64.             targetNode = node;  
  65. else {  
  66. // check if left or right got target, then only one target found only, strange problem, getParent also encountered, maybe not very good
  67. if(node.leftElement != null)  
  68.                targetNode = targetNode == null ? getNode(node.leftElement, value) : targetNode;  
  69. if(node.rightElement != null)  
  70.                targetNode = targetNode == null ? getNode(node.rightElement, value) : targetNode;  
  71.         }  
  72. return targetNode;  
  73.     }  
  74. // Get height of the tree
  75. // @param Tree node
  76. // @return height of tree
  77. public static int getNodeHeight(Node node) {  
  78. int height = 1;  
  79. int leftHeight = 0, rightHeight = 0;  
  80. if(node.leftElement == null && node.rightElement == null)  
  81. return height;  
  82. else {  
  83. if(node.leftElement != null)  
  84.                 leftHeight += getNodeHeight(node.leftElement);  
  85. if(node.rightElement != null)  
  86.                 rightHeight += getNodeHeight(node.rightElement);  
  87.         }  
  88. return height + Math.max(leftHeight, rightHeight);  
  89.     }  
  90. // Get number of leafs in the tree
  91. // @param Tree node
  92. // @return number of leaf
  93. public static int getLeaf(Node node) {  
  94. int leaf = 0;  
  95. if(node.leftElement == null && node.rightElement == null)  
  96. return 1;  
  97. else {  
  98. if(node.leftElement != null)  
  99.                 leaf += getLeaf(node.leftElement);  
  100. if(node.rightElement != null)  
  101. &
    nbsp;               leaf += getLeaf(node.rightElement);  

  102.         }  
  103. return leaf;  
  104.     }  
  105. // Get parent of node by value
  106. // @param Tree of node, child of node
  107. // @return the parent of node
  108. public static Node getParent(Node node, Node childNode) {  
  109. // found that node
  110.         Node parentNode = null;  
  111. if(node.value.equals(childNode.value))  
  112. return node.parentElement;  
  113. else {  
  114. if(node.leftElement != null)  
  115.                 parentNode = parentNode == null ? getParent(node.leftElement, childNode) : parentNode;  
  116. if(node.rightElement != null)  
  117.                 parentNode = parentNode == null ? getParent(node.rightElement, childNode) : parentNode;  
  118.          }       
  119. return parentNode;  
  120.     }  

Introducing the Google AJAX APIs

Google’s Mission

As you may know, Google’s mission is to organize the world’s information and make it universally accessible and useful. This article discusses how Google is doing just that by providing easy to use JavaScript-based APIs that allow a wide range of web developers, from experts to casual bloggers, to integrate rich and compelling Google provided search and feed data seamlessly into their web pages. More specifically, this article reviews the overall architecture of Google’s AJAX Search and AJAX Feed APIs and shows how to use the technologies they provide. As you’ll see with this article, integrating cool search and Internet feed technologies ranging from traditional web searches to compelling multimedia searches is actually very easy to do without even requiring a hard core AJAX programming background.

Introducing the Google AJAX APIs: AJAX Search and AJAX Feed

Have you ever wanted to integrate rich, multimedia, search, or feed-based Internet content into your web applications/pages only to realize that creating your own AJAX infrastructure for doing this turned out to be a daunting task? Fortunately, Google provides a solution to this by providing very easy to use JavaScript APIs known as the AJAX Search and AJAX Feed APIs. These APIs are cousins to the popular Google Maps API and are functionally similar in that you can use them to easily insert rich AJAX content into your pages simply by adding small amounts of JavaScript code.

The AJAX Search API allows you to easily integrate some very powerful and diverse Google based search mechanisms or “controls” onto a Web page with relatively minimal coding. These include:

  • Web Search: This is a traditional search input field where, when a query is entered, a series of text search results appear on the page.
  • Local Search: With Local Search, a Google Map is mashed together with a search input field and the search results are based on a specific location.
  • Video Search: The AJAX Video Search provides the ability to offer compelling video search along with accompanying video based search results.

Other search controls also included in the AJAX Search API are Google News Search, Blog Search, and Book Search; each offer enhanced and specialized search capabilities.

The AJAX Feed API is an Internet feed-based technology that allows web developers to pull down any RSS or Atom feed and integrate it into their web pages purely via JavaScript, all without requiring access to a server. In addition to raw data access to Internet feeds, Google also provides custom solutions built on top of the feed mechanism and offers rich feed-based solutions including a feed driven slideshow control.

Getting Started with the Google AJAX APIs

To get a feel for how to use Google’s AJAX APIs, you’ll review a simple “HelloWorld” AJAX Search application that integrates Google’s powerful search mechanism into a custom web page.

A HelloWorld AJAX Search Example

Getting started with an AJAX Search example is a two-step process. The first step, as with any of Google’s AJAX APIs, involves generating an API key for your usage of the API. This can be accomplished by going to Google’s developer web site, http://code.google.com, and generating an API key. A Google API key allows you to use the AJAX APIs on a particular web site or domain.

After generating a key, you then can create your own HelloWorld example with the AJAX API. Fortunately, this is just a matter of copying and pasting a provide example from http://code.google.com.

Here is the core part of a HelloWorld example provided in the AJAX Search Web site at code.google.com in the samples section (http://code.google.com/apis/ajaxsearch/samples.html/):

<html>
   <head>
   <script src="www.google.com/uds/api?file=uds.js&v=1.0
                &key=YOUR-KEY" type="text/javascript"></script>
   <script type="text/javascript">
   //<![CDATA[
   function onLoad() {
      // Create a search control
      var searchControl = new GSearchControl();

      // Add in a full set of searchers
      var localSearch = new GlocalSearch();
      searchControl.addSearcher(localSearch);
      searchControl.addSearcher(new GwebSearch());
      searchControl.addSearcher(new GvideoSearch());
      searchControl.addSearcher(new GblogSearch());
      searchControl.addSearcher(new GnewsSearch());
      searchControl.addSearcher(new GbookSearch());

      // Set the Local Search center point
      localSearch.setCenterPoint("New York, NY");

      // tell the searcher to draw itself and tell it where to attach
      searchControl.draw(document.getElementById("searchcontrol"));

      // execute an inital search
      searchControl.execute("VW Beetle");
   }
   GSearch.setOnLoadCallback(onLoad);

   //]]>
   </script>
   </head>
   <body>
      <div id="searchcontrol">Loading</div>
   </body>
</html>
Source: http://www.developer.com/design/article.php/3691506