วันพุธที่ 24 มกราคม พ.ศ. 2561

บังคับเว็บออก redirect จาก http เป็น https โดยใช้ mod_rewrite

เช็คว่า mod_rewrite ทำงานหรือเปล่า (เพราะเป็น default on อยู่แล้ว)

httpd -M

จะต้องมีบรรทัดเขียนว่า

...
rewrite_module (shared)
...

ถ้าไม่มีให้เพิ่ม rewrite_module ลงในไฟล์
/etc/httpd/conf.modules.d/00-base.conf

...
LoadModule rewrite_module modules/mod_rewrite.so
...

เพิ่มบรรทัดนี้ลงในไฟล์ httpd.conf

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

จากนั้น restart httpd

วันศุกร์ที่ 19 มกราคม พ.ศ. 2561

Script สั่ง Reboot MikroTik

ไปที่ System > Scripts
สร้าง Script ใหม่ ตั้งชื่อตามต้องการ เช่นชื่อ reboot
ช่อง Policy ให้เลือก Reboot
ช่อง Source พิมพ์ /system reboot


ไปที่ System > Scheduler
สร้าง Schedule ใหม่ ตั้งชื่อตามต้องการ เช่น reboot
ช่อง Start Time เลือก startup
ช่อง Interval ตั้งเวลาตามต้องการ
ช่อง Policy ให้เลือก Reboot
ช่อง On Event ให้ใส่ชื่อ Script ที่เราตั้งไว้ก่อนหน้า จากตัวอย่างคือ reboot


วันจันทร์ที่ 29 พฤษภาคม พ.ศ. 2560

This app can't open

This app can't open
XXX can't be opened using the Built-in Administrator account. Sign in with a difference account and try again.


  1. ไปที่ Local Security Policy
  2. Local Policies
  3. Security Options
  4. ทำการ Enabled ที่ตัวเลือก
    • User Account Control: Admin Approval Mode for the built-in Administrator account
    • User Account Control: Allow UIAccess applications to prompt for elevation without using the secure desktop
  5. Restart

วันพฤหัสบดีที่ 16 มิถุนายน พ.ศ. 2559

CentOS autologin

edit the file at /etc/gdm/custom.conf

vi /etc/gdm/custom.conf

You need to edit the daemon section of the file and add or change these:

[daemon]
AutomaticLoginEnable=true
AutomaticLogin=root

Just reboot your computer and you will automatically login.

วันอังคารที่ 8 มีนาคม พ.ศ. 2559

QlikView : Class

ฟังก์ชันเกี่ยวกับการแบ่งตัวแปรออกเป็นช่วงๆ ตามที่เราต้องการ โดยอยู่ในรูปแบบ a < x <= b
Syntax:
Class(expression, interval [, label [, offset]])
intervalความกว้างของช่วง
label (optional)คำที่จะมาแทน x
offset (optional)จุดเริ่มต้นที่จะมาใช้แทนค่าปกติ ซึ่งตั้งไว้ที่ 0
ตัวอย่างผลลัพธ์
Class(23,10)
20 < x <= 30
(แบ่งช่วงทุก 10 เริ่มต้นจาก 0 เพราะฉะนั้น ค่าดังกล่าวจึงตกอยู่ในช่วง 20 - 30)
Class (23,5,'อายุ')
20 < อายุ <= 25
(แบ่งช่วงทุก 5 เริ่มต้นจาก 0 และแทน x ด้วยคำว่า'อายุ' เพราะฉะนั้น ค่าดังกล่าวจึงตกอยู่ในช่วง 20 - 25)
Class (23,10,'อายุ',5)
15 < อายุ <= 25
(แบ่งช่วงทุก 10 เริ่มต้นจาก 5 และแทนค้า x ด้วยคำว่า 'อายุ' เพราะฉะนั้น ค่าดังกล่าวจึงตกอยู่ในช่วง 15 - 25 โดยช่วงเริ่มต้นคือ 5 - 15)

QlikView : MonthName

ฟังก์ชันที่ใช้งานบ่อยในการสร้าง Object ในโปรแกรม QlikView คือการกำหนด Dimension ที่จำแนกตามเดือน เช่น จำนวนผู้รับบริการจำแนกรายเดือน, แนวโน้มผู้มารับบริการจำแนกรายเดือน ซึ่งปกติ ข้อมูลของเรามักจะไม่มี field ที่เป็นเดือนที่มารับบริการโดยตรง แต่จะเป็น field ที่เป็น วัน/เดือน/ปี ที่มารับบริการมากกว่า ดังนั้น หากต้องการจำแนกรายเดือน ฟังก์ชันที่ใช้ในการจำแนกก็คือ MonthName
Syntax:
MonthName(date[,period_no])
dateคือ ฟิลด์ที่มีลักษณะของวันที่ที่เราต้องการ
period_no (optional)คือ ค่าตัวเลขที่เราจะระบุลงไป โดย หากเป็นเลขติดลบ จะเป็นเดือนก่อน หากเป็นเลขบวกจะเป็นเดือนถัดไป
ตัวอย่างผลลัพธ์
MonthName('31/12/2000')Nov 2000
MonthName('31/12/2000',-1)Dec 2000