Skip to content

Zeroplex 生活隨筆

軟體開發、伺服器和生活瑣事

小 縮小字型大小。 中 重設字型大小。 大 放大字型大小。

分類: 未分類

找對老師真的很重要

Posted on 2008 年 4 月 27 日2021 年 3 月 12 日 By 日落 在〈找對老師真的很重要〉中有 5 則留言

今天算排列組合,算到有種身體都快要被排列組合的感覺。

原本高中花了不少時間在排列組合上,筆記也有厚厚一疊(至少 300 頁 A4),可以說是我高中數學唯一有在聽課的章節。結果大學選錯課,雖然不能說他教的不好,但是他的上課方式我真的完全不能接受,上一小時的課,筆記要整理二小時,要看懂則要花上三小時。不懂題問,講解方式也是千篇一律,有沒有題問其實差不了很多。

上了他一學期的課,我高中打的基礎現在全垮了,原本懂得現在都不懂了。今天一個題目花了一個半小時還是看不出所以然,不知道往後的半學期要怎麼過下去……..

現在很能體會春風化雨 1996 裡面的一句話:「天下沒有壞學生,只有壞老師。」

Tags:生活雜記

PHP Captcha 大惡搞

Posted on 2008 年 4 月 19 日2021 年 3 月 12 日 By 日落 在〈PHP Captcha 大惡搞〉中有 4 則留言

自從上次改過別人的 PHP Captcha 以後,這次玩得更瘋了。

今天跟 scwu 聊過以後想出一堆鬼主意來當作 captcha 上面的文字,可以考慮的有注音文、火星文和一堆有的沒的符號。後來想整人所以決定讓大家動動頭腦,出點數學題目讓大家做,如加減乘除:

不過加減乘除對對電腦來說太簡單了,以後要試試看來點方程式求解,有必要來個微積分也行,不過這樣就得大費周章的請 LeTex 出來幫忙了。

上面的 captcha 我改名叫做「mathcha」,程式碼如下:

<?php
    $font_face = 'arialbd.ttf'; //font you want to use
    $width='80';
    $height='25';
    $font_size = $height * 0.65;

    $image = imagecreate($width, $height) or die('Cannot initialize new GD image stream');
    $background_color = imagecolorallocate($image, 0, 0, 0);
    $text_color = imagecolorallocate($image, 255, 255, 255);
    $noise_color = imagecolorallocate($image, 150, 255, 150);

    //create dots
    for( $i=0; $i<($width*$height)/3; $i++ ) {
        imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color);
    }

    //print text
    $n1 = mt_rand(1,20);
    $n2 = mt_rand(1,20);
    $string = "$n1 + $n2";
    $textbox = imagettfbbox($font_size, 0, $font_face, $string) or die('Error in imagettfbbox function');
    $x = ($width - $textbox[4])/2;
    $y = ($height - $textbox[5])/2;
    imagettftext($image, $font_size, 0, $x, $y, $text_color, $font_face , $string) or die('Error in imagettftext function');

    /* output captcha image to browser */
    header('Content-Type: image/jpeg');
    imagejpeg($image);
    imagedestroy($image);

    $_SESSION['mathcha'] = $n1 + $n2;
?>

記得你把你用的字型和這個程式放在同一個目錄。

Tags:PHP, 程式設計

Mediawiki 參數設定

Posted on 2008 年 4 月 13 日2021 年 3 月 12 日 By 日落 在〈Mediawiki 參數設定〉中有 2 則留言

要更改 Mediawiki 的權限設定,只要在 LocalSettings.php 更改一些變數值即可。不過因為前面會先載入預設值,所以自行增加的語句一定要在下面的語句之後:
require_once( "$IP/includes/DefaultSettings.php" );

未註冊使用者不可編輯:

$wgGroupPermissions['*']['edit']    = false;
$wgGroupPermissions['user']['edit'] = true;

允許註冊使用者上傳檔案:

$wgEnableUploads = true;
$wgGroupPermissions['user']['upload'] = true;

禁止使用者註冊:

$wgGroupPermissions['*']['createaccount']   = false;

修改預設時區:

#Set Default Timezone
$wgLocaltimezone = "Asia/Taipei";
#Calculate the timezone offset with UTC
$oldtz = getenv("TZ");
putenv("TZ=$wgLocaltimezone");
$wgLocalTZoffset = date("Z") / 60;
putenv("TZ=$oldtz");

參考網頁:
Manual:$wgGroupPermissions – MediaWiki
MediaWiki timezone | LemonWiki

Tags:網路架站

The mottos in the library of Harvard

Posted on 2008 年 4 月 12 日2021 年 3 月 12 日 By 日落 在〈The mottos in the library of Harvard〉中有 4 則留言
  1. This moment will nap, you will have a dream; But this moment study, you will interpret a dream.
  2. I leave uncultivated today, was precisely yesterday perishes tomorrow which person of the body implored.
  3. Thought is already is late, exactly is the earliest time.
  4. Not matter of the today will drag tomorrow.
  5. Time the study pain is temporary, has not learned the pain is life-long.
  6. Studies this matter, lacks the time, but is lacks diligently.
  7. Perhaps happiness does not arrange the position, but succeeds must arrange the position.
  8. The study certainly is not the life complete. But, since continually life part of – studies also is unable to conquer, what but also can make?
  9. Please enjoy the pain which is unable to avoid.
  10. Only has compared to the others early, diligently diligently, canfeel the successful taste.
  11. Nobody can casually succeed, it comes from the thoroughself-control and the will.
  12. The time is passing.
  13. Now drips the saliva, will become tomorrow the tear.
  14. The dog equally study, the gentleman equally plays.
  15. Today does not walk, will have to run tomorrow.
  16. The investment future person will be, will be loyal to the reality person.
  17. The education level represents the income.
  18. One day, has not been able again to come.
  19. Even if the present, the match does not stop changes the page.
  20. Has not been difficult, then does not have attains.

中文翻譯:

  1. 此刻打盹,你將做夢;而此刻學習,你將圓夢。
  2. 我荒廢的今日,正是昨日殞身之人祈求的明日。
  3. 覺得為時已晚的時候,恰恰是最早的時候。
  4. 勿將今日之事拖到明日。
  5. 學習時的苦痛是暫時的,未學到的痛苦是終生的。
  6. 學習這件事,不是缺乏時間,而是缺乏努力。
  7. 幸福或許不排名次,但成功必排名次。
  8. 學習並不是人生的全部。但,既然連人生的一部分——學習也無法征服,還能做什麼呢?
  9. 請享受無法迴避的痛苦。
  10. 只有比別人更早、更勤奮地努力,才能嘗到成功的滋味。
  11. 誰也不能隨隨便便成功,它來自徹底的自我管理和毅力。
  12. 時間在流逝。
  13. 現在淌的哈喇子,將成為明天的眼淚。
  14. 狗一樣地學,紳士一樣地玩。
  15. 今天不走,明天要跑。
  16. 投資未來的人是,忠於現實的人。
  17. 教育程度代表收入。
  18. 一天過完,不會再來。
  19. 即使現在,對手也不停地翻動書頁。
  20. 沒有艱辛,便無所獲。
Tags:分享

機械式鍵盤到手

Posted on 2008 年 4 月 7 日2021 年 3 月 12 日 By 日落 在〈機械式鍵盤到手〉中有 1 則留言

原本去年可以當聖誕節禮物的,但因為廠商 QC 上面出了點問題,所以拖到現在才交貨,不過機械式鍵盤敲起來手感實在很棒,氣一下子就消了。

第一次使用機械式鍵盤,買的是茶軸黑色同刻,聲音不會比薄模鍵盤來的大聲,耐久度卻是薄模式鍵盤的十多倍。機械式與薄模式鍵盤的區別在於,機械式鍵盤的每個按鍵都是獨立的一個軸心,而每個軸心的壽命以敲擊次數來算的話大約是一千萬次,若按鍵故障也不必整個鍵盤換掉,只需要更換該按鍵的軸心即可。

對我而言,鍵盤對我來說非常重要,忙碌時曾經也有一天敲鍵盤超過六萬次的紀錄! (by Workrave)

既然需要長久使用鍵盤,那倒不如多花一些錢買個較好較耐用的鍵盤。況且機械式鍵盤用起來手感那麼好,用電腦會越用越開心…. XD

鍵盤是在「藝之都」訂購,由 Aleiku 代收。原本打算買聲音最小的黑軸,但是敲起來感覺比較硬所以改買茶軸。另外會想買同刻(鍵盤上的字與鍵盤顏色相同)是因為主機、螢幕、耳機都是黑色的,要黑就要黑到底!反正鍵盤用了這麼久不用看知道哪個字在哪個位置。

鍵盤外觀感覺很棒,但是唯一的缺點就是他的 mark 太突出,把原本的顏色一致的感覺破壞掉了,如果改為暗灰色我會比較能夠接受。

另外,鍵盤上的 LED 燈實在太亮啦,比逢甲夜市裡的閃光還要閃,害我有點想把 LED 接線給剪掉。小弟不喜歡炫,只求低調。

Tags:分享, 生活雜記

文章分頁

上一頁 1 ... 231 232 233 ... 318 下一頁

其他

關於我  (About me)

  文章 RSS Feed

  留言 RSS Feed

Apache AWS Bash C/C++ Docker FreeBSD GCP Git Google Java JavaScript Laravel Linux Microsoft MSSQL MySQL Nginx PHP PHPUnit PostgreSQL Python Qt Ubuntu Unix Vim Web Windows WordPress XD 作業系統 分享 好站推薦 專題 攝影 新奇搞笑 新聞 旅遊 生活雜記 程式設計 網路架站 網頁設計 資訊學習 資訊安全 遊戲 音樂


創用 CC 授權條款
本著作係採用創用 CC 姓名標示-相同方式分享 4.0 國際 授權條款授權.