部落格文章訂閱


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


自訂搜尋

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


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

free counters

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) 人氣()

在 Windows XP 的命令列輸入任何指令的回應, 預設都會是英文語系, 當你的系統換成 Windows 7 或以上系統時, 假設你的預設語言是繁體中文, 則你執行程式的回應就會是中文.

看起來沒有甚麼問題,  但實際上當你寫了一隻測試程式是根據指令回應的字串做判斷時, 就會產生問題.

以 ping www.hinet.net 來說, 你會去抓 Received = 4 或其它值,

當回應字串為中文時, 就會變成 "收到 =4 "

看起來很便利, 但是會搞死人...

, , , ,

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

To configure passive mode for vsftpd you need to set some parameters in vsftpd.conf.

pasv_enable=Yes
pasv_max_port=10100
pasv_min_port=10090

This enables passive mode and restricts it to using the eleven ports for data connections. This is useful as you need to open these ports on your firewall.
iptables -I INPUT -p tcp --destination-port 10090:10100 -j ACCEPT

If after testing this all works then save the state of your firewall with

service iptables save

which will update the /etc/sysconfig/iptables file.

To do this is CentOS 7 you have to use the new firewalld, not iptables:

, ,

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