12/09/2023

Windows 11 Auto on numlock pad

 Windows 11 Auto on numlock pad
a. Press “Windows key + R” from keyboard.
b. Type “regedit” without quotes and hit enter.
c. Click on the “drop down arrow next to “Computer” (to make sure you see only “Computer” option is listed there).
d. Right click on the “Computer” option.
e. Select “Export” option and save the file on any external memory devices.

Follow these steps to enable “Num lock” option on boot.

a. Press “Windows key + R” from keyboard.
b. Type “regedit” without quotes and hit enter.
c. Navigate to “HKEY_USERS\.Default\Control Panel\Keyboard”.
d. Change the value for “InitialKeyboardIndicators” from 0 to 2.
e. Restart the computer and then check how it works.

https://answers.microsoft.com/en-us/windows/forum/windows_8-desktop/permanent-num-lock/ba98e4d7-f52f-45c3-870e-82c2b48fbfe8

9/29/2023

X++ code to open a form or menuitem AXAPTA

 X++ code to open a form or menuitem AXAPTA

How to open a form by using x++ code.

  1.  
  2. static void OpenDisplayMenuItem()
  3. {
  4.    Args args = new Args();
  5.    ;
  6.    args.record(VendTable::find('A-CSK'));
  7.    new MenuFunction(MenuItemDisplayStr(VendTable),MenuItemType::Display).run(Args);
  8. }


This Job will get the same result but with different approach by using formrun class.

  1. static void OpenForm()
  2. {
  3.    FormRun formRun;
  4.    Args args = new Args();
  5.    ;
  6.    args.name(formstr(VendTable));
  7.    args.record(CustTable::find('A-CSK'));
  8.  
  9.    formRun = ClassFactory.formRunClass(args);
  10.    formRun.init();
  11.    formRun.run();
  12.    formRun.wait();
  13. }

9/25/2023

Raspberrypi PI400 ติดตั้ง และ Auto RDP to windows

 Raspberrypi PI400 ติดตั้ง และ Auto RDP to windows

1. โหลดและติดตั้ง ใส่ sd
https://www.raspberrypi.com/software/operating-systems/
1.1. เปิด SSH
1.2. ตั้งรหัส wifi

  1. nano /etc/wpa_supplicant/wpa_supplicant.conf

เพิ่ม
network={
ssid="SCI_EMP"
psk="XXXXXX"
}



ใน Preferences --> Raspberry Pi Configuration หรือใช้คำสั่งผ่าน Terminal ก็ได้
sudo raspi-config
2. ตั้งค่า IP
3. ตั้งค่า Time zone
4. เปิด VNC ตั้งค่า Authentication เป็น VNC password ใส่รหัสสำหรับ Remote
5. เพิ่มตัวเปลี่ยนภาษาไทย
http://www.arduino-makerzone.com/article/59/raspberry-pi-tutorial-ep3-%E0%B8%95%E0%B8%B1%E0%B9%89%E0%B8%87%E0%B8%84%E0%B9%88%E0%B8%B2%E0%B8%A0%E0%B8%B2%E0%B8%A9%E0%B8%B2-%E0%B9%82%E0%B8%8B%E0%B8%99%E0%B9%80%E0%B8%A7%E0%B8%A5%E0%B8%B2-%E0%B8%84%E0%B8%B5%E0%B8%A2%E0%B9%8C%E0%B8%9A%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%94


6. ติดตั้ง Remmina

  1. apt-get install remmina


7. สร้าง config สำหรับ Remote ไปเครื่องที่ต้องการใน remmina ให้ Remote ได้
7.1. ทดลองเรียกใช้งานผ่าน Terminal
remmina /home/pd1/.local/share/remmina/group_rdp_win7_192-168-0-28.remmina
**** สำคัญ ให้ Run user ที่ไม่ใช่ root เพราะจะทำให้ รหัสในไฟล์เปลี่ยน ต้องกรอกรหัสใหม่*****

8. auto start remmina automatic to rdp.
8.2. หน่วงเวลาให้ เปิด remmina ตอน Start เครื่อง ช้าลง เพราะ Wifi ยังไม่ขึ้น
สร้างไฟล์
  1. nano .config/autostart/rdp.sh

เพิ่ม code
#!/bin/bash
env sleep 5
remmina /home/pd1/.local/share/remmina/group_rdp_win7_192-168-0-28.remmina


8.3. เรียกใช้งานในไฟล์ bash ตอนเปิดเครื่องผ่านโปรแกรม remmina โดย
แก้
  1. nano .config/autostart/remmina-applet.desktop

แก้ Exec ให้ไปใช้งานไฟลืข้อ 8.2.
Exec=bash .config/autostart/rdp.sh

ทดลอง Reboot เครื่อง ก็จะ Run และ เปิด RDP Auto

linux mint : ไม่สามารถ SSH ไปบางเครื่องได้

linux mint : ไม่สามารถ SSH ไปบางเครื่องได้

root@OD-SUWIT:/home/suwit_j# ssh sa@192.168.2.104
Unable to negotiate with 192.168.2.104 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss


วิธีแก้

1. สร้างไฟล์
  1. nano /etc/ssh/ssh_config.d/my.conf

2. เอาข้อมูลนี้ไปใส่
  1. HostKeyAlgorithms ssh-rsa,ssh-dss
  2. PubkeyAcceptedKeyTypes ssh-rsa,ssh-dss
  3.  
https://askubuntu.com/questions/836048/ssh-returns-no-matching-host-key-type-found-their-offer-ssh-dss

แล้วลอง SSH ดู มันจะให้ลบ key เดิมที่เคยบันทึกไว้ออก ด้วยคำสั่ง
ssh-keygen -f "/home/suwit_j/.ssh/known_hosts" -R "192.168.2.104"

 

5/29/2023

Bash get price cryto from binance.

All

https://api.binance.com/api/v3/ticker/price? 

Some symbol

https://api.binance.com/api/v3/ticker/price?symbol=LUNCUSDT

code

#!/usr/bin/env bash
btc=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT | jq -Mr '.price')
lunc=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=LUNCUSDT | jq -Mr '.price')
shib=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=SHIBUSDT | jq -Mr '.price')
xec=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=XECUSDT | jq -Mr '.price')

echo "B $btc | L $lunc | S $shib | X $xec"