Appendix B. Pop Quiz Answers

Chapter 2, Creating a Simple Spreadsheet

Serving content with CherryPy

Answer:

Rename the index() method to content()

Remember that in order to serve the content referred to by a URL such as http://127.0.0.1/content, CherryPy looks for a method named content() in the object instance passed to the quickstart() function. Later on, we will see that it is also possible to build hierarchies of classes that enable CherryPy to serve URLs like http://127.0.0.1/app/toplevel/content as well.

Adding an icon to a button

Answer:

$("button").button({icons: {primary: 'ui-icon-refresh'}})

Like many jQuery and jQuery UI plugins, the button widget takes an options object as an argument. This options object may have a number of attributes, one of them the icons attribute. The value of this attribute itself is an object again, its primary attribute determining which of the many standard icons will be displayed on the button. Refer to the online documentation of the button widget to see all options: http://jqueryui.com/demos/button/ and check jQuery UI's themeroller page at http://jqueryui.com/themeroller/ for an overview of all available icons for a given theme.

Adding conversions to a unitconverter instance

Answer:

$("#example").unitconverter({'cubic feet_litres':1.0/28.3168466 })

Changing option defaults

Answer: b

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.172.115