Main function
The main function is goodpractice()
and has an alias
gp()
which takes the path to the source code of a package
as its first argument. The goodpractice package
contains the source for a simple package which violates some good
practices. We’ll use this for the examples.
library(goodpractice)
# get path to example package
<- system.file("bad1", package = "goodpractice")
pkg_path
# run gp() on it
<- gp(pkg_path)
g #> Preparing: covr
#> Warning in MYPREPS[[prep]](state, quiet = quiet): Prep step for test coverage
#> failed.
#> Preparing: cyclocomp
#> Skipping 1 packages ahead of CRAN: goodpractice
#> WARNING: Rtools is required to build R packages, but is not currently installed.
#>
#> Please download and install Rtools 4.2 from https://cran.r-project.org/bin/windows/Rtools/ or https://www.r-project.org/nosvn/winutf8/ucrt3/.
#>
for file 'C:\Users\ana.simmons\AppData\Local\Temp\RtmpaalPlj\remotes1ab4565043fd\badpackage/DESCRIPTION' ...
checking
for file 'C:\Users\ana.simmons\AppData\Local\Temp\RtmpaalPlj\remotes1ab4565043fd\badpackage/DESCRIPTION'
✔ checking #>
'badpackage':
─ preparing #> checking DESCRIPTION meta-information ...
-information ...
checking DESCRIPTION meta
-information
✔ checking DESCRIPTION meta#>
-information
✔ checking vignette meta#>
for LF line-endings in source and make files and shell scripts
─ checking #>
for empty or unneeded directories
─ checking #>
'badpackage_1.0.0.tar.gz'
─ building #>
#>
#> Preparing: description
#> Preparing: lintr
#> Preparing: namespace
#> Preparing: rcmdcheck
#> WARNING: Rtools is required to build R packages, but is not currently installed.
#>
#> Please download and install Rtools 4.2 from https://cran.r-project.org/bin/windows/Rtools/ or https://www.r-project.org/nosvn/winutf8/ucrt3/.
#> WARNING: Rtools is required to build R packages, but is not currently installed.
#>
#> Please download and install Rtools 4.2 from https://cran.r-project.org/bin/windows/Rtools/ or https://www.r-project.org/nosvn/winutf8/ucrt3/.
#> Warning in MYPREPS[[prep]](state, quiet = quiet): Prep step for rcmdcheck
#> failed.
# show the result
g#> ── GP badpackage ───────────────────────────────────────────────────────────────
#>
#> It is good practice to
#>
#> ✖ not use "Depends" in DESCRIPTION, as it can cause name clashes, and
#> poor interaction with other packages. Use "Imports" instead.
#> ✖ omit "Date" in DESCRIPTION. It is not required and it gets invalid
#> quite often. A build date will be added to the package when you
#> perform `R CMD build` on it.
#> ✖ add a "URL" field to DESCRIPTION. It helps users find information
#> about your package online. If your package does not have a
#> homepage, add an URL to GitHub, or the CRAN package package page.
#> ✖ add a "BugReports" field to DESCRIPTION, and point it to a bug
#> tracker. Many online code hosting services provide bug trackers for
#> free, https://github.com, https://gitlab.com, etc.
#> ✖ omit trailing semicolons from code lines. They are not needed and
#> most R coding standards forbid them
#>
#> R\semicolons.R:4:30
#> R\semicolons.R:5:29
#> R\semicolons.R:9:38
#>
#> ✖ not import packages as a whole, as this can cause name clashes
#> between the imported packages. Instead, import only the specific
#> functions you need.
#> ✖ avoid 'T' and 'F', as they are just variables which are set to the
#> logicals 'TRUE' and 'FALSE' by default, but are not reserved words
#> and hence can be overwritten by the user. Hence, one should always
#> use 'TRUE' and 'FALSE' for the logicals.
#>
#> R/tf.R:NA:NA
#> R/tf.R:NA:NA
#> R/tf.R:NA:NA
#> R/tf.R:NA:NA
#> R/tf.R:NA:NA
#> ... and 4 more lines
#>
#> ────────────────────────────────────────────────────────────────────────────────
So with this package, we’ve done a few things in the DESCRIPTION file
for which there are reasons not to do them, have unnecessary trailing
semicolons in the code and used T
and F
for
TRUE
and FALSE
. The output of
gp()
tells you what you did that isn’t considered good
practice and if it’s in the R code, it points you the location of your
faux-pas. In general, the messages are supposed to not only point out to
you what you might want to avoid but also why.
The above example tries to run all 230 checks available, to see the
full list use all_checks()
. If you only want to run a
subset of the checks, e.g., the one on the URL field in the DESCRIPTION,
you can specify the checks by name:
# what is the name of the check?
grep("url", all_checks(), value = TRUE)
#> [1] "description_url"
# run only this check
<- gp(pkg_path, checks = "description_url")
g_url #> Preparing: description
g_url#> ── GP badpackage ───────────────────────────────────────────────────────────────
#>
#> It is good practice to
#>
#> ✖ add a "URL" field to DESCRIPTION. It helps users find information
#> about your package online. If your package does not have a
#> homepage, add an URL to GitHub, or the CRAN package package page.
#> ────────────────────────────────────────────────────────────────────────────────


XML Assessment
- [x]
doc("cars.xml")/cars/car[year>2000].data
- [ ]
doc("cars.xml")/cars/car[xs:integer(year) gt 2000]
- [ ]
doc("cars.xml")/cars/car[year gt 2000]
- [ ]
doc("cars.xml")/cars/car[integer(year) > 2000]
Q2. You are working with the following XSD fragment. What does it say about the <car>
element?
- [ ] The
<car>
element can be extended with only one attribute
- [ ] The
<car>
element can be extended with multiple attributes
- [x] The
<car>
element have any attributes
- [ ] The
<car>
element has child elements which can appear in order
Q3. You are converting your HTML file into XHTML Strict. Which code snippet will validate without errors?
Q4. When working with Ajax applications, which is faster, XML or JSON?
- [ ] XML, because it is extensible
- [x] JSON, because it transfers data without waiting for a sever response
- [ ] XML, because it supports namespaces
- [ ] JSON, because it is already parsed into a JavaScript object
Q5. Asynchronous Javascript and XML (Ajax) is technique for creating better, faster, and more interactive web applications. In addition to JavaScript and XML on the back end, which technologies are commonly used to craft AJAX experiences on the front end?
- [ ] PHP, .NET, and SQL
- [x] HTML, CSS, and DOM
- [ ] Python, Perl, and C++
- [ ] Java, ASP, and C#
Q6. What is this code an example of?
- [ ] null element
- [x] self-closing tag
- [ ] improperly named element
- [ ] incorrect XML syntax
Q7. Which XHTML syntax rule does NOT apply to XML?
- [x] XHTML attribute values must be quoted
- [ ] XHTML tags and attributes must be in lowercase
- [ ] XHTML elements must be properly nested within each other.
- [ ] XHTML tags must have an equivalent closing tag.
Q8. Which Ajax method is used to exchange data with a server, using a modern browser?
- [ ] request-XML
- [x] XMLHttRequest
- [ ] ActiveXObject
- [ ] responseXML
Q9. A markup language is a _-readable language that **_ text so that the computer can _** that text.
- [ ] processor; complies; process
- [ ] system; stores; retrieve
- [ ] non; processes; format
- [x] human; annotates; manipulate
Q10. What is this code an example of?
- [x] improperly named element
- [ ] self-closing tag
- [ ] null element
- [ ] incorrect XML syntax
Q11. XML provides a framework for specifying markup languages, while HTML is a predefined markup language. What is applicable to XML and not HTML?
- [x] It is mandatory to use closing tags with XML
- [ ] It is important for an XML document to be well formed
- [ ] XML elements start with an opening tag in angle brackets, such as
<p>
- [ ] XML syntax uses tags, elements, and attributes
Q12. What is the last step in extending XHTML modules?
- [ ] The last step is to complete the extension of XHTML compound documents and make sure the documents and make sure the documents adhere to the defined namespaces.
- [x] The last step is to create the DTD for the XHTML extension, which references both the XHTML modules and the new modules.
- [ ] The last step is to run the XHTML extension through the XSLT processor, which will properly format it.
- [ ] The last step is to verify that the XHTML is well formed and valid, and compatible with most browsers.
Q13. In an XML DTD ATTLIST declaration, which default value is used to indicate that the attribute does not have to be included?
- [x]
#DEFAULT
- [ ]
#OPTIONAL
- [ ]
#IMPLIED
- [ ]
#FIXED
Q14. How does the XML DOM present an XML document?
- [ ] as a set of objects
- [x] as a tree structure
- [ ] as an array of nodes
- [ ] as a dynamic program
Q15. You are working with an XML document that uses an XML schema. How do you specify that an element can appear multiple times inside its parent elemen t?
- [ ] Set the maxOccurs attribute to a large number, such as 1.000
- [ ] Set the maxOccurs attribute to 0
- [ ] Set the maxOccurs attribute to undefined.
- [x] Set the maxOccurs attribute to unbounded.
Q16. The element defines the value of a parameter to be passed into a template. It can be used within which elements?
- [x] and
- [ ] and
- [ ] and
- [ ] and
Q17. You are checking someone else’s XML document for errors. You notice that the prolog does not have a closing tag. What do you do?
- [ ] Remove the prolog to make sure that the XML document will be properly processed across all platforms.
- [x] Leave it alone, because the prolog does not require a closing tag.
- [ ] Move the prolog to an external file so thtat the XML document only has elements with closing tags.
- [ ] Add a closing tag, as al XML elements must have a closing tag.
Q18. Which statement is not true about XML?
- [ ] XML is flexible and customizable.
- [ ] XML can be used to store data.
- [ ] XML is independent of Operating System.
- [x] XML is a replacement for HTML.
Q19. In an XML DTD ATTLIST declaration, which tokenized attribute type is used to specify multiple ID values?
- [ ] ENTITIES
- [x] IDREFS
- [ ] IDS
- [ ] IDSETS
Q20. You want to convert a large XML file into CSV format. You did not create the XML file, so you are not familiar with all of the syntax. What will help you get the best insight into the file contents?
- [ ] XSLT
- [ ] DOM
- [ ] AJAX
- [ ] XSD
Q21. In an XML DTD, attributes are declared with an ATTLIST declaration. You need to validate the color attribute for element against a fixed list of values. Which is the correct declaration?
- [ ] <!ATTLIST car color (red|white|blue|black) black>
- [ ] <!ATTLIST car color (red|white|blue|black) #REQUIRED>
- [ ] <!ATTLIST car color (red|white|blue|black) #FIXED>
- [ ] <!ATTLIST car color (red|white|blue|black)>


Company Address
BHOLENATH NAGAR , MANE MALA AHEAD OF SAVLI DHABA
NANDED PHATA, Sinhgad Road,
Pune, Maharashtra 411051
Office Address
1131 SADASHIV PETH, VISHNUPRASAD CO-OP HOUSING SOCIETY
NEAR NIMBARKAR TALIM
Pune, Maharashtra 411030
E-mail
<EMAIL_ADDRESS><EMAIL_ADDRESS>Phone Numbers
9822042380
8237172128


This is another example sketch using the PLL50Hz library, this time to determine the correct value for ICAL, the current scale factor for emonTx.
In order to use this sketch you need a supply meter with a pulse LED and an optical sensor connected to the emonTx.
The advantage of this method is that it is not necessary to know the value of the load, nor does the load need to be purely resistive. It is however preferable to have a large load and for it to remain stable during the test.
It is still necessary to manually enter a value for VCAL, the voltage scale factor, but only if you require accurate values for Vrms and Irms. The value used for VCAL has no affect on the accuracy of the power measurements.
The PLL50Hz library uses the emonTx pulse jack, and hence digital pin 3, as an output to control a triac so it is necessary to connect the optical sensor to a different pin. The default pin in the sketch is digital pin 7 which is available on the CT1 header, P4. If you REALLY want to use the pulse jack then you will have to change the value for LOADPIN1 in PLL50Hz.h to a different pin.
The emonTx LED reflects the state of the optical sensor whenever the sketch is running so it may be used to test that sensor is “seeing” the meter LED (the TSL257 sensor from the shop is quite sensitive to ambient light and adjacent LEDs on the meter so can be difficult to set up).
Here’s a log from a test session...
First ‘V’ is entered to adjust VCAL to 228.7. This value makes the voltage display match the value measured directly.
‘C’ is then entered to run the calibration routine. This routine waits for sufficient meter pulses to be received and then calculates the correct value for ICAL. In this case the default value for ICAL, 111.1, was 1% out and the correct value of 110.02 is displayed. This value is then used for subsequent power calculations and when the test is run for a second time the small error of –0.1% is measured. This is probably well within the accuracy of the hardware.
If sufficient pulses to complete the test aren't received within 30 seconds the test will time out.
ICAL calibration tool
Submitted by MartinR on Tue, 26/02/2013 - 20:10This is another example sketch using the PLL50Hz library, this time to determine the correct value for ICAL, the current scale factor for emonTx.
In order to use this sketch you need a supply meter with a pulse LED and an optical sensor connected to the emonTx.
The advantage of this method is that it is not necessary to know the value of the load, nor does the load need to be purely resistive. It is however preferable to have a large load and for it to remain stable during the test.
It is still necessary to manually enter a value for VCAL, the voltage scale factor, but only if you require accurate values for Vrms and Irms. The value used for VCAL has no affect on the accuracy of the power measurements.
The PLL50Hz library uses the emonTx pulse jack, and hence digital pin 3, as an output to control a triac so it is necessary to connect the optical sensor to a different pin. The default pin in the sketch is digital pin 7 which is available on the CT1 header, P4. If you REALLY want to use the pulse jack then you will have to change the value for LOADPIN1 in PLL50Hz.h to a different pin.
The emonTx LED reflects the state of the optical sensor whenever the sketch is running so it may be used to test that sensor is “seeing” the meter LED (the TSL257 sensor from the shop is quite sensitive to ambient light and adjacent LEDs on the meter so can be difficult to set up).
Here’s a log from a test session...
First ‘V’ is entered to adjust VCAL to 228.7. This value makes the voltage display match the value measured directly.
‘C’ is then entered to run the calibration routine. This routine waits for sufficient meter pulses to be received and then calculates the correct value for ICAL. In this case the default value for ICAL, 111.1, was 1% out and the correct value of 110.02 is displayed. This value is then used for subsequent power calculations and when the test is run for a second time the small error of –0.1% is measured. This is probably well within the accuracy of the hardware.
If sufficient pulses to complete the test aren't received within 30 seconds the test will time out.
Here’s the sketch....
http://openenergymonitor.org/emon/sites/default/files/ical_tool.ino


Start
Stop
Reset (todo)
FPS:
Population size:
Mutation rate (in %):
Autostart
Level:
1
2
3
FPS:
Generation:


Navigating Through Crisis
Corporates recently witnessed the crisis like never before and it only made organizations stronger than ever before. According to one of the surveys, around 75 percent of organizations agree to the fact that their organization’s strategic implementation capabilities grew stronger due to crisis. During normalcy, every organization goes through its business cycles and the strategies are formulated in resonance with them. However, the outbreak of this pandemic brought nearly all of them into their depression cycle, testing their preparedness and capabilities in navigating through such crisis. The leadership team of almost all the organizations was forced to huddle around to rethink their business and operating model. The crisis created a need for organizations to demonstrate their purpose and values which they had long stood for.
The crisis brought about a paradigm shift moving away from their traditional working model. During this pandemic, working from home became the new way of working that employees were forced to take up. Dependency on technology grew with new telecommunication apps gathering steam along the way. There was an exponential rise in the daily users of apps like Zoom, Microsoft teams, skype, etc. Lay-offs became the talk of the town and hiring was frozen. The board room discussions shifted from sustainability to survivability. It was clearly evident that there was an urgent need for accelerated strategic transformation across organizations. Below are a few aspects organizations need to consider while managing crisis:
Getting priorities right: The current strategic plan needs to be rejigged in a way that it first protects the short-term needs by keeping its guard up against the ongoing crisis. A balanced approach to protecting today and envisioning tomorrow needs to be adopted. Today’s appropriate response can position the businesses to thrive tomorrow. With this pandemic around, organizations need to be sensitive to their employees’ health and safety by providing the wherewithal & support required to continue doing their tasks remotely with leaders keeping a regular tab on their entire well-being. Decisions are also taken in a direction to ensure business continuity and no impact on customer value delivery. A crisis is a situation when organizations should be looking to maximize their purpose and not focusing on revenue alone. And this can happen by setting priorities early to enable taking quick & right decisions.
Team Empowerment: To weather through the crisis, it is imperative for organizations to empower employees & teams to take certain key decisions rather than getting them dictated from the leadership level. While businesses would have navigated much crisis before, the unique nature of an unprecedented crisis (like an ongoing pandemic) could make all of us on the same experience level when it comes to gauging its impact on the existing businesses. Hence empowering non-leadership level employees could go a long way in making certain effective decisions related to the processes, offerings & customer support to ensure organizations stay relevant & emerge stronger in the post-crisis world.
Effective Communication: Communication is another precarious factor that needs to be managed in such a crisis-like-situation. Information should flow throughout an organization as well as through all the relevant stakeholders to ensure a complete congruence when it comes to putting efforts towards combating this crisis. Transparent & consistent communication would bridge the gap between strategy and implementation, building the organization’s capability to actualize the strategic initiatives effectively. Feeding an organization with real-time updates from the relevant sources also plays a vital role in assessing the situation accurately so that their responses are appropriately chosen in building the right strategy.
Embracing Digital transformation: More than technology, it is about putting people first. Keeping employees abreast of why and where the organization wants to head towards can only bring that shift in their mindset to adopt a new way of working. Digital transformation helps organizations replace their legacy systems with the ones in vogue, which not only provide efficiency gains but also help them achieve their revised strategic initiatives. That said, this drive can only be successful when the change is inside-out and organizations look to bring about this transformation in its culture, processes & their traditional practices. This brings the leadership roles under the scanner and the plethora of skills they are expected to display like Empathy, Communication, Empowerment, and Ethics.
Breaking away from the traditional way of working is a must to derive learnings from the crisis. These learnings are essential to outline the improvement plans in the post-crisis world and stay adequately prepared for any potential crisis (of a similar sort) in the future. Leaders need to be vigilant of certain new business opportunities that might emerge from the crisis, and so it is highly likely that organizations might put themselves into a profitable value proposition in the wake of a crisis.
Thanks for reading . Please feel free to share your comments and feedback.


In this example we want to introduce how to use table boxes in a document. In particular, a table is specified using the appropriate OpenOffice widget, and the table heading style is used to identify the heading cells of a particular table. The table should be followed by a caption paragraph by means of the appropriate default stylesheet, as shown as follows.
| Table heading 1 | Table heading 2 | Table heading 3 | Table heading 4 |
|---|---|---|---|
|
cell 1 row 1 |
cell 2 row 1 |
cell 3 row 1 |
cell 4 row 1 |
|
cell 1 row 2 |
cell 2 row 2 |
cell 3 row 2 |
cell 4 row 2 |
|
cell 1 row 3 |
cell 2 row 3 |
cell 3 row 3 |
cell 4 row 3 |
This is a normal paragraph.


Add a Feature to the model.
The FeatureCollection..
The Feature to add.
Number of Features in the colletion after adding.
Delete a Feature in the model.
The FeatureCollection.
The feature to delete.
Ture if the Feature was deleted, false if the Feature was not found.
Get all features from the FeatureCollection.
The FeatureCollection.
An array of features of different types.
Get LineStrings from the FeatureCollection.
The FeatureCollection..
An array of LineString features.
Get MultiLineStrings from the FeatureCollection.
The FeatureCollection..
An array of MultiLineString features.
Get MultiPoints from the FeatureCollection.
The FeatureCollection..
An array of MultiPoint features.
Get MultiPolygons from the FeatureCollection.
The FeatureCollection..
An array of MultiPolygon features.
Get MultiPolygons with holes from the FeatureCollection.
The FeatureCollection..
An array of MultiPolygon features with holes.
Get Points from the FeatureCollection.
The FeatureCollection.
An array of Point features.
Get Polygons from the FeatureCollection.
The FeatureCollection..
An array of Polygon features.
Get Polygons with holes from the FeatureCollection.
The FeatureCollection.
An array of Polygon features with holes.
Save the FeatureCollection as a geojson file.
The collection to save.
The name of the geojson file.
True if successful.
Generated using TypeDoc
Functions for working with geojson feature collections.


Sylvie and Bruno Concluded
by Lewis Carroll
Chapter 11: “The Man in the Moon”
Additional Information
- Year Published: 1893
- Language: English
- Country of Origin: England
- Source: Carroll, L. (1893). Sylvie and Bruno Concluded. London: Macmillan and Co.
-
Readability:
- Flesch–Kincaid Level: 6.5
- Word Count: 2,475
- Genre: Fantasy
- Keywords: 19th century literature, british literature, lewis carroll
- ✎ Cite This
Downloads
The children came willingly. With one of them on each side of me, I approached the corner occupied by “Mein Herr”. “You don’t object to children, I hope?” I began.
“Crabbed age and youth cannot live together!” the old man cheerfully replied, with a most genial smile. “Now take a good look at me, my children!
At first sight, though his face had reminded me so mysteriously of “the Professor”, he had seemed to be decidedly a younger man: but, when I came to look into the wonderful depth of those large dreamy eyes, I felt, with a strange sense of awe, that he was incalculably older: he seemed to gaze at us out of some by-gone age, centuries away.
“I don’t know if oo’re an old man,” Bruno answered, as the children, won over by the gentle voice, crept a little closer to him. “I thinks oo’re eighty-three.”
“He is very exact! ” said Mein Herr.
“Is he anything like right?” I said.
“There are reasons,” Mein Herr gently replied, “reasons which I am not at liberty to explain, for not mentioning definitely any Persons, Places, or Dates. One remark only I will permit myself to make—that the period of life, between the ages of a hundred-and-sixty-five and a hundred-and-seventy-five, is a specially safe one.”
“How do you make that out?” I said.
“Thus. You would consider swimming to be a very safe amusement, if you scarcely ever heard of any one dying of it. Am I not right in thinking that you never heard of any one dying between those two ages?”
“I see what you mean,” I said: “but I’m afraid you ca’n’t prove swimming to be safe, on the same principle. It is no uncommon thing to hear of some one being drowned.”
“In my country,” said Mein Herr. “no one is ever drowned.”
“Is there no water deep enough?”
“Plenty! But we ca’n’t sink. We are all lighter than water. Let me explain,” he added, seeing my look of surprise. “Suppose you desire a race of pigeons of a particular shape or colour, do you not select, from year to year, those that are nearest to the shape or colour you want, and keep those, and part with the others?”
“We do,” I replied. “We call it ‘Artificial Selection’.”
“Exactly so,” said Mein Herr. “Well, we have practised that for some centuries—constantly selecting the lightest people: so that, now, everybody is lighter than water.”
“Then you never can be drowned at sea?”
“Never! It is only on the land—for instance, when attending a play in a theatre—that we are in such a danger.”
“How can that happen at a theatre?”
“Our theatres are all underground. Large tanks of water are placed above. If a fire breaks out, the taps are turned, and in one minute the theatre is flooded, up to the very roof! Thus the fire is extinguished.”
“And the audience, I presume?”
“That is a minor matter,” Mein Herr carelessly replied. “But they have the comfort of knowing that, whether drowned or not, they are all lighter than water. We have not yet reached the standard of making people lighter than air: but we are aiming at it; and, in another thousand years or so—”
“What coos oo do wiz the peoples that’s too heavy?” Bruno solemnly enquired.
“We have applied the same process,” Mein Herr continued, not noticing Bruno’s question, “to many other purposes. We have gone on selecting walking-sticks— always keeping those that walked best—till we have obtained some, that can walk by themselves! We have gone on selecting cotton-wool, till we have got some lighter than air! You’ve no idea what a useful material it is! We call it ‘Imponderal’.”
“What do you use it for?”
“Well, chiefly for packing articles, to go by Parcel-Post. It makes them weigh less than nothing, you know.”
“And how do the Post Office people know what you have to pay?”
“That’s the beauty of the new system!” Mein Herr cried exultingly. “They pay us: we don’t pay them! I’ve often got as much as five shillings for sending a parcel.”
“But doesn’t your Government object?”
“Well, they do object a little. They say it comes so expensive, in the long run. But the thing’s as clear as daylight, by their own rules.  I said.
“Yet even ‘Imponderal’ has its disadvantages,” he resumed. “I bought some, a few days ago, and put it into my hat, to carry it home, and the hat simply floated away!’
“Had oo some of that funny stuff in oor hat to-day?” Bruno enquired. “Sylvie and me saw oo in the road, and oor hat were ever so high up! Weren’t it, Sylvie?”
“No, that was quite another thing,” said Mein Herr. “There was a drop or two of rain falling: so I put my hat on the top of my stick—as an umbrella, you know. As I came along the road”, he continued, turning to me, “I was overtaken by—”
“—a shower of rain?” said Bruno.
“Well, it looked more like the tail of a dog,” Mein Herr replied. “It was the most curious thing! Something rubbed affectionately against my knee. And I looked down. And I could see nothing! Only, about a yard off, there was a dog’s tail, wagging, all by itself!”
“Oh, Sylvie!” Bruno murmured reproachfully. “Oo didn’t finish making him visible!”
“I’m so sorry!” Sylvie said, looking very penitent. “I meant to rub it along his back, but we were in such a hurry. We’ll go and finish him to-morrow. Poor thing! Perhaps he’ll get no supper to-night!”
“Course he won’t!” said Bruno. “Nobody never gives bones to a dog’s tail!”
Mein Herr looked from one to the other in blank astonishment. “I do not understand you,” he said. “I had lost my way, and I was consulting a pocket-map, and somehow I had dropped one of my gloves, and this invisible Something, that had rubbed against my knee, actually brought it back to me!”
“Course he did!” said Bruno. “He’s welly fond of fetching things.”
Mein Herr looked so thoroughly bewildered that I thought it best to change the subject. “What a useful thing a pocket-map is!” I remarked.
“That’s another thing we’ve learned from your Nation,” said Mein Herr, “map-making. But we’ve carried it much further than you. What do you consider the largest map that would be really useful?”
“About six inches to the mile.”
“Only six inches!” exclaimed Mein Herr. “We very soon got to six yards to the mile. Then we tried a hundred yards to the mile. And then came the grandest idea of all! We actually made a map of the country, on the scale of a mile to the mile!”
“Have you used it much?” I enquired.
“It has never been spread out, yet,” said Mein Herr: “the farmers objected: they said it would cover the whole country, and shut out the sunlight! So we now use the country itself, as its own map, and I assure you it does nearly as well. Now let me ask you another question. What is the smallest world you would care to inhabit?”
“I know!” cried Bruno, who was listening intently.  “And so you would never see your sister at all!”
“And I’d have no lessons,” said Bruno.
“You don’t mean to say you’ve been trying experiments in that direction!” I said.
“Well, not experiments exactly. We do not profess to construct planets. But a scientific friend of mine, who has made several balloon-voyages, assures me he has visited a planet so small that he could walk right round it in twenty minutes! There had been a great battle, just before his visit, which had ended rather oddly: the vanquished army ran away at full speed, and in a very few minutes found themselves face-to-face with the victorious army, who were marching home again, and who were so frightened at finding themselves between two armies, that they surrendered at once! Of course that lost them the battle, though, as a matter of fact, they had killed all the soldiers on the other side.”
“Killed soldiers ca’n’t run away,” Bruno thoughtfully remarked.
“ ‘Killed’ is a technical word,” replied Mein Herr. “In the little planet I speak of, the bullets were made of soft black stuff, which marked everything it touched. So, after a battle, all you had to do was to count how many soldiers on each side were ‘killed’—that means ‘marked on the back’, for marks in front didn’t count. ”
“Then you couldn’t ‘kill’ any, unless they ran away?” I said.
“My scientific friend found out a better plan than that. He pointed out that, if only the bullets were sent the other way round the world, they would hit the enemy in the back. After that, the worst marksmen were considered the best soldiers; and the very worst of all always got First Prize.”
“And how did you decide which was the very worst of all?”
“Easily. The best possible shooting is, you know, to hit what is exactly in front of you: so of course the worst possible is to hit what is exactly behind you.”
“They were strange people in that little planet!” I said.
“They were indeed! Perhaps their method of government was the strangest of all. In this planet, I am told, a Nation consists of a number of Subjects, and one King: but, in the little planet I speak of, it consisted of a number of Kings, and one Subject!”
“You say you are ‘told’ what happens in this planet,” I said. “May I venture to guess that you yourself are a visitor from some other planet?”
Bruno clapped his hands in his excitement. “Is oo the Man-in-the-Moon?” he cried.
Mein Herr looked uneasy. “I am not in the Moon, my child,” he said evasively. “To return to what I was saying. I think that method of government ought to answer well. You see, the Kings would be sure to make Laws contradicting each other: so the Subject could never be punished, because, whatever he did he’d be obeying some Law.”
“And, whatever he did, he’d be disobeying some Law!” cried Bruno. “So he’d always be punished!”
Lady Muriel was passing at the moment, and caught the last word. “Nobody’s going to be punished here!” she said, taking Bruno in her arms. “This is Liberty-Hall! Would you lend me the children for a minute?”
“The children desert us, you see,” I said to Mein Herr, as she carried them off: “so we old folk must keep each other company!”
The old man sighed. “Ah, well! We’re old folk now and yet I was a child myself, once—at least I fancy so.”
It did seem a rather unlikely fancy, I could not help owning to myself—looking at the shaggy white hair, and the long beard—that he could ever have been a child. You are fond of young people?” I said.
“Young men,” he replied. “Not of children exactly. I used to teach young men—many a year ago—in my dear old University!”
“I didn’t quite catch its name?” I hinted
“I did not name it,” the old man replied mildly. “Nor would you know the name if I did. Strange tales I could tell you of all the changes I have witnessed there! But it would weary you, I fear.”
“No, indeed!” I said. “Pray go on. What kind of changes?”
But the old man seemed to be more in a humour for questions than for answers. “Tell me,” he said, laying his hand impressively on my arm, “tell me something. For I am a stranger in your land, and I know little of your modes of education: yet something tells me we are further on than you in the eternal cycle of change—and that many a theory we have tried and found to fail, you also will try, with a wilder enthusiasm: you also will find to fail, with a bitterer despair!”
It was strange to see how, as he talked, and his words flowed more and more freely, with a certain rhythmic eloquence, his features seemed to glow with an inner light, and the whole man seemed to be transformed, as if he had grown fifty years younger in a moment of time.


A new task has been opened for your workgroup:
"${taskName}"
- Order ID: ${orderId}
- Task ID: ${taskInstanceId}
- Due Date: ${dueDate}
To view or act on this task, click on the following link:
${taskInstanceUrl}
To mark this task as completed, click here:
Complete


I look at it like this: Websites are merely tools. It’s the people who use them and the experiences they have while using them that matter the most.
That’s why creating websites which are centred around the customer, you might say “customer first design”, is essential to growing your business online.
In a basic sense, I solve common, and not so common, business problems using design and code.
Get Started!I offer website design and development, including blogs. I don't do eCommerce as those projects are better left to larger teams.
I use or make templates that are up to date, so they don't break.
Each project tends to go through 4 distinct phases. Those phases are planning, design, development and pre-launch.
I use Basecamp for all my project management, so you'll be able to easily see how the project is progressing day-by-day.
You have to make your websites with love these days!
This are a few demo's that I made in my learning journey, looking back I can see their imperfection but I chose to let them be as they are.
As I will keep learning, I will build more projects with the latest technologies. Visit my Github profile for more.
Find Out MoreReady to start your next project with me? That's great! Send me an email and I will get back to you as soon as possible!


Raw - Original query is fed to the search engine without any modification.
Pseudo-Relevance Feedback (PRF-TFIDF) - The query is expanded using the top-N TF-IDF terms.
PRF-Relevance Model (PRF-RM) - Probability of adding token t to the query q0 is given by P(t|q0) = (1 − λ)P′(t|q0) + λ sum (P(d)P(t|d)P(q0|d))
Reward - The paper uses Recall@K as a reward when training the RL-based models with the argument that the “metric has shown to be effective in improving the other metrics as well”, without any justification though.
SL-Oracle - classifier that perfectly selects terms that will increase performance based on the supervised learning approach.


Room Class
A session can be divided in any number of rooms. Rooms are where the clients communicate. Every room is limited to a maximum number of clients.
Item Index
Methods
Methods
createDataObject
-
values
-
[broadcast]
Creates a DataObject in this room.
Parameters:
-
values
ObjectAn object with key/values. The keys must be unique integers. The values must be binary.
-
[broadcast]
Boolean optionalIf true the creation will be broadcast to all users in the room.
Returns:
The freshly created dataObject.
Example:
//define the dataobject structure var values = {}; values[0] = new Buffer(1); values[1] = new Buffer(2); values[2] = new Buffer(2); values[3] = new Buffer(1); values[4] = new Buffer(4); this.active = Rnd.boolean(); //write the initial values values[0].writeInt8(1, 0); values[1].writeInt16BE(900, 0); values[2].writeInt16BE(500, 0); values[3].writeInt8(false, 0); values[4].writeInt32BE(0xff0000, 0); //create and broadcast the dataObject this.dataObject = this.room.createDataObject(values, true);
Properties
id
String
The room UUID.
logic
Object
The custom logic attached to this room. See the examples for use cases.
var Gamelogic = require('./gamelogic'); var session = gordon.createSession('session1', 'Session with custom logic'); var lobby = session.createRoom('lobby'); //create the logic module and attach it the room lobby.logic = new Gamelogic(lobby);
The logic object could also define the following methods to modify the standard protocol flow:
joinLogic(user, proceed) changeRoomLogic(user, newRoom, oldRoom, proceed) chatMessageLogic(target, message, proceed) customMessageLogic(buffer, proceed)
Call the passed in proceed function to continue with the standard protocol flow.
this.changeRoomLogic = function (user, newRoom, oldRoom, proceed) { //don't allow users to change to room3 if (newRoom.id == 'room3') { proceed(false); } else { proceed(true); } };
master
User
The master user of this room. Every room has one dedicated master user. The master changes automatically if the current master user left the room.
maxUsers
Number
The max number of users for this room.
Default: 50
name
String
The room name.
password
String
The password for this room. If empty there's no password.
Default: ''
persistent
Boolean
If set to true this room won't be removed automatically after 2 secs if emtpy.
userCount
Number
The number of users.


Having never built a game of this type before I needed to familiarise myself with the game structure. Fortunately this was quite apparent after looking at Flash Jester Punk's level data and using his in-built level designer.
Alien Breed obliteration is essentially a 2d square tile based background with dynamic character overlays. The tiles are static and the background never changes. Only the characters are dynamic.
The background is actually composed of 2 layers, a lower layer which is usually fully defined and an upper layer adding finer details (angled corners, special walls etc) which is only sparsely defined. You can see this through the level designer by showing/hiding upper levels.
Alien Breed includes a level designer which allows exploration of the tile set and experiments with the level data. This has been invaluable for determining the structure of the level maps.
The background for a particular level is defined in a file levellX.til. It is a sequence of 16bit words indicating the tile index at a certain x,y position for the lower level. Word 0 is 0,0, word 1 is 1,0 etc. The sparse upper level data is interleaved within this data. The parser can spot that the value refers to the upper level as it is proceeded by 0x8000 (which is larger than the max tile number). Once this structure is understood writing a level loader for this data is fairly straight forward (array_levelloader.py). Care must be taken around word byte ordering differences between Intel (LSB) and PPC chip (MSB) in the Wii.
There is also a meta data file describing the characteristics of a tile, tileset.map. This must be read to determine if a particular background tile should block the player/bullets (for example indicating the tile is a wall).
In the Wii game the Level class (level.py) loads owns the background tile map and is used by the Display class (display.py) to plot the background every game cycle.
Any dynamic behaviour (animated objects or movable characters) must be modeled as a Character 'Unit'. In FJP's designer you can see the list of units and add them at particular coordinates on the map. The designer also presents the name of the unit in the form of the unit's configuration file (e.g. player1.uni).
Examples of units are explosions, player, aliens, alien spawners, bullets, doors and pickups.
The design of a Unit can be determined by inspecting the Unit's configuration file, e.g. player1.uni.
BITMAP file=player1.bmp tileheight=32 tilewidth=32 STATS health=50 speed=130 collideable=1 OBJECTTYPE type=friendly SPAWN state=moveup ANIMATION state=moveup numframes=4 firetile=4 firex=15 firey=4 FRAME tile=0 time=120 FRAME tile=1 time=120 FRAME tile=0 time=120 FRAME tile=2 time=120 ANIMATION state=moveupright numframes=4 firetile=9 firex=-6 firey=6 FRAME tile=5 time=120 FRAME tile=6 time=120
A Unit can be in a number of states (an 'Animation State'). Within that state the unit is normally cycling through a number of animation frames. For example above, the Unit could be in the state representing moving up. The 4 frames represent the images of moving feet and arms.
A Unit identifies a sprite map containing a tiled set of sprites representing the different animation frames for the unit ('BITMAP'). The 'FRAME' configuration then references the sprite through the sprite's index.
Occasionally the Unit will change Animation state automatically when it reaches the end of a list of Frames. More often it will just loop back to the first frame. A character often changes state based on some game logic, for example pressing the Up key instructs the Player unit to enter state 'moveup'.
In the Wii game this logic around interacting with a character and how the character behaves is encapsulated in the behavior classes (behaviour.py). When the list of units for a level is loaded, as defined in levelX.lev data, each unit is assigned a behaviour class.
To allow a dynamic Unit to update itself, or be updated by other units (e.g. being hit by a bullet/alien etc) the main game loop must call update() on every unit every frame. As only Units are dynamic only units must be updated.
Playing a level essentially comes down to:
while (!finished) { //wait for frame rate sync //Allow each unit to update its state or be updated for each unit { update() } //Plot the static background tile_background.plot() //Plot each unit ontop of the background for each unit { unit.plot() } //sdl display flip }
There are optimizations to reduce the effort for units which are not on screen etc. but the above is essentially the structure of the level play code (class LevelplayScene in scene.py).
There is more to the game than just playing a level. There is the main menu, level intro scenes and Intex terminal scenes etc. Essentially the game consists of multiple types of Scene (scene.py), only one of which is active at any one time. The sequence of scenes and the transitions of scenes are controlled by a Director (director.py). For example an example game flow looks like:
Menu scene -> Level intro scene -> Level play scene -> Game over scene -> Menu scene
Put together this defines the structure to navigate menus and play levels consisting of static background tiles and dynamic characters. This is the majority of the game.
There are additional areas of complexity which are called upon by the above components (input handling, collision detection, AI etc) but I''ll leave that up to the reader. You can easily find the code responsible by navigating from the Unit's behaviour class.


§560:3-618 Termination of appointment; special administrator. The appointment of a special administrator terminates in accordance with the provisions of the order of appointment or on the appointment of a general personal representative. In other cases, the appointment of a special administrator is subject to termination as provided in sections 560:3-608 through 560:3-611. [L 1996, c 288, pt of §1]
Rules of Court
Termination of special administration, see HPR rule 57.


This is a heading
Every believer was created by God to succeed. No particular person was created for success. In the first book of the bible, we learn that the first mandate God gave to man was for man to be successful.
So God created man in His own image, in the image of God created he him; male and female created he them.
And God blessed them, and God said unto them, Be fruitful, and multiply…
Genesis 1:27-28 KJV
Firstly, God created mankind in His image and likeness. God’s image and likeness has to do with the way God behaves. In other words, God put what makes Him God into man. Also, man had no hand in his creation as to how he was created.


OT Name Table Switcher
Suppose you want to install two very similar fonts on your system, like two different versions of the same font for comparison. You'll find out that there can be only one of these versions installed on the system at the same time.
Changing the file names won't help. This is because the system looks
inside the font at the OpenType name
table. That
table of both your font versions is too similar for your two fonts to
coexist installed on the system.
This tool changes the name
tables of any font you drop
at it. It does so by adding an extra part to the font family name in all
places where it matters.
1.
Drop the font files here or click to choose.
2.
Say how to amend the family name:


Account Setup
- Solve problem with your account
- Set up your account
- Change your account settings
- Recommended browsers and devices
- Reset your password
Typeopplearning policies
- Accommodations for learners with disabilities
- Third party tools
- International restrictions
- Age restrictions


@import models.view.BreadcrumbView
@import models.view.AnswerView
@import views.html.triage.outcomePage
@import views.html.common.form.formCheckbox
@import views.html.common.page._
@this(outcomePage: outcomePage)
@(form: Form[_], stageId: String, sessionId: String, resumeCode: String, decontrolUrl: String, breadcrumbView: BreadcrumbView, controlCodesToConfirmDecontrolledStatus: Set[String])
@outcomePage("Item is decontrolled", sessionId, resumeCode, subtitle = "stageDescriptor") {
@twoThirdsColumn{
@errorSummary(form)
}
@decontrolBreadcrumb(decontrolUrl, breadcrumbView)
@if(!controlCodesToConfirmDecontrolledStatus.isEmpty) {
@decontrolVerification(sessionId, controlCodesToConfirmDecontrolledStatus)
} else {
Based on the choices you’ve made, you may generate a no licence required (NLR) document.
Before generating your document
-
Get someone who knows the technical details of your item to help you check the choices you've made against the
technical specifications of your item.
-
Even if your item is not controlled it may still be affected by
WMD (opens in a new tab)
and
military (opens in a new tab)
end use controls and any
sanctions and embargoes (opens in a new tab)
.
To find out if your item needs a licence, log in to SPIRE and refer to the
End User Advisory Service (EUAS) (opens in a new tab) or use the links above.
-
You may generate a no licence required (NLR) document if, following the points above, you believe that your item
is still not subject to controls.
Warning:
Always double-check if your items are controlled. If you export controlled items without the correct export licence
you could:
- have your items seized
- face a fine
- serve up to 10 years in prison
}
}


| Attribute | Description |
|---|---|
| username semi-optional |
The username of the consumer. You must send either this field or custom_id with the request. |
| custom_id semi-optional |
Field for storing an existing ID for the consumer, useful for mapping Kong with users in your existing database. You must send either this field or username with the request. |


 At mollitia vel ad beatae.Lorem ipsum dolor sit amet.
ON SALE
SPECIAL OFFERS
MUST HAVE
New arrivals on FooseShoes
€145,99
Even&Odd
€145,99
Even&Odd
€145,99
Even&Odd
Best sellers of the month
€145,99
€145,99
Even&Odd
€145,99
Even&Odd
FREE SHIPPING
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maxime magnam, molestias illum quam veritatis consectetur nihil aliquid quo culpa?
TESTAMONIALS
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maxime magnam, molestias illum quam veritatis consectetur nihil aliquid quo culpa?
- john doe -
BLOG NEWS
APR 01
Nice & clean. The best for you blog!
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
APR 01
What an Ecommerce theme
Lorem ipsum dolor sit amet, consectetur adipisicing elit.


{% extends "_base.html" %} {% block page_title %} SpiderSilk - Page not found! {% endblock %} {% block content %} Whoops! The page you were looking for was not found! {% endblock %}


Join us any evening for refreshing elixirs, conversation and maybe a game or two of Dance Dance Revolution Wireless access is always provided; BYOWS (Bring your own web server).
You'll find us right in the center of downtown Webville. If you need help finding us, check out our detailed directions Come join us!


CONTENTS | PREV | NEXT
Rather than the client
describing the print data format with a MIME type, the client can
supply a Java object from which a print service determines the
print data format. For example, the Java object can encapsulate a
PostScript document. Instead of the client explicitly
describing the document as PostScript with a MIME type, the
client can wrap a reference to the document in a Java object, which
the print service inspects to determine that the format is
PostScript. Because the print data is delivered to the print
service through the Java object, the class that the Java object
implements is the representation class.
The DocFlavor class
has an inner class called DocFlavor.SERVICE_FORMATTED that contains
DocFlavor object constants representing service-formatted print
data. Each of these constants has a MIME type of
"application/x-java-jvm-local-objectref", which indicates
that the client will supply a reference to a Java object
implementing the interface named as the representation class.
The three
DocFlavor object constants contained in DocFlavor.SERVICE_FORMATTED
each represent a common representation class name used with
service-formatted print data:
-
DocFlavor.SERVICE_FORMATTED.PAGEABLE:The client supplies an object
that implements thejava.awt.print.Pageable interface, which
represents a set of pages to be printed. The printer calls methods
in that interface to obtain the pages to be printed, one by one.
For each page, the printer supplies a graphics context and prints
whatever the client draws in that graphics context.
-
DocFlavor.SERVICE_FORMATTED.PRINTABLE:The client supplies an object
that implements the java.awt.print.Printable interface, which is
responsible for drawing the contents of each page. The printer
calls methods in that interface to obtain the pages to be printed,
one by one. For each page, the printer supplies a graphics context
and prints whatever the client draws in that graphics context.
-
DocFlavor.SERVICE_FORMATTED.RENDERABLE_IMAGE:The client supplies an
object that implements interface
java.awt.image.renderable.RenderableImage, which represents an
image that can be manipulated in a rendering-independent manner and
can be rendered to various contexts, such as a printer, without
compromising quality. The printer calls methods in the interface to
obtain the image to be printed.
-
As stated in the Introduction,
applications that wrap 2D graphics into a Java object can use the
service-formatted print data DocFlavor constants. See Printing and Streaming 2D
Graphics for more information.
CONTENTS | PREV | NEXT


Collisions
by Peter N. Wood
Previous Step 3: Control Schemes
coming soon: State and the Scene
Last Updated: 16 Jan, 2018
by Peter N. Wood
Previous Step 3: Control Schemes
coming soon: State and the Scene
Last Updated: 16 Jan, 2018
Collision detection (sometimes called “hit detection”) is a crucial part of any game with even the simplest physics simulations. In this step, we’re going to update our physics engine a little. No, we aren’t about to make the next Unreal engine here, but this is a physics engine; we have reusable functions that can simulate movement and physical interactions. Just because the term wasn’t around when Asteroids was originally designed doesn’t mean it doesn’t apply.
We’ll need our engine to check whether the ship collides with an asteroid, or two asteroids collide with each other. Let’s start with an Asteroid class so we can create multiple asteroids at a time. Our asteroids will have a few properties in common with the player object: x/y position, x/y speed, and facing direction in radians. I haven’t used object orientation yet in this tutorial, because there isn’t much use in writing a player class that only gets instantiated once.
I’ve set up a constructor that can generate two varieties of asteroids: big and small. The big asteroids turn up at random, at some point along the perimeter of the screen. When a big asteroid is destroyed, two small ones will appear to replace it. These asteroids have the same properties and behave nearly the same as big asteroids, so it makes sense to use the same constructor; we just give the constructor some parameters for the small asteroid.
We could take advantage of the prototype system and assign our rendering function to the Asteroid class, but declaring it as a local function gives us a small performance boost (I think it has to do with lookup time rather than execution time). This is very similar to the way we render the player ship, except that we take the asteroid’s size into account when rendering.
const MAX_ASTEROIDS = 6; const MAX_BIG_ASTEROIDS = 3; const ASTEROID_SPEED = 1; const ASTEROID_SIZE = 16; // Render points relative to center const ASTEROID_POINTS = [ { x: 6, y:-16 }, { x: 16, y: -6 }, { x: 16, y: 6 }, { x: 6, y: 18 }, { x: 2, y: 14 }, { x: -6, y: 16 }, { x:-16, y: 6 }, { x:-14, y: -6 }, { x: -8, y:-12 }, { x: -6, y:-16 }, ]; /* I use this declaration syntax so that "Asteroid" gets hoisted as a function declaration rather than as an undefined variable declaration. */ function Asteroid(isSmall, astX, astY, xSpeed, ySpeed) { // Get a random radian value for rendering this.radians = Math.random() * TAU; if (isSmall) { this.size = 1; this.x = astX; this.y = astY; this.xSpeed = xSpeed; this.ySpeed = ySpeed; } else { // New big asteroid this.size = 2; var x, y; // Gets a random number along the perimeter of the canvas var perimeterPoint = Math.random() * (2 * CANVAS_H + 2 * CANVAS_W); if (perimeterPoint <= CANVAS_W) { // This point is along the top edge of the canvas x = perimeterPoint; y = 0; } else if (perimeterPoint <= CANVAS_W + CANVAS_H) { // This point is along the right edge of the canvas x = CANVAS_W; y = perimeterPoint - CANVAS_W; } else if (perimeterPoint <= 2 * CANVAS_W + CANVAS_H) { // This point is along the bottom edge of the canvas x = perimeterPoint - (CANVAS_W + CANVAS_H); y = CANVAS_H; } else { // This point is along the left edge of the canvas x = 0; y = perimeterPoint - (2 * CANVAS_W + CANVAS_H); } this.x = x; this.y = y; // Pick a random direction for the asteroid to move // This way every asteroid moves at the same speed var radians = Math.random() * TAU; this.xSpeed = ASTEROID_SPEED * Math.cos(radians); this.ySpeed = ASTEROID_SPEED * Math.sin(radians); } // I think it's good practice to explicitly return the instance return this; } function renderAsteroid(asteroid) { var cos = Math.cos(asteroid.radians); var sin = Math.sin(asteroid.radians); context.beginPath(); for (var i = 0; i < 10; i++) { var pointX = asteroid.size * (ASTEROID_POINTS[i].x * cos + ASTEROID_POINTS[i].y * sin); var pointY = asteroid.size * (ASTEROID_POINTS[i].x * sin - ASTEROID_POINTS[i].y * cos); context[i === 0 ? 'moveTo' : 'lineTo'](asteroid.x + pointX, asteroid.y + pointY); } context.closePath(); context.strokeStyle = '#FFF'; context.stroke(); } var asteroidCount = 0; var asteroids = new Array(MAX_ASTEROIDS);
Now that we’ve got our asteroids, it’s time to make them move. We can actually reuse part of our function for moving the player. Let’s break up our updatePlayer() function into one that is specific to the player object, and another that is common for any objects we want to move, which we can call “actors”.
// Updates that are specific to the player actor function updatePlayer(mod) { const TAU = 2 * Math.PI; if (player.radAcc) { var radians = player.radians + mod * player.radAcc / 10; if (radians < 0) { radians += TAU; } else if (radians >= TAU) { radians -= TAU; } player.radians = radians; } // Update the player's speed in the x and y directions if (player.thrust) { var cos = Math.cos(player.radians); var sin = Math.sin(player.radians); // Calculate the combined speed of both directions player.xSpeed += cos; player.ySpeed += sin; var speed = getHypoteneuse(player.xSpeed, player.ySpeed); if (speed < -MAX_SPEED || speed > MAX_SPEED) { speed = clamp(speed, -MAX_SPEED, MAX_SPEED); player.xSpeed = speed * cos; player.ySpeed = speed * sin; } } } // Common updates for all actors function updateActor(mod, actor) { actor.x += mod * actor.xSpeed; actor.y += mod * actor.ySpeed; // If the actor passes an edge of the canvas, move it to the opposite edge if (actor.x < 0) { actor.x += CANVAS_W; } else if (actor.x > CANVAS_W) { actor.x -= CANVAS_W; } if (actor.y < 0) { actor.y += CANVAS_H; } else if (actor.y > CANVAS_H) { actor.y -= CANVAS_H; } }
Now that we’ve got our asteroids moving around the canvas, we can’t just let them pass through each other like ghosts. Collision detection will be different depending on what game you’re making: it could be based on looking for overlapping square hitboxes, or comparing two complex shapes. For Asteroids, all we need to do is check the distance between two actors. Our asteroids are fairly circular, so we can get away with that kind of collision detection.
We can use getHypoteneuse(), but that means we have to calculate the x and y distances between two asteroids first. Instead, let’s write a new function to handle all of that for us. We’ll be reusing this function for other collisions too. In our game loop, after we’ve updated the position of our asteroids, we loop through them again and compare their distance to their relative sizes to see if they collide.
Breaking the asteroids gets a little more complicated. We want two small asteroids to burst out of any big asteroid we destroy, ideally moving in different directions so they don’t immediately collide and destroy each other. Usually, JavaScript provides an easier way to do certain tasks at a small cost to performance; in this case I found it easier to follow a lower level approach.
When two asteroids collide, we need to handle one after the other. If we splice out the old one and push in two new ones, the other asteroid we need to destroy will end up in a different position in the array, with a different index; it’ll be very difficult to find. We could designate a name for each asteroid, but then we have to figure out a way to generate a new, unique name with each new asteroid. I have a much simpler solution, though it discards those JavaScript methods that often make our work easier: store our asteroids in a fixed-length array, and identify each asteroid by its index.
To break an asteroid we first check its size; if it’s small, we set it to null and skip any further steps, otherwise we replace it with a new small one. We generate a random direction for it to move, and start it a short distance from the center of the old asteroid. Then we loop through the array and add the second small asteroid in the first null element we find. To ensure it doesn’t collide with the first or loop around the screen and collide later, we add 3 to the radians of the first asteroid (a little less than 180 degrees).
// Get the distance between two actors function getDistance(a, b) { return Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)); } // We get the index so we can change the asteroids array in place function breakAsteroid(index) { var ast = asteroids[index]; if (ast.size === 1) { asteroidCount--; asteroids[index] = null; } else { // Big asteroids create two new small ones asteroidCount++; // Generate random direction to move var radians = Math.random() * TAU; var xSpeed = Math.cos(radians); var ySpeed = Math.sin(radians); // Ensure the asteroids start far apart enough to not collide with each other var x = ASTEROID_SIZE * xSpeed; var y = ASTEROID_SIZE * ySpeed; // Create two new asteroids for (var i = 0; i < MAX_ASTEROIDS; i++) { if (i !== index && !asteroids[i]) { asteroids[i] = new Asteroid(true, ast.x + x, ast.y + y, xSpeed, ySpeed); break; } } // This astroid moves in nearly the total opposite direction; if it was 180 degrees the two would loop around and collide radians += 3; xSpeed = Math.cos(radians); ySpeed = Math.sin(radians); x = ASTEROID_SIZE * xSpeed; y = ASTEROID_SIZE * ySpeed; asteroids[index] = new Asteroid(true, ast.x + x, ast.y + y, xSpeed, ySpeed); } } // Update asteroids for (var i = 0; i < MAX_ASTEROIDS; i++) { if (asteroids[i]) { updateActor(mod, asteroids[i]); } else { // Only add new asteroids if there are fewer than the max big ones if (asteroidCount < MAX_BIG_ASTEROIDS) { asteroids[i] = new Asteroid(); asteroidCount++; } } } // Check for asteroids colliding with each other for (var i = 0; i < MAX_ASTEROIDS; i++) { if (asteroids[i]) { // Check for collision with other asteroids; starting with the next index so we don't repeat ourselves for (var a = i + 1; a < MAX_ASTEROIDS; a++) { if (asteroids[a]) { // Add both asteroid's sizes together if (getDistance(asteroids[i], asteroids[a]) < asteroids[i].size * ASTEROID_SIZE + asteroids[a].size * ASTEROID_SIZE) { breakAsteroid(i); breakAsteroid(a); break; } } } // Render the asteroid if it still exists if (asteroids[i]) { renderAsteroid(asteroids[i]); } } }
This involves a little more work, but the other asteroid in the collision has the same index in the array after the function call as it did before. We can apply the same function to the other asteroid using the index we already got when we found two that were colliding. In this way, we can use this one function to handle an asteroid colliding with another asteroid, the player, or anything else in the game for that matter.
Speaking of which, asteroids still pass through our player; let’s handle player collision too. First, we need to add a few properties to the player object: status will indicate whether the player is alive, destroyed, or in a recovery period, and we’ll use countdown to determine how long to keep the player in the “destroyed” and “recovery” states.
We also have to modify our updatePlayer() function. We check in the asteroids update loop whether the player collides with any asteroids, change it’s state to “destroyed” if it does, and set the countdown. When we get to updating the player, we count down based on our framerate modifier; once we reach zero we reset the player’s position and change to “recovery” state. In this state, the player is invulnerable to asteroid collisions, so that we don’t instantly destroy it again if there happens to be an asteroid in the center of the screen.
We continue to count down to the end of the recovery period, and make the player vulnerable again. Note that I declare our delay variables by dividing the time in milliseconds by the update rate. Let’s modify the player rendering as well, and use a light gray instead of white for when the player is in the recovery state.
const RESPAWN_DELAY = 1200 / UPDATE_RATE; const RECOVER_DELAY = 1800 / UPDATE_RATE; function resetPlayer() { player.x = CANVAS_W / 2; player.y = CANVAS_H / 2; player.xSpeed = 0; player.ySpeed = 0; player.radians = 0; player.state = 'recovery'; player.countdown = RECOVER_DELAY; } function updatePlayer(mod) { const TAU = 2 * Math.PI; if (player.countdown > 0) { // Count down to either respawning or resetting the player player.countdown -= 1 / mod; if (player.countdown <= 0) { player.countdown = 0; // Update player state; change to recovery period if destroyed, or alive if already recovering switch (player.state) { case 'destroyed': resetPlayer(); break; case 'recovery': player.state = 'alive'; break; } } } // Only update the player's position if it's not destroyed if (player.state !== 'destroyed') { // All the player updating here // Update asteroids for (var i = 0; i < MAX_ASTEROIDS; i++) { if (asteroids[i]) { updateActor(mod, asteroids[i]); // Check for player collision if player is alive if (player.state === 'alive') { if (getDistance(asteroids[i], player) < asteroids[i].size * ASTEROID_SIZE) { // Destroy player player.state = 'destroyed'; player.countdown = RESPAWN_DELAY; } } } else { // Etc... function frameStep(timestamp) { // After transforming our player object's render points context.closePath(); context.lineWidth = 2; context.strokeStyle = player.state === 'alive' ? '#FFF' : '#AAA'; context.stroke(); // Etc...
With collisions our game is getting a little more dynamic, and we’ve provided a consequence for colliding with asteroids: a respawn delay. Next, we’ll add win and lose states as well as different scenes such as the title screen.
— Peter N. Wood
Previous Step 3: Control Schemes
coming soon: State and the Scene


Settings
Loading, please hold on ...
0 tags selected
Note: If no tags are selected then all available blog posts will be shown.
Allow users to add comments
Cancel
Save blog settings
This blog show posts for the following tags:
There are no posts found for the following tags:


ArcGIS-based Functions¶
Collection of all functions based on arcpy.
- Generate and clip ID-raster
- Import ID-raster to ID-array
- Export pandas Series to raster
- Export all rows of a DataFrame to rasters in a File-Geodatabase,
- optionally calculating statistics rasters (mean, sum, max, …)
- Import attribute table or dbf table to DataFrame
- Join DataFrame columns to attribute table of a Feature Class
- Extract values from rasters at point locations and the eight surrounding cells
- Extract values from rasters to new fields in a Point Feature Class
- Calculate zonal statistics and join to zone Feature Class
raster_to_array |
Imports all values of a raster and converts them to one-dimensional array. |
create_idraster_germany |
Creates an ID raster in stereographic projection for the extended national RADOLAN grid (900 x 1100 km) or the national grid (900 x 900 km). |
clip_idraster |
Clips a raster to the extent of the clip feature. |
import_idarray_from_raster |
Imports all values of raster and converts them to one-dimensional array. |
create_idarray |
Creates an ID Array for a study area. |
export_to_raster |
Exports series to raster by inserting target values at their corresponding ID values in the ID raster. |
export_dfrows_to_gdb |
Exports all rows of a DataFrame to rasters in a File-Geodatabase. |
attribute_table_to_df |
Load data from dbf table into a pandas DataFrame for subsequent analysis. |
join_df_columns_to_attribute_table |
Join DataFrame columns to attribute table of a feature flass or Shapefile. |
idTable_nineGrid |
Gets the IDs of point locations from an ID raster and calculates the IDs of the eight surrounding cells for every point. |
idTable_to_valueTable |
Selects the values defined in an ID Table from a data Series. |
valueTable_nineGrid |
Selects the values of a nine cell grid around point locations. |
rastervalues_to_points |
Extract values from a list of rasters to new fields in a point Feature Class. |
zonalstatistics |
Calculate Zonal Statistics as Table, join output to copy of zone Feature Class and import resulting table into DataFrame. |


05-Jul-2017 | Milku
But the Newton house at school had mixed fortunes in sports day.
Did you know that Sir Isaac Newton's Philosophiæ Naturalis Principia Mathematica was first published on 5 July 1687. That's a long time ago. At least students of Newton's laws of motion and his law of universal gravitation don't have to read about them in the original Latin. I'd find the theory difficult to understand in English...although I understand the practical aspects of it all very well...the bigger and nearer that a treat is to me, the stronger its attraction. And I'll definitely remain at rest whenever possible unless a human hand starts to try to grab me!
I thought yesterday's school sports day would be postponed. I noticed that it was raining as I went to bed. But as my littlest human said, "footballers play football in the rain so we'll be able to do sport when it's wet". They were lucky that the rain stopped for a couple of hours so nobody got wet...unless they fell over when doing the sack race. Apparently, my little humans raced very well. They're fast...like me. So I wasn't surprised to hear that they competed in the final relay race too. I've seen a photo of my littlest friend crossing the finishing line in first place. Well done to the Clifton team.
It's an exciting day today too. I'm counting down the hours until my little human comes home from Poland. I can't wait to hear all about Polish food...oh, and all about the sights too I suppose.


{% extends "base.html" %} {% block title %}Full text hidden service search{% endblock %} {% block content %}
This version of the search needs JavaScript. You can use search without JavaScript instead.


Yo, I LOVE Hong Kong, I swear when you come to Hong Kong you would want to live there. The view is amazing. Hong Kong is a city that I miss the most, and that I will always remember.
The view is amazing at the Peak. One place you need to go to when you are visiting Hong Kong, is The Peak. The Peak also offers a very good hike that you can go on. I like it a lot and it's not that long. Don't worry.
If you come to Hong Kong and you are looking for a beach to go swimming, you should visit The Repulse Bay Beach. The Repulse Bay Beach is a cool beach. Lot's of people have fun there. You can ask anyone. If you are in Hong Kong when it is Lantern Festival, the Repulse Bay beach is a great place to experience the Chinese lunar moon festival. It's a great place to go with your friends and Family. But it's dark so tell your children not to go swimming or they'll get lost!
Hope you Enjoy Hong Kong!!!!
Some text..
Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
Some text..
Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
Some text..
Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
Some text..
Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.


Read this article to know how to set up your blog site with pagd and host it using github. Continue reading if you want to customize your site with pagd.
adding fonts with google-webfonts
Pagd by default comes with inconsolata font from google-webfonts. Pagd templates will load all font references from config.json file present under your layout's root directory. Just append the reference URL to the list of google_webfonts. To apply one of the loaded fonts to page's <body> element - set the font-family attribute in config.json. The style property object in config.json will be converted to a string of semi-colon separated list of CSS properties and applied to page's body element as its style attribute.
{ "google_webfonts" : [
"http://fonts.googleapis.com/css?family=Inconsolata"
],
"style" : {
"font-family" : "Inconsolata"
}
}
Note that above settings are global to all pages in the site. If you want to customize the fonts for specific elements in the page, then you must customize them using media/myblog.css.
let your readers mail you directly
Pagd can generate a mailto: hyper-reference at the bottom of every blog article, if you provide email meta-data for your pages. If you are managing your site with git or mercurial then, you can add your email-id as part of .gitconfig or .hgrc file. Otherwise, you can simply add your email id along with the page content as meta data, like,
:title: <Page title for this blog article>
:author: prataprc
:email: <emailid>
...
rest of the content
...
note if you are not providing your email id as part of repository meta-data, they you will have add it manually for every blog article that you are creating under _contents sub-directory.
copyright
Add your copyright information in config.json file placed under your site layout's root directory, for eg.,
{ "copyright" : "© 2013 Pratap Chakravarthy" }
advanced customization
Once you are comfortable adding pages under _contents/ directory and managing your config.json, you must go through pagd package documentation and learn now pagd.myblog layout is organized. Subsequently you can alter your site layout either using CSS or directly by changing the template files. This section gives a short introduction on them.
customizing with CSS
Html elements generated by pagd.myblog template are selectable using CSS id and class names. Under your site-layout, media/myblog.css file contains the necessary styling attributes for your pages. It is generally divided into,
- CSS reset declarations.
- standard element styling applicable to all pages.
- targeted styling for specific html elements.
You can freely modify / add / remove CSS declaration as it suites your site.
customizing with templates
All template files for pagd.myblog layout can be found under _templates/ sub-directory and uses tayra templating language to describe them. Experimental support is available for mako and jinja2 templates, but use them only if you are well-versed with pagd-tool. Pages generated by pagd.myblog layout plugin is made up of three parts, header, container and footer.
- index.ttl directly maps to _contents/index.<format> file. This template is used only for the index-page.
- _default.ttl template will be used for all other pages, if a matching template is not found for a page under _contents/ sub-directory.
- _head.ttl will go under <head> element of the page. Both index.ttl and _default.ttl templates include them.
- _header.ttl constitute the header portion of site pages. You can add your site-wide navigation links inside this template file.
- _footer.ttl constitute the footer portion of site pages. You can add acknowledgments, copyright notice under this template.
- _social.ttl adds social sharing features for your site. Uses social_sharing configuration parameter from config.json.
- _social/ add all html snippets that you obtain from disqus, twitter, facebook etc... under this directory.
To keep a tab on pagd - follow the project at github and post your queries to their mailing-list.


For the fig-swirl: Melt butter over medium heat in a saucepan. Add brown sugar and stir to dissolve. Halve all of the figs and toss in the saucepan with water and lemon juice. Cook over medium heat, stirring frequently, until you have a chunky-jam mixture. Add salt with one or two stirs, set aside and let cool completely.
Ice Cream: In a small pot over medium heat, combine milk, and granulated sugar until sugar is completely dissolved and the milk is just barely lukewarm. Whisk in the egg yolks. Set mixture in the fridge and wait until the fig mixture is cooled.
Using an ice cream machine, pour liquids in to the frozen basin and process according to manufacturer insturctions, i.e., let spin and thicken for 20 minutes before adding mascarpone, fig jam mixture, and the nuts. Continue to process for +/- 10 minutes. Pour semi-frozen mixture into a pyrex dish or glass tupperware. Freeze for at least two hours before serving.


The Great
RGB
Guessing Game::By Shakil
Click "New Game" to Generate colors and start playing
New Game
Easy
Hard


MMAP
Section: Linux Programmer's Manual (2)
Updated: 2014-08-19
Index
Return to Main Contents
NAME
mmap, munmap - map or unmap files or devices into memory
SYNOPSIS
#include <sys/mman.h>
void *mmap(void *addr, size_t length, int prot, int flags,
int fd, off_t offset);
int munmap(void *addr, size_t length);
See NOTES for information on feature test macro requirements.
DESCRIPTION
mmap()
creates a new mapping in the virtual address space of
the calling process.
The starting address for the new mapping is specified in
addr.
The
length
argument specifies the length of the mapping.
If
addr
is NULL,
then the kernel chooses the address at which to create the mapping;
this is the most portable method of creating a new mapping.
If
addr
is not NULL,
then the kernel takes it as a hint about where to place the mapping;
on Linux, the mapping will be created at a nearby page boundary.
The address of the new mapping is returned as the result of the call.
The contents of a file mapping (as opposed to an anonymous mapping; see
MAP_ANONYMOUS
below), are initialized using
length
bytes starting at offset
offset
in the file (or other object) referred to by the file descriptor
fd.
offset
must be a multiple of the page size as returned by
sysconf(_SC_PAGE_SIZE).
The
prot
argument describes the desired memory protection of the mapping
(and must not conflict with the open mode of the file).
It is either
PROT_NONE
or the bitwise OR of one or more of the following flags:
- PROT_EXEC
-
Pages may be executed.
- PROT_READ
-
Pages may be read.
- PROT_WRITE
-
Pages may be written.
- PROT_NONE
-
Pages may not be accessed.
The
flags
argument determines whether updates to the mapping
are visible to other processes mapping the same region,
and whether updates are carried through to the underlying file.
This behavior is determined by including exactly one
of the following values in
flags:
- MAP_SHARED
-
Share this mapping.
Updates to the mapping are visible to other processes that map this file,
and are carried through to the underlying file.
The file may not actually be updated until
msync(2)
or
munmap()
is called.
- MAP_PRIVATE
-
Create a private copy-on-write mapping.
Updates to the mapping are not visible to other processes
mapping the same file, and are not carried through to
the underlying file.
It is unspecified whether changes made to the file after the
mmap()
call are visible in the mapped region.
Both of these flags are described in POSIX.1-2001.
In addition, zero or more of the following values can be ORed in
flags:
- MAP_32BIT (since Linux 2.4.20, 2.6)
-
Put the mapping into the first 2 Gigabytes of the process address space.
This flag is supported only on x86-64, for 64-bit programs.
It was added to allow thread stacks to be allocated somewhere
in the first 2GB of memory,
so as to improve context-switch performance on some early
64-bit processors.
Modern x86-64 processors no longer have this performance problem,
so use of this flag is not required on those systems.
The
MAP_32BIT
flag is ignored when
MAP_FIXED
is set.
- MAP_ANON
-
Synonym for
MAP_ANONYMOUS.
Deprecated.
- MAP_ANONYMOUS
-
The mapping is not backed by any file;
its contents are initialized to zero.
The
fd
and
offset
arguments are ignored;
however, some implementations require
fd
to be -1 if
MAP_ANONYMOUS
(or
MAP_ANON)
is specified,
and portable applications should ensure this.
The use of
MAP_ANONYMOUS
in conjunction with
MAP_SHARED
is supported on Linux only since kernel 2.4.
- MAP_DENYWRITE
-
This flag is ignored.
(Long ago, it signaled that attempts to write to the underlying file
should fail with
ETXTBUSY.
But this was a source of denial-of-service attacks.)
- MAP_EXECUTABLE
-
This flag is ignored.
- MAP_FILE
-
Compatibility flag.
Ignored.
- MAP_FIXED
-
Don't interpret
addr
as a hint: place the mapping at exactly that address.
addr
must be a multiple of the page size.
If the memory region specified by
addr
and
len
overlaps pages of any existing mapping(s), then the overlapped
part of the existing mapping(s) will be discarded.
If the specified address cannot be used,
mmap()
will fail.
Because requiring a fixed address for a mapping is less portable,
the use of this option is discouraged.
- MAP_GROWSDOWN
-
Used for stacks.
Indicates to the kernel virtual memory system that the mapping
should extend downward in memory.
- MAP_HUGETLB (since Linux 2.6.32)
-
Allocate the mapping using "huge pages."
See the Linux kernel source file
Documentation/vm/hugetlbpage.txt
for further information.
- MAP_LOCKED (since Linux 2.5.37)
-
Lock the pages of the mapped region into memory in the manner of
mlock(2).
This flag is ignored in older kernels.
- MAP_NONBLOCK (since Linux 2.5.46)
-
Only meaningful in conjunction with
MAP_POPULATE.
Don't perform read-ahead:
create page tables entries only for pages
that are already present in RAM.
Since Linux 2.6.23, this flag causes
MAP_POPULATE
to do nothing.
One day the combination of
MAP_POPULATE
and
MAP_NONBLOCK
may be reimplemented.
- MAP_NORESERVE
-
Do not reserve swap space for this mapping.
When swap space is reserved, one has the guarantee
that it is possible to modify the mapping.
When swap space is not reserved one might get
SIGSEGV
upon a write
if no physical memory is available.
See also the discussion of the file
/proc/sys/vm/overcommit_memory
in
proc(5).
In kernels before 2.6, this flag had effect only for
private writable mappings.
- MAP_POPULATE (since Linux 2.5.46)
-
Populate (prefault) page tables for a mapping.
For a file mapping, this causes read-ahead on the file.
Later accesses to the mapping will not be blocked by page faults.
MAP_POPULATE
is supported for private mappings only since Linux 2.6.23.
- MAP_STACK (since Linux 2.6.27)
-
Allocate the mapping at an address suitable for a process
or thread stack.
This flag is currently a no-op,
but is used in the glibc threading implementation so that
if some architectures require special treatment for stack allocations,
support can later be transparently implemented for glibc.
- MAP_UNINITIALIZED (since Linux 2.6.33)
-
Don't clear anonymous pages.
This flag is intended to improve performance on embedded devices.
This flag is honored only if the kernel was configured with the
CONFIG_MMAP_ALLOW_UNINITIALIZED
option.
Because of the security implications,
that option is normally enabled only on embedded devices
(i.e., devices where one has complete control of the contents of user memory).
Of the above flags, only
MAP_FIXED
is specified in POSIX.1-2001.
However, most systems also support
MAP_ANONYMOUS
(or its synonym
MAP_ANON).
Some systems document the additional flags
MAP_AUTOGROW,
MAP_AUTORESRV,
MAP_COPY,
and
MAP_LOCAL.
Memory mapped by
mmap()
is preserved across
fork(2),
with the same attributes.
A file is mapped in multiples of the page size.
For a file that is not
a multiple of the page size, the remaining memory is zeroed when mapped,
and writes to that region are not written out to the file.
The effect of
changing the size of the underlying file of a mapping on the pages that
correspond to added or removed regions of the file is unspecified.
munmap()
The
munmap()
system call deletes the mappings for the specified address range, and
causes further references to addresses within the range to generate
invalid memory references.
The region is also automatically unmapped
when the process is terminated.
On the other hand, closing the file
descriptor does not unmap the region.
The address
addr
must be a multiple of the page size.
All pages containing a part
of the indicated range are unmapped, and subsequent references
to these pages will generate
SIGSEGV.
It is not an error if the
indicated range does not contain any mapped pages.
Timestamps changes for file-backed mappings
For file-backed mappings, the
st_atime
field for the mapped file may be updated at any time between the
mmap()
and the corresponding unmapping; the first reference to a mapped
page will update the field if it has not been already.
The
st_ctime
and
st_mtime
field for a file mapped with
PROT_WRITE
and
MAP_SHARED
will be updated after
a write to the mapped region, and before a subsequent
msync(2)
with the
MS_SYNC
or
MS_ASYNC
flag, if one occurs.
RETURN VALUE
On success,
mmap()
returns a pointer to the mapped area.
On error, the value
MAP_FAILED
(that is,
(void *) -1)
is returned, and
errno
is set appropriately.
On success,
munmap()
returns 0, on failure -1, and
errno
is set (probably to
EINVAL).
ERRORS
- EACCES
-
A file descriptor refers to a non-regular file.
Or a file mapping was requested, but
fd
is not open for reading.
Or
MAP_SHARED
was requested and
PROT_WRITE
is set, but
fd
is not open in read/write
(O_RDWR)
mode.
Or
PROT_WRITE
is set, but the file is append-only.
- EAGAIN
-
The file has been locked, or too much memory has been locked (see
setrlimit(2)).
- EBADF
-
fd
is not a valid file descriptor (and
MAP_ANONYMOUS
was not set).
- EINVAL
-
We don't like
addr,
length,
or
offset
(e.g., they are too large, or not aligned on a page boundary).
- EINVAL
-
(since Linux 2.6.12)
length
was 0.
- EINVAL
-
flags
contained neither
MAP_PRIVATE
or
MAP_SHARED,
or contained both of these values.
- ENFILE
-
The system limit on the total number of open files has been reached.
- ENODEV
-
The underlying filesystem of the specified file does not support
memory mapping.
- ENOMEM
-
No memory is available, or the process's maximum number of mappings would
have been exceeded.
- EPERM
-
The
prot
argument asks for
PROT_EXEC
but the mapped area belongs to a file on a filesystem that
was mounted no-exec.
- ETXTBSY
-
MAP_DENYWRITE
was set but the object specified by
fd
is open for writing.
- EOVERFLOW
-
On 32-bit architecture together with the large file extension
(i.e., using 64-bit
off_t):
the number of pages used for
length
plus number of pages used for
offset
would overflow
unsigned long
(32 bits).
Use of a mapped region can result in these signals:
- SIGSEGV
-
Attempted write into a region mapped as read-only.
- SIGBUS
-
Attempted access to a portion of the buffer that does not correspond
to the file (for example, beyond the end of the file, including the
case where another process has truncated the file).
CONFORMING TO
SVr4, 4.4BSD, POSIX.1-2001.
AVAILABILITY
On POSIX systems on which
mmap(),
msync(2),
and
munmap()
are available,
_POSIX_MAPPED_FILES
is defined in <unistd.h> to a value greater than 0.
(See also
sysconf(3).)
NOTES
On some hardware architectures (e.g., i386),
PROT_WRITE
implies
PROT_READ.
It is architecture dependent whether
PROT_READ
implies
PROT_EXEC
or not.
Portable programs should always set
PROT_EXEC
if they intend to execute code in the new mapping.
The portable way to create a mapping is to specify
addr
as 0 (NULL), and omit
MAP_FIXED
from
flags.
In this case, the system chooses the address for the mapping;
the address is chosen so as not to conflict with any existing mapping,
and will not be 0.
If the
MAP_FIXED
flag is specified, and
addr
is 0 (NULL), then the mapped address will be 0 (NULL).
Certain
flags
constants are defined only if either
_BSD_SOURCE
or
_SVID_SOURCE
is defined.
(Requiring
_GNU_SOURCE
also suffices,
and requiring that macro specifically would have been more logical,
since these flags are all Linux-specific.)
The relevant flags are:
MAP_32BIT,
MAP_ANONYMOUS
(and the synonym
MAP_ANON),
MAP_DENYWRITE,
MAP_EXECUTABLE,
MAP_FILE,
MAP_GROWSDOWN,
MAP_HUGETLB,
MAP_LOCKED,
MAP_NONBLOCK,
MAP_NORESERVE,
MAP_POPULATE,
and
MAP_STACK.
C library/kernel ABI differences
This page describes the interface provided by the glibc
mmap()
wrapper function.
Originally, this function invoked a system call of the same name.
Since kernel 2.4, that system call has been superseded by
mmap2(2),
and nowadays
the glibc
mmap()
wrapper function invokes
mmap2(2)
with a suitably adjusted value for
offset.
BUGS
On Linux there are no guarantees like those suggested above under
MAP_NORESERVE.
By default, any process can be killed
at any moment when the system runs out of memory.
In kernels before 2.6.7, the
MAP_POPULATE
flag has effect only if
prot
is specified as
PROT_NONE.
SUSv3 specifies that
mmap()
should fail if
length
is 0.
However, in kernels before 2.6.12,
mmap()
succeeded in this case: no mapping was created and the call returned
addr.
Since kernel 2.6.12,
mmap()
fails with the error
EINVAL
for this case.
POSIX specifies that the system shall always
zero fill any partial page at the end
of the object and that system will never write any modification of the
object beyond its end.
On Linux, when you write data to such partial page after the end
of the object, the data stays in the page cache even after the file
is closed and unmapped
and even though the data is never written to the file itself,
subsequent mappings may see the modified content.
In some cases, this could be fixed by calling
msync(2)
before the unmap takes place;
however, this doesn't work on tmpfs
(for example, when using POSIX shared memory interface documented in
shm_overview(7)).
EXAMPLE
The following program prints part of the file specified in
its first command-line argument to standard output.
The range of bytes to be printed is specified via offset and length
values in the second and third command-line arguments.
The program creates a memory mapping of the required
pages of the file and then uses
write(2)
to output the desired bytes.
Program source
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define handle_error(msg) \
do { perror(msg); exit(EXIT_FAILURE); } while (0)
int
main(int argc, char *argv[])
{
char *addr;
int fd;
struct stat sb;
off_t offset, pa_offset;
size_t length;
ssize_t s;
if (argc < 3 || argc > 4) {
fprintf(stderr, "%s file offset [length]\n", argv[0]);
exit(EXIT_FAILURE);
}
fd = open(argv[1], O_RDONLY);
if (fd == -1)
handle_error("open");
if (fstat(fd, &sb) == -1) /* To obtain file size */
handle_error("fstat");
offset = atoi(argv[2]);
pa_offset = offset & ~(sysconf(_SC_PAGE_SIZE) - 1);
/* offset for mmap() must be page aligned */
if (offset >= sb.st_size) {
fprintf(stderr, "offset is past end of file\n");
exit(EXIT_FAILURE);
}
if (argc == 4) {
length = atoi(argv[3]);
if (offset + length > sb.st_size)
length = sb.st_size - offset;
/* Can't display bytes past end of file */
} else { /* No length arg ==> display to end of file */
length = sb.st_size - offset;
}
addr = mmap(NULL, length + offset - pa_offset, PROT_READ,
MAP_PRIVATE, fd, pa_offset);
if (addr == MAP_FAILED)
handle_error("mmap");
s = write(STDOUT_FILENO, addr + offset - pa_offset, length);
if (s != length) {
if (s == -1)
handle_error("write");
fprintf(stderr, "partial write");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}
SEE ALSO
getpagesize(2),
mincore(2),
mlock(2),
mmap2(2),
mprotect(2),
mremap(2),
msync(2),
remap_file_pages(2),
setrlimit(2),
shmat(2),
shm_open(3),
shm_overview(7)
The descriptions of the following files in
proc(5):
/proc/[pid]/maps,
/proc/[pid]/map_files,
and
/proc/[pid]/smaps.
B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.

Time: 02:54:49 GMT, September 18, 2014


Copyright 2020, UPPRO.
We have quite a few services as you can see in the navbar. We connect Farmers in Uttar Pradesh to the market by giving out services. These include:


{{ partial "head.html" . }}
Ph.D. Student | Earth and Environmental Science Department | University of Pennsylvania
Ice Mechanics | Rheology | Ice Physics Lab
Maria Micaela Ninni


How To Upgrade The Firmware Version Of Tp Link Wireless Router
Bow And Arrow Free Download Borrow And Streaming Internet Archive
Ascii Jp えっ メールにzipファイルを添付しちゃダメなの 2 5
Cannot Unbrick My Tp Link Archer C7 V4 Router Installing And Using Openwrt Openwrt Forum
Tp Link Archer C20 Firmware Upgrade Without Internet Offine And Online
Archer Mr200 V4 Firmware Update Failure Home Network Community
How To Fix A Bricked Tp Link Archer C7 Ac1750 Router
Debrick Tp Link Archer C7 Minh S Scrap Yard
Unable To Download The Firmware File 1 3 4 Build 20200512 Rel 51608 Home Network Community
How To Update Firmware On A Tp Link Ac1750 Router
Archer Regular Download For Free View Sample Text Rating And More On Fontsgeek Com
How To Download The Isp File From Tp Link Home Network Community
Restore Tp Link Archer C7 Dd Wrt To Stock Youtube
Unbricking A Tp Link Router Recover Your Bricked Tp Link Router
Ascii Jp えっ メールにzipファイルを添付しちゃダメなの 4 5
Tp Link Firmware Upgrade Archer C20 Ac750
Tp Link Archer A9 V6 X For Developers Openwrt Forum
Failed Update Archer C20 V5 Update Failed Home Network Community
3d Illusion Led Lamp Archer File Cdr And Dxf Free Vector Download For Laser Engraving Machines Download Vector
Tp Link Archer C7 V5 Eu Problems To Unbrick Installing And Using Openwrt Openwrt Forum
Archer Book Download For Free View Sample Text Rating And More On Fontsgeek Com
Tp Link T4u V2 Archer T4u V2 Installation Guide Manualzz
Archer C80 Unable To Boot In Ap Mode After Firmware Upgrade Home Network Community
Archer Hairline Download For Free View Sample Text Rating And More On Fontsgeek Com
Aopa Piper Pa 28 Archer For Fsx
Tp Link Archer T4uhp User Manual Manualzz
Archer Class Rifle Royal Navy R Type By Gunturblakeisback On Deviantart
Apache Cordova Learn Playcanvas
Archer Thin Download For Free View Sample Text Rating And More On Fontsgeek Com
Woman Bandit Archer B002902 File Stl Free Download 3d Model For Cnc And 3d Printer Download Stl Files Obj Files
Archery Archer Bow Deer Hunting Hunt Silhouette Svg File Silhouettefile