關於我自己

我的相片
New York, New York, United States
我叫江奕賢啦

2004年3月24日

Database contents information about plants which has drug activity. Searchable.
Phytochemical and Ethnobotanical Databases
Example:
You can search plants which has anticancer activity.

2004年3月7日

assume we got weather info in xml format from here

then, we can use this xsl to display it.


<?xml version='1.0' encoding="Big5" ?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<xsl:template match="/">

<HTML>

<HEAD><TITLE>天氣預報</TITLE></HEAD>

<BODY>

<xsl:apply-templates select="ExtendedWeatherInfo"/>

</BODY>

</HTML>

</xsl:template>

<xsl:template match="ExtendedWeatherInfo">

<TABLE border="1" cellspacing="0">

<xsl:apply-templates select="Info"/>

</TABLE>

</xsl:template>

<xsl:template match="Info">

<TR>

<TD><xsl:apply-templates select="Location"/></TD>

<TD><xsl:apply-templates select="IconIndex"/></TD>

<TD><xsl:apply-templates select="Temprature"/></TD>

<TD><xsl:apply-templates select="Forecast"/>

<xsl:eval language="VBScript">Celsius(this)</xsl:eval>

<xsl:script language="VBScript"><![CDATA[

   Function Celsius(fDegrees)

      Celsius = (fDegrees - 32) * 5 / 9

   End Function

   ]]>

</xsl:script>

</TD>

</TR>

</xsl:template>

<xsl:template match="Location"><xsl:value-of/></xsl:template>

<xsl:template match="IconIndex">

<xsl:choose>

<xsl:when test=".[value() $gt$ 30]">晴</xsl:when>

<xsl:when test=".[value() $gt$ 20]">陰</xsl:when>

<xsl:when test=".[value() $gt$ 10]">雨</xsl:when>

<xsl:when test=".[value() $gt$ 5]">雪</xsl:when>

<xsl:otherwise>去死啦</xsl:otherwise>

</xsl:choose>

</xsl:template>

<xsl:template match="Temprature"><xsl:value-of/></xsl:template>

<xsl:template match="Forecast"><xsl:value-of/></xsl:template>

</xsl:stylesheet>

HTML to combine RSS and XSL


<HTML>

  <HEAD>

    <TITLE>Simple demo of Microsoft XSL Processor</TITLE>

  </HEAD>

  <XML id="source1" src="http://tw.news.yahoo.com/rss/technology"></XML>

  <XML id="source2" src="http://news.com.com/2547-1_3-0-20.xml"></XML>

  <XML id="source3" src="http://www.nws.noaa.gov/alerts/ny.rss"></XML>



  <XML id="style" src="C:\Documents and Settings\Owner\Desktop\technology.xsl"></XML>

 

  <SCRIPT FOR="window" EVENT="onload">

    tech.innerHTML = source1.transformNode(style.XMLDocument);

    cnet.innerHTML = source2.transformNode(style.XMLDocument);

    weather.innerHTML = source3.transformNode(style.XMLDocument);

  </SCRIPT>

  <BODY>

    <P STYLE="font-size:10pt; font-family:Verdana; color:gray">

      <B>This demo shows the use of data islands for loading XML source and

      XSL style sheets and inserting the transformed result into the Web page.</B>

    </P>

    <DIV id="tech"></DIV>

    <DIV id="cnet"></DIV>

    <DIV id="weather"></DIV>

  </BODY>

</HTML>


XSL for RSS


<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"

   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

   exclude-result-prefixes="xsl">

<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>



<xsl:template match="/">

  <div>

  <xsl:apply-templates select="rss/channel"/>

  </div>

</xsl:template>



<xsl:template match="rss/channel">

  <xsl:variable name="link" select="link"/>

  <xsl:variable name="description" select="description"/>

  <xsl:variable name="image" select="image/url"/>

  <xsl:if test="$image">

    <img src="{$image}" style="float: right; margin: 2px;" />

  </xsl:if>

  <h3>

    <a href="{$link}" title="{$description}"><xsl:value-of select="title" /></a>

  </h3>

  <hr/>

  <ul><xsl:apply-templates select="item"/></ul>

</xsl:template>



<xsl:template match="item">

  <xsl:variable name="item_link" select="link"/>

  <xsl:variable name="item_title" select="description"/>

  <li>

    <a href="{$item_link}" title="{$item_title}"><xsl:value-of select="title"/></a>

  </li>

</xsl:template>



</xsl:stylesheet>

2004年3月4日

I'd like to use "javascript wysiwyg html editor" to implement my diary.
TextAreaPro V1.0 Demo
Demo Supporting floating images, text, tables; also support sounds, video; save to local, server.

for creating thumbnails, I think I'll use ASP.NET to do it.
How To: Creating Thumbnail Images
Image.GetThumbnailImage on microsoft

public class MakeThumbnail : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
string file = Request.QueryString["file"];
System.Drawing.Image image = System.Drawing.Image.FromFile(Server.MapPath(file));
System.Drawing.Image thumbnailImage = image.GetThumbnailImage(64, 64, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);
MemoryStream imageStream = new MemoryStream();
thumbnailImage.Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] imageContent = new Byte[imageStream.Length];
imageStream.Position = 0;
imageStream.Read(imageContent, 0, (int)imageStream.Length);
Response.ContentType = "image/jpeg";
Response.BinaryWrite(imageContent);
}
public bool ThumbnailCallback()
{
return true;
}
// ... non-applicable infrastructure code removed for clarity ...
}

2004年3月3日

Movable Type + Gallery might be able to make my photo album diary
examples' here
just need to combine functions in those websites.