發表文章

目前顯示的是 9月, 2019的文章

VSCode - How to ignore cv2 not recognized by pylint issue (Python + Opencv)

圖片
//note: All the configuration in this tutorial is on macOS 10.14.6, but you can solve the issue on Windows 10 too. By default, after user downloaded python extension in VSCode, and finish configuring python environment (whether Python 2.x or 3.x) . Also, pip command can work on your computer, first of all, you have to download opencv package using pip3 (command: pip3 install opencv-python ) after installed, type pip3 list and check whether opencv has already been installed. Okay, and now open VSCode and add a new python file (you can name "test.py" like what I do), copy the sample code below and paste it on your .py file like so: good, and you will see red wave line warning but when you run this file by pressing fn + F5 on keyboard, it works! Now the problem is that how to disable the annoying warning in VSCode ? It's simple. Just go to VSCode's Preferences -> Settings then in search bar type " pylint args ", yo

Swift - Create UICollectionViewController without Storyboard

圖片
After we create a new project, first thing we need to do is to delete Main.storyboard. Next Step, go to project general setting -> Deployment Info, delete "Main" on Main Interface Good, and then we go to ViewController.swift, change Subclass to UICollectionViewController, also change collectionview's background to red color to specify that we are using UICollectionViewController. import UIKit class ViewController: UICollectionViewController {     override func viewDidLoad() {         super . viewDidLoad ()         // Do any additional setup after loading the view.         collectionView . backgroundColor = UIColor . red     } } Then, go to AppDelegate.swift, and now we have to manually build what storyboard do for us. In func application( _ application: UIApplication , didFinishLaunchingWithOptions launchOptions: [ UIApplication . LaunchOptionsKey : Any ]?)   -> Bool {         // Override point for c