Search

7/12/2009

XInclude - Wikipedia, the free encyclopedia

XInclude - Wikipedia, the free encyclopedia

XInclude is a generic mechanism for merging XML documents, by writing inclusion tags in the "main" document to automatically include other documents or parts thereof[1]. The resulting document becomes a single composite XML Information Set. For example, including the text file license.txt:

Augmented Reality in SIGGRAPH 2007

Augmented Reality in SIGGRAPH 2007

7/10/2009

Gmail for Mobile HTML5 Series: Using Timers Effectively

Gmail for Mobile HTML5 Series: Using Timers Effectively


The dashed blue line represents the requested timer interval, 200 ms. Notice that the median was almost 50% higher than requested, at 276 ms; the time between ticks varied from 98 ms to almost 4 seconds, with an average delay of 493 ms.
This highlights the fact that the interval at which your timer actually fires may differ greatly from the requested delay. In fact, the time between ticks is typically highly variable. It will fluctuate based on what else is happening in your application and on the device. Don't rely on your timer being precise!

Here's what we learned. With low-frequency timers — timers with a delay of one second or more — we could create many timers without significantly degrading performance on either device. Even with 100 timers scheduled, our app was not noticeably less responsive. With high-frequency timers, however, the story was exactly the opposite. A few timers firing every 100-200 ms was sufficient to make our UI feel sluggish.

This led us to take a mixed approach with the timers we use in our application. For timers that have a reasonably long delay, we just freely create new timers wherever they are needed. However, for timers that need to execute many times each second, we consolidate all of the work into a single global high-frequency timer.
A global high-frequency timer strikes a balance between needing several different functions to execute frequently and application performance. The idea is simple: create a single timer in a central class that calls as many functions as required. Ours looks something like this:


var highFrequencyTimerId_ = window.setInterval(globalTimerCallback, 100);

globalTimerCallback = function() {
navigationManager.checkHash();
spinnerManager.spin();
detectWakeFromSleep_();
};

永和黑糖剉冰刨冰‧福滿溢

永和黑糖剉冰刨冰‧福滿溢

永和冰品美食
【店家地址】台北縣永和市安樂路240-1號﹝四號公園旁﹞
【店家電話】02-29277958
【營業時間】中午12:00-晚上11:30

7/03/2009

symfony

Frequently Used Helpers
http://www.symfony-project.org/book/1_2/07-Inside-the-View-Layer

Day 4: The Controller and the View
http://www.symfony-project.org/jobeet/1_2/Propel/en/04

JavaScript helpers
http://vit.free.fr/symfony/0.6.3/javascript.html

Chapter 11 - Ajax Integration
http://www.symfony-project.org/book/1_0/11-Ajax-Integration

php DOMDocument::loadXML & xpath


class helloAction extends sfAction
{
// data values
// $newsitems -> [ [link, title, desc]* ]
public function execute()
{
$rssurl = 'http://rss.news.yahoo.com/rss/tech';
$rssdata = $this->url_get_contents($rssurl);
$rssdom = DOMDocument::loadXML($rssdata);

// fetch values from dom and put into array of [link,title,desc] arrays
$newsitems = array();
$xpath = new DOMXPath($rssdom);
foreach ($xpath->query("//rss/channel/item") as $item)
{
$link = $this->get_element_value($item, 'link');
$title = $this->get_element_value($item, 'title');
$description = $this->get_element_value($item, 'description');
$newsitems[] = array($link, $title, $description);
}

// pass this struct to the template
$this->newsitems = $newsitems;
}

// note: no error handling yet
private function url_get_contents($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
private function get_element_value($node, $itemname)
{
return $node->getElementsByTagName($itemname)->item(0)->nodeValue;
}
}