顯示文章

這裡允許您檢視這個會員的所有文章。請注意, 您只能看見您有權限閱讀的文章。


主題 - asako

頁: [1]
1
如 title 。

如 使用 Pentaho BI,使用 MS SSAS , Tableau 或其它或自行開發。

2
有一個 table 有 1仟萬筆的資料,想把某欄裡 是 null 跟空白的抓出來。有什麼有效率的方式嗎?
目前我用的是
select * from table where isnull(date,'')=''

3
最近要送修硬碟,但忘了在那家買的。保固貼紙 是黃色的,上頭有 WE 還是 EW 的圖案,有沒有人知道這是那一家啊。

==============
商家給我的是水貨,又忘記是那一家,打電話 建x 不修。只好寄到蘆竹。
有買水貨的且在官網查是在保固內的可自寄至蘆竹維修,且只花80 元。

4
database 討論版 / MS SQL 授權 問題。
« 於: 2007-06-29 18:02 »
公司要買 sql 當 web 的資料庫,可不可以只買 5 u 的授權就可以了。
如果只買 5 u 會不會有限制,iis 只能有5個使用者連到sql server。

ps:個人覺得 不管 iis 有多少的使用者連到 sql server  應只算1個使用權。

5
有沒有人有經驗過,我按照官方說明每次一編都會錯在
sql_locale.cpp

其它沒有include到 sql_locale.cpp 的程式都可以成功編出。

6
Linux 討論版 / [問題]GCC 編譯參數
« 於: 2007-03-23 17:55 »
一般在 gcc 後面加上這些參數-mcpu=i386, -mcpu=i486, -mcpu=pentium, ...
真得程式會跑的比較快嗎?有沒有什麼程式可以有數據測試?

7
database 討論版 / [問題]mysql round function
« 於: 2007-03-20 15:25 »
當我下
select round(0.05,1) from dual
系統回傳 0 ,可是以四捨五入來說應該是0.1才對
如果下的是
select round(0.06,1) from dual
系統回傳 0.1
所以說 mysql 應該是五捨六入才對

怎樣改才會變成 四捨五入?

剛寫錯了,重新修正一下
給樓下的大哥,你可以實際跑跑看嗎?
第一個 sql 嗎?
我的 mysql 版本為 4.1.22-community-nt

最新測試 select round(0.05,1) from dual 在 mysql 5.x 上 系統傳回 0.1



在 mysql 4.1X 的測試

mysql> select round(0.1055,3);
+-----------------+
| round(0.1055,3) |
+-----------------+
|           0.105 |
+-----------------+
1 row in set

mysql> select round(0.1054,3);
+-----------------+
| round(0.1054,3) |
+-----------------+
|           0.105 |
+-----------------+
1 row in set

mysql> select round(0.1056,3);
+-----------------+
| round(0.1056,3) |
+-----------------+
|           0.106 |
+-----------------+
1 row in set

mysql>

8
雜七雜八 / [問題]mysql 認知測試
« 於: 2007-03-16 15:15 »
假設目前系統有一個 table test 而 test 只有一個 int 的欄位
當我下
create table if not exists test select 1 from dual

會發生什麼情況?


============
公佈答案,每執行這個sql一次 test 的資料就會加一筆 1 的資料在裡頭
if not exists test  只影響 create table 不影響 後面的 select

9
自從換了新機後總覺得老機器(p3-1g)跑得比新機(xeon 2.4G)還快
系統效能上的 avg. disk queue 大多在 70 -100 上跳
後來受不了去查 hp smart array 6i 的設定,發覺 hp smart array 6i  沒 write back cache ,天啊那個天才規劃的,上原廠查 要有 write back cache 請買一個 128 MB的option kit。十幾萬買的雙 XEON 的機器居然沒買 option kit,真服了這個規劃的人。

10
程式討論版 / [原創]傳送簡訊至 HINET(PERL)
« 於: 2006-09-07 09:48 »
第一次寫class,大部份改至hinet的公用程式。
目前程式已可以用,想問一下 sms_hinet.pm 還有什麼要改的嗎?


EXAMPLE:
#!c:/Apache2/Perl/bin/Perl.exe
use sms_hinet;
my $new_sms=sms_hinet->new();;
$new_sms->user_account('8888');
$new_sms->user_password('9999');
$new_sms->mobile_number('0806449');
$new_sms->message("簡訊內容");
if ($new_sms->check_hinet_account()==0) {
$new_sms->sendmsg();
}




====將以下存成 sms_hinet.pm ====
package sms_hinet;
use Socket;
#作者:我本善良   :asakous(at)yahoo.com.tw
#版權:請自由取用,但請不要拿掉作者是誰。
sub new {
        my $self  = {};
        $self->{ACCOUNT}   = undef;
        $self->{PASSWORD}    = undef;
      $self->{msg}    = undef;
      $self->{interface_type}    = 0;
      $self->{msg_type}    = 0; # 0:檢查帳號密碼 1:傳送簡訊
      $self->{send_type}    = 100; # 100即時傳送
      $self->{mobile_number}    = undef;
        bless($self);            
        return $self;
    }

   sub user_account {
        my $self = shift;
        if (@_) { $self->{ACCOUNT} = shift }
        return $self->{ACCOUNT};
    }
    sub user_password {
        my $self = shift;
        if (@_) { $self->{PASSWORD} = shift }
        return $self->{PASSWORD};
    }
   
       sub interface_type {
        my $self = shift;
        if (@_) { $self->{interface_type} = shift }
        return $self->{interface_type};
    }
   
       sub msg_type {
        my $self = shift;
        if (@_) { $self->{msg_type} = shift }
        return $self->{msg_type};
    }

       sub send_type {
        my $self = shift;
        if (@_) { $self->{send_type} = shift }
        return $self->{send_type};
    }   
   
       sub message {
        my $self = shift;
        if (@_) { $self->{msg} = shift }
        return $self->{msg};
    }   


   sub mobile_number {
        my $self = shift;
        if (@_) { $self->{mobile_number} = shift }
        return $self->{mobile_number};
    }   
   
sub check_hinet_account {

 my $self = shift;
  $proto = getprotobyname('tcp');
  $i_addr = inet_aton('203.66.172.131');
  $paddr = sockaddr_in('8000', $i_addr);
  socket(SOCK, PF_INET, SOCK_STREAM, $proto);
  connect(SOCK, $paddr) or die "\n### Error: Couldnot using socket to connect to remote_host(203\.66\.172\.131:8000) : $! ";

  #檢查帳號密碼
  $dd = $self->{ACCOUNT} . "\0" . $self->{PASSWORD} . "\0";
  $tmp = pack("C",$self->{interface_type}) . pack("C",$self->{msg_type}) . pack("C",length($dd)) . $dd ;  

  my $send_length = send( SOCK, $tmp, 0 );

  my $scalar="" ;
  my $ret_length = recv( SOCK, $scalar, 129, 0 );


  my $return_c = substr $scalar,0,1 ;
  my $return_code = unpack("c", $return_c);
 
  my $return_message_length = length $scalar;
  $return_message_length--;
  my $return_message = substr $scalar, 1, $return_message_length;

  return $return_code;

}   

sub sendmsg {
      my $self = shift;
     $self->{msg_type} =1;   
     my $dd = $self->{mobile_number} . "\0" . $self->{msg} . "\0";
     my $tmp = pack("C",$self->{interface_type}) . pack("C",$self->{msg_type}) . pack("C",length($dd)) . $dd . pack("C",$self->{send_type});  
     my $send_length = send( SOCK, $tmp, 0 );
     my $scalar="" ;
     my $ret_length = recv( SOCK, $scalar, 129, 0 );
     #print "\n rec data:" . $scalar;
     my $return_c = substr $scalar,0,1 ;
     my $return_code = unpack("c", $return_c);
     my $return_message_length = length $scalar;
     $return_message_length--;
     my $return_message = substr $scalar, 1, $return_message_length;
   return $return_code;

     
}
   
sub close_session {

my $self = shift;
close(SOCK);
}

1;


====sms_hinet.pm完=========

11
PHP程式設計討論區 / php 語法問題
« 於: 2006-05-30 14:49 »
$result=$dbh->query($query);

$result=&$dbh->query($query);

以上這兩個語法有什麼不一樣嗎?

我執行的結果都是一樣的,沒感覺有什麼差

有誰知那裡有資料可以看。英文可。

12
程式討論版 / [原創] 大樂透自動對獎程式
« 於: 2006-05-17 09:50 »
use strict;
use WWW::Mechanize;

#設定每期樂透公佈的網頁
my $url = "http://www.roclotto.com.tw/topnews/biglotto.asp";
my $mech = WWW::Mechanize->new();

$mech->get( $url );
#抓完存檔
$mech->save_content( '1.html');


my @special_number;
my %lotto_number;
my $line_number=1;

#讀檔
open(output,"< 1.html ") or die;

while (<output>) {

if ($_ =~ /(\d+)、(\d+)、(\d+)、(\d+)、(\d+)、(\d+)/ )

 {  
 #把到的一般號碼抓進hash裡
 %lotto_number=($1=>1,$2=>1,$3=>1,$4=>1,$5=>1,$6 );
  }

#抓特別號
 if ($_ =~ /<font color=\"\#FF0000\">(\d+)<\/font>/ )


 { push @special_number ,$1;  }
 

}
close(output);

#開檔,你的樂透號碼檔
#每一行的格式為(記得把#號去掉,最後一個號碼記得斷行(\n))
#2 6 11 12 27 45
#4 12 17 20 24 47

open(log_file,"< log.txt ") or die;

while (<log_file>) {
my $hit_number=0;
my @line_number=split(/\s/);

foreach my $temp_number (@line_number) {

#看讀進的號碼有沒有中
if (exists $lotto_number{$temp_number}){

$hit_number++;
}


}

#印出行號及中獎的號碼數
print '行號 ',$line_number," 中 ",$hit_number," 號碼\n";
$line_number++;
}

close(log_file);

#
#
#備註:程式中用所使用的正規可能不是很好,也許有發生錯誤的可能
#但目前可用
#希望有其它的人能想出更好的方法。
#忘記寫特別號的判斷,等寫完再補上  
#
#

#-------------以下是有特別號判斷的--------------------

use strict;
use WWW::Mechanize;

my $url = "http://www.roclotto.com.tw/topnews/biglotto.asp";
my $mech = WWW::Mechanize->new();
$mech->get( $url );
$mech->save_content( '1.html');

my (%lotto_number,%special_number);
my $line_number=1;

open(output,"< 1.html ") or die;

while (<output>) {

if ($_ =~ /(\d+)、(\d+)、(\d+)、(\d+)、(\d+)、(\d+)/ )

 {  
 
 %lotto_number=($1=>1,$2=>1,$3=>1,$4=>1,$5=>1,$6 );
  }

 if ($_ =~ /<font color=\"\#FF0000\">(\d+)<\/font>/ )

 { %special_number=($1=>1);  }
 

}
close(output);

open(log_file,"< log.txt ") or die;

while (<log_file>) {
my ($hit_number,$hit_special)=(0,'沒中');
my @line_number=split(/\s/);

foreach my $temp_number (@line_number) {

if (exists $lotto_number{$temp_number}){

$hit_number++;
}

if (exists $special_number{$temp_number}){

$hit_special="有中";
}



}


print '行號 ',$line_number," 中 ",$hit_number," 號碼 "," 特別號 $hit_special\n";
$line_number++;

}

close(log_file);

13
database 討論版 / [MYSQL]搜尋語法的問題
« 於: 2006-04-13 13:50 »
我的 table 裡有一欄的資料有

聯宿
聯強

當我用 select * from test where cust_name like '聯強%'

MYSQL 會把

聯宿跟聯強一起抓出來。

這是 mysql 的 bug 嗎?

有無解決的方式?


我的 mysql 版本為 4.18
欄位型態為 varchar
character set =latin1
collation =  latin1_swedish_ci

14
程式討論版 / [原創] 大樂透亂數選號
« 於: 2005-11-29 15:39 »
簽這麼久也沒中超過400元。
閒來無事用perl寫個『電腦選號』
祝大家中大獎。

#!c:/Apache2/Perl/bin/Perl.exe
use Array::Unique;
use strict;
use warnings;
tie my @a, 'Array::Unique';

until ( $#a == 5){
my $num1 = int rand 49 ;
if ($num1 == 0){next;}
push @a,$num1;
}
@a = sort {$a <=> $b } @a;

print $a[0]." ".$a[1]." ".$a[2]." ".$a[3]." ".$a[4]." ".$a[5]."\n";

15
如果想要把 某 table a 的 emp_name 內含有『王』這個字的全抓出來我可用
select * from a where emp_name regexp '王'

那不含『王』的要如何表示?

不能用 like 喔。

16
javascript 能跑 sql query 嗎?

17
在進入 HP_UX 之後 如何檢查有多少 CPU 在這台機器上

18
雜七雜八 / store mails into mysql --- from google
« 於: 2003-10-22 01:00 »
寄件者:Matthew England (mengland@chi.mti.com)
主旨:RE: How automatically to store emails into MySQL?
View: Complete Thread (共 7 條留言)  
Original Format
網上論壇:mailing.database.mysql
日期:2000/03/31
 

The Perl and PHP examples provided by Indrek and Michael are great!  These
examples are just the things I was looking for to help get me started.

Any other email-header parsing utilities besides MIME::Parser?  Anything I
can access via PHP?

I answer Indrek's question below:

At 3/30/00 05:28 PM, indrek siitan wrote:
>um. care to explain, what you're planning to do with the e-mail
>afterwards?

I like to describe my goal as an application that mimicks an email-based
"trouble-tracking" system (eg, GNATS, a GNU email-based bug-tracking).  I
want to collect messages/info about customers, products, and events and be
able to retrieve these messages accordingly.  We've chosen to distribute
messages via email in our initial product implementation.

Some of the emails will contain specific, company-proprietary
information.  Other emails will be free form.

I absolutely need to store each message/email in it's entirety--no headers
chopped off or anything else.  This is very important for my
message-archiving requirements.

I will also want to parse the email headers so that I can store things like
date, time, "case ID", originator, etc.  I'm not yet concerned about data
redudancy (from the header info being copied into record
fields/columns).  Should I be concerned about this?

-Matt

>one thing is for sure - you can't use mysql client for that. the
>easiest way is to forward mail to a perl script, what does the job.
>the easiest script should look something like this (i'm writing
>it directly to the e-mail, so i'm not responsible for this being
>absolutely bugfree):
>
>--- 8< ---
>
>#!/usr/bin/perl
>use DBI;
>
>$dbh=DBI->connect("dbi:mysql:database", 'user', 'password');
>
>my $mailbody=''; while (<STDIN>) { $mailbody.=$_; }
>my $qmailbody=$dbh->quote($mailbody);
>
>$sth=dbh->prepare("INSERT INTO mail (body) VALUES($qmailbody)");
>$sth->execute;
>
>$dbh->disconnect;
>
>
>--- 8< ---
>
>if you want to store e-mail headers into separate fields, i
>recommend you taking a look at MIME::Parser module. this does
>a really nice job taking the mail into pieces.
>
>i have a script that does that, but it's not complete yet
>(craps out on some types of attachments) :(
>
>
>Rgds,
>   Tfr
>
>   --==< tfr@cafe.ee >==< http://tfr.cafe.ee/ >==< +1-504-4467425 >==--


--
---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail mysql-thread32776@lists.mysql.com

To unsubscribe, send a message to:
    <mysql-unsubscribe-mysql=freebsd.csie.nctu.edu.tw@lists.mysql.com>

19
雜七雜八 / ioffice v4 中文版
« 於: 2003-10-15 04:54 »
http://www.neoint.com/ioffice/support.html

很好用的軟体。
基本上只能用 60天/50帳戶

安裝前調調時間可用無限

破解人數--容易,但要有點耐心

20
> We have three WAN links each of capacity 2 Mbps.
>
> There is a one linux box per link which is used for NAT and firewall. So
> I have three linux boxes and three WAN links to talk to the internet.
>
> We want to do bandwidth shaping over these three links. I know
> individually we can do bandwidth shaping for a particular WAN link using
> linux tc tool. I can repeat the same bandwidth shaping commands for
> other two links also. However it would be better if I can treat three
> links as one big WAN pipe and do the bandwidth shaping for all of them
> at one place. Is it possible?
>
> I am just thinking aloud and not sure if that is possible or not.
It also depends if you want to shape download or upload.  If you want to shape
upload, you have to realize that you can only use 1 link.  For download, you
can use 3 links but only if you NAT and you have a lot of connections so you
can load balance the different connections (like http traffic).  An ftp
download, will only use 1 link.
This all to say that's not so easy to determine what will be the maximum
bandiwdth a class can get.  And that's one of the parameters you need to
create a good tc setup.  But you can create a tc setup that can shape the 3
links in both directions.  Even if this shaping is not perfect, it still
beter then not shaping at all.

Stef

--

stef.coene@docum.org
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

21
雜七雜八 / ioffice V4 發表了
« 於: 2003-03-06 16:26 »
http://www.neoint.com/ioffice/index.html

雖然要錢,但這個群組軟体還真不錯。

頁: [1]