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

How backward and step are associated with model paramters update?

How are backward and step associated with model paramters update? optimizer accept the paramters of the model, it can update the parameters, but how is loss function associated with paramters? loss.backward() optimizer.step() REFERENCE: 1.pytorch - connection between loss.backward() and optimizer.step() 2.https://pytorch.org/tutorials/beginner/former_torchies/nnft_tutorial.html#forward-and-backward-function-hooks

nn_Module

nn_Module 1.Where are module parameters configured? The parameters are stored in the network node which is one of points of a network layer. Neural network layer is defined in init method of module and need to be defined as class variable; import torch.nn as nn import numpy as np class TorchDNN(nn.Module): def __init__(self, input, hidden, output): super(TorchDNN, self).__init__(); layer_hidden = nn.Linear(input, hidden, bias = True); def forward(self, input_data): pass x = np.

Github ssh key didn't work

Check the git URL configuration of your project

Github ssh key didn’t work After you config a ssh key on github, you can test your ssh connection. 1.Open Terminal. 2.Enter the following: $ ssh -T git@github.com If you see your username of github in the resulting message, that means you configure successfully. But, when you run git pull under the root of the project, the it prompt you to enter your Username of github, what is wrong?

Understanding arange, unsqueeze, repeat, stack methods in Pytorch

Understanding arange, unsqueeze, repeat, stack methods in Pytorch torch.arange(start=0, end, step=1) return 1-D tensor of size (end-start)/step which value begin from start and each value take with common differences step. torch.unsqueeze(input, dim) return a new tensor with a dimension of size one insterted at specified position; A dim value within the range [-input.dim() - 1, input.dim() + 1) can be used. tensor.repeat(size*) return a tensor; the new shape of tensor is that original shape multiplied by arguments correspondingly, if the number of paramter don’t match the original shape, then last dimension of new shape = the last dimension of original shape * last paramter;

L1 L2 Regularization - Optimizer

Optimizer: L1 L2 Regularization L1,L2 Loss function mean different type of loss function. L1: sum(Y-f(x)) lasso L2: sum(Y-f(x))^2 Ridge L1, L2 regularization : Y_predict = E(w_i(x_i)+b_i) MES = E(Y-Y_predict)^2 L1: loss = MSE + 入E|w_i| L2: loss = MES + 入E(w_i)^2 What does penalize the weights? It means add another parameters to the loss function, so

How to Label Voice with Praat for Machine Learning

Praat

How to Label Voice with Praat for Machine Learning 1.Install 1.1 Download praat 1.Open Praat: doing Phonetics by Computer website; 2.Choose your OS system on download area in the upper left conner of website; 3.Then click the praat6150_mac.dmg or praat6150_win64.zip to download file; For example, my os is MacOS, in my case I should download praat6150_mac.dmg and install it. Option: You can also download the file from github, referce to Praat in github 1.

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.

Anacode simple usage

Anacode simple usage 1.1 Download and install –Mac os Download file: click to download Install after download. Run command in terminal to see your anconda version: $conda -V conda 4.10.1 Use conda info to see conda configuration: (base) $ conda info 2.Anaconda Usage 2.1 List all enviroments (base) $ conda info -e # conda environments: # base /Users/Rhys/opt/anaconda3 2.1 create an enviroment (base) $ conda create -n py36 python=3.6 2.2 activate an enviroment (base) $ conda activate py36 (py36) $ The environment had changed after activating;

Simple AI expert Enhanced Loop

Simple AI expert Enhanced Loop Habit: Daily plan, weekly plan, month plan, 10 minute reading, Daily self-examination Loop1: Assumption->design a experiment->do->feedback->conclusion Loop2: Choose a subject->Weekly Share to my classmates->Feedback and update -> Make another share;