DHCP Server on Mint

$ sudo apt install isc-dhcp-server
[sudo] password for adull: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  isc-dhcp-server-ldap
The following NEW packages will be installed:
  isc-dhcp-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 381 kB of archives.
After this operation, 864 kB of additional disk space will be used.
Get:1 http://ftp.us.debian.org/debian/ jessie/main isc-dhcp-server amd64 4.3.1-6+deb8u2 [381 kB]
Fetched 381 kB in 10s (38.1 kB/s)                                                                                                                                      
Preconfiguring packages ...
Selecting previously unselected package isc-dhcp-server.
(Reading database ... 122029 files and directories currently installed.)
Preparing to unpack .../isc-dhcp-server_4.3.1-6+deb8u2_amd64.deb ...
Unpacking isc-dhcp-server (4.3.1-6+deb8u2) ...
Processing triggers for systemd (215-17+deb8u7) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up isc-dhcp-server (4.3.1-6+deb8u2) ...
Generating /etc/default/isc-dhcp-server...
Job for isc-dhcp-server.service failed. See 'systemctl status isc-dhcp-server.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript isc-dhcp-server, action "start" failed.
Processing triggers for systemd (215-17+deb8u7) ...
$ sudo nano /etc/default/isc-dhcp-server

     INTERFACES=""
to
     INTERFACES="eth0"
$ sudo nano /etc/dhcp/dhcpd.conf

#Network : 192.168.10.0/24
#Range : 192.168.10.10 ( Starting IP ) – 192.168.10.100 ( Ending IP )
#Gateway : 192.168.10.1
#Primary DNS : 192.168.10.1
#Sec DNS : 8.8.4.4

subnet 192.168.10.0 netmask 255.255.255.0 {  #network
 range 192.168.10.10 192.168.10.100; # Range
 option domain-name-servers 192.168.10.1, 8.8.4.4; #Pri DNS , Sec DNS
 option domain-name "nano.in.th"; #Domain name
 option routers 192.168.10.1; #Gateway
 option broadcast-address 192.168.10.255; #Broadcast
 default-lease-time 600;
 max-lease-time 7200;
}
$ sudo nano /etc/network/interfaces

allow-hotplug eth0
iface eth0 inet static
	address 192.168.10.1
	netmask 255.255.255.0
	network 192.168.10.0
	broadcast 192.168.10.255
	gateway 192.168.10.1
	dns-nameservers 8.8.4.4
	dns-nameservers 192.168.0.1
	dns-nameservers 192.168.10.1
	dns-search nano.in.th
$ sudo service isc-dhcp-server restart
Posted in Debian, Linux Mint | Leave a comment

Telegram on Mint

$ sudo add-apt-repository ppa:atareao/telegram
$ sudo apt update
$ sudo apt install telegram

Screenshot at 2017-06-20 14-44-19

Posted in Linux Mint | Leave a comment

VSCode on Mint

Screenshot at 2017-06-02 15-21-10

 

Download code_1.12.2-1494422229_amd64.deb
https://go.microsoft.com/fwlink/?LinkID=760868

$ sudo dpkg -i code_1.12.2-1494422229_amd64.deb
$ curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
$ sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
$ sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
$ sudo apt update
$ sudo apt install code

https://code.visualstudio.com/docs/setup/linux

Document
https://code.visualstudio.com/docs?start=true

7 must-have Visual Studio Code extensions for Angular
View story at Medium.com
https://marketplace.visualstudio.com/items?itemName=Angular.ng-template

php
https://code.visualstudio.com/docs/languages/php

python
https://marketplace.visualstudio.com/items?itemName=donjayamanne.python

c/c++
https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools

Reactjs
https://marketplace.visualstudio.com/items?itemName=mohithg.ReactNewSnippets

Posted in Uncategorized | Leave a comment

Go Lang on Debian

https://golang.org/doc/install

Screenshot at 2017-05-26 14-00-46

$ sudo cd /opt
$ sudo curl https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz | tar zxf -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 85.8M  100 85.8M    0     0  8626k      0  0:00:10  0:00:10 --:--:-- 10.2M
$ sudo nano /etc/profile

# Point to the local installation of golang.
export GOROOT=/opt/go

# Point to the location beneath which source and binaries are installed.
export GOPATH=$HOME/go

# Ensure that the binary-release is on your PATH.
export PATH=${PATH}:${GOROOT}/bin

# Ensure that compiled binaries are also on your PATH.
export PATH=${PATH}:${GOPATH}/bin
$ /etc/profile
$ go
Go is a tool for managing Go source code.

Usage:

	go command [arguments]

The commands are:

	build       compile packages and dependencies
	clean       remove object files
	doc         show documentation for package or symbol
	env         print Go environment information
	bug         start a bug report
	fix         run go tool fix on packages
	fmt         run gofmt on package sources
	generate    generate Go files by processing source
	get         download and install packages and dependencies
	install     compile and install packages and dependencies
	list        list packages
	run         compile and run Go program
	test        test packages
	tool        run specified go tool
	version     print Go version
	vet         run go tool vet on packages

Use "go help [command]" for more information about a command.

Additional help topics:

	c           calling between Go and C
	buildmode   description of build modes
	filetype    file types
	gopath      GOPATH environment variable
	environment environment variables
	importpath  import path syntax
	packages    description of package lists
	testflag    description of testing flags
	testfunc    description of testing functions

$ go version
go version go1.8.3 linux/amd64
$ go get github.com/golang/example/hello
$ cd go/src/github.com/golang/example/hello
$ go run hello.go 
Hello, Go examples!

https://debian-administration.org/article/727/Installing_the_Go_programming_language_on_Debian_GNU/Linux

Posted in Debian, Language | Leave a comment

Flask (Lightweight Python web framework) on mint

 

$ sudo apt search python-pip
p   python-pip                      - alternative Python package installer      
idA python-pip-whl                  - alternative Python package installer
$ sudo apt install python-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Recommended packages:
  build-essential python-all-dev python-wheel
The following NEW packages will be installed:
  python-pip
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 0 B/144 kB of archives.
After this operation, 635 kB of additional disk space will be used.
Selecting previously unselected package python-pip.
(Reading database ... 647024 files and directories currently installed.)
Preparing to unpack .../python-pip_8.1.1-2ubuntu0.4_all.deb ...
Unpacking python-pip (8.1.1-2ubuntu0.4) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up python-pip (8.1.1-2ubuntu0.4) ...
$ sudo apt show python-pip
Package: python-pip
Version: 8.1.1-2ubuntu0.4
Priority: optional
Section: universe/python
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 635 kB
Depends: ca-certificates, python-pip-whl (= 8.1.1-2ubuntu0.4), python:any (<< 2.8), python:any (>= 2.7.5-5~)
Recommends: build-essential, python-all-dev (>= 2.6), python-setuptools, python-wheel
Homepage: https://pip.pypa.io/en/stable/
Download-Size: 144 kB
APT-Manual-Installed: yes
APT-Sources: http://ubuntu-mirror.totbb.net/ubuntu xenial-updates/universe amd64 Packages
Description: alternative Python package installer
 pip is a replacement for easy_install, and is intended to be an improved
 Python package installer.  It integrates with virtualenv, doesn't do partial
 installs, can save package state for replaying, can install from non-egg
 sources, and can install from version control repositories.

N: There is 1 additional record. Please use the '-a' switch to see it
$ sudo pip install Flask
The directory '/home/nano/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/nano/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting Flask
  Downloading Flask-0.12.1-py2.py3-none-any.whl (82kB)
    100% |████████████████████████████████| 92kB 691kB/s 
Requirement already satisfied: itsdangerous>=0.21 in /usr/lib/python2.7/dist-packages (from Flask)
Collecting click>=2.0 (from Flask)
  Downloading click-6.7-py2.py3-none-any.whl (71kB)
    100% |████████████████████████████████| 71kB 3.6MB/s 
Requirement already satisfied: Werkzeug>=0.7 in /usr/lib/python2.7/dist-packages (from Flask)
Requirement already satisfied: Jinja2>=2.4 in /usr/lib/python2.7/dist-packages (from Flask)
Requirement already satisfied: MarkupSafe in /usr/lib/python2.7/dist-packages (from Jinja2>=2.4->Flask)
Installing collected packages: click, Flask
Successfully installed Flask-0.12.1 click-6.7
$ nano hello.py


#!/usr/bin/python

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello Nano!"

if __name__ == "__main__":
    app.run('0.0.0.0')


$ chmod +x hello.py
$ ./hello.py
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
$ curl http://localhost:5000
Hello Nano!

Screenshot at 2017-04-25 12-21-17

 

http://www.w3ii.com/th/flask/flask_quick_guide.html

https://jahchaisang.gitbooks.io/fra142-gui/content/chapter2-0.html

Posted in Framework, Language, Linux Mint | Leave a comment

Canon MX477 on Mint

Download : http://support-asia.canon-asia.com/contents/ASIA/EN/0100586902.html

$ tar -xf canon\ mx477/cnijfilter-mx470series-4.10-1-deb.tar.gz
$ cd canon\ mx477/cnijfilter-mx470series-4.10-1-deb/
$ sudo ./install.sh 
[sudo] password for nano: 
==================================================

Canon Inkjet Printer Driver
Version 4.10
Copyright CANON INC. 2001-2014

==================================================
Command executed = sudo dpkg -iG ./packages/cnijfilter-common_4.10-1_amd64.deb
(Reading database ... 642383 files and directories currently installed.)
Preparing to unpack .../cnijfilter-common_4.10-1_amd64.deb ...
Unpacking cnijfilter-common (4.10-1) over (4.10-1) ...
Setting up cnijfilter-common (4.10-1) ...
Processing triggers for libc-bin (2.23-0ubuntu7) ...
/sbin/ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbolic link

/sbin/ldconfig.real: /usr/lib32/nvidia-375/libEGL.so.1 is not a symbolic link

Command executed = sudo dpkg -iG ./packages/cnijfilter-mx470series_4.10-1_amd64.deb
(Reading database ... 642383 files and directories currently installed.)
Preparing to unpack .../cnijfilter-mx470series_4.10-1_amd64.deb ...
Unpacking cnijfilter-mx470series (4.10-1) over (4.10-1) ...
Setting up cnijfilter-mx470series (4.10-1) ...
Processing triggers for libc-bin (2.23-0ubuntu7) ...
/sbin/ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbolic link

/sbin/ldconfig.real: /usr/lib32/nvidia-375/libEGL.so.1 is not a symbolic link

/sbin/ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbolic link

/sbin/ldconfig.real: /usr/lib32/nvidia-375/libEGL.so.1 is not a symbolic link


#=========================================================#
#  Register Printer
#=========================================================#
Next, register the printer to the computer.
Connect the printer, and then turn on the power.
To use the printer on the network, connect the printer to the network.
When the printer is ready, press the Enter key.
> 

#=========================================================#
#  Connection Method
#=========================================================#
 1) USB
 2) Network
Select the connection method.[1]2

Searching for printers...


#=========================================================#
#  Select Printer
#=========================================================#
Select the printer.
If the printer you want to use is not listed, select Update [0] to search again.
To cancel the process, enter [Q].
-----------------------------------------------------------
 0) Update
-----------------------------------------------------------
Target printers detected (MAC address  IP address)
1) Canon MX470 series (D8-49-2F-AF-9B-80 192.168.111.101)
-----------------------------------------------------------
Currently selected:[1] Canon MX470 series (D8-49-2F-AF-9B-80 192.168.111.101)
Enter the value. [1]

#=========================================================#
#  Register Printer
#=========================================================#
Enter the printer name.[MX470LAN-1]MX477
Command executed = sudo /usr/sbin/lpadmin -p MX477 -P /usr/share/cups/model/canonmx470.ppd -v cnijbe://Canon/?port=net&serial=D8-49-2F-AF-9B-80 -E

#=========================================================#
#  Set as Default Printer
#=========================================================#
Do you want to set this printer as the default printer?
Enter [y] for Yes or [n] for No.[y]

#=========================================================#
Installation has been completed.
Printer Name : MX477
Select this printer name for printing.
#=========================================================#

Screenshot at 2017-04-18 15-42-11

 

 

Download : http://support-asia.canon-asia.com/contents/ASIA/EN/0100587102.html

$ tar -xf scangearmp-mx470series-2.30-1-deb.tar.gz
$ cd scangearmp-mx470series-2.30-1-deb
$ sudo ./install.sh 
[sudo] password for nano: 
==================================================

ScanGear MP
Version 2.30
Copyright CANON INC. 2007-2014

==================================================
Command executed = sudo dpkg -iG ./packages/scangearmp-common_2.30-1_amd64.deb
Selecting previously unselected package scangearmp-common.
(Reading database ... 642383 files and directories currently installed.)
Preparing to unpack .../scangearmp-common_2.30-1_amd64.deb ...
Unpacking scangearmp-common (2.30-1) ...
Setting up scangearmp-common (2.30-1) ...
Processing triggers for libc-bin (2.23-0ubuntu7) ...
/sbin/ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbolic link

/sbin/ldconfig.real: /usr/lib32/nvidia-375/libEGL.so.1 is not a symbolic link

Command executed = sudo dpkg -iG ./packages/scangearmp-mx470series_2.30-1_amd64.deb
Selecting previously unselected package scangearmp-mx470series.
(Reading database ... 642410 files and directories currently installed.)
Preparing to unpack .../scangearmp-mx470series_2.30-1_amd64.deb ...
Unpacking scangearmp-mx470series (2.30-1) ...
Setting up scangearmp-mx470series (2.30-1) ...
Processing triggers for libc-bin (2.23-0ubuntu7) ...
/sbin/ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbolic link

/sbin/ldconfig.real: /usr/lib32/nvidia-375/libEGL.so.1 is not a symbolic link

Installation has been completed.

$ scangearmp

Screenshot at 2017-04-16 23-27-48

Screenshot at 2017-04-16 23-38-06

Posted in Linux Mint | Leave a comment

Yii2 via composer and highcharts extension on mint

$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
$ composer global require "fxp/composer-asset-plugin:^1.2.0"
Changed current directory to /home/adull/.composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing fxp/composer-asset-plugin (v1.3.0): Loading from cache
Writing lock file
Generating autoload files
$ composer install
Composer could not find a composer.json file in /home/adull/Documents/html/yii/composer
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
$ composer create-project --prefer-dist yiisoft/yii2-app-basic basic
Installing yiisoft/yii2-app-basic (2.0.11)
  - Installing yiisoft/yii2-app-basic (2.0.11): Loading from cache
Created project in basic
Loading composer repositories with package information
Updating dependencies (including require-dev)
Reading bower.json of bower-asset/punycode (v1.3.0)       
Could not fetch https://api.github.com/repos/bestiejs/punycode.js/contents/bower.json?ref=40e15ef43a44fdcb2b60fb631384168ef8e0181f, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+nano+2017-03-31+1343
to retrieve a token. It will be stored in "/home/adull/.composer/auth.json" for future use by Composer.
Token (hidden): 

https://github.com/settings/tokens

screencapture-github-settings-tokens-new-1490945930695

token

Token stored successfully.
Reading bower.json of bower-asset/jquery.inputmask (3.1.56)
Reading bower.json of bower-asset/jquery.inputmask (3.1.55)

Reading bower.json of bower-asset/jquery.inputmask (3.1.53)
Reading bower.json of bower-asset/jquery (1.7.2)           
Package operations: 59 installs, 0 updates, 0 removals  
  - Installing yiisoft/yii2-composer (2.0.5): Downloading (100%)         
  - Installing swiftmailer/swiftmailer (v5.4.6): Downloading (100%)         
  - Installing bower-asset/jquery (2.2.4): Downloading (100%)         
  - Installing bower-asset/yii2-pjax (v2.0.5): Downloading (100%)         
  - Installing bower-asset/punycode (v1.3.2): Downloading (100%)         
  - Installing cebe/markdown (1.1.1): Downloading (100%)         
  - Installing ezyang/htmlpurifier (v4.9.2): Downloading (100%)         
  - Installing bower-asset/jquery.inputmask (3.3.4): Downloading (100%)         
  - Installing yiisoft/yii2 (2.0.11.2): Downloading (100%)         
  - Installing yiisoft/yii2-swiftmailer (2.0.6): Downloading (100%)         
  - Installing bower-asset/bootstrap (v3.3.7): Downloading (100%)         
  - Installing yiisoft/yii2-bootstrap (2.0.6): Downloading (100%)         
  - Installing yiisoft/yii2-debug (2.0.9): Downloading (100%)         
  - Installing bower-asset/typeahead.js (v0.11.1): Downloading (100%)         
  - Installing phpspec/php-diff (v1.1.0): Downloading (100%)         
  - Installing yiisoft/yii2-gii (2.0.5): Downloading (100%)         
  - Installing fzaninotto/faker (v1.6.0): Downloading (100%)         
  - Installing yiisoft/yii2-faker (2.0.3): Downloading (100%)         
  - Installing psr/log (1.0.2): Downloading (100%)         
  - Installing symfony/debug (v3.2.6): Downloading (100%)         
  - Installing symfony/polyfill-mbstring (v1.3.0): Downloading (100%)         
  - Installing symfony/console (v3.2.6): Downloading (100%)         
  - Installing stecman/symfony-console-completion (0.7.0): Downloading (100%)         
  - Installing sebastian/diff (1.4.1): Downloading (100%)         
  - Installing sebastian/recursion-context (2.0.0): Downloading (100%)         
  - Installing sebastian/exporter (2.0.0): Downloading (100%)         
  - Installing sebastian/comparator (1.2.4): Downloading (100%)         
  - Installing behat/gherkin (v4.4.5): Downloading (100%)         
  - Installing symfony/dom-crawler (v3.2.6): Downloading (100%)         
  - Installing symfony/css-selector (v3.2.6): Downloading (100%)         
  - Installing symfony/browser-kit (v3.2.6): Downloading (100%)         
  - Installing symfony/yaml (v3.2.6): Downloading (100%)         
  - Installing symfony/event-dispatcher (v3.2.6): Downloading (100%)         
  - Installing symfony/finder (v3.2.6): Downloading (100%)         
  - Installing psr/http-message (1.0.1): Downloading (100%)         
  - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)         
  - Installing sebastian/version (2.0.1): Downloading (100%)         
  - Installing sebastian/environment (2.0.0): Downloading (100%)         
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)         
  - Installing phpunit/php-token-stream (1.4.11): Downloading (100%)         
  - Installing phpunit/php-text-template (1.2.1): Downloading (100%)         
  - Installing phpunit/php-file-iterator (1.4.2): Downloading (100%)         
  - Installing phpunit/php-code-coverage (4.0.7): Downloading (100%)         
  - Installing sebastian/resource-operations (1.0.0): Downloading (100%)         
  - Installing sebastian/object-enumerator (2.0.1): Downloading (100%)         
  - Installing sebastian/global-state (1.1.1): Downloading (100%)         
  - Installing doctrine/instantiator (1.0.5): Downloading (100%)         
  - Installing phpunit/phpunit-mock-objects (3.4.3): Downloading (100%)         
  - Installing phpunit/php-timer (1.0.9): Downloading (100%)         
  - Installing webmozart/assert (1.2.0): Downloading (100%)         
  - Installing phpdocumentor/reflection-common (1.0): Downloading (100%)         
  - Installing phpdocumentor/type-resolver (0.2.1): Downloading (100%)         
  - Installing phpdocumentor/reflection-docblock (3.1.1): Downloading (100%)         
  - Installing phpspec/prophecy (v1.7.0): Downloading (100%)         
  - Installing myclabs/deep-copy (1.6.0): Downloading (100%)         
  - Installing phpunit/phpunit (5.7.17): Downloading (100%)         
  - Installing codeception/base (2.2.10): Downloading (100%)         
  - Installing codeception/verify (0.3.3): Downloading (100%)         
  - Installing codeception/specify (0.4.6): Downloading (100%)         
symfony/console suggests installing symfony/filesystem ()
symfony/console suggests installing symfony/process ()
symfony/browser-kit suggests installing symfony/process ()
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.1)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
codeception/base suggests installing flow/jsonpath (For using JSONPath in REST module)
codeception/base suggests installing phpseclib/phpseclib (for SFTP option in FTP Module)
codeception/base suggests installing league/factory-muffin (For DataFactory module)
codeception/base suggests installing league/factory-muffin-faker (For Faker support in DataFactory module)
codeception/base suggests installing symfony/phpunit-bridge (For phpunit-bridge support)
Writing lock file
Generating autoload files
> yii\composer\Installer::postCreateProject
chmod('runtime', 0777)...done.
chmod('web/assets', 0777)...done.
chmod('yii', 0755)...done.
$ cd basic
$ ./yii serve -p=8888

Screenshot at 2017-03-31 14-31-18

Install yii2-highcharts Extensions

$ cd basic
$ composer require --prefer-dist miloschuman/yii2-highcharts-widget "dev-master"
./composer.json has been updated
The "extra.asset-installer-paths" option is deprecated, use the "config.fxp-asset.installer-paths" option
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals                                                    
  - Installing bower-asset/highcharts (v5.0.10): Downloading (100%)         
  - Installing miloschuman/yii2-highcharts-widget (dev-master ba5e5c4): Downloading (100%)         
Writing lock file
Generating autoload files

https://github.com/miloschuman/yii2-highcharts

$ nano basic/assets/HighchartsAsset.php

<?php
namespace app\assets;

use yii\web\AssetBundle;

class HighchartsAsset extends AssetBundle
{
 public $sourcePath = '@bower/highcharts';
 public $css = [];
 public $js = [
 'highcharts.js',
 'highcharts-more.js',
 ];
 
 public $depends = [
 'yii\web\JqueryAsset'
 ];
}
?>
$ nano basic/controllers/HighchartsController.php

<?php
namespace app\controllers;

use yii\web\Controller;

class HighchartsController extends Controller
{
 public function actionIndex()
 {
 return $this->render('index');
 }
}
?>
$ nano basic/views/highcharts/index.php

<?php
use app\assets\HighchartsAsset;

HighchartsAsset::register($this);
$this->title = 'Highcharts Test';
?>

<?php $this->registerJs(" $(function () { $('#my-chart').highcharts({ title: { text: 'Monthly Average Temperature', x: -20 //center }, subtitle: { text: 'Source: WorldClimate.com', x: -20 }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, yAxis: { title: { text: 'Temperature (°C)' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { valueSuffix: '°C' }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'middle', borderWidth: 0 }, series: [{ name: 'Tokyo', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] }, { name: 'New York', data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5] }, { name: 'Berlin', data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0] }, { name: 'London', data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8] }] }); }); ") ?>
 Screenshot at 2017-04-07 15-14-23

http://localhost/yii/composer/basic/web/index.php?r=highcharts

Screenshot at 2017-04-07 15-08-20

Posted in Framework, Linux Mint | Leave a comment