Yaohong

为了真相不惜被羞辱

What is the purpose of layering the architecture in a Flutter project? How should it be structured?

What is the purpose of layering the architecture in a Flutter project? How should it be structured? 1.The purpose of layering the architecture in a Flutter project The purpose of layering the architecture in a Flutter project is to enhance code maintainability, promote a clear separation of concerns, promote reusability, improve testability, and enhance scalability. 2.What is maintainability? Maintainability is defined as the probability that a failed component or system will be restored or repaired to a specified condition within a specified period or time when maintenance is performed in accordance with prescribed procedures.

Must-know information about Swift

Key Swift concepts you should be aware of

Must-know information about Swift entry point main? print log print("Hello swift") let name = "swift" print("Hello, \(name)") print("Hello, \(name1 ?? name)")// If the optional value is missing, the default value is used instead. Variable, Constant Int: On a 32-bit platform, Int is the same size as Int32. On a 64-bit platform, Int is the same size as Int64. UInt: On a 32-bit platform, UInt is the same size as UInt32.

The Flutter Plugin Project Files

The Flutter Plugin Project Files Creating the plugin project $ flutter create --org com.example --template=plugin --platforms=android,ios,linux,macos,windows hello_plugin Signing iOS app for device deployment using developer identity: "Apple Development: Yaohong Huang (WS3UUERGF9)" Creating project hello_plugin... Resolving dependencies in hello_plugin... (3.3s) Got dependencies in hello_plugin. Resolving dependencies in hello_plugin/example... (1.1s) Got dependencies in hello_plugin/example. Wrote 161 files. All done! Your plugin code is in hello_plugin/lib/hello_plugin.dart. Your example app code is in hello_plugin/example/lib/main.dart. Host platform code is in the android, ios, linux, macos, windows directories under hello_plugin.

The Widget tree, Element tree, and Rendering Object tree in flutter

The Widget tree, Element tree, Rendering Object tree in flutter The purpose of the three type of trees in Flutter: Widget tree: hold the config; Element tree: hold a spot in the UI hierarchy and manage parent/child relationship Rendering object tree: size and paint itself, lay out children; Entry-point binding.dart void runApp(Widget app){ WidgetsFlutterBinding.ensureInitialized() ..attachRootWidget(app) ..scheduleWarmUpFrame(); } Resouce: https://www.youtube.com/watch?v=996ZgFRENMs At what point are the root nodes for these three tree types created?

The project files generated by 'flutter create --template=plugin_ffi' using dart:ffi to call C APIs

The project files generated by ‘flutter create –template=plugin_ffi’ using dart:ffi to call C APIs Flutter mobile and desktop apps can use the dart:ffi library to call native C APIs. Here are the project files generated by executing the following command: flutter create --platforms=android,ios,macos,windows,linux --template=plugin_ffi native_add flutter version: flutter_macos_3.10.5-stable Reference: 1.Binding to native Android code using dart:ffi 2.Binding to native iOS code using dart:ffi Notes: 1.The FFI library can only bind

The method with the same name from the last mixin will override the previous ones in dart

The method with the same name from the last mixin will override the previous ones in dart TestMixin file: class MyObject{ init(){ print("draw object"); } } mixin Circle{ init(){ print("draw circle"); } } mixin Square{ init(){ print("draw Square"); } } class MyShape extends MyObject with Circle, Square{ init() { super.init(); print("draw MyShape"); } } void main() { MyShape shape = MyShape(); shape.init(); } //Output: draw Square draw MyShape

Comparison Of Programing Language

Comparison Of Programing Language Here are the release dates of the following programming languages: C: C was first released on March 8, 1972. Objective-C: Objective-C was first released on 1984. C++: C++ was first released in 1985. Python: Python was first released on February 20, 1991. Java: Java was first released on May 23, 1995. PHP: PHP was first released on June 8, 1995. Dart: Dart was first announced on

Rhythmically Intermittent When my Iphone 12 Connect To MacOS

解决iphone连接到macOS时,反复的断开重连

Rhythmically Intermittent When my Iphone 12 Connect To MacOS Recently, when my iPhone connects to MacOS, the battery icon on the phone alternates between showing the charging (lightning bolt icon) for a few seconds and then disappearing (no charging battery icon). This continuous loop prevents the phone from charging through MacOS and also hinders the ability to debug iPhone apps. Mac system version with the issue: macOS Monterey Version 12.7.3

Xcode or Android Studio is unable to list my iPhone device on MacOS

Xcode or Android Studio is unable to list my iPhone device I encountered an issue where my iPhone12 device was not listed in Android Studio while I was developing. The issue was dispeared after I restart my macOS, but it occurred again when I reopened my MacBook Pro from sleep mode. I noticed a new process running in Activity Monitor during the issue occurred. Here is the process list while

Distribution failed with errors When developing ios App

Distribution failed with errors When developing ios App Distribution failed with errors: Asset validation failed The product archive is invalid. The Info.plist must contain a LSApplicationCategoryType key, whose value is the UTI for a valid category. For more details, see "Submitting your Mac apps to the App Store". (ID: 67f59c1b-bb08-4694-978f-11d07ff31357) Solve this issue by add following codes on <project root folder>/macos/Runner/Info.plist: <key>LSApplicationCategoryType</key> <string>public.app-category.productivity</string> the value of LSApplicationCategoryType refer https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype

Flutter HTTP host maven.google.com is not reachable in Windows

Flutter HTTP host https://maven.google.com/ is not reachable in Windows 10 It shows the following error messages after executing flutter doctor in terminal prompt in Windows 10. Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 2.10.3, on Microsoft Windows [Version 10.0.19044.1586], locale zh-CN) [√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [√] Chrome - develop

Github API Basic Authentication Example

Github API Basic Authentication Example 1.Generate Personal access tokens Open this page Generate Personal access tokens and click Generate new token to get a token; 2.Use access token to request Github REST api 2.1 Install requests with pip; pip install requests 2.2 Sustitute GITHUB_API_USER_NAME with your user name and GITHUB_API_PERSONAL_TOKEN with the token you got in step one, then run the following code; from requests import Request, Session from requests.exceptions import ConnectionError, Timeout, TooManyRedirects def getRateLimit(): url = 'https://api.

Laravel配置阿里云企业邮箱

Laravel配置阿里云企业邮箱 企业邮箱POP、SMTP、IMAP地址列表如下: (阿里云邮箱web端通用访问地址:https://qiye.

How to Read a Image in Python

How to Read a Image in Python There are three ways to read a image, the codes is showing below. image_path = "fasterRCNN/faster-rcnn-keras-master/img/street.jpg"; from PIL import Image import numpy as np image = Image.open(image_path) # RGB tmp_image = np.array(image) print("PIL open shape:",tmp_image.shape, tmp_image) # load with cv2 import cv2 image = cv2.imread(image_path) # mode: BGR print("cv2 imread shape:", image.shape) # (width,height,channel) # load with matplotlib import matplotlib.image as mpimg image = mpimg.

Differences On Numpyp.Floor And Python Int method.md

Differences On Numpyp.Floor And Python Int method.md numpy.floor Return the floor of the input. The floor of the scalar x is the largest integer i, such that i <= x; np.floor() will not change its data type; Example: import numpy as np tmp_list = list([-3.3, -2.22, -1.56, -0.56, 0.56, 1.56, 2.22, 3.33]) tmp_list = np.array(tmp_list) print("type(tmp_list[0]):", type(tmp_list[0]) ) print("type(np.floor(tmp_list)[0]):", type(np.floor(tmp_list)[0]) ) print("np.floor(tmp_list):", np.floor(tmp_list)) # Output: # type(tmp_list[0]): <class 'numpy.float64'> # type(np.

How does numpy add two arrays with different shapes?

How does numpy add two arrays with different shapes? Numpy has a add method which add two numpy array. Arithmetic operation + does the same thing as Numpy.add; 1.Add a same shapes array Let’s see a example. import numpy as np list1 = np.array([1, 2, 3]); list2= np.array([10, 20, 30]); print("list1:",list1,"list2:",list2); # Print: list1: [1 2 3] list2: [10 20 30] added_list = list1 + list2; print("added_list.shape:",added_list.shape,"\nadded_list:",added_list); # Print: # added_list.

Understanding Transpose

Understanding Numpy Transpose 1.Transpose is to switch the row and column indices of the matrix A; x = np.arange(8).reshape((4,2)) print(x) print(x.T) # output: # [[0 1] # x # [2 3] # [4 5] # [6 7]] # [[0 2 4 6] # x.T # [1 3 5 7]] x = np.arange(9).reshape((3,3)) print(x) print(x.T) print(x.shape, x.T.shape) # output: # [[0 1 2] # [3 4 5] # [6 7 8]] # [[0 3 6] # [1 4 7] # [2 5 8]] x = np.

What do `*args` and `**kwargs` mean in python function?

What do *args and **kwargs mean in python function? *args means we can pass an arbitrary number of arguments to the function; Similarly, **kwargs allow we pass many key=value argument to the function; *args *args iterable: def my_sum(*args): result = 0 # Iterating over the Python args tuple for x in args: result += x return result print(my_sum(1, 2, 3)) # output: 6 The * is a unpacking operator; def print_three_things(a, b, c): print( 'a = {0}, b = {1}, c = {2}'.

Understanding Numpy expand_dims

Inserting 1 into the shape brackets base on the axis value

Understanding Numpy expand_dims Shape (n,)(n is a number) means it has only one dimension. The number of values is shape brackets represents the number of dimensions. import numpy as np arr = np.array([1,2,3,4,5]); print("arr shape: ",arr.shape) print("arr shape: ",arr) arr2 = np.expand_dims(arr, 0); print("expand_dims axis=0, shape:",arr2.shape) print("expand_dims axis=0, arr2:",arr2) arr2 = np.expand_dims(arr, 1); print("expand_dims axis=1, shape:",arr2.shape) print("expand_dims axis=1, arr2:",arr2) output: arr shape: (5,) arr shape: [1 2 3 4 5] expand_dims axis=0, shape: (1, 5) expand_dims axis=0, arr2: [[1 2 3 4 5]] expand_dims axis=1, shape: (5, 1) expand_dims axis=1, arr2: [[1] [2] [3] [4] [5]] numpy.

Sed

Sed sed is a steam editor. sed treats multiple input files as one long stream. The full format for invoking sed is: sed OPTIONS... [SCRIPT] [INPUTFILE...] Some common OPTIONS: -n to suppress output, sed -n '45p' file.txt this command prints only line 45 of input file; -e options are used to specify a script expression, such as sed -e 's/hello/world/' input.txt > output.txt; -f specify a script file, such as sed -f myscript.