NZ Economic Papers 34(1), June 2000, pp.129-147.
by
Robin Johnson
Since 1991, the New Zealand Government has allocated
public Research and Development funds through a pool system - called the public good
research fund - through which research providers (universities,
research institutes etc) must bid for funding on a project by
project basis. This system was to counteract a previous tendency
for public funding through departmental structures to discourage
private sector investment - crowding out
. The funding
administrators were enjoined to take account of the private
appropriability of the projects submitted and direct public funds
to complementary projects or projects which would otherwise be
under-funded. This paper finds evidence of increased private sector
participation in research funding, and a declining share going to
research provision over the last 9 years. The Crown Research
Institutes appear to be the main beneficiaries.
The administrative reforms of research organisations in New
Zealand in the last fifteen years have been propelled by fiscal
conservatism on the part of the governments of the time and a
perception that publicly provided funds should be accounted for in
a more open and efficient way. In that framework, it was thought
that the dominance of public funding in the science sector had
tended to discourage private investment in research and development
- the so-called phenomena of crowding-out
(Bollard et
al 1987, p.67;Jardine 1989, p.8). Part of the reform was
therefore to change the set of incentives that faced research
funders and providers in order to bring about greater
accountability, efficiency and private participation. It is now
fifteen years since the start of the reforms and
responses/reactions to the changes are starting to emerge. This
paper discusses the reasons behind the reforms as demonstrated in
government documents of the time and developments in funding and
provision since.
In the early 1980s government funded about half, business about a third and the universities about a sixth of annual research expenditure in New Zealand. Taking the public sector and the universities together, public investment was 64 per cent of the total funded and private investment 36 per cent. The pre-reform organisation of public science providing activities was strongly hierarchical and controlled and funded by central government. Prior to the reforms, the Ministry of Agriculture (MAF) and the Department of Scientific and Industrial Research (DSIR) spent 73 per cent of the total government budget on science.
The 1980s reforms changed the funding basis of public research as well as the organisational structures. Central government funds were placed in a pool (the public good science fund) and made available to all research providers through a bidding process - the universities were included at a later stage of the reforms when they could identify what they would contribute to the pool. The old departmental structures were replaced by subject-based, self-financed and governed research institutes, that would compete with other providers for the public funds available, and seek private funding as well.
In the aggregate, the share of funding carried by the public and private sectors in the 1990s has not changed greatly - private sector funding has risen to 40 per cent and the total public sector funding has declined accordingly. But within these changes, there has been a more pronounced shift in the conduct of research - the private sector (which includes industry research associations) is contracting out more of its research, mainly to the benefit of the universities. Government provision of research (mainly the CRIs) has increased marginally.
The post-reform response to the organisational and funding reforms has therefore been a shift toward private sector funding and direction of research (as envisaged by the planners) and a contrary shift toward public conduct of research (including the universities). Most significant has been the movement of new funds into the university research sector - from government, from university general funds, and from business. The flow of private funds into the research institutes has also increased, thus reducing their dependence on public funds from their previously high levels. These changes suggest that private investment was crowded out in earlier years, but closer investigation reveals that the private sector was not positioned to carry out a greater role in funding and conduct of research at the time.
This paper discusses the policy climate surrounding public fund allocation during the reforms of the science sector in the late 1980s and early 1990s, and the trends in organisation, funding and research provision that have emerged since.(1)
The public good science fund (PGSF) system pooled the available government funds for research and development (Research and Development) and instituted a bidding process, administered by the Foundation for Research, Science and Technology (FRST), in which research providers competed for public sponsorship. (2)
The newly formed crown research institutes (CRIs), other providers, and later the universities, were able to draw on these funds provided they met the administrative criteria for public good research.
The administrative test is specified as [investment in goods]
that may be of benefit to New Zealand, but are unlikely to be
funded, or adequately funded, from non-government sources
(MoRST 1992b, p.16). This [assumes] that the reason for
under-investment is non-appropriability of the results. It is a
wide definition that could encompass any research where the
benefits are spread across a large number of beneficiaries and
cannot be captured at all by a single entity. The addition of a
test of inadequate funding
suggests private market
failure
as economists understand the term, and allows some
degree of compensation or subsidisation to be taken into account in
making grants.
The title of the fund was borrowed from economics but the definition of public good science is fraught with difficulties in practice. The main criteria appears to be whether under-investment will result from the removal of public funds when it has been identified that a proposed piece of research would be in the national interest. This implies that a matrix of social benefits can be identified that will reward the taxpayer in some way. The award of contracts is actually decided not by some social cost-benefit analysis but by the defining of a research agenda and utilising the resulting rules accordingly (MoRST 1992b, p.78). There are thus real difficulties in turning broad objectives into practical rules for public good research funding and allocation.
The 1992 review of long term science priorities raised concerns about the balance of research funding between research directly impacting on economic performance, and research underpinning areas on which economic activity depends indirectly (infrastructure research, and the social and natural sciences)(MoRST 1992c, p.11). The report noted that 68 per cent of PGSF funding in 1991-92 was allocated to the directly `wealth creating' classes 1 to 19 (of the first list of output classes). They stated that this class of outputs was already well funded, but output classes 20 to 35 were more difficult to assess because the benefits they create are less direct and can be longer term. The report recommended a shift in emphasis from both the natural sciences and the production groups to what they called the infrastructural group (output areas 20 to 28). The implication is that underpinning research is more of a public good than wealth creating research goods.
The report recommended a productive partnership between the public and private sector to ensure successful commercialisation of PGSF research results. It stated that PGSF research is more likely to be successfully adopted if the research is planned with strong user involvement and is likely to have the greatest chance of producing benefits to New Zealand where users have well-established market linkages and were performing their own research. The implication here is that greater co-operation and co-ordination between sectors would compensate for the low level of private sector sponsorship of research (BERL 1995, p.46).
The 1992 report's authors believed there was an imbalance between different output classes. They noted the low spending of the private sector in primary production compared with primary processing. This allocation of funds by the different providers has been consistent through all the surveys conducted by the Ministry of Research, Science and Technology (MoRST)(Table 1). Government spending dominates in primary production and in environmental research; `business' investment dominates in processing primary products, manufacturing, construction, transport and energy; the universities dominate in social science, health and fundamental research. Since 1995-96, the private sector share as a whole has not changed much but there has been a shift away from government to the universities.
| Table 1: Spending on Research by Institutions and Major Output Classes 1997-98 % | |||
|---|---|---|---|
| 'Business' | Universities | Government | |
| Primary production/processing | 37.6 | 6.7 | 55.9 |
| Manufacturing | 50.7 | 19.8 | 29.4 |
| Construction/transport/energy | 50.1 | 26.3 | 23.5 |
| Social sciences | 2.0 | 83.1 | 14.8 |
| Environment | 2.6 | 24.3 | 73.1 |
| Information/communications | 67.5 | 21.1 | 11.3 |
| Fund'l, Health, Defence | 10.5 | 82.4 | 7.1 |
| Total 1997-98 | 28.2 | 36.4 | 35.3 |
| Total 1995-96 | 27.0 | 30.7 | 42.2 |
Source: Table on p.8, MoRST 1999. Businessis the MoRST descriptor. |
The report recommended that the PGSF should complement
successful private research activities where funds are used to
promote strategic and generic research and where there is a
demonstrated need for such research. Such complementarity should
not displace private research funding, the report states, or
support appropriable research. The panel therefore recommended that
using the PGSF to complement private funding should be
conditional on a continuation or enhancement of funding from the
private sector
.
In the MoRST instructions to FRST dated July 1997, these
objectives do not appear to have changed (MoRST 1997b). The
Minister noted that the organisational gains made have resulted in
a strong focus on small-scale purchasing of outputs, over
relatively short time frames, and within a rather rigid framework
of rules and procedures. FRST needed to develop a strategic,
far-sighted, and pro-active strategy for focusing on the
achievement of outcomes. It will be crucial to foster
interactive relationships....... in publicly funded organisations
and in the private sector, that together underpin a vibrant and
thriving knowledge-based society
. With respect to encouragement
of the private sector, funding allocations should be managed in
a way ........that does not diminish the incentives for, or
displace investment by other funders.....
The STEP report (MoRST 1992b) suggested that redistribution of
the PGSF from output classes where there is low private funding,
such as agricultural production, to output classes where there is a
high level of private funding, such as secondary processing and
manufacturing, will reduce the possibilities of crowding
out
, or funding appropriable research. The report noted that
there were applied research programmes in output areas where there
was also low private sector funding. PGSF funding should be
withdrawn in such an area. The report recommended a strategy for
five year priorities that supported strategic and generic research
in outputs which have high private sector funding, and withdrew
funding from the more applied research programmes in outputs where
there was low private sector funding (MoRST 1992c, p.15).
This observation does not surface in later literature. I would
suggest that the state could complement private sector activity
without specifying whether business was a big spender in that
output or not. I believe the panel got a bit off the track at this
point and got carried away with their complementarity idea.
Re-allocating investment away from one set of outputs (see Table 1)
would leave them worse off, and the gap will not be filled by
private enterprise without greater incentives. In addition, the
high so-called private investment in some sectors was due to the
fact that the industry research associations were
arbitrarily classified as business
rather than government
even though they were all established with DSIR seed money! The key
issue is whether public investment can be used to trigger further
private investment in a complementary way, as well as to create
conditions where the up-take of the results of all science
investment is enhanced.
The role of the private sector needs to be looked at from two different points of view. By international standards, the level of own investment in research by private New Zealand entities is low.(3) This suggests a search for reasons for firm behaviour in terms of incentives to invest, and rates of return expected from in-house and industry organisation research. Second, the level of public research is relatively high but its up-take by the private sector is perceived to be too low. This suggests an evaluation of the transfer mechanisms for the up-take of public good research.
The low participation rate of private sector research in New Zealand may well be explained by institutional features of the public and private research markets and not reflect an absence of incentives per se. In the case of the relatively low rate of private investment in intra-mural research [Research and Development activity carried out by an organisation on its own behalf or the behalf others], the impediments to greater investment have been identified by various authors as:
One answer to these institutional features would be to provide tax incentives to encourage the entry of new firms as well as increase the investment of existing firms (see Bollard et al 1987, p.67). Such measures could be designed to lower the cost of entry to the market for research goods, to lower the costs of technology transfer, and to lower the costs of intra-mural research. Such measures have not been tried extensively in New Zealand hence it is difficult to make a judgement about their efficacy. But given the history of low participation in the past, it seems unlikely they would be very effective in making a significant change in the private rate of Research and Development investment. In view of the low status of the TBG programme (see below), which subsidises very similar objectives, it would appear to me that the small size of the private research market and its dispersion are fundamental problems which can only be changed slowly, and which will not respond to incentives of either sort.(5)
Secondly, the private sector can draw upon the pool of research results derived from public investment in research as well as carrying out its own research. Prior to 1991, the departmental sector was the main supplier of public research goods. Since then, the PGSF system has provided research results as a free or nearly free good. The characteristics of non-rival consumption of such public goods means that private firms have some of the initial work done for them with few restrictions on access. Yet in practice, there appear to be all sorts of impediments to the up-take of these research goods by enterprise. There is not, apparently, a smooth-running market that transforms such free goods into practical uses. There appear to be transaction costs of some magnitude (see for example Bollard et al 1987, p.36). The institutional imperfections, in this case, which prevent higher utilisation of the knowledge already available, have been identified as:
stockof research is not easily understood nor immediately transparent;
agentswho can explain what is available are absent;
It states that government research will be unproductive if it not able to be utilised by enterprises. Enterprises should transform the results of research and technology into tangible economic benefits. There is a role for government in assisting the enterprise sector to achieve effective uptake of technology, particularly if there are transitional problems or barriers preventing this from happening through market processes - a possible co-operative approach. The 2010 Report refers to historically developed attitudes and behaviours which have been slow to change, such as many enterprises do not have a technology strategy, technically qualified staff, or any investment in research. Part of the reasons for this is the small scale of firms, the high degree of risk aversion, and the high cost of accessing information.
MoRST suggests that a major policy target should be assistance to firms making the transition to greater technological awareness. Access to information could be best assisted by improved networking, with Government taking a role in sectors which are highly disaggregated or where there are insufficient firms to make networking possible (ibid, p.28). In its 2010 Action Agenda, MoRST planned to strengthen the Technology for Business Growth scheme (TBG) administered by the Foundation for Research, Science and Technology (FRST), explore possible funding of `near market' research outside the PGSF, expand Joint Action Groups established by Tradenz, and evaluate the effectiveness of the tax system in achieving investment in innovation, research and technology (ibid, p.32).(8)
In 1996, the TBG had three grant programmes, the Co-operative Research programme, supporting joint research programmes between research institutions and companies; the Technology Transfer programme, encouraging the uptake of existing knowledge; and the In-House Research and Development programme, encouraging the expansion of effective technological capacity within enterprises. The programme financed up to 50 per cent of Research and Development costs for an agreed project. Total funding was $15m per year. In May 1997, FRST was concerned with the lack of applicants to join the programme [which it administers] and put it down to companies not having enough technically and scientifically trained staff to work on the technological directions they should be moving into (NBR, May 9, 1997). It was noted that only the electronics and software companies initiated their own Research and Development projects and led the private sector in employment of research scientists.
The Technology New Zealand programme was introduced in mid 1997 and consisted of the original TBG scheme, the Techlink scheme, and the Graduates in Industry Fellowships (GRIF) scheme. Through Techlink, business were able to get support for assessment of technology needs for small and medium businesses; Research and Development strategy development; assessing information on overseas technologies and technological innovations; and evaluation and acquisition of overseas technologies and technological innovations. The GRIF programme supports undergraduate, masterate, doctoral and post-doctoral research undertaken within New Zealand businesses. The level of uptake of these programmes did not greatly increase in the two following years (T. Hadfield, FRST, pers. comm.).
MoRST's policy at this stage, was to encourage co-operative or complementary investments through the public good science funding mechanism. In the past, the Manufacturers Federation had expressed negative views on private sector use of the PGSF system. A survey of manufacturers in 1995 revealed that 34 per cent thought current PGSF projects were totally irrelevant and only 6 per cent thought they were highly relevant; the relevance of the programmes as a whole was considered very low, and the relevance of intra-sector programmes (in relation to the respondents own sector) was extremely low (NBR, March 21, 1997). The Federation was in favour of an investigation of small company behaviour; how can the uptake of technology be improved, what infrastructure is required, and what skills are required? (9)
In August 1999, the National Government announced its Bright
Future: 5 Steps Ahead plan. This involved funds for 1500
enterprise scholarships and post-doctoral fellowships, a taskforce
to look at tertiary education, a transfer of money from the PGSF to
a New Economy Research Fund aimed at funding research in new areas,
funds for teacher fellowships, a proposal for a small business
stock exchange, and funds for an ideas incubator
. These
proposals focused on facilitating Research and Development rather direct
interventions such as a tax concession on Research and Development expenditure.
Ministers did not rule out tax concessions at some later date. The
policy was clearly based on a new appreciation of a knowledge-based
global economic environment. The proposals aimed to expand the
nation's intellectual and knowledge base to encourage an innovatory
approach to Research and Development, and sought to encourage industry to undertake
a more strategic role in knowledge development . Out of this, a
greater commitment from the business world to Research and Development might emerge
(NBR August 20 1999).
The 2000 Budget appears at first sight (as this paper went to press) to build on this approach. Total public investment in research, science and technology is $473.9m, a rise of 10 per cent on the previous year. New funding of $30m is to be allocated to private sector research encouragement, the New Economy Research Fund, and the Marsden Fund. The private sector component consists of a $9m increase in funding for Technology New Zealand and a new $12m grants programme (details not provided). The question of tax concessions has again been set aside though Ministers left the door open to further negotiations. The Minister of Finance told Parliament after the Budget presentation that it had been estimated that revenue of $100m -$120m would be lost through businesses using such a scheme for tax avoidance (Evening Post 21 June).
These policy announcements represent an incremental change to existing policies for private sector co-operation and support in Research and Development. Their effects on business behaviour will have to be assessed further down the track. What remains to be done is to examine actual research fund allocations since the reforms commenced.
Positive changes in the physical quantum of private investment in research (funding) is one measure of greater participation by the private sector. The second measure is the quantum of research conducted by private sector interests - approximately measured by the expenditure incurred by private research providers.(10) Measuring the effects of complementary spending by the PGSF is difficult (apart from case studies), but could possibly yield to some form of covariance analysis if data were available. The overall rate of up-take of public research goods by the private sector can be measured by an aggregate econometric analysis of sector performance(11) The following analysis is based on the actual trends measured in the MoRST surveys.
The trend in research funding by institutional category
since 1990-91 is shown in Table 2. The government contribution to
departments, universities, CRIs and the private sector has grown
from $437m to $579m in money terms or 32 per cent up to 1997-98.
The business contribution to departments, universities, CRIs and
the private sector has grown from $213m to $338m, or 58 per cent
over 7 years, while the universities/other have expanded their
funding by 153 per cent. The latter includes own
funds (fees
and earnings) for the universities, private non-profit funds and
all other funds. Thus private funding of own
research and
research in other entities has expanded markedly and well above the
government's contribution as the policy decisions dictated.
| Table 2: Funding of Purchasers of Science $m | ||||
|---|---|---|---|---|
| Funder | 1990-91 | 1992-93 | 1995-96 | 1997-98 |
| Business | 212.6 | 224.2 | 300.0 | 337.5 |
| Universities/other | 75.2 | 85.4 | 124.3 | 190.8 |
| Government | 436.9 | 445.7 | 465.0 | 579.1 |
| Government % | 60.2 | 59.0 | 52.2 | 52.0 |
| Total | 724.6 | 755.3 | 889.3 | 1107.4 |
| $90-91a | 724.6 | 731.8 | 815.1 | 1006.7 |
| % GDP | 0.99 | 0.98 | 0.99 | 1.12 |
| a GDP deflator. | ||||
| Source: MoRST 1999. |
Further detail of private funding of research is shown in Table
3. There has been a rapid expansion of private funds going into
both government and university research providing institutions.
Overall funding by the private sector in New Zealand increased by
58 per cent, but business own
research funded only increased
by 36 per cent. Private sector funds allocated to government
increased by 203 per cent, and funds allocated to universities
increased by 224 per cent. The use of these funds (particularly by
the CRIs) is discussed further below. Total funds provided by the
private sector have increased by 6.9 per cent per year while
private spending on research within house has only increased by 4.4
per cent per year.
| Table 3: Allocation of Total Private Funding to
‘Business’ and other Providersa $m |
||||
|---|---|---|---|---|
| Done by | 1990-91 | 1992-93 | 1995-96 | 1997-98 |
| Business | 182.5 | 183.7 | 207.9 | 247.8 |
| Universities | 7.7 | 9.2 | 25.6 | 25.0b |
| Government | 21.4 | 32.6 | 65.6 | 65.0b |
| Total | 212.6 | 224.2 | 300.0 | 337.5 |
| Overseas providers | 13.0 | 18.8 | 10.9 | na |
| Total | 225.6 | 243.0 | 320.0 | na |
| aThis data was presented in a
different form in 1997/98. bEstimated |
||||
| Sources: MoRST 1993, 1995a, 1997a, 1999. |
The involvement of the private sector in university funding is shown in Table 4. This shows the source of funds for all university research undertaken. While the main source is Vote Education, this has declined and then built up over the years shown. The next most important sources are `own funds' and the rest of government (FRST). Starting from a low base, private sector funding increased up to 1996 and then declined. The shifts in funding in university research have been quite considerable in recent years and reflect changes in the internal organisation of all university funding. Evidently, an earlier trend to finance university research by the private sector has not continued.
| Table 4: Source of Funds for University Research and Development ($m) | |||
|---|---|---|---|
| Source | 1992-93 | 1995-96 | 1997-98 |
| Own funds (incl. student fees) | 46.8 | 74.5 | 115.7 |
| General University funds | 120.4 | 96.0 | 144.2 |
| NZ Govt. (incl. FRST, HRC) | 31.9 | 53.5 | 99.2 |
| Private sector (incl. SOEs, RAs, PBs) | 9.2 | 25.6 | 18.8 |
| Funds from abroad | 8.9 | 13.4 | 13.2 |
| Others | 14.9 | 10.4 | 12.6 |
| Total | 232.4 | 273.5 | 403.5 |
| Sources: MoRST 1995a, 1997a. |
Trends in expenditure in the different institutional providers is shown in Table 5. The university data is only fully reliable from 1992-93; but the surveys of the business and government sectors have been consistent through the whole period shown. Business providers have expanded expenditure in money terms at 6.3 per cent per year since 1990-91, government providers by 3 per cent, and the universities by 13.5 per cent per year. Over the same period, the GDP deflator increased by 23 per cent or 3 per cent per year; hence the private sector (firms and industry associations) and the universities have been able to actually spend more real resources in the years since the reforms began. The Budget constraints on the government sector are confirmed.
27.8| Table 5: Research Expenditure by Major Providers ($m) | ||||||||
|---|---|---|---|---|---|---|---|---|
| 1990-91 | % | 1993-94 | % | 1995-96 | % | 1997-98 | % | |
| Business | 204.4 | 29.2 | 247.9 | 29.5 | 240.3 | 26.7 | 312.5 | 27.9 |
| Universitiesa | 166.3 | 23.7 | 233.5 | 273.5 | 30.3 | 403.6 | 36.0 | |
| Government | 318.2 | 45.3 | 343.4 | 40.8 | 375.6 | 41.7 | 391.3 | 34.9 |
| Overseas | 13.0 | 1.8 | 15.5 | 1.8 | 12.2 | 1.4 | 12.2 | 1.1 |
| Total | 701.9 | 100.0 | 840.2 | 100.0 | 901.6 | 100.0 | 1119.6 | 100.0 |
| a1990-91 estimated by the author. | ||||||||
| Sources: MoRST 1993, 1994, 1995a, 1996a, 1997a, 1999. |
Table 6 shows the sources of funds for all business enterprise Research and Development provision. Own funding rose up to 1993-94, declined in 1995-96, but increased again up to 1997-98. Government funding (mainly FRST) has increased steadily. It is not clear where the Technology New Zealand programmes are recorded. Overall there has been a small movement away from self-provision of Research and Development.
| Table 6: Source of Funds for Business Enterprise ($m) | ||||
|---|---|---|---|---|
| Source | 1991-92 | 1993-94 | 1995-96 | 1997-98 |
| Own funding | 179.1 | 221.5 | 208.0 | 247.8 |
| Government | 15.7 | 17.4 | 16.4 | 27.1 |
| Overseas | 9.0 | 8.3 | 13.8 | 35.0 |
| Private non-profit | 1.1 | 0.6 | 2.1 | 0.6 |
| Higher education | - | - | - | 2.0 |
| Total | 204.1 | 247.9 | 240.3 | 312.5 |
| Sources: MoRST 1996a, 1997a, 1999. |
Table 7 shows trends in private earnings among the different
CRIs [who are classified by MoRST as government
] and their
dependence on public funds. AgResearch, NIWA, Landcare, and
HortResearch have expanded into the private sector the most. The
gross total of private funding of CRIs has risen from $115.7m in
1993 to $173.3m in 1999 (+50 per cent). Most CRIs get about two
thirds of their funding from the Crown; only ESR is an exception.
Some of this difference is explained by the way ESR's funders are
classified by the Auditor-General as non-crown.(12)
This shift in the funding of Research and Development is the most transparent feature of the science reforms. The bidding process for FRST funds and its consequent transaction costs have rationed public sector funds to the CRIs as was probably intended by the science reformers like Treasury. Perusal of the Annual Reports of the CRIs indicates a high level of search activity for new funding.
| Table 7: Trends in CRI Private Sector Receipts ($m) | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| 30 June Year | AgR | NIWA | Hort | IRL | FRI | Land | C&F | ESR | GNS |
| 1993 | 23.9 | 10.5 | 13.1 | 11.2 | 11.4 | 8.6 | 6.7 | 24.3 | 5.8 |
| 1994 | 25.7 | 10.6 | 11.1 | 13.4 | 13.8 | 9.7 | 9.7 | 25.5 | 6.0 |
| 1995 | 25.8 | 11.6 | 13.1 | 15.0 | 15.8 | 10.9 | 9.1 | 25.5 | 6.6 |
| 1996 | 26.7 | 14.9 | 14.3 | 12.8 | 15.9 | 11.2 | 7.4 | 25.3 | 7.5 |
| 1997 | 27.9 | 16.2 | 13.6 | 12.2 | 16.5 | 12.6 | 8.3 | 24.7 | 6.2 |
| 1998 | 35.6 | 27.0 | 17.9 | 13.3 | 15.8 | 12.8 | 8.4 | 27.3 | 6.5 |
| 1999 | 38.9 | 29.7 | 17.9 | 14.8 | 15.2 | 13.0 | 8.7 | 27.9 | 7.3 |
| % Change 93-99 | +63 | +183 | +37 | +32 | +33 | +51 | +30 | +15 | +26 |
| % FRST 1999 | 57.8 | 54.1 | 65.4 | 67.7 | 60.7 | 65.4 | 70.1 | 5.2 | 73.8 |
| Abbreviations: AgR: NZ Pastoral Agriculture Research Institute Ltd NIWA: National Institute of Water and Atmospheric Research Ltd Hort: Horticulture and Food Research Institute of NZ Ltd IRL: Industrial Research Ltd FRI: NZ Forest Research Institute Ltd Land: Landcare Research NZ Ltd C&F: NZ Institute for Crop and Food Research Ltd ESR: Environmental Science and Research Ltd GNS: Institute of Geological and Nuclear Sciences Ltd |
|||||||||
| Source: Controller and Auditor-General 1998, CCMAU 1999. |
In summary, this section shows that private enterprises (which include the research associations) are investing proportionately less in their own Research and Development, and slowly increasing funds to other research providers. They are drawing more funds from FRST and overseas sources. They are providing more funds to the CRIs and the universities. In turn, some CRIs are expanding their private funding sources more rapidly than others. The amount invested in university research by private enterprise is small and has not increased in recent years.
The data for justifying government intervention in the New Zealand Research and Development market has not been generated until recently. High public investments in the past were explained by paternalistic policies which assumed that producers were not able to organise nor fund their own Research and Development. Industry involvement started with the government sponsorship of industry research associations on a partial funding basis which later grew to fully self-sufficient institutes. Conduct of government research was partially privatised when the Crown Research Institutes were established in 1991.
In terms of crowding out, the verdict is not proven. (13) In a historic sense, Government was dominant in spending and setting the priorities. To this extent, an alternative system did not develop. However, this review suggests that in the past the spending and the priorities established were not the right ones for the business sector (in the main). Since government was not doing the research that suited business it can hardly be said that private research was crowded out. The review shows that New Zealand firms were too small (on average), too dispersed by region and type of output, and unwilling to invest in the necessary skills and planning. Benefits were too slow in coming in the face of high discount rates for the private sector, and communication of known research results was deficient.
The reasons for the small size of the private research market remain:
The expansion of private funding into the CRIs and to a lesser extent the universities indicates a willingness to sponsor more research if not to conduct more. More information is needed to discover any special characteristics of this process though it clearly conforms with MoRST objectives. To obtain the benefits of such sponsorship, the private sector needs to be closely associated with the research programmes and its objectives including its transfer potential to the real situation. The association with the universities also provides a challenge to see that the results are applicable in practice and some positive national benefit emerges from the investment.
Alston, J.M., Pardey, P.G., and Smith, V.H. (1998), Financing agricultural Research and Development in rich countries: what's happening and why, The Australian Journal of Agricultural and Resource Economics 42, 51-82.
BERL (Business and Economic Research Limited)(1995), The New Zealand Innovation Environment, a report prepared for the Ministry of Research, Science and Technology, Wellington.
Bollard, A., Harper, D., and Theron, M. (1987), A Public Policy Framework for Research and Development in New Zealand, Research Monograph 39, New Zealand Institute of Economic Research, Wellington.
Controller and Auditor-General (1998), Report of the Controller and Auditor-General: Second Report for 1998, Wellington.
Jardine, V. (1989), Crisis in Agricultural Research and Development in New Zealand? invited paper presented to Annual Conference of the Australian Agricultural Economics Society, 6-9 February 1989, Christchurch, New Zealand.
Johnson, R.W.M. (1999), The Rate of Return to New Zealand Research and Development, contributed paper to Annual Conference of NZ Association of Economists, Rotorua, 29-30 June, 1999.
MoRST (Ministry of Research, Science and Technology)(1991), New Zealand Research and Development Statistics: Business Enterprise Sector, 1989-90, Publication No 1, Wellington.
MoRST (1992a), New Zealand Research and Development Statistics: Government Sector, 1989-90, Publication No 3.
MoRST (1992b), Long Term Priorities for the Public Good Science Fund: a Discussion Paper, (Science and Technology Expert Panel),(STEP Report).
MoRST (1992c), Long Term Priorities for the Public Good Science Fund: Final Report.
MoRST (1993), New Zealand Research and Development Statistics: All Sectors, 1990-91, Publication No 7,
MoRST (1994), New Zealand Research and Development Statistics: All Sectors, 1991-92, Publication No 12.
MoRST (1995a), New Zealand Research and Development Statistics: All Sectors, 1992-93, Publication No 13.
MoRST(1995b), R, S&T 2010, The Government's Strategy for Research, Science and Technology in New Zealand to the Year 2010.
MoRST (1996a), New Zealand Research and Development Statistics, All Sectors, 1993-94, Publication No 15.
MoRST (1996b), Briefing Notes for the Minister of Science, Research and Technology, Report No 53.
MoRST (1997a), New Zealand Research and Development Statistics: All Sectors, 1995-96, Publication No 16.
MoRST (1997b), Notice to the Foundation for Research, Science and Technology (FRST): the Government's Policies and Priorities for Public Good Science and Technology, www.morst.
Morst (1999), New Zealand Research and Development Statistics 1997/98, Publication No 17.
TIWG (Technological Innovation Working Group)(Chairman: Rick Christie)(1996), Report to the Minister for Research, Science and Technology, MoRST, Wellington.
Winsley P. (1996), Research and Development as a Socially Efficient Investment, Discussion Paper No 4, Foundation for Research, Science and Technology, Wellington.
| Table 1: Spending on Research by Institutions and Major Output Classes 1997-98 % | |||
|---|---|---|---|
| ‘Business’ | Universities | Government | |
| Primary production/processing | 37.6 | 6.7 | 55.9 |
| Manufacturing | 50.7 | 19.8 | 29.4 |
| Construction/transport/energy | 50.1 | 26.3 | 23.5 |
| Social sciences | 2.0 | 83.1 | 14.8 |
| Environment | 2.6 | 24.3 | 73.1 |
| Information/communications | 67.5 | 21.1 | 11.3 |
| Fund'l, Health, Defence | 10.5 | 82.4 | 7.1 |
| Total 1997-98 | 28.2 | 36.4 | 35.3 |
| Total 1995-96 | 27.0 | 30.7 | 42.2 |
Source: Table on p.8, MoRST 1999. Businessis the MoRST descriptor. |
1 For a review of the issues up to early 1989, see Jardine (1989). The election of the National government in 1991 precipitated the organisational and funding reforms eventually under Minister Upton.
2 This administrative arrangement had first been suggested by the 1988 Science and Technology Committee (STAC), though it was not adopted until 1991 (Jardine 1989, p.11).
3 Comparative figures are given in Alston, Pardey and Smith (1998, p.66).
4 Some companies have made rapid strides in recent years (BERL 1995, p.97). Winsley (1996, pp.5,10-11, 20) discusses some of the lag effects in adoption of research, the weakening of property rights by networking, and the `tacitness and inarticulate nature of much know-how in New Zealand.
5 MoRST (1996b, pp.22-23)
seems to have arrived at a similar conclusion. While inadequate
private sector investment in Research and Development is widely cited as the primary
reason for public investment in Research and Development, this viewpoint alone does
not provide a basis to say exactly what Government should do, how
it should do it, and how much it should do. Determining what the
Government should do cannot be easily settled by economic theory.
To ensure that private sector investment is not ‘crowded out’, the
Government must focus resources where markets are most likely to
fail. Recent analyses have shown a significant positive correlation
between public spending on research (generally on strategic
research) and business-funded Research and Development activities. `Induced'
privately funded Research and Development is linked to knowledge transfer between
publicly and privately funded Research and Development programmes..... The boundary
between public and private Research and Development is unlikely to be absolute, and
will vary between firms, industries and sectors depending on the
extent of maarket failure
.
6 In the BERL (1995, pp.163-4) survey, financial institutions stated that the needs of innovative firms for project advice, financial planning, and the provision of equity and initial loan capital were not being met. There were also serious shortcomings in the range of management skills posessed by those persons within the innovative firms who are responsible for dealing with financial matters. The BERL report also notes that scientific and technological information reaches small and medium enterprises essentially through ‘networks’ which are usually informal. The TIWG Report states that there are 20,000 manufacturing enterprises of which 6,000 have a staff of more than 5, 750 have a staff of more than 50. Only 70 enterprises undertake private Research and Development programmes.
7 Jardine (1989, p.3) doubts whether market failure explains the fundamental causes of underinvestment. Government failure may be present as well as market failure. Excessive transaction costs constrain economic behaviour and prevent exchanges that would occur in frictionless markets. More emphasis should be given to tests of appropriability.
8 The Minister appointed the Technological Innovation Working Group (TIWG) in September 1996 to examine and report on these issues. The group identified three areas of strategic focus: raising the technological competence and understanding of more NZ enterprises; ensuring the environment within which technology investments are made is free of regulatory, institutional and other impediments; and enhancing the integration of NZ firms into the global technology market.
9 Similar concerns are
expressed by BERL (1995, pp.117-8, 131): despite their profile
and previous experience, the research institutes are not seen as an
important source of innovative information or ideas
. This was
true of small and large companies. BERL concludes that heavy PGSF
funding will continue to prevent CRIs moving to new areas of
research more suited to the needs of industry.
10 In international terms (OECD countries), private sector funding grew faster than public sector funding between 1981 and 1993, with an implicit transfer of funds at the margin into the public sector (Alston, Pardey and Smith 1998, p.64).
11 See Johnson (1999).
12 ESR is funded on contract directly by government departments (police etc). It failed to meet its rate of return target in 1996/97. The low return was due to restructuring costs and a better return was expected for the following year (NBR, July 31, 1998).
13 Winsley (1986, p.2)
says it is questionable whether many industries failed to invest in
Research and Development because of a view that is is a government responsibility.
Cuts in funding in the 1980s did not bring about a corresponding
increase in private Research and Development investment. Patchy data suggest it is
reducing public Research and Development investment that leads to reduced industry
Research and Development. On the other hand, the TIWG (p.29) recommended that
....PGSF should be managed in a way that maximises the adopting
and application of PGSF results by users, without at the same time,
‘crowding out’ or displacing non PGSF funding
.
14 Winsley (1996) suggests that publicly funded research reduced incentives for scientists and their managers to perform, by shielding them from competitive pressures and from the need to interact with industry. The departmental science structures created difficulties in monitoring performance and the strategic direction of science, and core funding negated any competitive pressures. The science reforms have created some of the characteristics of a market for research which is now conducted by entities that replicate many of the incentive structures, commercial powers and behavioural traits of private firms. In the BERL Report (p.177), the authors note that the manufacturing sector had a strong dependency on the government in the 1970s. While complaining about government interference, most firms saw government as having a major responsibility for problem solving.


| Undo | Ctrl + Z |
| Redo | Ctrl + Y |
| Cut | Ctrl + X |
| Paste as unformatted text | Ctrl + Alt + Shift + V |
| Print (Download as PDF) | Ctrl + P |
| Bold | Ctrl + B |
| Italic | Ctrl + I |
| Underline | Ctrl + U |
| Double Underline | Ctrl + D |
| Strikethrough | Ctrl + Alt + 5 |
| Superscript | Ctrl + Shift + P |
| Subscript | Ctrl + Shift + B |
| Remove direct formatting | Ctrl + M |
| Align Center | Ctrl + E |
| Align Left | Ctrl + L |
| Align Right | Ctrl + R |
| Justify | Ctrl + J |
| Apply Default paragraph style | Ctrl + 0 |
| Apply Heading 1 paragraph style | Ctrl + 1 |
| Apply Heading 2 paragraph style | Ctrl + 2 |
| Apply Heading 3 paragraph style | Ctrl + 3 |
| Apply Heading 4 paragraph style | Ctrl + 4 |
| Apply Heading 5 paragraph style | Ctrl + 5 |
| Select All | Ctrl + A |
| Move cursor to the left | Arrow Left |
| Move cursor with selection to the left | Shift + Arrow Left |
| Go to beginning of a word | Ctrl + Arrow Left |
| Select to the left word by word | Ctrl + Shift + Arrow Left |
| Move cursor to the right | Arrow Right |
| Move cursor with selection to the right | Shift + Arrow Right |
| Go to start of the next word | Ctrl + Arrow Right |
| Select to the right word by word | Ctrl + Shift + Arrow Right |
| Move cursor up one line | Arrow Up |
| Select lines in upwards direction | Shift + Arrow Up |
| Move cursor to beginning of the previous paragraph | Ctrl + Arrow Up |
| Select to beginning of paragraph | Ctrl + Shift + Arrow Up |
| Move cursor down one line | Arrow Down |
| Select lines in downwards direction | Shift + Arrow Down |
| Move cursor to end of the previous paragraph | Ctrl + Arrow Down |
| Select to end of paragraph | Ctrl + Shift + Arrow Down |
| Go to beginning of line | Home |
| Go and select to the beginning of a line | Shift + Home |
| Go to start of document | Ctrl + Home |
| Go and select text to start of document | Ctrl + Shift + Home |
| Go to end of line | End |
| Go and select to the end of a line | Shift + End |
| Go to end of document | Ctrl + End |
| Go and select text to end of document | Ctrl + Shift + End |
| Move the view up one page | PageUp |
| Switch cursor between text and header | Ctrl + PageUp |
| Extend the selection up one page | Shift + PageUp |
| Move the view down one page | PageDown |
| Switch cursor between text and footer | Ctrl + PageDown |
| Extend the selection down one page | Shift + PageDown |
| Delete to beginning of word | Ctrl + Backspace |
| Delete to end of word | Ctrl + Del |
| Delete to beginning of sentence | Ctrl + Shift + Backspace |
| Delete to end of sentence | Ctrl + Shift + Del |
| Ctrl + A | If the active cell is empty: selects the whole table. Otherwise: selects the contents of the active cell. Pressing again selects the entire table. |
| Ctrl + Home | If the active cell is empty: goes to the beginning of the table. Otherwise: first press goes to beginning of the active cell, second press goes to beginning of the current table, third press goes to beginning of document. |
| Ctrl + End | If the active cell is empty: goes to the end of the table. Otherwise: first press goes to the end of the active cell, second press goes to the end of the current table, third press goes to the end of the document. |
| Ctrl + Tab | Inserts a tab stop (only in tables). Depending on the Window Manager in use, Alt + Tab may be used instead. |
| Alt + Arrow Keys | Increases/decreases the size of the column/row on the right/bottom cell edge |
| Alt + Shift + Arrow Keys | Increase/decrease the size of the column/row on the left/top cell edge |
| Alt + Ctrl + Arrow Keys | Like Alt, but only the active cell is modified |
| Ctrl + Alt + Shift + Arrow Keys | Like Alt, but only the active cell is modified |
| Alt + Insert | 3 seconds in Insert mode, Arrow Key inserts row/column, Ctrl + Arrow Key inserts cell |
| Alt + Del | 3 seconds in Delete mode, Arrow key deletes row/column, Ctrl + Arrow key merges cell with neighboring cell |
| Shift + Ctrl + Del | If no whole cell is selected, the text from the cursor to the end of the current sentence is deleted. If the cursor is at the end of a cell, and no whole cell is selected, the contents of the next cell are deleted.
If no whole cell is selected and the cursor is at the end of the table, the paragraph following the table will be deleted, unless it is the last paragraph in the document. If one or more cells are selected, the whole rows containing the selection will be deleted. If all rows are selected completely or partially, the entire table will be deleted. |
| Insert footnote | Ctrl + Alt + F |
| Insert endnote | Ctrl + Alt + D |
| Insert comment | Ctrl + Alt + C |
| Insert soft hyphen | Ctrl + - |
| Insert non-breaking hyphen | Ctrl + Shift + - |
| Insert non-breaking space | Ctrl + Shift + Space |
| Insert line break | Shift + Enter |
| Manual page break | Ctrl + Enter |
| Column break (in multicolumnar text) | Ctrl + Shift + Enter |
| Insert new paragraph directly before or after a section, or before a table | Alt + Enter |
| Insert new paragraph without numbering inside a list. Does not work when the cursor is at the end of the list. | Alt + Enter |
| Bold | Ctrl + B |
| Italic | Ctrl + I |
| Underline | Ctrl + U |
| Strikethrough | Ctrl + Alt + 5 |
| Remove direct formatting | Ctrl + M |
| Insert comment | Ctrl + Alt + C |
| Display comment | Ctrl + F1 |
| Fill Down | Ctrl + D |
| Align Center | Ctrl + E |
| Align Left | Ctrl + L |
| Align Right | Ctrl + R |
| Justify | Ctrl + J |
| Set Optimal Column Width | Ctrl + 3 |
| Two decimal places, thousands separator | Ctrl + Shift + 1 |
| Standard exponential format | Ctrl + Shift + 2 |
| Standard date format | Ctrl + Shift + 3 |
| Standard currency format | Ctrl + Shift + 4 |
| Standard percentage format (two decimal places) | Ctrl + Shift + 5 |
| Standard format | Ctrl + Shift + 6 |
| Bold | Ctrl + B |
| Italic | Ctrl + I |
| Underline | Ctrl + U |
| Strikethrough | Ctrl + Alt + 5 |
| Superscript | Ctrl + Shift + P |
| Subscript | Ctrl + Shift + B |
| Select All | Ctrl + A |
| Align Center | Ctrl + E |
| Align Left | Ctrl + L |
| Align Right | Ctrl + R |
| Justify | Ctrl + J |
| Demote list item (list item has to be selected) | Tab |
| Promote list item (list item has to be selected) | Shift + Tab |
| Select All | Ctrl + A |
| Move cursor to the left | Arrow Left |
| Move cursor with selection to the left | Shift + Arrow Left |
| Go to beginning of a word | Ctrl + Arrow Left |
| Select to the left word by word | Ctrl + Shift + Arrow Left |
| Move cursor to the right | Arrow Right |
| Move cursor with selection to the right | Shift + Arrow Right |
| Go to start of the next word | Ctrl + Arrow Right |
| Select to the right word by word | Ctrl + Shift + Arrow Right |
| Move cursor up one line | Arrow Up |
| Select lines in upwards direction | Shift + Arrow Up |
| Move cursor to beginning of the previous paragraph | Ctrl + Arrow Up |
| Select to beginning of paragraph | Ctrl + Shift + Arrow Up |
| Move cursor down one line | Arrow Down |
| Select lines in downwards direction | Shift + Arrow Down |
| Move cursor to end of the previous paragraph | Ctrl + Arrow Down |
| Select to end of paragraph | Ctrl + Shift + Arrow Down |
| Go to beginning of line | Home |
| Go and select to the beginning of a line | Shift + Home |
| Go to start of document | Ctrl + Home |
| Go and select text to start of textbox | Ctrl + Shift + Home |
| Go to end of line | End |
| Go and select to the end of a line | Shift + End |
| Go to end of document | Ctrl + End |
| Go and select text to end of textbox | Ctrl + Shift + End |
| Escape current mode, i.e. from edit mode switch to object selection mode, from object selection mode switch to view mode. | Esc |
| Select objects in the order in which they were created | Tab |
| Select objects in the reverse order in which they were created | Shift + Tab |
| Move to next text object on slide / drawing page | Ctrl + Enter |
| Select all in slide / drawing page | Ctrl + A |


BookingAppointment extends Entity
BookingAppointment class
Tags
Table of Contents
- $_propDict : array<string|int, mixed>
- The array of properties available to the model
- __construct() : mixed
- Construct a new Entity
- getAdditionalInformation() : string|null
- Gets the additionalInformation
- getCustomerEmailAddress() : string|null
- Gets the customerEmailAddress The SMTP address of the bookingCustomer who is booking the appointment.
- getCustomerId() : string|null
- Gets the customerId If CustomerId is not specified when an appointment is created then a new customer is created based on the appointment customer information. Once set, the customerId should be considered immutable.
- getCustomerLocation() : Location|null
- Gets the customerLocation Represents location information for the bookingCustomer who is booking the appointment.
- getCustomerName() : string|null
- Gets the customerName The customer's name.
- getCustomerNotes() : string|null
- Gets the customerNotes The value of this property is only available when reading an individual booking appointment by id. Its value can only be set when creating a new appointment with a new customer, ie, without specifying a CustomerId. After that, the property is computed from the customer represented by CustomerId.
- getCustomerPhone() : string|null
- Gets the customerPhone The customer's phone number.
- getDuration() : Duration|null
- Gets the duration The length of the appointment, denoted in ISO8601 format.
- getEnd() : DateTimeTimeZone|null
- Gets the end The date, time, and time zone that the appointment ends.
- getId() : string|null
- Gets the id Read-only.
- getInvoiceAmount() : float|null
- Gets the invoiceAmount The billed amount on the invoice.
- getInvoiceDate() : DateTimeTimeZone|null
- Gets the invoiceDate The date, time, and time zone of the invoice for this appointment.
- getInvoiceId() : string|null
- Gets the invoiceId The ID of the invoice.
- getInvoiceStatus() : BookingInvoiceStatus|null
- Gets the invoiceStatus The status of the invoice. Possible values are: draft, reviewing, open, canceled, paid, corrective.
- getInvoiceUrl() : string|null
- Gets the invoiceUrl The URL of the invoice in Microsoft Bookings.
- getIsLocationOnline() : bool|null
- Gets the isLocationOnline
- getODataType() : string|null
- Gets the ODataType
- getOnlineMeetingUrl() : string|null
- Gets the onlineMeetingUrl
- getOptOutOfCustomerEmail() : bool|null
- Gets the optOutOfCustomerEmail True indicates that the bookingCustomer for this appointment does not wish to receive a confirmation for this appointment.
- getPostBuffer() : Duration|null
- Gets the postBuffer The amount of time to reserve after the appointment ends, for cleaning up, as an example. The value is expressed in ISO8601 format.
- getPreBuffer() : Duration|null
- Gets the preBuffer The amount of time to reserve before the appointment begins, for preparation, as an example. The value is expressed in ISO8601 format.
- getPrice() : float|null
- Gets the price The regular price for an appointment for the specified bookingService.
- getPriceType() : BookingPriceType|null
- Gets the priceType A setting to provide flexibility for the pricing structure of services. Possible values are: undefined, fixedPrice, startingAt, hourly, free, priceVaries, callUs, notSet.
- getProperties() : array<string|int, mixed>
- Gets the property dictionary of the Entity
- getReminders() : array<string|int, mixed>|null
- Gets the reminders The value of this property is only available when reading an individual booking appointment by id.
- getSelfServiceAppointmentId() : string|null
- Gets the selfServiceAppointmentId An additional tracking ID for the appointment, if the appointment has been created directly by the customer on the scheduling page, as opposed to by a staff member on the behalf of the customer.
- getServiceId() : string|null
- Gets the serviceId The ID of the bookingService associated with this appointment.
- getServiceLocation() : Location|null
- Gets the serviceLocation The location where the service is delivered.
- getServiceName() : string|null
- Gets the serviceName This property is optional when creating a new appointment. If not specified, it is computed from the service associated with the appointment by the service id.
- getServiceNotes() : string|null
- Gets the serviceNotes The value of this property is only available when reading an individual booking appointment by id.
- getStaffMemberIds() : string|null
- Gets the staffMemberIds The ID of each bookingStaffMember who is scheduled in this appointment.
- getStart() : DateTimeTimeZone|null
- Gets the start The date, time, and time zone that the appointment begins.
- jsonSerialize() : array<string|int, mixed>
- Serializes the object by property array Manually serialize DateTime into RFC3339 format
- setAdditionalInformation() : BookingAppointment
- Sets the additionalInformation
- setCustomerEmailAddress() : BookingAppointment
- Sets the customerEmailAddress The SMTP address of the bookingCustomer who is booking the appointment.
- setCustomerId() : BookingAppointment
- Sets the customerId If CustomerId is not specified when an appointment is created then a new customer is created based on the appointment customer information. Once set, the customerId should be considered immutable.
- setCustomerLocation() : BookingAppointment
- Sets the customerLocation Represents location information for the bookingCustomer who is booking the appointment.
- setCustomerName() : BookingAppointment
- Sets the customerName The customer's name.
- setCustomerNotes() : BookingAppointment
- Sets the customerNotes The value of this property is only available when reading an individual booking appointment by id. Its value can only be set when creating a new appointment with a new customer, ie, without specifying a CustomerId. After that, the property is computed from the customer represented by CustomerId.
- setCustomerPhone() : BookingAppointment
- Sets the customerPhone The customer's phone number.
- setDuration() : BookingAppointment
- Sets the duration The length of the appointment, denoted in ISO8601 format.
- setEnd() : BookingAppointment
- Sets the end The date, time, and time zone that the appointment ends.
- setId() : Entity
- Sets the id Read-only.
- setInvoiceAmount() : BookingAppointment
- Sets the invoiceAmount The billed amount on the invoice.
- setInvoiceDate() : BookingAppointment
- Sets the invoiceDate The date, time, and time zone of the invoice for this appointment.
- setInvoiceId() : BookingAppointment
- Sets the invoiceId The ID of the invoice.
- setInvoiceStatus() : BookingAppointment
- Sets the invoiceStatus The status of the invoice. Possible values are: draft, reviewing, open, canceled, paid, corrective.
- setInvoiceUrl() : BookingAppointment
- Sets the invoiceUrl The URL of the invoice in Microsoft Bookings.
- setIsLocationOnline() : BookingAppointment
- Sets the isLocationOnline
- setODataType() : Entity
- Sets the ODataType
- setOnlineMeetingUrl() : BookingAppointment
- Sets the onlineMeetingUrl
- setOptOutOfCustomerEmail() : BookingAppointment
- Sets the optOutOfCustomerEmail True indicates that the bookingCustomer for this appointment does not wish to receive a confirmation for this appointment.
- setPostBuffer() : BookingAppointment
- Sets the postBuffer The amount of time to reserve after the appointment ends, for cleaning up, as an example. The value is expressed in ISO8601 format.
- setPreBuffer() : BookingAppointment
- Sets the preBuffer The amount of time to reserve before the appointment begins, for preparation, as an example. The value is expressed in ISO8601 format.
- setPrice() : BookingAppointment
- Sets the price The regular price for an appointment for the specified bookingService.
- setPriceType() : BookingAppointment
- Sets the priceType A setting to provide flexibility for the pricing structure of services. Possible values are: undefined, fixedPrice, startingAt, hourly, free, priceVaries, callUs, notSet.
- setReminders() : BookingAppointment
- Sets the reminders The value of this property is only available when reading an individual booking appointment by id.
- setSelfServiceAppointmentId() : BookingAppointment
- Sets the selfServiceAppointmentId An additional tracking ID for the appointment, if the appointment has been created directly by the customer on the scheduling page, as opposed to by a staff member on the behalf of the customer.
- setServiceId() : BookingAppointment
- Sets the serviceId The ID of the bookingService associated with this appointment.
- setServiceLocation() : BookingAppointment
- Sets the serviceLocation The location where the service is delivered.
- setServiceName() : BookingAppointment
- Sets the serviceName This property is optional when creating a new appointment. If not specified, it is computed from the service associated with the appointment by the service id.
- setServiceNotes() : BookingAppointment
- Sets the serviceNotes The value of this property is only available when reading an individual booking appointment by id.
- setStaffMemberIds() : BookingAppointment
- Sets the staffMemberIds The ID of each bookingStaffMember who is scheduled in this appointment.
- setStart() : BookingAppointment
- Sets the start The date, time, and time zone that the appointment begins.
Properties
$_propDict
The array of properties available to the model
protected
array<string|int, mixed>
$_propDict
Methods
__construct()
Construct a new Entity
public
__construct([array<string|int, mixed> $propDict = array() ]) : mixed
Parameters
- $propDict : array<string|int, mixed> = array()
-
A list of properties to set
Return values
mixed —getAdditionalInformation()
Gets the additionalInformation
public
getAdditionalInformation() : string|null
Return values
string|null —The additionalInformation
getCustomerEmailAddress()
Gets the customerEmailAddress The SMTP address of the bookingCustomer who is booking the appointment.
public
getCustomerEmailAddress() : string|null
Return values
string|null —The customerEmailAddress
getCustomerId()
Gets the customerId If CustomerId is not specified when an appointment is created then a new customer is created based on the appointment customer information. Once set, the customerId should be considered immutable.
public
getCustomerId() : string|null
Return values
string|null —The customerId
getCustomerLocation()
Gets the customerLocation Represents location information for the bookingCustomer who is booking the appointment.
public
getCustomerLocation() : Location|null
Return values
Location|null —The customerLocation
getCustomerName()
Gets the customerName The customer's name.
public
getCustomerName() : string|null
Return values
string|null —The customerName
getCustomerNotes()
Gets the customerNotes The value of this property is only available when reading an individual booking appointment by id. Its value can only be set when creating a new appointment with a new customer, ie, without specifying a CustomerId. After that, the property is computed from the customer represented by CustomerId.
public
getCustomerNotes() : string|null
Return values
string|null —The customerNotes
getCustomerPhone()
Gets the customerPhone The customer's phone number.
public
getCustomerPhone() : string|null
Return values
string|null —The customerPhone
getDuration()
Gets the duration The length of the appointment, denoted in ISO8601 format.
public
getDuration() : Duration|null
Return values
Duration|null —The duration
getEnd()
Gets the end The date, time, and time zone that the appointment ends.
public
getEnd() : DateTimeTimeZone|null
Return values
DateTimeTimeZone|null —The end
getId()
Gets the id Read-only.
public
getId() : string|null
Return values
string|null —The id
getInvoiceAmount()
Gets the invoiceAmount The billed amount on the invoice.
public
getInvoiceAmount() : float|null
Return values
float|null —The invoiceAmount
getInvoiceDate()
Gets the invoiceDate The date, time, and time zone of the invoice for this appointment.
public
getInvoiceDate() : DateTimeTimeZone|null
Return values
DateTimeTimeZone|null —The invoiceDate
getInvoiceId()
Gets the invoiceId The ID of the invoice.
public
getInvoiceId() : string|null
Return values
string|null —The invoiceId
getInvoiceStatus()
Gets the invoiceStatus The status of the invoice. Possible values are: draft, reviewing, open, canceled, paid, corrective.
public
getInvoiceStatus() : BookingInvoiceStatus|null
Return values
BookingInvoiceStatus|null —The invoiceStatus
getInvoiceUrl()
Gets the invoiceUrl The URL of the invoice in Microsoft Bookings.
public
getInvoiceUrl() : string|null
Return values
string|null —The invoiceUrl
getIsLocationOnline()
Gets the isLocationOnline
public
getIsLocationOnline() : bool|null
Return values
bool|null —The isLocationOnline
getODataType()
Gets the ODataType
public
getODataType() : string|null
Return values
string|null —The ODataType
getOnlineMeetingUrl()
Gets the onlineMeetingUrl
public
getOnlineMeetingUrl() : string|null
Return values
string|null —The onlineMeetingUrl
getOptOutOfCustomerEmail()
Gets the optOutOfCustomerEmail True indicates that the bookingCustomer for this appointment does not wish to receive a confirmation for this appointment.
public
getOptOutOfCustomerEmail() : bool|null
Return values
bool|null —The optOutOfCustomerEmail
getPostBuffer()
Gets the postBuffer The amount of time to reserve after the appointment ends, for cleaning up, as an example. The value is expressed in ISO8601 format.
public
getPostBuffer() : Duration|null
Return values
Duration|null —The postBuffer
getPreBuffer()
Gets the preBuffer The amount of time to reserve before the appointment begins, for preparation, as an example. The value is expressed in ISO8601 format.
public
getPreBuffer() : Duration|null
Return values
Duration|null —The preBuffer
getPrice()
Gets the price The regular price for an appointment for the specified bookingService.
public
getPrice() : float|null
Return values
float|null —The price
getPriceType()
Gets the priceType A setting to provide flexibility for the pricing structure of services. Possible values are: undefined, fixedPrice, startingAt, hourly, free, priceVaries, callUs, notSet.
public
getPriceType() : BookingPriceType|null
Return values
BookingPriceType|null —The priceType
getProperties()
Gets the property dictionary of the Entity
public
getProperties() : array<string|int, mixed>
Return values
array<string|int, mixed> —The list of properties
getReminders()
Gets the reminders The value of this property is only available when reading an individual booking appointment by id.
public
getReminders() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —The reminders
getSelfServiceAppointmentId()
Gets the selfServiceAppointmentId An additional tracking ID for the appointment, if the appointment has been created directly by the customer on the scheduling page, as opposed to by a staff member on the behalf of the customer.
public
getSelfServiceAppointmentId() : string|null
Return values
string|null —The selfServiceAppointmentId
getServiceId()
Gets the serviceId The ID of the bookingService associated with this appointment.
public
getServiceId() : string|null
Return values
string|null —The serviceId
getServiceLocation()
Gets the serviceLocation The location where the service is delivered.
public
getServiceLocation() : Location|null
Return values
Location|null —The serviceLocation
getServiceName()
Gets the serviceName This property is optional when creating a new appointment. If not specified, it is computed from the service associated with the appointment by the service id.
public
getServiceName() : string|null
Return values
string|null —The serviceName
getServiceNotes()
Gets the serviceNotes The value of this property is only available when reading an individual booking appointment by id.
public
getServiceNotes() : string|null
Return values
string|null —The serviceNotes
getStaffMemberIds()
Gets the staffMemberIds The ID of each bookingStaffMember who is scheduled in this appointment.
public
getStaffMemberIds() : string|null
Return values
string|null —The staffMemberIds
getStart()
Gets the start The date, time, and time zone that the appointment begins.
public
getStart() : DateTimeTimeZone|null
Return values
DateTimeTimeZone|null —The start
jsonSerialize()
Serializes the object by property array Manually serialize DateTime into RFC3339 format
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —The list of properties
setAdditionalInformation()
Sets the additionalInformation
public
setAdditionalInformation(string $val) : BookingAppointment
Parameters
- $val : string
-
The additionalInformation
Return values
BookingAppointment —setCustomerEmailAddress()
Sets the customerEmailAddress The SMTP address of the bookingCustomer who is booking the appointment.
public
setCustomerEmailAddress(string $val) : BookingAppointment
Parameters
- $val : string
-
The customerEmailAddress
Return values
BookingAppointment —setCustomerId()
Sets the customerId If CustomerId is not specified when an appointment is created then a new customer is created based on the appointment customer information. Once set, the customerId should be considered immutable.
public
setCustomerId(string $val) : BookingAppointment
Parameters
- $val : string
-
The customerId
Return values
BookingAppointment —setCustomerLocation()
Sets the customerLocation Represents location information for the bookingCustomer who is booking the appointment.
public
setCustomerLocation(Location $val) : BookingAppointment
Parameters
- $val : Location
-
The customerLocation
Return values
BookingAppointment —setCustomerName()
Sets the customerName The customer's name.
public
setCustomerName(string $val) : BookingAppointment
Parameters
- $val : string
-
The customerName
Return values
BookingAppointment —setCustomerNotes()
Sets the customerNotes The value of this property is only available when reading an individual booking appointment by id. Its value can only be set when creating a new appointment with a new customer, ie, without specifying a CustomerId. After that, the property is computed from the customer represented by CustomerId.
public
setCustomerNotes(string $val) : BookingAppointment
Parameters
- $val : string
-
The customerNotes
Return values
BookingAppointment —setCustomerPhone()
Sets the customerPhone The customer's phone number.
public
setCustomerPhone(string $val) : BookingAppointment
Parameters
- $val : string
-
The customerPhone
Return values
BookingAppointment —setDuration()
Sets the duration The length of the appointment, denoted in ISO8601 format.
public
setDuration(Duration $val) : BookingAppointment
Parameters
- $val : Duration
-
The duration
Return values
BookingAppointment —setEnd()
Sets the end The date, time, and time zone that the appointment ends.
public
setEnd(DateTimeTimeZone $val) : BookingAppointment
Parameters
- $val : DateTimeTimeZone
-
The end
Return values
BookingAppointment —setId()
Sets the id Read-only.
public
setId(string $val) : Entity
Parameters
- $val : string
-
The id
Return values
Entity —setInvoiceAmount()
Sets the invoiceAmount The billed amount on the invoice.
public
setInvoiceAmount(float $val) : BookingAppointment
Parameters
- $val : float
-
The invoiceAmount
Return values
BookingAppointment —setInvoiceDate()
Sets the invoiceDate The date, time, and time zone of the invoice for this appointment.
public
setInvoiceDate(DateTimeTimeZone $val) : BookingAppointment
Parameters
- $val : DateTimeTimeZone
-
The invoiceDate
Return values
BookingAppointment —setInvoiceId()
Sets the invoiceId The ID of the invoice.
public
setInvoiceId(string $val) : BookingAppointment
Parameters
- $val : string
-
The invoiceId
Return values
BookingAppointment —setInvoiceStatus()
Sets the invoiceStatus The status of the invoice. Possible values are: draft, reviewing, open, canceled, paid, corrective.
public
setInvoiceStatus(BookingInvoiceStatus $val) : BookingAppointment
Parameters
- $val : BookingInvoiceStatus
-
The invoiceStatus
Return values
BookingAppointment —setInvoiceUrl()
Sets the invoiceUrl The URL of the invoice in Microsoft Bookings.
public
setInvoiceUrl(string $val) : BookingAppointment
Parameters
- $val : string
-
The invoiceUrl
Return values
BookingAppointment —setIsLocationOnline()
Sets the isLocationOnline
public
setIsLocationOnline(bool $val) : BookingAppointment
Parameters
- $val : bool
-
The isLocationOnline
Return values
BookingAppointment —setODataType()
Sets the ODataType
public
setODataType(string $val) : Entity
Parameters
- $val : string
-
The ODataType
Return values
Entity —setOnlineMeetingUrl()
Sets the onlineMeetingUrl
public
setOnlineMeetingUrl(string $val) : BookingAppointment
Parameters
- $val : string
-
The onlineMeetingUrl
Return values
BookingAppointment —setOptOutOfCustomerEmail()
Sets the optOutOfCustomerEmail True indicates that the bookingCustomer for this appointment does not wish to receive a confirmation for this appointment.
public
setOptOutOfCustomerEmail(bool $val) : BookingAppointment
Parameters
- $val : bool
-
The optOutOfCustomerEmail
Return values
BookingAppointment —setPostBuffer()
Sets the postBuffer The amount of time to reserve after the appointment ends, for cleaning up, as an example. The value is expressed in ISO8601 format.
public
setPostBuffer(Duration $val) : BookingAppointment
Parameters
- $val : Duration
-
The postBuffer
Return values
BookingAppointment —setPreBuffer()
Sets the preBuffer The amount of time to reserve before the appointment begins, for preparation, as an example. The value is expressed in ISO8601 format.
public
setPreBuffer(Duration $val) : BookingAppointment
Parameters
- $val : Duration
-
The preBuffer
Return values
BookingAppointment —setPrice()
Sets the price The regular price for an appointment for the specified bookingService.
public
setPrice(float $val) : BookingAppointment
Parameters
- $val : float
-
The price
Return values
BookingAppointment —setPriceType()
Sets the priceType A setting to provide flexibility for the pricing structure of services. Possible values are: undefined, fixedPrice, startingAt, hourly, free, priceVaries, callUs, notSet.
public
setPriceType(BookingPriceType $val) : BookingAppointment
Parameters
- $val : BookingPriceType
-
The priceType
Return values
BookingAppointment —setReminders()
Sets the reminders The value of this property is only available when reading an individual booking appointment by id.
public
setReminders(BookingReminder $val) : BookingAppointment
Parameters
- $val : BookingReminder
-
The reminders
Return values
BookingAppointment —setSelfServiceAppointmentId()
Sets the selfServiceAppointmentId An additional tracking ID for the appointment, if the appointment has been created directly by the customer on the scheduling page, as opposed to by a staff member on the behalf of the customer.
public
setSelfServiceAppointmentId(string $val) : BookingAppointment
Parameters
- $val : string
-
The selfServiceAppointmentId
Return values
BookingAppointment —setServiceId()
Sets the serviceId The ID of the bookingService associated with this appointment.
public
setServiceId(string $val) : BookingAppointment
Parameters
- $val : string
-
The serviceId
Return values
BookingAppointment —setServiceLocation()
Sets the serviceLocation The location where the service is delivered.
public
setServiceLocation(Location $val) : BookingAppointment
Parameters
- $val : Location
-
The serviceLocation
Return values
BookingAppointment —setServiceName()
Sets the serviceName This property is optional when creating a new appointment. If not specified, it is computed from the service associated with the appointment by the service id.
public
setServiceName(string $val) : BookingAppointment
Parameters
- $val : string
-
The serviceName
Return values
BookingAppointment —setServiceNotes()
Sets the serviceNotes The value of this property is only available when reading an individual booking appointment by id.
public
setServiceNotes(string $val) : BookingAppointment
Parameters
- $val : string
-
The serviceNotes
Return values
BookingAppointment —setStaffMemberIds()
Sets the staffMemberIds The ID of each bookingStaffMember who is scheduled in this appointment.
public
setStaffMemberIds(string $val) : BookingAppointment
Parameters
- $val : string
-
The staffMemberIds
Return values
BookingAppointment —setStart()
Sets the start The date, time, and time zone that the appointment begins.
public
setStart(DateTimeTimeZone $val) : BookingAppointment
Parameters
- $val : DateTimeTimeZone
-
The start


Hello, HippoCoin Block
Level {{.block.Level}}: {{.block.Hash}}
Miner: {{.block.Miner}}
Time: {{.block.Time}}
NumBytes: {{.block.NumBytes}}
My Address:
{{.address}}
My Key:
{{.publicKey}}
Balance Change
{{range $key, $change := .block.BalanceChange}}
- {{$key}}: {{$change}}
{{end}}
{{range $i, $tr := .transactions}}
{{$i}}
{{$tr.Time}}
Senders
{{range $i, $address := $tr.SenderAddresses}}
- {{$address}}: {{index $tr.SenderAmounts $i }}
{{end}}
Receivers
{{range $i, $address := $tr.ReceiverAddresses}}
- {{$address}}: {{index $tr.ReceiverAmounts $i }}
{{end}}
Fee: {{$tr.Fee}}
{{end}}


Data gathering for Water Security: a suggested process
About
This is a guidance document for the Water Security Contextualized Assessment Tool developed within the Water Security Hub at Newcastle University. Separate documents illustrates methods and additional literature reviewed in this project .
Feedback
The document is open to feedback and suggestions.
For general comments you may use this form
For specific comments you may edit the text files that contain the guidance and the additional documentation here
Updates
22-31.01.2021 - Draft improved in order to be presented to Hub members for feedback
22.1.2021 - Initial draft uploaded on Github and online.


This library contains the different components of the r3 robot. Usually, there is no need to use this library directly.
| Name | Description |
|---|---|
| AxisControlBus | Data bus for one robot axis |
| ControlBus | Data bus for all axes of robot |
| PathPlanning1 | Generate reference angles for fastest kinematic movement |
| PathPlanning6 | Generate reference angles for fastest kinematic movement |
| PathToAxisControlBus | Map path planning to one axis control bus |
| GearType1 | Motor inertia and gearbox model for r3 joints 1,2,3 |
| GearType2 | Motor inertia and gearbox model for r3 joints 4,5,6 |
| Motor | Motor model including current controller of r3 motors |
| Controller | P-PI cascade controller for one axis |
| AxisType1 | Axis model of the r3 joints 1,2,3 |
| AxisType2 | Axis model of the r3 joints 4,5,6 |
| MechanicalStructure | Model of the mechanical part of the r3 robot (without animation) |


| Class | Octave |
| In: |
Octave/Octave.rb
|
| Parent: | Object |
interface to call octave facilities.
Octave.new(){|oct| ...}
oct = Octave.new() ; oct.start(){|oct| ...}
oct = Octave.new() ; oct.start() ; ... oct.final() ;
oct = Octave.new() ; oct.<method>
[1,2,3] => [1;2;3]
[[1,2,3]] => [1,2,3]
| DefaultCom | = | "octave" ; | command name | |
| DefaultComOption | = | "--silent" ; | basic option | |
| DefaultDelimiter | = | "___END_ANSWER___" ; | delimiter for answer |
| comOption | [RW] | default option |
| command | [RW] | command full path of octave. |
| strm | [RW] | command stream IO. |
description of method initialize
| comPath: | specify fullpath to octave. |
| optStr: | command line option for octave. |
| block: | if specified, block is executed with invoked octave stream |
convert Ruby Array to octave column vector string
| vec: | Ruby‘s Array of numeric |
| return: | octave column vector string |
convert Ruby matrix to octave matrix string
| csv: | CSV string of the matrix get from octave output |
| return: | Ruby‘s matrix (Array of Array of numeric). If the each row of the matrix has only single item, it is converted to Ruby Array. |
convert Ruby matrix to octave matrix string
| mat: | Ruby‘s matrix (Array of Array of numeric). If mat is [[1,2],[3,4]], it is converted to "[1,2;3,4]". If mat is [1,2,3], it is converted to "[1;2;3]". If mat is [[1,2,3]], it is converted to "[1,2,3]". |
| return: | octave matrix string |
convert Ruby matrix to octave matrix string
| mat: | Ruby‘s matrix (Array of Array of numeric) |
| return: | octave matrix string |
convert Ruby Array to octave row vector string
| vec: | Ruby‘s vector (Array of numeric) |
| return: | octave row vector string |
convert Octave scalar to Ruby float
| scalar: | scalar string in octave. |
| return: | Ruby‘s float value |
get eigenvalues and eigenvectors.
| mat: | a matrix (Array of Array of Numeric) |
| return: | [<Array of eigenvalues>, <Array of eigenVectors>] ; |
multiply matrix
| _mat0_: | the first matrix |
| _mat1_: | the second matrix |
| return: | multiplied matrix |
solve linear equation. Acquire the vector x w.r.t Ax=b.
| matA: | a matrix A (Array of Array of Numeric) |
| vecB: | an row vector b (Array of Numeric) |
| return: | solved x |


Contributed by Jon Bentley
The m1 program is a "little brother" to the m4 macro processor found on UNIX systems. It was originally published in the article m1: A Mini Macro Processor, in Computer Language, June 1990, Volume 7, Number 6, pages 47-61. This program was brought to my attention by Ozan Yigit. Jon Bentley kindly sent me his current version of the program, as well as an early draft of his article (I was having trouble getting a copy of the published one). A PostScript version of this paper is included with the example programs, available from O'Reilly's FTP server (see the Preface). I wrote these introductory notes, and the program notes below. [A.R.]
A macro processor copies its input to its output, while performing several jobs. The tasks are:
Define and expand macros. Macros have two parts, a name and a body. All occurrences of a macro's name are replaced with the macro's body.
Include files. Special include directives in a data file are replaced with the contents of the named file. Includes can usually be nested, with one included file including another. Included files are processed for macros.
Conditional text inclusion and exclusion. Different parts of the text can be included in the final output, often based upon whether a macro is or isn't defined.
Depending on the macro processor, comment lines can appear that will be removed from the final output.
If you're a C or C++ programmer, you're already familiar with the built-in preprocessor in those languages. UNIX systems have a general-purpose macro processor called m4. This is a powerful program, but somewhat difficult to master, since macro definitions are processed for expansion at definition time, instead of at expansion time. m1 is considerably simpler than m4, making it much easier to learn and to use.
Here is Jon's first cut at a very simple macro processor. All it does is define and expand macros. We can call it m0a. In this and the following programs, the "at" symbol (@) distinguishes lines that are directives, and also indicates the presence of macros that should be expanded.
/^@define[ \t]/ { name = $2 $1 = $2 = ""; sub(/^[ \t]+/, "") symtab[name] = $0 next } { for (i in symtab) gsub("@" i "@", symtab[i]) print }
This version looks for lines beginning with<EMAIL_ADDRESS>This keyword is $1 and the macro name is taken to be $2. The rest of the line becomes the body of the macro. The next input line is then fetched using next. The second rule simply loops through all the defined macros, performing a global substitution of each macro with its body in the input line, and then printing the line. Think about the tradeoffs in this version of simplicity versus program execution time.
The next version (m0b) adds file inclusion:
function dofile(fname) { while (getline <fname > 0) { if (/^@define[ \t]/) { # @define name value name = $2 $1 = $2 = ""; sub(/^[ \t]+/, "") symtab[name] = $0 } else if (/^@include[ \t]/) # @include filename dofile($2) else { # Anywhere in line @name@ for (i in symtab) gsub("@" i "@", symtab[i]) print } } close(fname) } BEGIN { if (ARGC == 2) dofile(ARGV[1]) else dofile("/dev/stdin") }
Note the way dofile() is called recursively to handle nested include files.
With all of that introduction out of the way, here is the full-blown m1 program.
#! /bin/awk -f # NAME # # m1 # # USAGE # # awk -f m1.awk [file...] # # DESCRIPTION # # M1 copies its input file(s) to its output unchanged except as modified by # certain "macro expressions." The following lines define macros for # subsequent processing: # # @comment Any text # @@ same as @comment # @define name value # @default name value set if name undefined # @include filename # @if varname include subsequent text if varname != 0 # @unless varname include subsequent text if varname == 0 # @fi terminate @if or @unless # @ignore DELIM ignore input until line that begins with DELIM # @stderr stuff send diagnostics to standard error # # A definition may extend across many lines by ending each line with # a backslash, thus quoting the following newline. # # Any occurrence of @name@ in the input is replaced in the output by # the corresponding value. # # @name at beginning of line is treated the same as<EMAIL_ADDRESS># # BUGS # # M1 is three steps lower than m4. You'll probably miss something # you have learned to expect. # # AUTHOR # # Jon L. Bentley<EMAIL_ADDRESS># function error(s) { print "m1 error: " s | "cat 1>&2"; exit 1 } function dofile(fname, savefile, savebuffer, newstring) { if (fname in activefiles) error("recursively reading file: " fname) activefiles[fname] = 1 savefile = file; file = fname savebuffer = buffer; buffer = "" while (readline() != EOF) { if (index($0, "@") == 0) { print $0 } else if (/^@define[ \t]/) { dodef() } else if (/^@default[ \t]/) { if (!($2 in symtab)) dodef() } else if (/^@include[ \t]/) { if (NF != 2) error("bad include line") dofile(dosubs($2)) } else if (/^@if[ \t]/) { if (NF != 2) error("bad if line") if (!($2 in symtab) || symtab[$2] == 0) gobble() } else if (/^@unless[ \t]/) { if (NF != 2) error("bad unless line") if (($2 in symtab) && symtab[$2] != 0) gobble() } else if (/^@fi([ \t]?|$)/) { # Could do error checking here } else if (/^@stderr[ \t]?/) { print substr($0, 9) | "cat 1>&2" } else if (/^@(comment|@)[ \t]?/) { } else if (/^@ignore[ \t]/) { # Dump input until $2 delim = $2 l = length(delim) while (readline() != EOF) if (substr($0, 1, l) == delim) break } else { newstring = dosubs($0) if ($0 == newstring || index(newstring, "@") == 0) print newstring else buffer = newstring "\n" buffer } } close(fname) delete activefiles[fname] file = savefile buffer = savebuffer } # Put next input line into global string "buffer" # Return "EOF" or "" (null string) function readline( i, status) { status = "" if (buffer != "") { i = index(buffer, "\n") $0 = substr(buffer, 1, i-1) buffer = substr(buffer, i+1) } else { # Hume: special case for non v10: if (file == "/dev/stdin") if (getline <file <= 0) status = EOF } # Hack: allow @Mname at start of line w/o closing @ if ($0 ~ /^@[A-Z][a-zA-Z0-9]*[ \t]*$/) sub(/[ \t]*$/, "@") return status } function gobble( ifdepth) { ifdepth = 1 while (readline() != EOF) { if (/^@(if|unless)[ \t]/) ifdepth++ if (/^@fi[ \t]?/ && --ifdepth <= 0) break } } function dosubs(s, l, r, i, m) { if (index(s, "@") == 0) return s l = "" # Left of current pos; ready for output r = s # Right of current; unexamined at this time while ((i = index(r, "@")) != 0) { l = l substr(r, 1, i-1) r = substr(r, i+1) # Currently scanning @ i = index(r, "@") if (i == 0) { l = l "@" break } m = substr(r, 1, i-1) r = substr(r, i+1) if (m in symtab) { r = symtab[m] r } else { l = l "@" m r = "@" r } } return l r } function dodef(fname, str, x) { name = $2 sub(/^[ \t]*[^ \t]+[ \t]+[^ \t]+[ \t]*/, "") # OLD BUG: last * was + str = $0 while (str ~ /\\$/) { if (readline() == EOF) error("EOF inside definition") x = $0 sub(/^[ \t]+/, "", x) str = substr(str, 1, length(str)-1) "\n" x } symtab[name] = str } BEGIN { EOF = "EOF" if (ARGC == 1) dofile("/dev/stdin") else if (ARGC >= 2) { for (i = 1; i < ARGC; i++) dofile(ARGV[i]) } else error("usage: m1 [fname...]") }
The program is nicely modular, with an error() function similar to the one presented in Chapter 11, A Flock of awks, and each task cleanly divided into separate functions.
The main program occurs in the BEGIN procedure at the bottom. It simply processes either standard input, if there are no arguments, or all of the files named on the command line.
The high-level processing happens in the dofile() function, which reads one line at a time, and decides what to do with each line. The activefiles array keeps track of open files. The variable fname indicates the current file to read data from. When an "@include" directive is seen, dofile() simply calls itself recursively on the new file, as in m0b. Interestingly, the included filename is first processed for macros. Read this function carefully - there are some nice tricks here.
The readline() function manages the "pushback." After expanding a macro, macro processors examine the newly created text for any additional macro names. Only after all expanded text has been processed and sent to the output does the program get a fresh line of input.
The dosubs() function actually performs the macro substitution. It processes the line left-to-right, replacing macro names with their bodies. The rescanning of the new line is left to the higher-level logic that is jointly managed by readline() and dofile(). This version is considerably more efficient than the brute-force approach used in the m0 programs.
Finally, the dodef() function handles the defining of macros. It saves the macro name from $2, and then uses sub() to remove the first two fields. The new value of $0 now contains just (the first line of) the macro body. The Computer Language article explains that sub() is used on purpose, in order to preserve whitespace in the macro body. Simply assigning the empty string to $1 and $2 would rebuild the record, but with all occurrences of whitespace collapsed into single occurrences of the value of OFS (a single blank). The function then proceeds to gather the rest of the macro body, indicated by lines that end with a "\". This is an additional improvement over m0: macro bodies can be more than one line long.
The rest of the program is concerned with conditional inclusion or exclusion of text; this part is straightforward. What's nice is that these conditionals can be nested inside each other.
m1 is a very nice start at a macro processor. You might want to think about how you could expand upon it; for instance, by allowing conditionals to have an "@else" clause; processing the command line for macro definitions; "undefining" macros, and the other sorts of things that macro processors usually do.
Some other extensions suggested by Jon Bentley are:
Add "@shell DELIM shell line here," which would read input lines up to "DELIM," and send the expanded output through a pipe to the given shell command.
Add commands "@longdef" and<EMAIL_ADDRESS>These commands would define macros with long bodies, i.e., those that extend over more than one line, simplifying the logic in dodoef().
Add "@append MacName MoreText," like ".am" in troff. This macro in troff appends text to an already defined macro. In m1, this would allow you to add on to the body of an already defined macro.
Avoid the V10 /dev/stdin special file. The Bell Labs UNIX systems[1] have a special file actually named /dev/stdin, that gives you access to standard input. It occurs to me that the use of "-" would do the trick, quite portably. This is also not a real issue if you use gawk or the Bell Labs awk, which interpret the special file name /dev/stdin internally (see Chapter 11).
[1] And some other UNIX systems, as well.
As a final note, Jon often makes use of awk in two of his books, Programming Pearls, and More Programming Pearls - Confessions of a Coder (both published by Addison-Wesley). These books are both excellent reading.


'Pac-Pixel' is a derivative of Pac-Man, implemented at a resolution of 32x32 pixels.
The game is implemented in plain Javascript, with no additional dependencies.
The actual game plays in the small 32x32 game screen at the top. The larger 320x320 game screen is presented for the player's convenience. The larger game screen contains a copy of each rendered frame of the original game, scaled 10x, so it's easier to play the game.
Unlike the original game, Pac-Pixel features a single on-going level where your goal is to eat as many food pellets as you can before being caught by one of the ghosts.
New food pellets will randomly appear on the playing field.
New ghosts will regularly enter the playing field as well.
Use the arrow keys to move your pac-pixel character.
If you're interested in how the game was made, the full source code is available here.
Thank you for playing!
Andrey Butov
andreybutov.com


i
Reporter
Login
Signup Here
*
Required
First Name
*
Last Name
*
Phone Number
E-mail
*
Password
*
Sign up