那些

ETL
E(Data Extraction)
擷取各類型態的資料,視其需要之程度設定不同抓取之頻率。
T(Data Transformation)
從各個不同來源所擷取的資料,必須根據特殊規則轉換其值 。
L(Data Load)
將擷取、轉換及清理過之資料正確的載入資料倉儲中。


Fact Table
中心資料表,包含數字量值 (Numerical Measure) 以及與維度資料表相關事實的索引鍵。
Key Column(s) -  Foreign Key,對應 Dimension Primary Key
Measure Column(s) – 純數值欄位(Number or Float)
Like Transaction Table
Dimension Table
有組織的分類 (或層級) 階層架構,用來描述事實資料表 (Fact Table) 內的資料。
Key Column– Primary Key
Description Column– 描述Dimension 欄位之資料
Like Basic Table

Star Schema
每一個維度資料表經由索引鍵資料行,與事實資料表(Fact Table)直接地產生關聯 。
Snowflake Schema
Star Schema 的延伸,只有主要維度資料表聯結到事實資料表 。其他的維度資料表則聯結到主要維度資料表。

Denormalize(反正規化 )
透過簡化資料倉儲結構描述 (Data Warehouse Schema) 的複雜性,來改善效率與執行效能。
Content Minimize
DW 容量成長快速,若非必要資料則勿轉入至DW內。

declare @a table (a int)
declare @i int
set @i=1
while(@i<=50)
begin
insert @a select @i
set @i=@i+1
end

select * from @a a,@a b,@a c,@a d,@a e
where
a.a>b.a and a.a>c.a and a.a>d.a and a.a>e.a
and b.a>c.a and b.a>d.a and b.a>e.a
and c.a>d.a and c.a>e.a
and d.a>e.a
and a.a+b.a+c.a+d.a+e.a=100


public class M {
  int[] s       = new int[50];
  int   count   = s.length;
  int[] sign    = new int[count];
  int   mark[]  = { 1, 0 };
  int   total   = 0;
  int   onjNum  = 100;
  int   fno     = 0;

  public static void main(String[] args){
    Calendar cstart = Calendar.getInstance();
    M g = new M();
    g.calculate();
    Calendar cend = Calendar.getInstance();
    System.out.println("take time:" + (cend.getTimeInMillis() - cstart.getTimeInMillis()) / 1000.0 + " seconds");
  }

  public void calculate(){
    for (int i = 0; i < count; i++) {
      s[i] = i + 1;
      sign[i] = 0;
    }
    total = 0;
    f(0);
  }

  int ppp = 0;

  private void f(int n){
    if (n == count) {
      return;
    }
    for (int i = 0; i < mark.length; i++) {
      sign[n] = mark[i];
      if (mark[i] == 1) {
        total += s[n];
        ppp++;
        if (total == onjNum && ppp == 5) {
          fno++;
          show();
        }
      }
      if (total < onjNum && ppp < 5)
        f(n + 1);
      if (mark[i] == 1) {
        total -= s[n];
        ppp--;
      }
    }
  }

  void show(){
    StringBuffer buf = new StringBuffer();
    for (int L = 0; L < s.length; L++)
      if (sign[L] == 1)
        buf.append(s[L] + " ");
    System.out.println("no " + fno + ":" + buf.toString());
  }
}


思路:
第一个数不能大于100 / 5
第二个数不能大于100 - 第一个数 / 4
类推

算法:(asp  低级吧)
nTotal = 100
nCount = 5
i = 0

For n1 = 1 To Int( nTotal / nCount )
If n1 > Int( nTotal / 2 ) Then Exit For

For n2 = n1 + 1 To Int( ( nTotal - n1 ) / ( nCount - 1 ) )
If n2 > Int( nTotal / 2 ) Then Exit For

For n3 = n2 + 1 To Int( ( nTotal - n1 - n2 ) / ( nCount - 2) )
If n3 > Int( nTotal / 2 ) Then Exit For

For n4 = n3 + 1 To Int( ( nTotal - n1 - n2 - n3 ) / ( nCount - 3 ) )
If n4 > Int( nTotal / 2 ) Then Exit For

For n5 = n4 + 1 To Int(  ( nTotal - n1 - n2 - n3 - n4 ) / ( nCount - 4 ) )
If n5 > Int( nTotal / 2 ) Then Exit For

If n1 + n2 + n3 + n4 + n5 = nTotal Then
Response.Write n1 & "+" & n2 & "+" & n3 & "+" & n4 & "+" & n5 & "=" & nTotal & "<br/>"
i = i + 1
End If
Next
Next
Next
Next
Next
Response.Write i & "次"

 

 


--------
<html>
<head>
<script Language="JavaScript">
function mycalc()
{
// JmLei 2007.02.27 
// jmlei.blogchina.com
var cnt=0;
var i=0;
var j=0;
var k=0;
var l=0;
var m=0;
var now = new Date();
var hh  = now.getHours(); 
var mm  = now.getMinutes(); 
var ss  = now.getTime() % 60000;
document.write("Start Time: "+hh+":"+mm+":"+ss+"<br>");

for (i=1;i<100/5+1;i++)
 {
 for (j=i+1;j<(100-i)/4+1;j++)
  {
  for (k=j+1;k<(100-i-j)/3+1;k++)
   {
   for (l=k+1;l<(100-i-j-k)/2+1;l++)
    {
    for (m=l+1;m<51;m++)
     {
     if  (i+j+k+l+m==100)
      {
      cnt=cnt+1;
//      document.write("No."+cnt+" "+i+"+"+j+"+"+k+"+"+l+"+"+m+"=100<br>");
      }
     }
    }
   }
  }
 }
document.write("counter: "+cnt+"<br>");
now = new Date();
hh  = now.getHours(); 
mm  = now.getMinutes(); 
ss  = now.getTime()  %  60000;
document.write("End Time: "+hh+":"+mm+":"+ss+"<br>");
}
</script>
<body>

<Form>
<Input type="button" Value="calc" onClick="mycalc()">
</Form>

</body>
</html>

9.
StreamReader sr = new StreamReader(strFilePath,System.Text.Encoding.GetEncoding("utf-8"));
    sr.BaseStream.Seek(0,SeekOrigin.Begin);
    string strRead="";
    while(sr.Peek()>-1)
    {
     strRead = sr.ReadLine();
     DataRow Drow = ds.Tables[0].NewRow();
     Drow[0] = strRead.Trim();
     ds.Tables[0].Rows.Add(Drow);
    }
    sr.Close();

posted on 2007-02-28 08:41  KenL  阅读(171)  评论(0)    收藏  举报

导航