Example: <div> ... </div> <br style="page-break-before: always;" clear="all" /> does not create a page break in a print preview or the actual printing.
This works: <p> ... </p> <br style="page-break-before: always;" clear="all" />
This works: <div> ... </div> <p><br style="page-break-before: always;" clear="all" /></p>
And this works: <div> ... </div> <br style="page-break-after: always;" clear="all" />
ปัญหาหนึ่งที่พบเจอบ่อยๆ คือความคุ้นเคยในการใช้ text editor บน windows แล้วพอสลับไปใช้เครื่อง mac. คือการหลงไปกดปุ่ม Home หรือ End แทนที่จะไปที่หัวหรือท้ายบรรทัด แต่กลับกระโดดไปที่ส่วนบนสุดหรือล่างสุดของไฟล์ทำให้เสียเวลามาก วิธีแก้คือเข้าไปเพิ่มไฟล์ DefaultKeyBinding.dict เข้าไปในระบบ
To get your Home and End keys working properly on Mac OS X (in my case, Mountain Lion, although this should work in prior versions back to at least Tiger), simply open the Terminal and do this:
$ cd ~/Library $ mkdir KeyBindings $ cd KeyBindings $ nano DefaultKeyBinding.dict Put these lines in that file, including the curly braces:
{ /* Remap Home / End keys to be correct */ "\UF729" = "moveToBeginningOfLine:"; /* Home */ "\UF72B" = "moveToEndOfLine:"; /* End */ "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */ "$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */ "^\UF729" = "moveToBeginningOfDocument:"; /* Ctrl + Home */ "^\UF72B" = "moveToEndOfDocument:"; /* Ctrl + End */ "$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Ctrl + Home */ "$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; /* Shift + Ctrl + End */ } Press Ctrl+O and then Enter to save the file, and Ctrl+X to exit. Restart your computer to have it take full effect.
แต่ในบางโปรแกรมที่มีความฉลาดในการกำหนดคีย์เองอยู่แล้วก็สามารถเข้าไปกำหนดได้เลย เช่น Eclipse โดยเข้าไปที่ Preferences -> General.Keys -> Text Editing source: http://mwholt.blogspot.com/2012/09/fix-home-and-end-keys-on-mac-os-x.html http://www.kelek.com/blog/2006/09/16/fixing_home_end.html
คำสั่ง finish() จะเป็นแค่การบอกว่าจบการทำงานแล้ว แต่ถ้าในโปรแกรมของเรายังรัน service หรือ Listener ใดๆอยู่ โปรแกรมก็จะยังทำงานต่อไปจนกว่าจะจบ service หรือ Listener นั้น
ดังนั้นบางคนที่ใช้คำสั่ง finish() แล้วยังสงสัยว่าทำไมโปรแกรมยังรันเบื้องหลังอยู่ไม่ยอมปิดจริงๆ ก็เพราะสาเหตนี้
ส่วนคำสั่ง System.exit(0) จะเป็นการบังคับให้โปรแกรมหยุดทำงานทันทีไม่ว่าจะมี service หรือ Listener ใดๆอยู่ก็ตาม เปรียบเหมือนการ force close ซึ่งในการใช้งานต้องระวังให้มากและต้องแน่ใจว่าไม่มีโพรเซสใดค้างอยู่แล้วไม่งั้นอาจทำให้โปรแกรม error ได้ เช่นมีคำสั่ง save หรือเขียนข้อมูลอยู่ซึ่งยังทำไม่เสร็จแล้วใช้คำสั่ง System.exit(0) จะทำให้การเซฟนั้นไม่สมบูรณ์และไฟล์ข้อมูลอาจเสียหายได้
การเขียนแอพพลิเคชั่นเพื่อใช้งาน Bluetooth บนระบบปฏิบัติการที่เป็น Android นั้นสามารถดูรายละเอียดได้ที่ http://developer.android.com ตัวอย่างแอพพลิเคชั่นที่ Google มีให้ดาวน์โหลด และหลายๆเว็บไซต์นิยมนำมาใช้อ้างอิงหรือยกตัวอย่างคือ Bluetooth Chat โดยดูวิธีการดาวน์โหลด Source Code ได้ที่ http://developer.android.com/tools/samples/index.html
การทำงานของ Bluetooth Chat จะเป็นการสื่อสารระหว่างอุปกรณ์ที่เป็น Android เหมือนกันโดยผ่านทาง Bluetooth และสามารถเข้าไปทดลองเล่นตัวแอพพลิเคชั่น Bluetooth Chat นี้ได้ที่ Google Play
ค่า Default ของตัวโมดูลนี้คือ Default serial port setting : 9600, N, 8, 1; Pairing code : 1234
ส่วนค่าอีกตัวหนึ่งของโมดูลที่จะใช้ที่ต้องรู้คือ Unique identifier ซึ่งจะอยู่ในรูปของตัวเลขฐาน 16 จำนวน 6 ชุด เช่น CC:8C:E3:DC:63:20 ถ้ามีพีซีหรือโน๊ตบุคที่เป็น Windows 7 และที่ตัวเครื่องมี Bluetooth อยู่แล้วสามารถดูได้ดังนี้
1. ไปที่ Devices and Printer เลือก Add a device
2. เมื่อ Windows เริ่มค้นหาอุปกรณ์ก็ต่อไฟเลี้ยงเข้าที่ตัวโมดูล แล้วรอซักครู่ Windows จะแจ้งว่าเจออุปกรณ์ BT UART Bluetooth Other
3. คลิกขวาที่ตัว BT UART ที่ Windows เจอแล้วเลือก Properties
4. กดที่ Tab Bluetooth ดูที่ด้านล่างจะมีบรรทัดที่เขียนว่า Unique identifier
เมื่อเราได้ Unique identifier ของ Bluetooth Module ที่จะใช้มาแล้วต่อไปจะเป็นขั้นตอนการดัดแปลง Source Code ของแอพพลิเคชั่น Bluetooth Chat เพื่อให้อุปกรณ์ Android สามารถสื่อสารกับ Bluetooth Module นี้ได้มีขั้นตอนดังนี้
1. ไปที่ class BluetoothChatService หาบรรทัดที่พิมพ์ว่า
// Unique UUID for this application private static final UUID MY_UUID = UUID.fromString(“fa87c0d0-afac-11de-8a39-0800200c9a66″);
แก้บรรทัดนี้เป็น
// Unique UUID for this application //private static final UUID MY_UUID = UUID.fromString(“fa87c0d0-afac-11de-8a39-0800200c9a66″); private static final UUID MY_UUID= UUID.fromString(“00001101-0000-1000-8000-00805F9B34FB”);
2. ถ้าต้องการให้ทุกครั้งที่รันแอพพลิเคชั่นให้เชื่อมต่อกับ Bluetooth Module อัตโนมัติก็สามารถทำได้โดยเข้าไปที่ class BluetoothChat extends Activity แล้วไปที่ event onStart()