跳到主要內容

發表文章

R Project with ODBC

1.Setting ODBC in windows Control panel 2.install R package "RODBC" 3.In R Command Line > library(RODBC) > channel = odbcConnect("$ODBC_Name") //Create Connection > odbcGetInfo(channel) //Get odbc connection info > odbcQuery(channel,"$SQL_command") //Set SQL Command String > sqlGetResults(channel, max=$TopNumber) //get top N Data

IE7 preivew Local image in html page

Use the IE filter "AlphaImageLoader" and javascript in Header <style type="text/css"> #newPreview { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale); } </style> <script type="text/javascript" language="javascript"> <!-- function PreviewImg(imgPath) { //IE6﹜IE7﹝ var newPreview = document.getElementById("newPreview"); newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgPath; } --> </script> in body <div id="newPreview" ></div>

[.net]IComparable Interface

Sorting Example Imports System.Collections Public Class Temperature Implements IComparable ' The temperature value Protected temperatureF As Double Public Overloads Function CompareTo( ByVal obj As Object ) As Integer _ Implements IComparable.CompareTo Dim otherTemperature As Temperature = TryCast(obj, Temperature) If otherTemperature IsNot Nothing Then Return Me .temperatureF.CompareTo(otherTemperature.temperatureF) Else Throw New ArgumentException( "Object is not a Temperature" ) End If End Function Public Property Fahrenheit() As Double Get Return temperatureF End Get Set ( ByVal Value As Double ) Me .temperatureF = Value End Set End Property Public Property Celsius() As Double Get Return (temperatureF - 32) * (5/9) End Get Set ( ByVal Value As Double ) Me .temperatureF = (Value * 9/5...

[.Net] List(Of T).Find (Predicate(Of T))

Find Object in List Method 1 Function PredicatFunction( ByVal tempProduct As Product) as boolean Return tempProduct.ProductID='MyID' End Function Dim MyList As List(Of Product)=new List(Of Product) Dim tmpProduct as Product=MyList.Find(AddressOf PredicatFunction ) Mothod 2 Dim ProductID as String='MyID' Dim MyList As List(Of product)=new List(Of product) Dim tmpProduct as Product=MyList.Find(Function(n) n.ProductID=productID )