Iklan1

Tuesday, December 10, 2019

TIPS : Boot initramfs repair


Assalamualaykum.
Cerita kali ini masuk kantor agak pagi.
Seperti biasa, nyalahin kompie. gak lengkap klo belum nyalahin linux. maklum dikantor allow hanya windows untuk kerja.

Gelotak klotak
Nyalahin kompi
buka software default kerja
nyalahin VM
Baaam, boot-initramfs. Apaan nih
linux aye gak bisa start

waddawwwww
sumpek ah
terpaksa cari solusi

ternyata gini aka
Alhamdulillah

fsck -yv /dev/sda1
reboot


Thursday, September 26, 2019

Linux Cara Kontrol Brightness Monitor Via Command Line

namapc@namapc-baru:~$ sudo xrandr | grep " connected" | cut -f1 -d " "
[sudo] password for namapc:
LVDS-1
namapc@namapc-baru:~$ sudo xrandr --output LVDS-1 --brightness 0.5
namapc@namapc-baru:~$ sudo xrandr --output LVDS-1 --brightness 0.7
namapc@namapc-baru:~$ sudo xrandr --output LVDS-1 --brightness 0.8
namapc@namapc-baru:~$ sudo xrandr --output LVDS-1 --brightness 0.85
namapc@namapc-baru:~$ sudo xrandr --output LVDS-1 --brightness 1

Cara Install Paket Dot deb (.deb) Extention

namapc@namapc-baru:/media/namapc/namapcLinuxData/namapc/Downloads$ sudo dpkg -i google-chrome-stable_current_amd64.deb
[sudo] password for namapc:
Selecting previously unselected package google-chrome-stable.
(Reading database ... 176331 files and directories currently installed.)
Preparing to unpack google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (71.0.3578.98-1) ...
Setting up google-chrome-stable (71.0.3578.98-1) ...
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160824-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.59ubuntu1) ...
namapc@namapc-baru:/media/namapc/namapcLinuxData/namapc/Downloads$ sudo add-apt-repository ppa:vokoscreen-dev/vokoscreen
Cannot add PPA: 'ppa:~vokoscreen-dev/ubuntu/vokoscreen'.
ERROR: '~vokoscreen-dev' user or team does not exist.
namapc@namapc-baru:/media/namapc/namapcLinuxData/namapc/Downloads$

Atau langsung dengan command apt-get

namapc@namapc-baru:/media/namapc/namapcLinuxData/namapc/Downloads$ sudo apt-get install vokoscreen
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  ffmpeg libavdevice-ffmpeg56 libdc1394-utils libqt4-test libsdl1.2debian libvdpau1 mesa-vdpau-drivers vdpau-driver-all
Suggested packages:
  ffmpeg-doc libvdpau-va-gl1 nvidia-vdpau-driver nvidia-legacy-340xx-vdpau-driver
The following NEW packages will be installed:
  ffmpeg libavdevice-ffmpeg56 libdc1394-utils libqt4-test libsdl1.2debian libvdpau1 mesa-vdpau-drivers vdpau-driver-all vokoscreen
0 upgraded, 9 newly installed, 0 to remove and 577 not upgraded.
Need to get 4.559 kB of archives.
After this operation, 29,2 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://id.archive.ubuntu.com/ubuntu xenial/main amd64 libsdl1.2debian amd64 1.2.15+dfsg1-3 [168 kB]
Get:2 http://id.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 libavdevice-ffmpeg56 amd64 7:2.8.15-0ubuntu0.16.04.1 [70,7 kB]
Get:3 http://id.archive.ubuntu.com/ubuntu xenial/main amd64 libvdpau1 amd64 1.1.1-3ubuntu1 [25,5 kB]
Get:4 http://id.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 ffmpeg amd64 7:2.8.15-0ubuntu0.16.04.1 [1.289 kB]
Get:5 http://id.archive.ubuntu.com/ubuntu xenial/main amd64 libqt4-test amd64 4:4.8.7+dfsg-5ubuntu2 [61,1 kB]                                
Get:6 http://id.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mesa-vdpau-drivers amd64 18.0.5-0ubuntu0~16.04.1 [1.967 kB]              
Get:7 http://id.archive.ubuntu.com/ubuntu xenial/main amd64 vdpau-driver-all amd64 1.1.1-3ubuntu1 [4.674 B]                                  
Get:8 http://id.archive.ubuntu.com/ubuntu xenial/universe amd64 vokoscreen amd64 2.4.0-2 [967 kB]                                            
Get:9 http://id.archive.ubuntu.com/ubuntu xenial/universe amd64 libdc1394-utils amd64 2.2.4-1 [6.366 B]                                      
Fetched 4.559 kB in 55s (82,0 kB/s)                                                                                                          
Selecting previously unselected package libsdl1.2debian:amd64.
(Reading database ... 176438 files and directories currently installed.)
Preparing to unpack .../libsdl1.2debian_1.2.15+dfsg1-3_amd64.deb ...
Unpacking libsdl1.2debian:amd64 (1.2.15+dfsg1-3) ...
Selecting previously unselected package libavdevice-ffmpeg56:amd64.
Preparing to unpack .../libavdevice-ffmpeg56_7%3a2.8.15-0ubuntu0.16.04.1_amd64.deb ...
Unpacking libavdevice-ffmpeg56:amd64 (7:2.8.15-0ubuntu0.16.04.1) ...
Selecting previously unselected package libvdpau1:amd64.
Preparing to unpack .../libvdpau1_1.1.1-3ubuntu1_amd64.deb ...
Unpacking libvdpau1:amd64 (1.1.1-3ubuntu1) ...
Selecting previously unselected package ffmpeg.
Preparing to unpack .../ffmpeg_7%3a2.8.15-0ubuntu0.16.04.1_amd64.deb ...
Unpacking ffmpeg (7:2.8.15-0ubuntu0.16.04.1) ...
Selecting previously unselected package libqt4-test:amd64.
Preparing to unpack .../libqt4-test_4%3a4.8.7+dfsg-5ubuntu2_amd64.deb ...
Unpacking libqt4-test:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Selecting previously unselected package mesa-vdpau-drivers:amd64.
Preparing to unpack .../mesa-vdpau-drivers_18.0.5-0ubuntu0~16.04.1_amd64.deb ...
Unpacking mesa-vdpau-drivers:amd64 (18.0.5-0ubuntu0~16.04.1) ...
Selecting previously unselected package vdpau-driver-all:amd64.
Preparing to unpack .../vdpau-driver-all_1.1.1-3ubuntu1_amd64.deb ...
Unpacking vdpau-driver-all:amd64 (1.1.1-3ubuntu1) ...
Selecting previously unselected package vokoscreen.
Preparing to unpack .../vokoscreen_2.4.0-2_amd64.deb ...
Unpacking vokoscreen (2.4.0-2) ...
Selecting previously unselected package libdc1394-utils.
Preparing to unpack .../libdc1394-utils_2.2.4-1_amd64.deb ...
Unpacking libdc1394-utils (2.2.4-1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160824-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libsdl1.2debian:amd64 (1.2.15+dfsg1-3) ...
Setting up libavdevice-ffmpeg56:amd64 (7:2.8.15-0ubuntu0.16.04.1) ...
Setting up libvdpau1:amd64 (1.1.1-3ubuntu1) ...
Setting up ffmpeg (7:2.8.15-0ubuntu0.16.04.1) ...
Setting up libqt4-test:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Setting up mesa-vdpau-drivers:amd64 (18.0.5-0ubuntu0~16.04.1) ...
Setting up vdpau-driver-all:amd64 (1.1.1-3ubuntu1) ...
Setting up vokoscreen (2.4.0-2) ...
Setting up libdc1394-utils (2.2.4-1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
 

Wednesday, July 31, 2019

Perbedaan antara Python 2 dan Python 3

Assalamualaykum,
Berikut beberapa perbedaan antara python 2 dan python 3 :

1. Python 2 menggunakan print sebagai pernyataan dan digunakan sebagai print "sesuatu" untuk mencetak beberapa string pada konsol. Di sisi lain, Python 3 menggunakan print sebagai fungsi dan digunakan sebagai print ("sesuatu") untuk mencetak sesuatu di konsol.
2. Python 2 menggunakan fungsi raw_input () untuk menerima input pengguna. Lalu mengembalikan string sebagai nilai, yang diketik oleh pengguna. Untuk mengubahnya menjadi integer, kita perlu menggunakan fungsi int() dengan Python. Di sisi lain, Python 3 menggunakan fungsi input() yang secara otomatis menafsirkan jenis input yang dimasukkan oleh pengguna. Namun, kami dapat memberikan nilai ini ke jenis apa pun dengan menggunakan fungsi primitif (int(), str(), dll.).
3.Dalam Python 2, tipe string implisit adalah ASCII, sedangkan, dalam Python 3, tipe string implisit adalah Unicode.
4. Python 3 tidak mengandung fungsi xrange() dari Python 2. Xrange() adalah varian dari range() fungsi yang mengembalikan objek xrange yang bekerja mirip dengan Java iterator. range() mengembalikan daftar misalnya rentang fungsi (0,3) berisi 0, 1, 2.
5. Penanganan pengecualian (Exception handling) yang berbeda antara python 2 dan 3.

Demikian, Semoga bermanfaat
Wassalamulaykum

Saturday, July 27, 2019

TIPS : Install opencv-python

Assalamualaykum,
Berikut command install opencv library untuk python dengan PIP

C:\Windows\system32>pip install opencv-contrib-python
Collecting opencv-contrib-python
  Downloading https://files.pythonhosted.org/packages/aa/4c/a3125e25da4b121b4077
c575eee8a691ffabb5d97afc5ae832fd5a7015e3/opencv_contrib_python-4.1.0.25-cp37-cp3
7m-win32.whl (30.9MB)
     |████████████████████████████████| 30.9MB 26kB/s
Requirement already satisfied: numpy>=1.14.5 in c:\users\alooo\appdata\local\pro
grams\python\python37-32\lib\site-packages (from opencv-contrib-python) (1.16.4)

Installing collected packages: opencv-contrib-python
Successfully installed opencv-contrib-python-4.1.0.25

C:\Windows\system32>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> ^Z

Coba tes dengan script ini :

import numpy as np
import cv2

# Load an color image in grayscale
img = cv2.imread('opencv-tes.jpg',0)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
(2)
import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread('opencv-tes.jpg',0)
plt.imshow(img, cmap = 'gray', interpolation = 'bicubic')
plt.xticks([]), plt.yticks([])  # to hide tick values on X and Y axis
plt.show()

Semoga bermanfaat
Wassalamualaykum

TIPS : Switch Python Version On Ubuntu 16.04

Assalamualaykum,
Cara menukar versi python yang akan digunakan pada Linux Ubuntu 16.04.

Berikut langkahnya:

1. Penggunaan linux default-nya
pcname@pcname:~$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
KeyboardInterrupt
>>>
[1]+  Stopped                 python

2. lihat versi python yang terinstall
pcname@pcname:~$ ls /usr/bin/python*
/usr/bin/python   /usr/bin/python2.7  /usr/bin/python3.5   /usr/bin/python3m
/usr/bin/python2  /usr/bin/python3    /usr/bin/python3.5m

3. eksekusi koman
pcname@pcname:~$ sudo nano ~/.bashrc

4. Setelah muncul file bashrc tambahkan rule
alias python='/usr/bin/python3.5'

5. eksekusi . ~/.bashrc
pcname@pcname:~$ . ~/.bashrc

6. cek versi python terbaru
pcname@pcname:~$ python --version
Python 3.5.2

pcname@pcname:~$ python
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[2]+  Stopped                 /usr/bin/python3.5

Demikian, Semoga bermanfaat
Wassalamulaykum

Friday, July 26, 2019

TIPS : Instalasi Scikit-image Sampai Tahap Tes

Assalamualaykum,
Berikut adalah proses instalasi scikit-image pasca install python sampai tahap tes.

E:\tesScikit-image>python -V
Python 3.7.4

E:\tesScikit-image>python get-pip.py
Collecting pip
  Downloading https://files.pythonhosted.org/packages/62/ca/94d32a6516ed197a491d
17d46595ce58a83cbb2fca280414e57cd86b84dc/pip-19.2.1-py2.py3-none-any.whl (1.4MB)

     |████████████████████████████████| 1.4MB 182kB/s
Collecting wheel
  Using cached https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f22
7dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl
Installing collected packages: pip, wheel
  Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
Successfully installed pip-19.2.1 wheel-0.33.4

E:\tesScikit-image>pip -V
pip 19.2.1 from c:\users\pcname\appdata\local\programs\python\python37-32\lib\sit
e-packages\pip (python 3.7)

E:\tesScikit-image>pip install scikit-image
Collecting scikit-image
  Downloading https://files.pythonhosted.org/packages/68/49/46dc899a804fc4ed19f5
0708c64bcc6e7323529c960721dfe935c279f933/scikit_image-0.15.0-cp37-none-win32.whl
 (24.8MB)
     |████████████████████████████████| 24.8MB 113kB/s
Collecting imageio>=2.0.1 (from scikit-image)
  Downloading https://files.pythonhosted.org/packages/af/0a/943c965d372dae0b1f14
82677d29030ab834351a61a9a632fd62f27f1523/imageio-2.5.0-py3-none-any.whl (3.3MB)
     |████████████████████████████████| 3.3MB 192kB/s
Collecting PyWavelets>=0.4.0 (from scikit-image)
  Downloading https://files.pythonhosted.org/packages/e2/21/76b982c168b728dceed5
00ae716ac0433989e21ceeaddae184c98ca20fb1/PyWavelets-1.0.3-cp37-none-win32.whl (4
.1MB)
     |████████████████████████████████| 4.1MB 198kB/s
Collecting pillow>=4.3.0 (from scikit-image)
  Downloading https://files.pythonhosted.org/packages/a1/db/d855fe2625bf3fee24b0
d6138b6d10ebaee9a36b104fa77b71713c1f669f/Pillow-6.1.0-cp37-cp37m-win32.whl (1.7M
B)
     |████████████████████████████████| 1.8MB 168kB/s
Collecting networkx>=2.0 (from scikit-image)
  Downloading https://files.pythonhosted.org/packages/85/08/f20aef11d4c343b557e5
de6b9548761811eb16e438cee3d32b1c66c8566b/networkx-2.3.zip (1.7MB)
     |████████████████████████████████| 1.8MB 126kB/s
Collecting numpy (from imageio>=2.0.1->scikit-image)
  Downloading https://files.pythonhosted.org/packages/07/46/656c25b39fc152ea525e
ef14b641993624a6325a8ae815b200de57cff0bc/numpy-1.16.4-cp37-cp37m-win32.whl (10.0
MB)
     |████████████████████████████████| 10.0MB 164kB/s
Collecting decorator>=4.3.0 (from networkx>=2.0->scikit-image)
  Downloading https://files.pythonhosted.org/packages/5f/88/0075e461560a1e750a0d
cbf77f1d9de775028c37a19a346a6c565a257399/decorator-4.4.0-py2.py3-none-any.whl
Building wheels for collected packages: networkx
  Building wheel for networkx (setup.py) ... done
  Created wheel for networkx: filename=networkx-2.3-py2.py3-none-any.whl size=15
56414 sha256=cb839e06732ac262baac6634690f8ae7723e9d6612957ea4074d1d252fe7e616
  Stored in directory: C:\Users\pcname\AppData\Local\pip\Cache\wheels\de\63\64\36
99be2a9d0ccdb37c7f16329acf3863fd76eda58c39c737af
Successfully built networkx
Installing collected packages: numpy, pillow, imageio, PyWavelets, decorator, ne
tworkx, scikit-image
Successfully installed PyWavelets-1.0.3 decorator-4.4.0 imageio-2.5.0 networkx-2
.3 numpy-1.16.4 pillow-6.1.0 scikit-image-0.15.0

E:\tesScikit-image>pip install scipy
Collecting scipy
  Downloading https://files.pythonhosted.org/packages/be/cc/6f7842a4d9aa7f51155f
849185631e1201df255742de84d724ac33bff723/scipy-1.3.0-cp37-cp37m-win32.whl (27.1M
B)
     |████████████████████████████████| 27.1MB 142kB/s
Requirement already satisfied: numpy>=1.13.3 in c:\users\pcname\appdata\local\pro
grams\python\python37-32\lib\site-packages (from scipy) (1.16.4)
Installing collected packages: scipy
Successfully installed scipy-1.3.0

E:\tesScikit-image>pip install PyQt5
Collecting PyQt5
  Downloading https://files.pythonhosted.org/packages/c9/e3/302602473ad0997d9a86
b69324350bcfd13ac137ffa76806d6f58bda1e1d/PyQt5-5.13.0-5.13.0-cp35.cp36.cp37.cp38
-none-win32.whl (41.9MB)
     |████████████████████████████████| 42.0MB 93kB/s
Collecting PyQt5_sip<13,>=4.19.14 (from PyQt5)
  Downloading https://files.pythonhosted.org/packages/38/10/4ee0be6337eddcdf9070
659b314416c66b73198505d61995684ff5538e69/PyQt5_sip-4.19.18-cp37-none-win32.whl (
44kB)
     |████████████████████████████████| 51kB 297kB/s
Installing collected packages: PyQt5-sip, PyQt5
Successfully installed PyQt5-5.13.0 PyQt5-sip-4.19.18

E:\tesScikit-image>pip install pyqt
Collecting pyqt
  ERROR: Could not find a version that satisfies the requirement pyqt (from vers
ions: none)
ERROR: No matching distribution found for pyqt

E:\tesScikit-image>pip install PyQt
Collecting PyQt
  ERROR: Could not find a version that satisfies the requirement PyQt (from vers
ions: none)
ERROR: No matching distribution found for PyQt

E:\tesScikit-image>pip3 install pyqt
Collecting pyqt
  ERROR: Could not find a version that satisfies the requirement pyqt (from vers
ions: none)
ERROR: No matching distribution found for pyqt

E:\tesScikit-image>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from skimage import data
>>> from skimage.viewer import ImageViewer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\pcname\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\skimage\viewer\__init__.py", line 2, in <module>
    from .viewers import ImageViewer, CollectionViewer
  File "C:\Users\pcname\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\skimage\viewer\viewers\__init__.py", line 1, in <module>
    from .core import ImageViewer, CollectionViewer
  File "C:\Users\pcname\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\skimage\viewer\viewers\core.py", line 10, in <module>
    from ..widgets import Slider
  File "C:\Users\pcname\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\skimage\viewer\widgets\__init__.py", line 19, in <module>
    from .core import *
  File "C:\Users\pcname\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\skimage\viewer\widgets\core.py", line 2, in <module>
    from ..utils import RequiredAttr
  File "C:\Users\pcname\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\skimage\viewer\utils\__init__.py", line 1, in <module>
    from .core import *
  File "C:\Users\pcname\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\skimage\viewer\utils\core.py", line 4, in <module>
    import matplotlib as mpl
ModuleNotFoundError: No module named 'matplotlib'
>>> from skimage.viewer imp^Z
  File "<stdin>", line 1
    from skimage.viewer imp→
                          ^
SyntaxError: invalid syntax
>>> ^Z


E:\tesScikit-image>pip install matplotlib
Collecting matplotlib
  Downloading https://files.pythonhosted.org/packages/71/13/0720e50bd8988299137f
d7e936e4d494b45a473c5fe70d72cd6c1bd79163/matplotlib-3.1.1-cp37-cp37m-win32.whl (
8.9MB)
     |████████████████████████████████| 8.9MB 160kB/s
Requirement already satisfied: numpy>=1.11 in c:\users\pcname\appdata\local\progr
ams\python\python37-32\lib\site-packages (from matplotlib) (1.16.4)
Collecting kiwisolver>=1.0.1 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/20/6a/e5fff2ed776ab0cd11d7
c1d5d3e5e549952464a6f1b9084b7ecbd8341352/kiwisolver-1.1.0-cp37-none-win32.whl (4
4kB)
     |████████████████████████████████| 51kB 172kB/s
Collecting cycler>=0.10 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440
ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl
Collecting python-dateutil>=2.1 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f
3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.
whl (226kB)
     |████████████████████████████████| 235kB 252kB/s
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/ff/2c/afc36631a9e0dc9f2b8b
d4c19fa2d330cbe07d6679a1c0910418a200acad/pyparsing-2.4.1.1-py2.py3-none-any.whl
(64kB)
     |████████████████████████████████| 71kB 306kB/s
Requirement already satisfied: setuptools in c:\users\pcname\appdata\local\progra
ms\python\python37-32\lib\site-packages (from kiwisolver>=1.0.1->matplotlib) (40
.8.0)
Collecting six (from cycler>=0.10->matplotlib)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe8
98238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: kiwisolver, six, cycler, python-dateutil, pyparsi
ng, matplotlib
Successfully installed cycler-0.10.0 kiwisolver-1.1.0 matplotlib-3.1.1 pyparsing
-2.4.1.1 python-dateutil-2.8.0 six-1.12.0

E:\tesScikit-image>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from skimage import data
>>> from skimage.viewer import ImageViewer
>>> image = data.coins()
>>> viewer = ImageViewer(image)
>>> viewer.show()

Demikian semoga bermanfaat.
Wassalamualaykum

TIPS : Scikit-image error Viewer requires Qtwarn

Berikut adalah error warning yang muncul pada saat kita ingin menampilkan gambar dari scikit-image :

UserWarning: Viewer requires Qtwarn('Viewer requires Qt')

Langkah menampilkan Image atau gambar dari scikit-image :
1. Install PyQt yang sesuai dengan Scikit-image-nya
D:\tesF>pip install PyQt5
Collecting PyQt5
  Using cached https://files.pythonhosted.org/packages/c9/e3/302602473ad0997d9a86b69324350bcfd13ac137ffa76806d6f58bda1e1d/PyQt5-5.13.0-5.13.0-cp35.cp36.cp37.cp38-none-win32.whl
Collecting PyQt5_sip<13,>=4.19.14 (from PyQt5)
  Downloading https://files.pythonhosted.org/packages/38/10/4ee0be6337eddcdf9070659b314416c66b73198505d61995684ff5538e69/PyQt5_sip-4.19.18-cp37-none-win32.whl (44kB)
     |████████████████████████████████| 51kB 1.7MB/s
Installing collected packages: PyQt5-sip, PyQt5
Successfully installed PyQt5-5.13.0 PyQt5-sip-4.19.18

2. tes dengan sample program ini
from skimage import data
from skimage.viewer import ImageViewer

image = data.coins()
viewer = ImageViewer(image)
viewer.show()

HASIL :

Akan muncul gambar coin tersebut.


Akan menampilkan gambar dan histogram :

from skimage import data
from skimage.exposure import histogram
from skimage.viewer import ImageViewer
from skimage.viewer.plugins.lineprofile import LineProfile
image = data.coins()
viewer = ImageViewer(image)
viewer += LineProfile(viewer)
overlay, data = viewer.show()[0]

Thursday, July 25, 2019

TIPS: Error saat import skimage library dari scikit-image

scikit-image adalah paket pengolah gambar Python yang bekerja dengan array numpy. Paket ini diimpor sebagai skimage.

Error muncul pada saat kita meng-import library skimage.

Berikut langkah-langkah memperbaiki error tersebut.

C:\WINDOWS\system32>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import skimage
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\pc-name\AppData\Roaming\Python\Python37\site-packages\skimage\__init__.py", line 127, in <module>
    from .util.dtype import (img_as_float32,
  File "C:\Users\pc-name\AppData\Roaming\Python\Python37\site-packages\skimage\util\__init__.py", line 12, in <module>
    from ._montage import montage
  File "C:\Users\pc-name\AppData\Roaming\Python\Python37\site-packages\skimage\util\_montage.py", line 2, in <module>
    from .. import exposure
  File "C:\Users\pc-name\AppData\Roaming\Python\Python37\site-packages\skimage\exposure\__init__.py", line 1, in <module>
    from .exposure import histogram, equalize_hist, \
  File "C:\Users\pc-name\AppData\Roaming\Python\Python37\site-packages\skimage\exposure\exposure.py", line 3, in <module>
    from ..color import rgb2gray
  File "C:\Users\pc-name\AppData\Roaming\Python\Python37\site-packages\skimage\color\__init__.py", line 1, in <module>
    from .colorconv import (convert_colorspace,
  File "C:\Users\pc-name\AppData\Roaming\Python\Python37\site-packages\skimage\color\colorconv.py", line 55, in <module>
    from scipy import linalg
  File "C:\Users\pc-name\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\linalg\__init__.py", line 195, in <module>
    from .misc import *
  File "C:\Users\pc-name\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
    from .blas import get_blas_funcs
  File "C:\Users\pc-name\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\linalg\blas.py", line 214, in <module>
    from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.

Langkah Pertama :

C:\WINDOWS\system32>pip uninstall scipy
Uninstalling scipy-1.3.0:
  Would remove:
    c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages\scipy-1.3.0.dist-info\*
    c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages\scipy\*
Proceed (y/n)? y
  Successfully uninstalled scipy-1.3.0
Langkah Kedua :
C:\WINDOWS\system32>pip uninstall scikit-image
Uninstalling scikit-image-0.15.0:
  Would remove:
    c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages\scikit_image-0.15.0.dist-info\*
    c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages\skimage\*
    c:\users\pc-name\appdata\local\programs\python\python37-32\scripts\skivi.exe
Proceed (y/n)? y
  Successfully uninstalled scikit-image-0.15.0
Langkah Ketiga :
C:\WINDOWS\system32>pip install scikit-image
Collecting scikit-image
  Downloading https://files.pythonhosted.org/packages/68/49/46dc899a804fc4ed19f50708c64bcc6e7323529c960721dfe935c279f933/scikit_image-0.15.0-cp37-none-win32.whl (24.8MB)
     |████████████████████████████████| 24.8MB 6.4MB/s
Requirement already satisfied: imageio>=2.0.1 in c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages (from scikit-image) (2.5.0)
Requirement already satisfied: PyWavelets>=0.4.0 in c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages (from scikit-image) (1.0.3)
Requirement already satisfied: networkx>=2.0 in c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages (from scikit-image) (2.3)
Requirement already satisfied: pillow>=4.3.0 in c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages (from scikit-image) (6.1.0)
Requirement already satisfied: numpy in c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages (from imageio>=2.0.1->scikit-image) (1.16.4)
Requirement already satisfied: decorator>=4.3.0 in c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages (from networkx>=2.0->scikit-image) (4.4.0)
Installing collected packages: scikit-image
Successfully installed scikit-image-0.15.0

Langkah Keempat :
C:\WINDOWS\system32>pip install scipy
Collecting scipy
  Downloading https://files.pythonhosted.org/packages/be/cc/6f7842a4d9aa7f51155f849185631e1201df255742de84d724ac33bff723/scipy-1.3.0-cp37-cp37m-win32.whl (27.1MB)
     |████████████████████████████████| 27.1MB 6.4MB/s
Requirement already satisfied: numpy>=1.13.3 in c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages (from scipy) (1.16.4)
Installing collected packages: scipy
Successfully installed scipy-1.3.0

HASIL, Berikut hasil eksekusi script dari command prompt, jika tidak ada error berarti proses intalasi kamu berhasil

C:\WINDOWS\system32>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import skimage
>>> from skimage import data
>>> coins = data.coins()
>>> hist, hist_centers = histogram(coins)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'histogram' is not defined
>>> from skimage.exposure import histogram
>>> hist, hist_centers = histogram(coins)
>>> from skimage.feature import canny
>>> edges = canny(coins/255.)
>>> from scipy import ndimage as ndi
>>> fill_coins = ndi.binary_fill_holes(edges)
>>> label_objects, nb_labels = ndi.label(fill_coins)
>>> sizes = np.bincount(label_objects.ravel())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'np' is not defined
>>> from scipy import ndimage as ndi
>>> fill_coins = ndi.binary_fill_holes(edges)
>>> import numpy
>>> fill_coins = ndi.binary_fill_holes(edges)
>>> sizes = np.bincount(label_objects.ravel())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'np' is not defined
>>> import numpy as np
>>> sizes = np.bincount(label_objects.ravel())
>>> mask_sizes = sizes > 20
>>> mask_sizes[0] = 0
>>> coins_cleaned = mask_sizes[label_objects]
>>> markers = np.zeros_like(coins)
>>> markers[coins < 30] = 1
>>> markers[coins > 150] = 2
>>> from skimage.filters import sobel
>>> elevation_map = sobel(coins)
>>> markers = np.zeros_like(coins)
>>> markers[coins < 30] = 1
>>> markers[coins > 150] = 2
>>> from skimage.morphology import watershed
>>> segmentation = watershed(elevation_map, markers)
>>> segmentation = ndi.binary_fill_holes(segmentation - 1)
>>> labeled_coins, _ = ndi.label(segmentation)

catatan :
C:\WINDOWS\system32>python -V
Python 3.7.4

C:\WINDOWS\system32>pip -V
pip 19.1.1 from c:\users\pc-name\appdata\local\programs\python\python37-32\lib\site-packages\pip (python 3.7)

script pythonnya :

from skimage import data
from skimage.exposure import histogram
from scipy import ndimage as ndi
import numpy as np

coins = data.coins()
hist, hist_centers = histogram(coins)
from skimage.feature import canny
edges = canny(coins/255.)
fill_coins = ndi.binary_fill_holes(edges)
label_objects, nb_labels = ndi.label(fill_coins)
sizes = np.bincount(label_objects.ravel())
mask_sizes = sizes > 20
mask_sizes[0] = 0
coins_cleaned = mask_sizes[label_objects]
markers = np.zeros_like(coins)
markers[coins < 30] = 1
markers[coins > 150] = 2
from skimage.filters import sobel
elevation_map = sobel(coins)
markers = np.zeros_like(coins)
markers[coins < 30] = 1
markers[coins > 150] = 2
from skimage.morphology import watershed
segmentation = watershed(elevation_map, markers)
segmentation = ndi.binary_fill_holes(segmentation - 1)
labeled_coins, _ = ndi.label(segmentation)


Sunday, July 21, 2019

TIPS : Install Pip Python, Scikit Image Pada Windows

Install scikit_image pada windows :

software yang dibutuhkan
python
pip (peng-install paket python)untuk menginstal scikit_image
python package scikit_image yang sesuai versi python
python package scipy yang sesuai versi python

Jika setelah install pyhton command pip tidak bekerja
D:\Download>pip install scikit_image-0.15.0-cp38-cp38m-win_amd64.whl
scikit_image-0.15.0-cp38-cp38m-win_amd64.whl is not a supported wheel on this platform.
You are using pip version 19.0.3, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
lakukan upgrade

D:\Download>python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 5.8MB/s
Installing collected packages: pip
  Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
Successfully installed pip-19.1.1

jika sudah upgrade muncul error

D:\Download>pip install scikit_image-0.15.0-cp38-cp38m-win_amd64.whl
ERROR: scikit_image-0.15.0-cp38-cp38m-win_amd64.whl is not a supported wheel on this platform.

lakukan dengan get-py linknya di https://bootstrap.pypa.io/get-pip.py
D:\Download>python get-pip.py
Collecting pip
  Using cached https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl
Installing collected packages: pip, wheel
  Found existing installation: pip 19.1.1
    Uninstalling pip-19.1.1:
      Successfully uninstalled pip-19.1.1
Successfully installed pip-19.1.1 wheel-0.33.4

jika masih muncul

D:\Download>pip install scipy-1.3.0-cp37-cp37m-win_amd64.whl
ERROR: scipy-1.3.0-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.

lakukan instal scipy yang sesuai paket pyhton-nya dan platformnya (32 atau 64 bit)
Processing d:\download\scipy-1.3.0-cp37-cp37m-win32.whl
Collecting numpy>=1.13.3 (from scipy==1.3.0)
  Downloading https://files.pythonhosted.org/packages/07/46/656c25b39fc152ea525eef14b641993624a6325a8ae815b200de57cff0bc/numpy-1.16.4-cp37-cp37m-win32.whl (10.0MB)
     |████████████████████████████████| 10.0MB 544kB/s
Installing collected packages: numpy, scipy
Successfully installed numpy-1.16.4 scipy-1.3.0

D:\Download>pip install scikit_image-0.15.0-cp37-cp37m-win32.whl
Processing d:\download\scikit_image-0.15.0-cp37-cp37m-win32.whl
Collecting imageio>=2.0.1 (from scikit-image==0.15.0)
  Downloading https://files.pythonhosted.org/packages/af/0a/943c965d372dae0b1f1482677d29030ab834351a61a9a632fd62f27f1523/imageio-2.5.0-py3-none-any.whl (3.3MB)
     |████████████████████████████████| 3.3MB 2.2MB/s
Collecting pillow>=4.3.0 (from scikit-image==0.15.0)
  Downloading https://files.pythonhosted.org/packages/a1/db/d855fe2625bf3fee24b0d6138b6d10ebaee9a36b104fa77b71713c1f669f/Pillow-6.1.0-cp37-cp37m-win32.whl (1.7MB)
     |████████████████████████████████| 1.8MB ...
Collecting networkx>=2.0 (from scikit-image==0.15.0)
  Downloading https://files.pythonhosted.org/packages/85/08/f20aef11d4c343b557e5de6b9548761811eb16e438cee3d32b1c66c8566b/networkx-2.3.zip (1.7MB)
     |████████████████████████████████| 1.8MB ...
Collecting PyWavelets>=0.4.0 (from scikit-image==0.15.0)
  Downloading https://files.pythonhosted.org/packages/e2/21/76b982c168b728dceed500ae716ac0433989e21ceeaddae184c98ca20fb1/PyWavelets-1.0.3-cp37-none-win32.whl (4.1MB)
     |████████████████████████████████| 4.1MB 6.4MB/s
Requirement already satisfied: numpy in c:\users\iocn-2017-pc-025\appdata\local\programs\python\python37-32\lib\site-packages (from imageio>=2.0.1->scikit-image==0.15.0) (1.16.4)
Collecting decorator>=4.3.0 (from networkx>=2.0->scikit-image==0.15.0)
  Downloading https://files.pythonhosted.org/packages/5f/88/0075e461560a1e750a0dcbf77f1d9de775028c37a19a346a6c565a257399/decorator-4.4.0-py2.py3-none-any.whl
Building wheels for collected packages: networkx
  Building wheel for networkx (setup.py) ... done
  Stored in directory: C:\Users\IOCN-2017-PC-025\AppData\Local\pip\Cache\wheels\de\63\64\3699be2a9d0ccdb37c7f16329acf3863fd76eda58c39c737af
Successfully built networkx
Installing collected packages: pillow, imageio, decorator, networkx, PyWavelets, scikit-image
Successfully installed PyWavelets-1.0.3 decorator-4.4.0 imageio-2.5.0 networkx-2.3 pillow-6.1.0 scikit-image-0.15.0

Semoga bermanfaat. Thanks

Sunday, June 16, 2019

TIPS : PHP Creating Database (OOP)

 TIPS : Membuat database dengan PHP (Object-oriented Programming)

Codding : (Kodingnya)

<?php
$servername = "localhost";//hostname or ip address
$username = "root"; //username database
$password = "password";//assword Database

/* Create connection */
$conn = new mysqli($servername, $username, $password);

/* Check connection */
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}  
/* Create database */
$sql = "CREATE DATABASE newDB";

/* Check Result OK/NOT */
if ($conn->query($sql) === TRUE) {
    echo "Successfully";
}
else
{
    echo "Error creating database: " . $conn->error;
}
/* closed connection */
$conn->close();
?>

Capture : (Tampilannya)






Monday, January 7, 2019

TIPS : SQLite "Database is locked"


Database is locked”

Jadi, jika kamu menghadapi hal yang sama maka kamu berada di tempat yang tepat untuk menemukan solusi query bagaimana memperbaiki database kesalahan SQLite dikunci. Mari cari tahu alasan kesalahan ini sebelum mencari solusinya.
Alasan yang Bertanggung Jawab atas Kesalahan Database Terkunci


Kode kesalahan ini terjadi ketika pengguna mencoba melakukan dua operasi yang tidak tepat pada database pada detail yang sama dan pada koneksi database yang sama. Kode kesalahan ini menunjukkan bahwa operasi tidak dapat dilanjutkan karena bertemu dengan transaksi yang menggunakan koneksi database yang sama atau transaksi yang menggunakan koneksi database yang berbeda dengan menggunakan cache bersama.

Lihat Video Demonstrasi Berikut:
Demonstrasi Error SQLite