FB plugin

Source Code Display Plugin

星期四, 3月 07, 2019

CC0/免費圖片無版權/可商用圖片網站


Free
Photo via Shane Adams, CC License

工作上有需要使用各式各樣的圖片?需要可以商用的版權?除了付費的網站以外,還可以選擇以下網站,取得免費並且可以商用的圖片/影片。


  • BurstFree Stock Photos: High-Res Images for Websites & Commercial Use
  • Canva, Free Stock Photos - Canva 
  • CUPCAKE, Free images for commercial use
  • Foter, Premium Royalty-Free Stock Photos From The Foter Community
  • Freeimages
  • Getty Images
  • Gratisography
  • Kaboompics
  • Life Of Pix
  • Magdeleine
  • Pexels, Free stock photos
  • Photo Pin
  • PicJumbo
  • Pixabay, Stunning free images
  • StockSnap
  • STOKPIC
  • Unsplash
  • Visual Hunt
  • 星期四, 2月 21, 2019

    巧遇安平有一間非油炸蝦餅,蔡大哥的人生經驗分享!


    Family
    Photo via Ivan, CC License.


    蔡 大 哥 的 人 生 智 慧


    對 孩 子 只 要 求 兩 件 事


    [bug] jquery select change default value not working


    My env is JQuery 3.3.1 / Bootstrap 4.0.0 / Laravel 5.7


    I want to change the select default value after retrieving data through AJAX. The following code is the original version

    $("#mySelect option").each(function(){
        if($(this).val() == myArray[0].id) {
            $(this).attr('selected', true);
        } else {
            $(this).attr('selected', false);
        }
    });

    This will WORK when getting the data in the FIRST TIME.
    BUT, if I keep getting other selection, the selected appears wrong result. The text show the wrong default text.

    Therefore, my workaround method is to remove the option and append new option code. Here is the example:

    var optionHtml = "<option value=\"0\">My default text</option>";
    for (i = 0; i < myOptionArr.length; i++) {
        if (mySelectedOption == myOptionArr[0].id) {
            optionHtml += "<option value=\"" + myOptionArr[i].id + "\" selected " + " >" + myOptionArr[i].desc +  "</option>";
        } else {
            optionHtml += "<option value=\"" + myOptionArr[i].id + "\">" + myOptionArr[i].desc +  "</option>";
        }
    }
    $("#inctypeSel2").append(optionHtml);

    星期四, 2月 14, 2019

    GDPR 是什麼


    data protection
    (Photo via Stock Catalog, CC License)

    「GDPR 資料已儲存...」

    設定完 Google Adwords 之後,就會跑出這麼一個代稱。到底 GDPR 是什麼呢?

    GDPR (General Data Protection Regulation,一般資料保護規範),指的就是歐盟法律中,對歐盟所有個人關於『資料保護』和『隱私』的規範。這部份涵蓋歐洲境外的個人資料使用。GDPR 主要目標是『取回在歐盟內的公民以及住民對於個人資料的控制權力,以及為了國際商務而簡化的統一規範』。

    更完整的資料可以參考以下資訊:

    一般資料保護規範 (維基百科)

    什麼是GDPR?三分鐘帶你了解「史上最嚴格個資法」相關規定 (蘋果仁)

    星期二, 1月 29, 2019

    期貨致命、家庭破碎事件簿


    market_crashes_banner
    Photo by trader_john via CC License

    『期貨』最原始的目的是拿來避險,但是股票世界中的期貨,一旦操作不當,不但無法避險,反而有傾家盪產的致命危機,以下節錄近年發生的新聞事件:

    投資期貨大賠 郵局經理貍貓換太子 用假鈔混真鈔侵占600萬 (東森新聞) (2020/04/14)

    【貴婦奈奈密帳】玩期貨慘輸3億 奈奈夫狂line金主急調頭寸 (鏡週刊) (2019/1/23)

    投150萬慘賠4千萬! 0206期貨屠殺股民泣訴 (TVBS) (2018/10/19)

    欠上千萬債務搶銀行 沙鹿搶嫌買早餐錯愕落網 (自由時報) (2018/7/26)

    10天暴虧 2億人民幣被斷頭 橡膠期貨大佬跳樓 (鉅亨網) (2017/9/30)

    雷洪還債6000萬老婆鳥獸散 (中國時報) (2017/2/9)

    投資賠億元 夫妻摟2幼女燒炭 全家4死 (蘋果日報) (2012/12/22)

    星期五, 12月 21, 2018

    在台灣的協會、基金會、農會、工會、漁會、基金會、教會、寺廟、同鄉會、宗親會要在那裡查詢?


    Q:在台灣的協會、基金會、農會、工會、漁會、基金會、教會、寺廟、同鄉會、宗親會要在那裡查詢?

    內政部:公益資訊平台
    http://npo.moi.gov.tw/npom/homepage/list

    司法院: 法人及夫妻查詢系統
    http://cdcb.judicial.gov.tw/abbs/wkw/WHD6K00.jsp

    星期四, 12月 20, 2018

    [Javascript] 今天、本月、今年怎麼取得?


    var today = new Date();
    var tDay = today.getDate();
    var tMonth = today.getMonth()+1; //January is 0!
    var tYear = today.getFullYear();
    var twYear = tYear - 1911; // 換算為民國年

    星期三, 12月 05, 2018

    [臉書] 如何查看優先追蹤的粉絲頁/朋友


    當臉書跳出『"搶先看"已達上限』的時候,當下就會想知道自己到底有那些搶先看?!

    要如何查詢自己的優先追蹤或者所謂的「搶先看名單」呢?

    步驟如下:
    1. 點擊桌機流覽器右上角有個倒三角型 ▼ 的下拉式選單
    2. 點選『動態消息偏好設定』
    3. 點選『排定優先查看的對象』
    4. 自行編輯 (朋友 / 粉絲頁)




    星期二, 12月 04, 2018

    [Laravel] 顯示 SQL 指令


    Laravel 目前並沒有像 CodeIgniter 可以直接輸入 SQL 指令,只能透過預定的函式存取想要的資料。那要如何檢查在 Laravel 中放的 SQL 指令是否正確呢?以下是建議方式:

    DB::enableQueryLog();

    // 你的 Laravel SQL 指命區

    dd(DB::getQueryLog());

    星期四, 11月 29, 2018

    Bootstrap set select box select value


    Method 1. doesn't work for me.

    $('#yourSelectBox').val(yourvalue); // not work

    Therefore, I try the following code to resolve:

    $('#yourSelectBox option').each(function () {
         if (this.value == yourvalue) {
            this.selected = true;
         }
    });

    Bootstrap CDN 順序筆記 (順序錯了就出錯)


    如果使用了「BootstrapCDN」(content delivery network),例如在網站上直接複製貼上以下的程式碼,就要注意幾件事情。



    <link crossorigin="anonymous" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" rel="stylesheet"></link>

    <scriptsrc="https://code.jquery.com/jquery-3.3.1.slim.min.js"integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"crossorigin="anonymous"></script>

    <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>

    <script crossorigin="anonymous" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>

    <script crossorigin="anonymous" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>


    要注意的項目如下:
    【jquery slim】

    上述的範例中,引用了 jquery-3.3.1.slim.min.js 這個套件。這個 slim 版本並非完整的版本。如果使用了 ajax 功能,例如 $.post() 就會得到下例的錯誤訊息,為了解決此問題,建議在 slim 之後,放上完整的 jquery 套件:
    Uncaught TypeError: $.post is not a function


    【jquery 套件順序】
    bootstrap 的 css 與 js 套件一定要在 jquery.min.js 之後,否則會造成部份功能失效。例如 modal('show') 這種元件的 js 功能,會出現如下的錯誤訊息:
    Uncaught TypeError: $(...).modal is not a function

    然而,jquery.slim.min.js 擺放的位置也必須注意,它必須放在 bootstrap.min.js 之前,否則會出現以下的怪異錯誤:
    Cannot read property 'fn' of undefined
    上述這個很多網友說這是 bootstrap 4.1.3 的錯誤,但還是提一下。

    結論就是,對於前端程式設計師而言 jquery 完整套件建議一定要加,而且位置很重要,以上就是一個可行的範例。


    星期三, 11月 28, 2018

    [PHP] how to format print_r() output data


    print_r() is a useful tool for debug. add '<pre>' to format the array structure!

    echo '<pre>' . print_r($data, true) . '</pre>';

    星期五, 10月 26, 2018

    可怕的釣魚網站: 您有機會贏得一個 Google 禮物?小心別上當


    大家千萬小心

    不曉得按到了什麼東西,跑出來這個頁面。

    這個網站全是假的

    Google 才不會搞那麼無聊的抽獎。

    這個網址是
    http://trafficads.net/graun/?pubads=15bbf08c7e0bf5#

    相信應該很快就會被刪掉



    星期四, 10月 25, 2018

    WP Mail SMTP: the way to make Woocommerce email notification work in Google Cloud Platform


    40+216 Faces
    (Photo via bark, CC Licensed)


    I have to say that Mailgun is a powerful plugin to make wordpress email work because I receive the TEST email from mailgun successfully. But, I can't get any email notification through mailgun while the woocommerce get any order.

    In GCP(google cloud platform), mailgun doesn't work for woocommerce. Finally, the woocommerce new order email notification works by using G-Suite API. The following steps show how i solve this problem. (More information)


    Step 1. [Wordpress] Install WP Mail SMTP by WPForms

    Step 2. [G Suite] Create a Web Application

    Step 3. [G Suite] Grant Permissions and Send Test Email

    for complete reference, please refer to WPForms Blog

    星期日, 10月 21, 2018

    韓國瑜唱紅的『舊皮箱的流浪兒』


    舊皮箱的流浪兒


    演唱:林峰
    詞:呂金守
    曲:佚名 

    離開著阮故鄉 孤單來流浪
    不是阮愛放蕩 有話無地講
    自從我畢業後 找無頭路
    父母也年老 要靠阮前途
    做著一個男兒
    應該會...來打拼..

    手提著舊皮箱 隨風來飄流
    阮出外的主張 希望會成就
    不管伊叨一項 還是做工
    為生活不驚 一切的苦歎
    做著一個男兒
    應該會...來打拼..

    看見著面頭前 已經來都市
    他鄉的黃昏時 引人心迷醉
    故鄉的親愛的 爸爸媽媽
    請你也不免 掛念阮將來
    做著一個男兒
    應該會...來打拼..







    隨著 韓國瑜 的人氣直線上升,他的一舉一動也更容易透過「網路」被人發現。其中,他常常公開演唱的一首台語老歌『舊皮箱的流浪兒』,也重新讓大家認識。這一首由『林峰』古老的台語歌,但之後經過「葉啟田」、「洪榮宏」、「江蕙」等人許多歌星重新翻唱。

    網路的威力無窮!藉由熱門人物的宣傳,很多資訊就能輕易炸開!






    星期二, 10月 16, 2018

    美國副總統彭斯(Mike Pence)發表演說(全文中翻英)


    * 原文摘錄自白宮網站 (見原文)
    * 翻譯文字部份引用 Google翻譯
    THE VICE PRESIDENT: Thank you, Ken, for that kind introduction. To the Members of the Board of Trustees, to Dr. Michael Pillsbury, to our distinguished guests, and to all of you who, true to your mission in this place, “think about the future in unconventional ways” –- it is an honor to be back at the Hudson Institute.
    副總統:謝謝肯,很棒的介紹。致董事會成員、邁可皮爾斯伯里博士、我們所敬愛的嘉賓,以及在座真正履行使命的所有人,你們一直『以非傳統的方式思考未來』 。回到哈德森學院真是我的榮幸

    備註:哈德森學院 Hudson Institute 位於華盛頓哥倫比亞特區的美國保守主義非營利組織智庫,是美國五大保守派智庫之一。

    星期五, 10月 12, 2018

    每日(期貨/選擇權)未平倉資訊在那裡?


    Stock Crash
    (Photo via Alper Çuğun, CC License)

    本來在 Google 搜尋中輸入「未平倉」這三個字,就可以得到 台灣期貨交易所 每日的最新期貨交易結果。但不知何時,那個連結就不見了!取而代之的,是 聚財網的台指期未平倉圖表 。(其實,聚財網的資料還真的滿清楚的)

    原來,期交所的網頁資訊已經不知不覺被洗掉了,最新的未平倉資訊位址在此:






    星期一, 7月 23, 2018

    Post input array to Laravel PHP server by jQuery


    Website:


    <div><input type="checkbox" name="List[]" value="1"></div>
    <div><input type="checkbox" name="List[]" value="2"></div>
    <div><input type="checkbox" name="List[]" value="3"></div>


    js code:


        var valArr= [];
        $('input:checkbox[name^="List[]"]:checked').each(function(){
            valArr.push($(this).val());
        });
        valArr = JSON.stringify(valArr);
        $.post(<YOUR SERVER URL>,
        {
            type: 'post',
            data: valArr,
        });


    PHP server:


    $list = json_decode($request->data, true);
    var_dump($list);

    星期二, 5月 29, 2018

    使用 Imagemagick 來批次調整影像尺寸 (Resize Images with Linux with Imagemagick in Batch mode)


    在 CentOS 7 下,安裝 Imagemagick:

    我採用的方法如下:

    Step 1. 安裝 Imagemagick

    # yum install --enablerepo remi php-pear php-devel gcc

    # yum install ImageMagick ImageMagick-devel ImageMagick-perl

    # pecl install imagick

    # vim /etc/php.ini
    ; 增加以下段落
    extension=imagick.so

    # systemctl restart httpd.service

    Note:
    我的環境是 CentOS 7, php56
    過程中數度出現如 php-config 找不到、或是目錄、路徑不正確等問題。
    a. 目錄可以透過 ln -s 的方式,將所需要的檔案位置放到所需要的路徑。
    b. 安裝相關程式如 yum install php-dev

    Step 2. 建立一個批次檔案 resize.sh

    # 請列出要批次轉檔的「絕對路徑」
    FOLDER="/var/www/wordpress/wp-content/uploads"

    # 轉檔後,圖檔所允許最大的寬度
    WIDTH=640

    # 轉檔後,圖檔所允許最大的高度
    HEIGHT=640

    #PNG 圖檔所適用的指令
    #find ${FOLDER} -iname '*.png' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \;

    #JPG/JPEG 圖檔所適用的指令
    find ${FOLDER} -iname '*.jpg' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \;

    以上為 resize.sh 示範的內容,編輯完 resize.sh 之後,就直接執行

    #/bin/sh resize.sh

    這個 resize.sh 可以選擇 jpg 或 png 格式的檔案,請自行調整

    另外,執行完之後,可以使用以下指令來看看轉檔後的目錄尺寸是否變小

    # du -k

    CentOS 系統時間設定指令


    CentOS 裝好以後,怎麼把系統時間設定正確呢?

    以下指令一個接著一個輸入即可!

    # cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime

    # md5sum /usr/share/zoneinfo/Asia/Taipei

    # md5sum /etc/localtime

    # ntpdate -u time.stdtime.gov.tw

    # date -u

    熱門文章