- ต่อโทรศัพท์ Android กับ Mac ก่อน ด้วย USB Cable
- เปิด Termilal แล้ว run
Library/Android/sdk/platform-tools/adb tcpip 5555 Library/Android/sdk/platform-tools/adb connect YOURDEVICEIP:5555
- รอดูผลของการเชื่อมต่อ
- ถอดสาย USB ออก แล้วก็ debug ผ่าน WIFI โลด
ที่มา
Apache Tuning from How To Optimize Apache
Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 MinSpareServers 5 MaxSpareServers 10 StartServers 5 MaxClients 150 MaxRequestsPerChild 0
Create new user how
sudo adduser userName
Make user sudo how
sudo adduser userName sudo
MySQL Configuration
- Increrase memory size for MySQL Server using nano /etc/my.cnf and add/change value ตามรายละเอียด
innodbbufferpoolsize = 2048M innodblogfilesize = 512M maxconnections = 500 keybuffer_size = 512M
PHP Config
Set timezone to Asia/Bangkok
nano /etc/php/7.4/apache2/php.ini
date.timezone = Asia/Bangkok
Add CNAME domain.com to ppi.psu.ac.th
Add new site to Apache
cd /etc/apache2/sites-available nano sites-available/doname.com.conf
<VirtualHost *:80> ServerName domain.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html/domain.com </VirtualHost> <VirtualHost *:80> ServerName www.domain.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html/domain.com </VirtualHost> <IfModule mod_ssl.c> <VirtualHost _default_:443> ServerName domain.com ServerAdmin webmaster@localhost DocumentRoot /home/user/domains/domain.com </VirtualHost> <VirtualHost _default_:443> ServerName www.domain.com ServerAdmin webmaster@localhost DocumentRoot /home/user/domains/domain.com </VirtualHost> </IfModule>
cd /etc/apache2/sites-enabled ln -s ../sites-available/domain.com.conf domain.com.conf
Restart Apache
systemctl restart apache2
Restart MySql
systemctl restart mysql
INSTALL Let's Encrypt
1. ติดตั้งด้วย snap ดูรายละเอียดได้ที่ Certbot instructions
snap install --classic certbot ln -s /snap/bin/certbot /usr/bin/certbot certbot --apache certbot certonly --apache certbot renew --dry-run
2. ติดตั้งด้วย apt-get จาก repo
apt-add-repository -r ppa:certbot/certbot
After that, the following commands do not generate any errors:
apt update apt-get update apt install python3-certbot-apache
certbot --apache -d domain.com -d www.domain.com
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=domain.com
IMPORTANT NOTES:
Congratulations! Your certificate and chain have been saved at:
- /etc/letsencrypt/live/domain.com/fullchain.pem
- Your key file has been saved at:
- /etc/letsencrypt/live/domain.com/privkey.pem
- Your cert will expire on 2021-01-08. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew all of your certificates, run "certbot renew"
To test the renewal process, you can do a dry run with certbot:
sudo certbot renew --dry-run
Correct way to completely remove issued certificate(s) for a domain
certbot delete --cert-name domain.com
Copy file from another server using SSH
Alternatively, you could mount the myserver's filesystem over SSH with sshfs. This may be too much hassle for a one-off need, but convenient if you do this sort of thing often.
mkdir myserver sshfs -p 22 domain.com:/path/ myserver wget -O ~/myserver/path/to/remote/destination http://www.example.com/whatever rsync -trv myserver/src/path/ dest/path/ umount myserver
rsync in background
nohup rsync -trv myserver/src/path/ dest/path/ &
Dump Database
mysqldump -u [username] -p [database-you-want-to-dump] > [path-to-place-data-dump.sql] /usr/local/mysql/bin/mysqldump -u [username] -p [database-you-want-to-dump] > [path-to-place-data-dump.sql]
Ways to Flush DNS Cache on Mac OSx
sudo killall -HUP mDNSResponder
WhoIs LookUp
nslookup -type=ns softganz.com
Setup Time Sync
ติดตั้ง
apt-get install ntp
แก้ไข config
nano /etc/ntp.conf
เปลี่ยน server เป็น
server 1.th.pool.ntp.org server 0.asia.pool.ntp.org server 2.asia.pool.ntp.org server clock.nectec.or.th
Restart
service ntpd restart
หรือ
service ntp restart
ที่มา
- Certbot instructions
- How To Secure Apache with Let's Encrypt on Ubuntu 18.04
- E: The repository 'http://ppa.launchpad.net/certbot/certbot/ubuntu focal Release' does not have a Release file
- How To Use SSHFS to Mount Remote File Systems Over SSH
- How to wget a file to a remote machine over SSH?
- Correct way to completely remove issued certificate(s) for a domain
- How to increase memory size for MySQL Server
- MySQL Performance Tuning Settings
- HOWTO: Sync เวลาไม่ควรใช้ ntpdate ควรใช้ ntpd แทน
ตอนที่เริ่มสร้าง App ใหม่ โดยใช้ Template Buttom Navigator Activity นั้นจะไม่มีปุ่มเมนูบนด้านขวาของ Action Bar หากเราต้องการใช้ ก็จำเป็นต้องสร้างขึ้นมาเอง
เริ่มด้วยการสร้าง resource file ของ options menu ก่อน
Menu -> New -> Resource File File name : options_menu Resource type : Menu
options_menu.xml
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/searchFragment" android:icon="@drawable/ic_baseline_search_24" android:title="@string/action_search" app:showAsAction="always" /> <item android:id="@+id/settingsFragment" android:icon="@drawable/ic_baseline_settings_24" android:title="@string/action_settings" app:iconTint="@color/yourcolor" app:showAsAction="ifRoom" /> <item android:id="@+id/aboutUsFragment" android:icon="@drawable/ic_baseline_info_24" android:title="@string/action_aboutus" /> </menu>
MainActivity.kt
override fun onCreateOptionsMenu(menu: Menu?): Boolean { val inflater = menuInflater inflater.inflate(R.menu.options_menu, menu) if (menu is MenuBuilder) { menu.setOptionalIconsVisible(true) } return super.onCreateOptionsMenu(menu) } override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { R.id.aboutUsFragment -> { toast("About Us") } } return super.onOptionsItemSelected(item) }
เพิ่มรายการในเมนู
menu?.apply { // ----------------- add a new item to menu ---------------- // add new item to menu val newItem:MenuItem = menu.add( Menu.NONE, // group id 2, // item id 1, // order "New Item" // title ) // set new item's icon newItem.setIcon(R.drawable.ic_check_circle) // set new item show as action flags newItem.setShowAsActionFlags( MenuItem.SHOW_AS_ACTION_ALWAYS or MenuItem.SHOW_AS_ACTION_WITH_TEXT ) // menu new item click listener newItem.setOnMenuItemClickListener { Toast.makeText(this@MainActivity, "New Item Clicked", Toast.LENGTH_SHORT).show() true } // ----------------- remove an item from menu ---------------- menu.removeItem(R.id.cancel) // ----------------- update an item in menu ---------------- menu.findItem(R.id.settings).apply { title = "Updated Title" }
ตรวจสอบว่า menu ได้สร้างหรือยัง?
::actionMenu.isInitialized
ตรวจสอบว่า key ของ Array มีหรือไม่?
options.has("menu")
การเข้าถึง R -> Resource
android.R.attr.actionBarSize
ที่มา
ช่วงนี้กำลังพัฒนา Green Smile App เวอร์ชั่นใหม่ โดยเปลี่ยนแปลงรูปแบบมาใช้ Fragment แทน
หลังจากทำไปพักหนึ่ง ก็มีปัญหาในการสื่อสาร/เข้าถึงข้อมูลระหว่า Activity กับ Fragment
ขอบคุณบทความดี ๆ จาก Akexorcist เรื่อง Let’s Fragment — วิธีการรับส่งข้อมูลของ Fragment แถมในบทความยังมีบทความในซีรีย์เดียวกันอีกหลายเรื่อง เช่น
- มารู้จักกับ Fragment กันเถอะ~
- เริ่มต้นง่ายๆกับ Fragment แบบพื้นฐาน
- ว่าด้วยเรื่องการสร้าง Fragment จาก Constructor ที่ถูกต้อง
- รู้จักกับ FragmentTransaction สำหรับการแสดง Fragment [ตอนที่ 1]
- รู้จักกับ FragmentTransaction สำหรับการแสดง Fragment [ตอนที่ 2]
- Lifecycle ของ Fragment (Fragment Lifecycle)
- วิธีการรับส่งข้อมูลของ Fragment
- มาทำ View Pager กันเถิดพี่น้อง~ [ตอนที่ 1]
- มาทำ View Pager กันเถิดพี่น้อง~ [ตอนที่ 2]
- เพิ่มลูกเล่นให้กับ View Pager ด้วย Page Transformer
ลองตามไปอ่านกันดูนะครับ
fun evaluateJsFromNative(command: String, webView: WebView, function: (value : Boolean) -> Unit ) { webView.evaluateJavascript("(function() { return $command; })();") { s -> function(s.toBoolean()) } } override fun onBackPressed() { var boxCheck = "document.getElementsByClassName('box-page')[0].tagName == 'DIV';" evaluateJsFromNative(boxCheck, myWebView) { if (it) { evaluateJsFromNative("$.colorbox.close()", myWebView){} } else { super.onBackPressed() } } }
[Intro] C Cmaj7 Cadd9 C Asus2 Asus4 Am Asus2 Cadd9 C Cmaj7 Cadd9 Am Asus2 Asus4 Am
C G/B Am G Dm7 Am I close my eyes only for a moment and a moment´s gone. C G/B Am G Dm7 Am All my dreams pass before my eyes a curiosity.
D G Am D G Am Dust in the wind, all we are is dust in the wind.
C G/B Am G Dm7 Am Same old song, just a drop of water in the endless sea. C G/B Am G Dm7 Am All we do, crumbles to the ground though we refuse to see.
D G Am D G Am Dust in the wind, all we are is dust in the wind.
C G/B Am G Dm7 Am Don't hang on, nothing last´s forever but the earth and sky. C G5 Am G Dm7 Am It slips away all your money won´t another minute buy.
D G Am D G Am Dust in the wind, all we are is dust in the wind D G Am D G Am Dust in the wind, everything is dust in the wind.
Application Green Smile ที่เราสร้างขึ้นมาเพื่อให้เป็นเครื่องมือหนึ่งของแพลตฟอร์ม ที่จะช่วยให้เกษตรกรสามารถเชื่อมโยงผลผลิตไปสู่ผู้บริโภคนะครับ
เครื่องมือนี้ทำอะไรได้บ้าง?
- จะเป็นตัวช่วยให้กลุ่มเกษตรกรหรือเกษตรกรสามารถบริหารจัดการแปลงที่ดินที่มีอยู่ โดยการบันทึกผลผลิตในแต่ละรุ่นทั้งประเภท จำนวน วันเก็บเกี่ยว รวมถึงการให้ผู้บริโภคสามารถจองผลผลิตดังกล่าวได้ ผู้บริโภคสามารถติดตามกิจกรรมของการผลิตในแต่ละแปลงได้
นอกจากนี้เรายังมีระบบซื้อขายสินค้าเพื่อให้เกษตรกรสามารถต่อยอดขายสินค้าออนไลน์ได้ด้วย
Application Green Smile สามารถนำไปประยุกต์ให้งานกับเกษตรกรกลุ่มไหนได้บ้าง?
สามารถนำไปใช้กับสวนยางได้ ในระบบการขนส่งน้ำยางจากแปลงยางได้ทันเวลาได้น้ำยางที่มีคุณภาพ การเก็บข้อมูลพืชร่วมยาง รวมทั้งธนาคารต้นไม้
เราสามารถนำไปใช้งานในการบริหารจัดการเกษตรได้หลากหลายรูปแบบ เช่น เกษตรสวนยางพารา(FSC), เกษตรกรอินทรีย์(PGS,GAP), ธนาคารต้นไม้
ผลผลิต รายวัน,รายสัปดาห์,รายเดือน,รายปี,ระยะยาว(หลังเกษียณ)
umount -l /dev/sda1 e2fsck -cfpv /dev/sda1 > chresult.txt&
เลือกเมนู New Value Resource
กำหนดค่า
Local
th
ตั้งชื่อ strings_th.xml
cd /usr/local/directadmin/data/admin echo -n "" > tickets.list