#Create camera service
- Create file /etc/systems/system/camera.service
[Unit] Description=Flood Camera FTP Scan # Requires=mysqld.service memcached.service After=network.target [Service] User=username Group=groupname Type=simple TimeoutSec=0 PIDFile=/var/run/php_camera_scan.pid WorkingDirectory=/folder/to/working ExecStart=/usr/local/php72/bin/php -f /folder/to/file.php 2>&1 > /folder/to/store/log/file.log KillMode=mixed Restart=on-failure RestartSec=42s [Install] WantedBy=default.target
#Run service
systemctl start camera systemctl stop camera systemctl restart camera
Server มี RAM 32GB nginx + php 8.3
ลองตั้งค่า config ในไฟล์ /etc/mysql/my.cmf
[mysqld] # ตั้งค่าขนาดที่แนะนำ innodb_buffer_pool_size = 16G # แบ่ง Buffer Pool เป็นส่วนย่อยเพื่อลดการแย่งทรัพยากร (แนะนำ 1GB ต่อ 1 Instance) innodb_buffer_pool_instances = 16 # (ถ้ามี) ตั้งค่าขีดจำกัดล่างให้ระบบยืดหยุ่น innodb_buffer_pool_size_auto_min = 8G innodb_buffer_pool_size_auto_shrink = ON
ลองปรับขนาดแบบ Dynamic
sql SET GLOBAL innodb_buffer_pool_size = 20G;
ปล. เคยลองแล้วไม่ได้ผล เขาบอกว่า ระบบจะค่อยๆ ปรับขนาดใน Background โดยแบ่งเป็นส่วนๆ (Chunks) จนครบตามที่คุณสั่ง
ลองตรวจสอบด้วยคำสั่ง
SHOW GLOBAL VARIABLES LIKE 'innodb_buffer_pool_%';
SELECT CEILING(Total_InnoDB_Bytes*1.6/POWER(1024,3)) RIBPS FROM (SELECT SUM(data_length+index_length) Total_InnoDB_Bytes FROM information_schema.tables WHERE engine='InnoDB') A;
SELECT (PagesData*PageSize)/POWER(1024,3) DataGB FROM (SELECT variable_value PagesData FROM information_schema.global_status WHERE variable_name='Innodb_buffer_pool_pages_data') A, (SELECT variable_value PageSize FROM information_schema.global_status WHERE variable_name='Innodb_page_size') B;
sudo crontab -e
@reboot sleep 30 && /usr/bin/curl "https://example.com/api/system/issue/add?type=Server+Reboot&url=https://softganz.com&date=$(date +%Y-%m-%dT%H:%M:%S)&agent=crontab&referer=boot"
Create new app
flutter create --org com.yourdomain appname
Change app version
File: pubspec.yaml
version: 1.0.00+1
Create app icon
Add dependencie in file pubspec.yaml
And adddependencies: ... flutterlaunchericons: ^0.14.4
flutterlaunchericons: imagepath: "assets/icons/logo512.png" android: true ios: true removealphaios: true
Then run command in terminal
# dart run flutterlaunchericons:main
เอาคำว่า "DEBUG" ของเธอคืนไป
ใส่ไว้ใน MaterialApp
debugShowCheckedModeBanner: false
Change AndroidManifest.xml
File: android/app/src/main/AndroidManifest.xml
Change from
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
To
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:dist="http://schemas.android.com/apk/distribution"
>
Add permission
File: android/app/src/main/AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESSNETWORKSTATE" />
<uses-permission android:name="android.permission.WRITEEXTERNALSTORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESSFINELOCATION" />
<uses-permission android:name="android.permission.ACCESSCOARSELOCATION" />
<uses-feature android:name="android.hardware.camera" />
Change app label
File: android/app/src/main/AndroidManifest.xml
android:label="My App"
InAppWebView
Add InAppWebView provider
<provider
android:name="com.pichillilorenzo.flutterinappwebviewandroid.InAppWebViewFileProvider"
android:authorities="${applicationId}.flutterinappwebviewandroid.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILEPROVIDERPATHS"
android:resource="@xml/provider_paths" />
</provider>
Flutter command
Clean
flutter clean
Get
flutter pub get
Run release
flutter run --release
Add dependencies แล้ว แต่ import package ไม่ได้
Close project and re-open projectflutter packages get
Build app for Play Store
Generate JKS file : ถ้ายังไม่มีการสร้างไฟล์ .jks ให้สร้างขึ้นมาก่อน
ดูข้อมูลในไฟล์ .jkskeytool -genkey -v -keystore /Users/name/appname.jks -keyalg RSA -keysize 2048 -validity 10000 -alias release
ดูข้อมูลในไฟล์ .apkkeytool -v -list -keystore appname.jks
keytool -printcert -jarfile appname.apk
#กำหนดการ keystore ไว้ใน app สร้างไฟล์ [project]/android/key.properties แล้ว copy code ด้านล่างไปใส่
storePassword=<password from previous step> keyPassword=<password from previous step> keyAlias=upload storeFile=<location of the key store file, such as /Users/<user name>/upload-keystore.jks>
คำเตือน เก็บรักษาไฟล์ key.properties ไว้ให้ดี อย่างส่งขึ้น git เด็ดขาด
กำหนดค่าเพื่อ signing ใน gradle
1.แก้ไขไฟล์ [project]/android/app/build.gradle.kts
import java.util.Properties
import java.io.FileInputStream
val keyProperties = Properties().apply {
val file = rootProject.file("key.properties")
if (file.exists()) {
load(FileInputStream(file))
}
}
android {
...
}
2.หา buildTypes
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now,
// so flutter run --release works.
signingConfig signingConfigs.debug
}
}
แทนที่ด้วย
signingConfigs {
create("release") {
keyAlias = keyProperties["keyAlias"] as String
keyPassword = keyProperties["keyPassword"] as String
storeFile = keyProperties["storeFile"]?.let { file(it) }
storePassword = keyProperties["storePassword"] as String
}
// You can also create other signing configs like "debug" if needed
}
buildTypes {
release {
signingConfig = signingConfigs.getByName("release")
// signingConfig signingConfigs.release
}
}
Build
flutter build appbundle
ผลลัพท์ของการ build จะอยู่ที่
build/app/outputs/bundle/release/app-release.aab
ติดขั้นตอนอัพโหลดขึ้น play store
"Your Android App Bundle is signed with the wrong key. Ensure that your App Bundle is signed with the correct signing key and try again. Your App Bundle is expected to be signed with the certificate with fingerprint"
ลองหาทางแก้ไข ก็ไม่หาย แต่พอลองอัพหลายครั้ง ก็ยังขึ้น error แต่ปุ่มให้ SAVE สามารถใช้งานได้ ก็เลยผ่าน
ลองอัพ version ใหม่ ปรากฎว่า ไม่ขึ้น error
App Permission
หัวข้ออื่น
ที่มา
- มาลองสร้าง Flutter App กันเถอะ
- ประสบการณ์ Build flutter on iOS ครั้งแรก
- webview_flutter 2.0.2
- Different ways to change the status bar and navigation bar color (iOS and Android) in Flutter
- Flutter Launcher Icons
- How to use user-agent in webview-flutter Flutter?
- Flutter webview intercept and add headers to all requests
- Webview in flutter not working getting a platform error
- Flutter BottomNavigationBar not working with more than three items
ที่มา:
Backup to remote server
Connect remove server via folder
sshfs username@example.com:/folder localfolder
Backup with rsync
rsync -trv /folder/src/ /folder/dest/
Backup with copy
cp -R /folder/src /folder/dest &
Shortcut
- Command palette : Cmd ⌘ + P
- Warp text : Option ⌥ + Z
- Undo: Cmd ⌘ + Z
- Redo: Cmd ⌘ + Shift ⇧ + Z
- Bookmark next: Cmd ⌘ + Option ⌥ + L
- Bookmark previous: Cmd ⌘ + Option ⌥ + J
- Bookmark toggle: Cmd ⌘ + Option ⌥ + K
Settings
- Text wrapping by default -> "editor.wordWrap": "on"
- Access the json file with the settings by typing CTRL + SHIFT + P, then typing 'open default settings (JSON)'
How can I customize the space-to-tab conversion factor in VS Code?
Code → Preferences → Settings
// The number of spaces a tab is equal to. This setting is overridden // based on the file contents wheneditor.detectIndentationis true. "editor.tabSize": 2,// Insert spaces when pressing Tab. This setting is overriden // based on the file contents when
editor.detectIndentationis true. "editor.insertSpaces": false,// When opening a file,
editor.tabSizeandeditor.insertSpaces// will be detected based on the file contents. Set to false to keep // the values you've explicitly set, above. "editor.detectIndentation": false
ที่มา How can I customize the tab-to-space conversion factor in VS Code?
Setting ให้ ตำแหน่ง cursor ยังคงอยู่ที่เดิมเมื่อ vscode refocus
โดยการ disable the setting window:click through inactive หรือ window.clickThroughInactive to false
ที่มา [Can you stop VS Code from moving the cursor when you tap to refocus a window?](https://stackoverflow.com/questions/61789575/can-you-stop-vs-code-from-moving-the-cursor-when-you-tap-to-refocus-a-window)
ตรวจสอบ OS version
cat /etc/os-release
ขั้นตอน 1: Update เวอร์ชั่นปัจจุบันของ Ubuntu
***
sudo apt update && apt upgrade -y
ขั้นตอน 2: เตรียมสำหรับการ upgrade:
***
sudo apt install update-manager-core
ขั้นตอน 3: Run the Upgrade:
***
sudo do-release-upgrade
***
ขั้นตอน 4: Post-Upgrade Cleanup:
***
sudo apt autoremove && apt clean
ขั้นตอน 5: ตรวจสอบผลการอัพเกรด: ***
cat /etc/os-release
***
หากเกิดความผิดพลาด สามารถเปลี่ยน sources แล้ว update
First, ensure that all the contents of /etc/apt/sources.list and /etc/apt/sources.list.d/ubuntu.sources contain the word noble instead of jammy. If it contains jammy, replace that with noble.
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo sed -i 's/jammy/noble/g' /etc/apt/sources.list sudo sed -i 's/jammy/noble/g' /etc/apt/sources.list.d/ubuntu.sources
sudo apt update sudo apt full-upgrade
หลังจาก upgrade แล้ว start apache ไม่ได้ เนื่องจากมีการเปลี่ยน php version ให้สร้างลิงก์ไฟล์ของ apache config ใหม่
cd /etc/apache2/mods-enable ln -s php8.1.conf ../mods-avaliable/php8.1.conf ln -s php8.1.load ../mods-avaliable/php8.1.load
แล้ว restart apache
systemctl restart apache2
Upgrade MariaDB
apt upgrade mariadb-server apt install mariadb-server
Pure White Color
#FFFFFF
#FFFFF0
#FCFCF7
#F2F8FC
#FAF9F6
#F4F1F8
#F0F8FF
#FBF5DF
#F8F7F4
#FDFDFD
Gray Color
#000000
#171717
#0C0C0C
#0B1215
#101720
#0D1717
#020D19
#011222
#21242A
#161110
#101923
#08100C
#23262A
#01A2228
#232325
เริ่มศึกษา ภาษา Go
ตารางที่เกี่ยวข้อง
- tag : taggroup => project:supportType, catId
- glcode : glcode
- project_gl : glcode
- project_dev : category
- project : supportType is value
- project_tr : formId="info", part="project",
refCodeis value