部落格文章訂閱


貧窮不能等,因為時間久了,你就會貧窮習慣了;
夢想不能等,因為努力晚了,人老就無能為力了;
學習不能等,因為懂得少了,就沒本事夢想成真了;
健康不能等,因為身體垮了,人生的一切就都沒了。


自訂搜尋

找不到想要的文章嗎? 請直接再下面的搜尋框裡輸入要查詢文章內容關鍵字 ,就能夠更快速的取得想要閱讀的問題喔~~謝謝大家的支持與愛護~若有任何建議事項, 歡迎透過留言板留言給我喔!!


  • 你不能決定生命的長度,但可以控制它的寬度;
  • 你不能左右天氣,但可以改變心情;
  • 你不能改變容顏,但可以展現笑容;
  • 你不能控制他人,但可以掌握自己;
  • 你不能預知明天,但可以利用今天;
  • 你不能樣樣勝利,但可以事事盡力。

free counters

由於需要寫自動將網址轉成 google 短網址, 所以需要用到 Google Short URL api, 正巧使用的是 Laravel, 所以就順勢搜尋有沒有現成的 package 可以使用, 沒想到居然真的有, 那就不要浪費!直接給他用下去!

Laravel Package for Google Short URL API -> https://github.com/mbarwick83/shorty

使用步驟:

1.  於專案目錄執行 composer require mbarwick83/shorty

2.  修改 config/app.php 在 providers 末端增加 Mbarwick83\Shorty\ShortyServiceProvider::class 後存檔

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

轉眼間已經破百開始到數了...人生第一次的破百倒數是當兵屆退伍的日子,在部隊退伍前三個月就升上兵,終於是走路有風、閒著無事到處晃的日子。

人生第二次的倒數就從今天開始,小皮球在99天就要出生,有著為人父的喜悅,說不緊張是騙人的。


期待一切平安健康、快樂長大。

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

I'm running MySql Server 5.7.11 and this sentence:

updated datetime NOT NULL DEFAULT '0000-00-00 00:00:00'

is not working. Giving the error:

ERROR 1067 (42000): Invalid default value for 'updated'

But the following:

updated datetime NOT NULL DEFAULT '1000-01-01 00:00:00'

just works.

The same case for DATE.

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

To create a migration, you may use the migrate:make command on the Artisan CLI. Use a specific name to avoid clashing with existing models

for Laravel 3:

php artisan migrate:make add_paid_to_users

for Laravel 5+:

php artisan make:migration add_paid_to_users

You then need to use the Schema::table() method (as you're accessing an existing table, not creating a new one). And you can add a column like this:

public function up()
{
    Schema::table('users', function($table) {
        $table->integer('paid');
    });
}

and don't forget to add the rollback option:

, , ,

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

Today I got again problem with PHP 7 running despite I have disabled php7.0 apache module: phpinfo was showing php 7 using fastCGI ...
... So if after you follow the below instructions you face this situation, you may need to disable the proxy_fcgi apache module:

sudo a2dismod proxy_fcgi proxy; sudo service apache2 restart

1. Re-Install PHP 5.6

What worked for me was this guide: http://www.lornajane.net/posts/2016/php-7-0-and-5-6-on-ubuntu

Actually is not required to remove php7.0, you can install php5.6 together ( also because you will have dependency problem with phpmyadmin package that required php7.0)

, , , ,

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

Remove all the stock php packages

List installed php packages with dpkg -l | grep php| awk '{print $2}' |tr "\n" " " then remove unneeded packages with sudo aptitude purge your_packages_here or if you want to directly remove them all use :

sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

Add the PPA

sudo add-apt-repository ppa:ondrej/php

Install your PHP Version

sudo apt-get update
sudo apt-get install php5.6

You can install php5.6 modules too for example

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

One of the changes introduced in Ubuntu Wily Werewolf is persistent stateless names. It means your network interfaces in ifconfig output will no longer follow the ethX pattern. This solves major problems with predictability of an interface name on Ubuntu if you have multiple cards. This applies to ethernet, WLAN and WWAN interfaces.

This originally started off due to Dell devices and SLES has defaulted to the nomenclature earlier. It’s nice to see Ubuntu adopting the same too. Both udev and systemd are involved in this change.

The udev naming convention follows different schemes:

  1. Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: eno1)
  2. Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: ens1)
  3. Names incorporating physical/geographical location of the connector of the hardware (example: enp2s0)
  4. Names incorporating the interfaces’s MAC address (example: enx78e7d1ea46da)
  5. Classic, unpredictable kernel-native ethX naming (example: eth0) – depreciated

systemd naming convention will use the same convention from above in the below order:

  1. if that information from the firmware is applicable and available
  2. if that information from the firmware is applicable and available
  3. if applicable
  4. in all other cases
  5. is not used by default, but is available if the user chooses so

It’s unlikely this will bother you. However, if you want to fallback to the older nomenclature, you need to make some changes in udev:

, , , , ,

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

Edit /etc/default/grub with your favourite editor, e.g. nano:

sudo nano /etc/default/grub

Find this line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Change it to:

GRUB_CMDLINE_LINUX_DEFAULT="text"

Update GRUB:

sudo update-grub

For systems that use systemd

This is an additional step for systemd releases, e.g. Ubuntu 15.04, the steps above for grub are still necessary.

, , , , , , , ,

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

List interfaces that tcpdump can listen on

tcpdump -D

Turn on "verbose" key in TCPDUMP to see IP and TCP header information

tcpdump -vi eth0

Turn off hostname and port lookup in TCPDUMP

tcpdump -vnni eth0

Tcpdump filter only icmp traffic

tcpdump -nni eth0 icmp

Tcpdump command to filter on ICMP type - capture only ICMP echo request

# tcpdump -nni vlan111 -e icmp[icmptype] == 8

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

說到 Log 分析大家都會先想到用 AWStats 來分析,沒錯這絕對是一個最好的解決方式,但如果你只是要簡單的分析一些資訊,就可以利用一些簡單的 shell 組合來撈出你要的資料

這篇主要是針對 Apache 的 access log 來進行分析,並提供以下範例給大家參考

取得前十名 access 最多的 IP 位址

, ,

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

namespace App\Http\Controllers;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Input;
use Validator;

class ImageController extends Controller {
    /**
     * Store an image.
     *
     * @return simple JSON response message
     */
    public function store(Request $r)
    {
        $image = Input::file('file');
        $validator = Validator::make([$image], ['image' => 'required']);
        if ($validator->fails()) {
            return $this->errors(['message' => 'Not an image.', 'code' => 400]);
        }
        $destinationPath = storage_path() . '/uploads';
        if(!$image->move($destinationPath, $image->getClientOriginalName())) {
            return $this->errors(['message' => 'Error saving the file.', 'code' => 400]);
        }
        return response()->json(['success' => true], 200);
    }
}

取自 https://github.com/danialfarid/ng-file-upload/wiki/PHP-Laravel-5-controller-example


, , , ,

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

在安裝 PHP Laravel  framework (5.1版) 後,建立一個 Laravel Project

並且使用 {!! HTML flag 引入 CSS, JavaScript , 但卻顯示 HTML Class not found 的問題.

查了一下似乎有很多人遇到相似問題.

所以我把解決方案整理如下,請參考:

指定版本建立 laravel project 檔案

, , , ,

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

Linux 底下很方便使用的網路設定管理工具 Network Manager, 具備圖形化的操作介面.

沒有圖形化介面的使用者, 可以使用 nmcli 來設定你的網路連線 .

Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }

OPTIONS
  -t[erse]                                   terse output

,

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

在Linux中用xl2tpd建立L2TP协议的VPN连接需要两个配置文件,一个是给xl2tpd的配置文件,一个是给pppd的配置文件(xl2tpd会调用pppd)。

    为说明方便,我们假设我们要建立的VPN连接的名字为testvpn,连到的l2tp服务器地址为xxx.xxx.xxx.xxx,用户名为someone,密码为passwordstring。那么该xl2tpd的配置文件应该如下所示:

1
2
3
, , , , , ,

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

問題:

I have an installation of Laravel on Wampserver. The directory is as follows:

C:\wamp\www\laravel

Now URLs are like this:

http://localhost/laravel/public/index.php/home/index

, , , ,

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()