tailieunhanh - Smart Home Automation with Linux- P10
Smart Home Automation with Linux- P10:For every word I’ve written, five have been discarded. Such is the nature of writing. For every ten programs I’ve downloaded, tried, and tested, nine have been discarded. Such is the nature of software. Finding a perspicuous overlap has been a long and arduous tasks, and one that I’d wish for no one to suffer in solitude. | CHAPTER 7 CONTROL HUBS In the TODO example your applet should be able to list the to-do list for the current user or the public and optionally be able to sort it This will ultimately provide you with five potential parameters Refresh state parameter Which user is visible Refresh state parameter Is the list sorted Command argument Switch to user X. Command argument Sort list. Command argument Unsort list aka show in order . This demonstrates the next point there is redundancy here. It is technically possible to combine the refresh state and command parameter in one since they both control the same data. However when you are building a web page you need to know all the refresh state parameters so that the other links on the page have the correct values. Unfortunately that would require a lot of work to know which state parameter would be overridden later by the command parameters. You can simplify this by writing a refresh function that describes the current state and that every other applet will indirectly call when it requests a URL from the applet manager function getRefreshParams appMan return appMan- getArgument this user this- _viewuser . . appMan- getArgument this sort this- _sortlist You next add links that contain command parameters which are similar to those you ve seen already html Show html. appMan- getAppletLink this dosort 0 Chronologically . html. appMan- getAppletLink this dosort 1 Alphabetically html. For html. appMan- getAppletLink this douser user user . html. appMan- getAppletLink this douser public Public 5 To correctly delete an entry from the TODO list you d need to lock the file in case the file got corrupted when two people tried to delete at the same time. I have a truly marvelous solution to this which this margin is too narrow to contain 253 CHAPTER 7 CONTROL HUBS These parameters by convention are prefixed with do indicating that they should change the refresh state. That is new state old state do changes. The applet .
đang nạp các trang xem trước