tailieunhanh - Apress - Smart Home Automation with Linux (2010)- P39

Apress - Smart Home Automation with Linux (2010)- P39:Linux users can now control their homes remotely! Are you a Linux user who has ever wanted to turn on the lights in your house, or open and close the curtains, while away on holiday? Want to be able to play the same music in every room, controlled from your laptop or mobile phone? Do you want to do these things without an expensive off-the-shelf kit | CHAPTER 5 COMMUNICATION Finally remember that most system commands are blocking. That is they don t return until they ve finished their task. So when the task is being called from inside a web page the user will be at a blank web page with the waiting cursor until the page has completed. Consequently any output or error codes from the command cannot be shown on the page. Instead you will have to write your software so that Your command executes asynchronously using shell_exec cmd or similar. You can update the error or output status through Ajax. You can retrieve error states through a secondary command issued after an asynchronously command invocation. None of these are unsolved problems but it is an extra layer of complexity for those wanting to write their own home automation web applications. Media Access One common piece of functionality is to provide access to your music collection from outside home such as from the office. Several Apache modules are available to handle this one of them is mod_musicindex http projects musicindex . Although capable of being used to list general-purpose directories as it does for its own online documentation it is capable of rendering music-specific icons to let you download and or stream this music anywhere in the world and create playlists interactively for the current folder and all the subdirectories underneath it. To prepare an online portal for your music first create a directory inside your web directory mkdir music Then create an . htaccess file inside granting permissions to whichever users you see fit. These permissions apply to this directory and every one underneath it unless superseded by another .htaccess file. Since your music collection is likely to be stored outside of the web root you must add a symlink to it In -s net media mp3 mp3 This also highlights the reason you created a separate media directory in the root it eliminates the need for web-specific files polluting the directory structure of

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.