text
stringlengths
454
608k
url
stringlengths
17
896
dump
stringclasses
91 values
source
stringclasses
1 value
word_count
int64
101
114k
flesch_reading_ease
float64
50
104
Checking Program Style with style61b On the instructional machines, you can run our version of the open-source checkstyle program with the command style61b FILE.java ... where FILE.java... denotes one or more names of Java source files. The program will exit normally if there are no style violations, and otherwise will exit with a non-zero exit code. Style61b' is a simple script that invokescheckstyle configured with our official style parameters. For home use, it is included in our cs61b-software package. The rest of this document details the style rules thatstyle61b` enforces. Whitespace - W1. Each file must end with a newline sequence. - W2. Files may not contain horizontal tab characters. Use blanks only for indentation. - W3. No line may contain trailing blanks. W4. Do NOT put whitespace: - Around the "<" and ">" within a generic type designation ("List ", not "List ", or "List< Integer >"). - After the prefix operators "!", "--", "++", unary "-", or unary "+". - Before the tokens ";" or the suffix operators "--" and "++". - After "(" or before ")". - After "." W5.". W6. In general, break (insert newlines in) lines before an operator, as in ... + 20 * X + Y - W7. Do not separate a method name from the "(" in a method call with blanks. However, you may separate them with a newline followed by blanks (for indentation) on long lines. Indentation - I1. The basic indentation step is 4 spaces. I2. Indent code by the basic indentation step for each block level (blocks are generally enclosed in "{" and "}"), as in if (x > 0) { r = -x; } else { r = x; } I3. Indent 'case' labels at the same level as their enclosing 'switch', as in switch (op) { case '+': addOpnds(x, y); break; default: ERROR(); } - I4. Indent continued lines by the basic indentation step. Braces - BR1. Use { } braces around the statements of all 'if', 'while', 'do', and 'for' statements. BR2. Place a "}" brace on the same line as a following "else", "finally", or "catch", as in if (x > 0) { y = -x; } else { y = x; } - BR3.. - C1. Every class and field must have a Javadoc (/ ... */) comment. Every method must either have a Javadoc comment, or an @Overrideannotation. - C2. Each parameter of a method must be mentioned in its Javadoc comment, using either a @paramtag, or spelled out in all capital letters in running text. Parameters that begin with "dummy", "ignored", or "unused" do not need to be commented. - C3. Methods that return non-void values must describe them in their Javadoc comment either with a "@return" tag or in a phrase in running text that contains the word "return", "returning", or "returns". - C4. The Javadoc comment on every class must contain an @author tag. - C5. Each Javadoc comment must start with a properly formed sentence, starting with a capital letter and ending with a period. - C6. Do not use C++-style ( //) comments. If they appear in a skeleton file provided by the staff, they are intended to be removed. - C7. In method bodies, use /* ... */'-style comments only at the beginning of the method. That is, avoid internal comments. - C8. Comments must appear alone on their line(s). Names - N1. Names of static final constants must be in all capitals (e.g., RED, DEFAULT_NAME). - N2. Names of parameters, local variables, and methods must start with a lower-case letter, or consist of a single, upper-case letter. - N3. Names of types (classes), including type parameters, must start with a capital letter. - N4. Names of packages must start with a lower-case letter. - N5. Names of instance variables and non-final class (static) variables must start with either a lower-case letter or "_". Imports - IM1. Do not use 'import PACKAGE.*', unless the package is java.lang.Math, java.lang.Double, or org.junit.Assert. import static CLASS.*is OK. - IM2. Do not import the same class or static member twice. - IM3. Do not import classes or members that you do not use. Assorted Java Style Conventions - S1. Write array types with the "[]" after the element-type name, not after the declarator. For example, write " String[] names", not " String names[]". S2. Write any modifiers for methods, classes, or fields in the following order: - public, protected, or private. - abstract or static. - final, transient, or volatile. - synchronized. - native. - strictfp. S3.". S4. Do not use empty blocks ('{ }' with only whitespace or comments inside) for control statements. There is one exception: a catch block may consist solely of comments having the form /* Ignore EXCEPTIONNAME. */ S5. Avoid "magic numbers" in code by giving them symbolic names, as in public static final MAX_SIZE = 100; Exceptions are the numerals -16 through 16, 100, 1000, 0.5, -0.5, 0.25, -0.25. - S6. Do not try to catch the exceptions Exception, RuntimeError, or Error. - S7. Write " b" rather than " b == true" and " !b" rather than " b == false". S8. Replace if (condition) { return true; } else { return false; } with just return condition; - S9. Only static final fields of classes may be public. Other fields must be private or protected. - S10. Classes that have only static methods and fields must not have a public (or defaulted) constructor. - S11. Classes that have only private constructors must be declared "final". Avoiding Error-Prone Constructs - E1. If a class overrides .equals, it must also override .hashCode. E2. Local variables and parameters must not shadow field names. The preferred way to handle, e.g., getter/setter methods that simply control a field is to prefix the field name with "_", as in public double getWidth() { return _width; } public void setWidth(double width) { _width = width; } - E3. Do not use nested assignments, such as " if ((x = next()) != null) ...". Although this can be useful in C, it is almost never necessary in Java. - E4. Include a defaultcase in every switchstatement. E5. End every arm of a "switch" statement either with a breakstatement or a comment of the form /* fall through */ E6. Do not compare String literals with ==. Write if (x.equals("something")) and not if (x == "something") There are cases where you really want to use ==, but you are unlikely to encounter them in this class. Limits - L1. No file may be longer than 2000 lines. - L2. No line may be longer than 80 characters. - L3. No method may be longer than 60 lines. - L4. No method may have more than 8 parameters. - L5. Every file must contain exactly one outer class (nested classes are OK).
http://inst.eecs.berkeley.edu/~cs61b/fa18/docs/style-guide.html
CC-MAIN-2019-22
refinedweb
1,041
67.76
PGX supports referring to entities (e.g., graphs, properties) by name. Since multiple sessions can refer to entities by name, there could be cases in which different sessions want to use the same name for different entities. Since version 19.4.0, PGX supports separate namespaces: the name of an entity lives in a certain namespace where it must be unique, but different namespaces can contain entities with the same name. For example, for graph names each session has its own session-private namespace and can choose any name without affecting other sessions, nor can see the content of other private namespaces. In addition to the session-private namespace there is a public namespace for published graphs (e.g., published via the publishWithSnapshots() or the publish() methods). Similarly, each published graph defines a public namespace for published properties as well as per-session, private namespaces, so that different sessions can create properties with the same name on a published graph. Private graphs only have a private namespace. We illustrate more details focusing on graphs and then provide some additional details regarding properties; the same behavior applies to named entities as well. Graphs that are created in a session either through loading (e.g., readGraphWithProperties(), with the graph builder or through mutations will take up a name in the session-private namespace. A graph will be placed in the public namespace only through publishing (i.e., when calling the publishWithSnapshots() or the publish() methods). Publishing a graph will move its name from the session-private namespace to the public namespace. There can only be one graph with a given name in a given namespace, but a name can be used in different namespaces to refer to different graphs. An operation that creates a new graph (e.g., readGraphWithProperties() will fail if the chosen name of the new graph already exists in the session-private namespace. Publishing a graph fails if there is already a graph in the public namespace with the same name. There are two ways to retrieve a graph by name: with or without explicitly mentioning the namespace. With getGraph(Namespace, String), you need to provide the namespace (either session private or public); the graph then will be looked up in the given namespace only. With getGraph(String), the provided name will be first looked up in the private namespace and, if no graph with the given name is found there, in the public one. In other words, if a graph with the same name is defined in both the public and the private namespaces, getGraph(String) will return the private graph and you need to use getGraph(Namespace, String) to get hold of the public graph with that name. To see the currently used names in a namespace you can use the PgxSession.getGraphs(Namespace) method, which will list all the names in the given namespace. The names in the returned collection can be used in a getGraph(Namespace, String) call to retrieve the corresponding PgxGraph. Property names behave in a similar way as graph names. All property names of a non-published graph are in the session-private namespace. Once a graph is published with PgxGraph.publishWithSnapshots() or the PgxGraph.publish() methods), its properties are published as well and their names move into the public namespace. Once a graph is published, newly created properties will still be private to the session and their names will be in the private namespace. Those properties can be published individually with the Property.publish() method, as long as no other property with the same name is already published for that graph. Additionally, new private properties can be created with the same name of an already-published properties (since the names are part of separate namespaces). To handle such situations and retrieve the correct property, the PGX API offers the getVertexProperty(Namespace, String) and the getEdgeProperty(Namespace, String) methods, which allow specifying the namespace where the property name should be looked up. Similarly to graphs, if you search a property without specifying the namespace, the private namespace is searched first and the search proceeds to the public namespace only if the former fails; this is the case, for example, for the getVertexProperty(String) or the getEdgeProperty(String) methods and for PGQL queries). Likewise, when a mutation on a graph reads or writes a property referred to by name and two properties exist with the same name, the property in the private namespace is selected. To override the default selection, some mutation mechanisms accept a collection of specific Property objects to be copied into the mutated graph. For example, such mechanism is supported for filter expressions; see the Creating Subgraphs page for more details.
https://docs.oracle.com/cd/E56133_01/latest/reference/overview/namespaces.html
CC-MAIN-2020-50
refinedweb
781
52.9
Guido van Rossum Unleashed 241 Ruby by Luke Thoughts on Ruby? Guido: I just looked it up -- I've never used it. Like Parrot, it looks like a mixture of Python and Perl to me. That was fun as an April Fool's joke, but doesn't tickle my language sensibilities the right way. That said, I'm sure it's cool. I hear it's very popular in Japan. I'm not worried. Data Structures Library by GrEp I love python for making quick hacks, but the one thing that I haven't seen is a comprehensive data structures library. Is their one in development that you would like to comment about or point us to? Guido: One of Python's qualities is that you don't need a large data structures library. Rather than providing the equivalent of a 256-part wrench set, with a data type highly tuned for each different use, Python has a few super-tools that can be used efficiently almost everywhere, and without much training in tool selection. Sure, for the trained professional it may be a pain not to have singly- and doubly-linked lists, binary trees, and so on, but for most folks, dicts and lists just about cover it, and even inexperienced programmers rarely make the wrong choice between those two. Since this is of course a simplification, I expect that we will gradually migrate towards a richer set of data types. For example, there's a proposal for a set type (initially to be added as a module, later as a built-in type) floating. See and. [j | c]Python by seanw .NET initiative)? Guido: Note that the new name is Jython, by the way. Check out -- they're already working on a 2.1 compatible release. We used to work really close -- originally, when JPytnon was developed at CNRI by Jim Hugunin, Jim & I would have long discussions about how to implement the correct language semantics in Java. When Barry Warsaw took over, it was pretty much the same. Now that it's Finn Bock and Samuele Pedroni in Europe, we don't have the convenience of a shared whiteboard any more, but they are on the Python developers mailing list and we both aim to make it possible for Jython to be as close to Python in language semantics as possible. For example, one of my reasons against adding Scheme-style continuations to the language (this has seriously been proposed by the Stackless folks) is that it can't be implemented in a JVM. I find the existence of Jython very useful because it reminds me to think in terms of more abstract language semantics, not just implementation details. IMO the portability of C Python is better than that of Jython, by the way. True, you have to compile C Python for each architecture, but there are fewer platforms without a C compiler than platforms without a decent JVM. Jython is mostly useful for people who have already chosen the Java platform (or who have no choice because of company policy or simply what the competition does). In that world, it is the scripting and extension language of choice. does Python need a CPAN? by po_boy One of the reasons I still write some things in PERL is because I know that I can find and install about a zillion modules quickly and easily through the CPAN repository and CPAN module. I'm pretty sure that if Python had something similar, like the Vaults of Parnassus but more evolved that I would abandon PERL almost entirely. Do you see things in a similar way? If so, why has Python not evolved something similar or better, and what can I do to help it along in this realm? Guido: It's coming! Check out the action in the catalog-sig. You can help by joining. One reason why it hasn't happened already is that first we needed to have a good package installation story. With the widespread adoption of distutils, this is taken care of, and I foresee a bright future for the catalog activities. Favourite Python sketch? by abischof Considering that you named the language after the comedy troupe, what's your favourite Monty Python sketch? Personally, my favourite is the lecture on sheep aircraft, but I suppose that's a discussion for another time ;). Guido: I'm a bit tired of them actually. I guess I've been overexposed. :-) Conflict with GPL by MAXOMENOS The Free Software foundation mentions the license that comes with Python versions 1.6b1 and later as being incompatible with the GPL. In particular they have this to say about it: So, my question is a two parter:So, my question is a two parter:This is a free software license but is incompatible with the GNU GPL. The primary incompatibility is that this Python license is governed by the laws of the "State" of Virginia in the USA, and the GPL does not permit this. 1.What was your motivation for saying that Python's license is governed by the laws of Virginia? 2.Is it possible that a future Python license could be GPL-compatible again? Guido: Let me answer the second part first. I asked the FSF to make a clear statement about the GPL compatibility of the Python 2.1, and their lawyer gave me a very longwinded hairsplitting answer that said neither yes nor no. You can read for yourself at. I find this is very disappointing; I had thought that with the 1.6.1 release we had most of this behind us, but apparently they change their position at each step in the negotiations. I don't personally care any more whether Python will ever be GPL-compatible -- I'm just trying to do the FSF a favor because they like to use Python. With all the grief they're giving me, I wonder why I should be bothered any more. As for the second part: most of you should probably skip right to the next question -- this answer is full of legal technicalities. I've spent waaaaaaaaay to much time talking and listening to lawyers in the past year! :-( Anyway. The Python 1.6 license was written by CNRI, my employer until May 2000, where I did a lot of work on Python. (Before that, of course, I worked at CWI in Amsterdam, whom I have to thank for making my early work on Python possible.) CNRI own the rights to Python versions 1.3 through 1.6, so they have every right to pick the license. CNRI's lawyers designed the license with two goals in mind:(1) maximal protection of CNRI, (2) open source. (If (2) hadn't been a prerequisite for my employment at CNRI, they would have preferred not to release Python at all. :-) Almost every feature of the license works towards protecting CNRI against possible lawsuits from disappointed Python users (as if there would be any :-), and the state of Virginia clause is no exception. CNRI's lawyers believe that sections 4 and 5 of the license (the all caps warnings disclaiming all warranties) only provide adequate protection against lawsuits when a specific state is mentioned whose laws and courts honor general disclaimers. There are some states where consumer protection laws make general disclaimers illegal, so without the state of Virginia clause, they fear that CNRI could still be sued in such a state. (Being a consumer myself, I'm generally in favor of such consumer protection laws, but for open source software that is downloadable for free, I agree with CNRI that without a general disclaimer the author of the software is at risk. I'm happy that Maryland, for example, is considering to pass a law that makes a special exception for open source software here.) Python 1.6.1, the second "contractual obligation release" (1.6 was the first), was released especially to change CNRI's license in a way that resolved all but one of the GPL incompatibilities in the 1.6 license. I'm not going to explain what those incompatibilities were, or how they were resolved. Just look for yourself by following the "accept license" link at. The relevant changes are all in section 7 of the license, which now contains several excruciating sentences crafted to disable certain other clauses of the license under certain conditions involving the GPL. Read it and weep. The remaining incompatibility, according to the FSF, is the "click-to-accept" feature of the license. This is another feature to protect CNRI -- their lawyers believe that this is necessary to make the license a binding agreement between the user and CNRI. The FSF is dead against this, and their current position is that because the GPL does not require such an "acceptance ceremony" (their words), any license that does is incompatible with the GPL. It's like the old story of the irresistible force meeting the immovable object: CNRI's lawyers have carefully read the GPL and claim that CNRI's license is fully compatible with the GPL, so you can take your pick as to which lawyer you believe. Anyway, I removed the acceptance ceremony from the 2.1 license, in the hope that this would satisfy the FSF. Unfortunately, the FSF's response to the 2.1 license (see above) seems to suggest that they have changed their position once again, and are now requesting other changes in the license. I'm very, very tired of this, so on to the next question! Structured Design. by Xerithane First off, as a disclaimer I have never actually written anything in Python. But, I have read up on virtually all the introduction articles and tutorials so I have a grasp on syntax and structure.? Guido: What's wrong with the legibility answer? I think that's an *excellent* reason! Don't care if your code is legible? Don't you hate code that's not properly indented? Making it part of the syntax guarantees that all code is properly indented! When you use braces, there are several different styles of brace placement (e.g. whether the open brace sits on the same line as the "if" or on the next, and if on the next, whether it is indented or not; ditto for the close brace). If you're used to code written in one style, it can be difficult to read code written in another. Most people, when skimming code, look for the indentation anyway. This leads to sometimes easily overlooked bugs like this one: if (x 10) x = 10; y = 0;Still not convinced? In 1974, Don Knuth predicted that indentation would eventually become a viable means of structuring code, once program units were small enough. (Full quotation:) Still not convinced? You admit that you haven't tried it yet. Almost everybody who tries it gets used to it very quickly and end up loving the indentation feature, even those who hated it at first. There's still hope for you! So, no, I'm not worried about Python holding out 20 more years. What is *your* idea of Python and its future? by Scarblac There are a lot of "golden Python rules" or whatever you would call them, like "explicit is better than implicit", "there should be only one way to do it", that sort of thing. As far as I know, those are from old posts to the mailing list, often by Tim Peters, and they've become The Law afterwards. In the great tradition of Usenet advocacy, people who suggest things that go against these rules are criticized. But looking at Python, I see a lot more pragmatism, not rigid rules. What do you think of those "golden rules" as they're written down?. Guido: You're referring to the "Zen of Python", by Tim Peters: It's no coincidence that these rules are posted on the Python Humor page! Those rules are useful when they work, but several of the rules warn against zealous application (e.g. "practicality beats purity" and and "now is better than never"). While we put "There's only one way to do it" on a T-shirt, mostly to poke fun at Larry Wall's TMTOWTDI, the actual Python Zen rule reads: "There should be one-- and preferably only one -- obvious way to do it." That has several nuances! Regarding the future, I doubt that any piece of software ever stops evolving until it dies. It's like your brain: you never stop learning. Good software has the ability to evolve built in from the start, and evolves in a way that keeps the complexity manageable. Python started out pretty well equipped for evolution: it was extensible at two levels (C extension modules and Python modules) that didn't require changing the language itself. We've occasionally added features to support evolution better, e.g. package namespaces make it possible to have a much large number of modules in the library, and distutils makes it easier to add third party packages. I hear the complaints from the community about the rate of change in Python, and I'm going to be careful not to change the language too fast. The next batch of changes may well be aimed at *reducing* complexity. For example, there are PEPs proposing a simplification of Python's numeric system (like eradicating the distinction between 32/64-bit ints and bignums), and I've started to think seriously about removing the distinction between types and classes -- another simplification of the language's semantics. Strangest use of Python by Salamander What use of Python have you found that surprised you the most, that gave you the strongest "I can't believe they did that" reaction? Guido: I find few things strange. For the most obfuscated code I've ever come across, see the Mandelbrot set as a lambda,. Digital Creations has written a high-performance fully transactional replicated object database in Python. That's definitely *way* beyond what I thought Python would be good for when I started. Some people at national physics labs like LANL and LLNL have a version of Python running on parallel supercomputers with many hundreds of processors. That's pretty awesome. But my *favorite* use of Python is at a teaching language, to teach the principles of programming, without fuss. Think about it -- it's the next generation! --Guido van Rossum (home page:) Guido van Rossum Unleashed More Login Guido van Rossum Unleashed Related Links Top of the: day, week, month.
http://developers.slashdot.org/story/01/04/20/1455252/guido-van-rossum-unleashed/insightful-comments
CC-MAIN-2015-11
refinedweb
2,432
70.73
Creating a Slide Show Using the History API and jQuery Introduction During Ajax communication, page content is often modified in some way or another. Since Ajax requests are sent through a client side script, the browser address bar remains unchanged even if the page content is being changed. Although this behavior doesn't create any problem for an application's functionality, it has pitfalls of its own. That's where History API comes to your rescue. History API allows you to programmatically change the URL being shown in the browser's address bar. This article demonstrates how History API can be used with an example of a slide show. Overview of History API Browsers keep a track of the URLs you visit in the history object. The history object tracks only those URLs that you actually visited, usually by entering them in the browser's address bar. While this serves its purpose in most cases, Ajax driven web pages face a problem of their own. Such pages make Ajax calls to the server and often change the content of the page dynamically. Let's understand this with an example. Suppose you wish to develop an Ajax driven slide show. This slide show consists of previous and next buttons and an image element to display the slide. In order to navigate between two or more slides the slide show needs to make an Ajax call to the server to fetch the slide information to be displayed. Irrespective of the slide being displayed, the browser address bar always shows the URL of the web page that houses the slide show. Now imagine that a user is on the third slide and bookmarks that page with the intention to revisit later. If the user visits the bookmarked URL later, the URL won't fetch the third slide but will fetch the initial slide. This is because the browser's address bar was always pointing to the main page and the history object tracked only the URL of the main page. - pushState() : The pushState() method is used to add an entry to the browser's history and thus changes the browser's address bar. - replaceState() : The replaceState() method is used to update an existing entry in the browser's history with new details. - popstate : The popstate event is raised by the window object when a user visits an entry from the history object. Ajax Driven Slide Show To illustrate the use of History API, let's develop an Ajax driven slide show. The slide show exhibits only the basic functionality of showing slides as you click on next and previous buttons. For the sake of simplicity we won't add any fancy effects, configuration or error handling to the slide show. Of course, you can add these features once you finish this basic example. A slide show sample developed in this example is shown below: Slide Show As you can see each slide has a title, image and description. Clicking on the Previous or Next button causes an Ajax request to be sent to the server and details of the next or previous slide are fetched accordingly. Also, the browser's address bar reflects a unique URL for each slide being displayed even though the slide is being displayed using Ajax. For example, the above figure shows the URL for the second slide as /slides/index/2. The slide show shown above can be developed in seven easy steps. Let's see what they are... 1. Create a Database Table to Store Slide Information The slide show stores all the information about slides in a database. This example uses a SQL Server database but you can use any other RDBMS for storing this information. The following figure shows the Slides table used for this purpose: Slides Table As you can see the slides table consists of four columns - Id, Title, Description and ImageUrl. These columns store slide ID, slide title, description of a slide and URL of the slide's image respectively. 2. Create HTML Page and Style Sheet Next, you need to create an HTML page that houses the slide show. The slide show application needs some server side processing (fetch data from database when Ajax calls are made) and hence you need to use some server side processing engine to display this HTML page. This example assumes ASP.NET MVC as the server side technology but that's not mandatory. You can use any other server side framework (such as PHP) that allows you to execute the required server side logic. The following markup shows the HTML needed to display the slide information. In this example this markup goes inside a Razor view (Index.cshtml). @model HistoryAPISlideShow.Models.Slide ... <body> <form> <input id="slideId" type="hidden" value="@Model.Id" /> <h1 id="slideTitle" class="Title">@Model.Title</h1> <div><img id="slideImage" src="@Model.ImageUrl" /></div> <div id="slideDescription">@Model.Description</div> <div> <input id="prevButton" type="button" value="Previous" /> <input id="nextButton" type="button" value="Next" /> </div> </form> </body> </html> Let's examine this markup. The markup consists of a <form> that houses all the DOM elements making the slide show. The hidden field - slideId - is used to store the slide ID and is used in the client script (you will learn about it later). The <h1> element displays a slide's title. The slideImage <img> element displays the slide's image and the slideDescription <div> displays the slide's description. Two buttons - prevButton and nextButton - represent the Previous and Next buttons respectively. Notice that a Slide object acts as a model to this view. The Id, Title, ImageUrl and Description properties of the Slide object are rendered inside the slideId, slideTitle, slideImage and slideDescription elements respectively. You will create the Slide model class later in this article. The DOM elements discussed above also have some CSS styles attached with them. These CSS rules are defined in a style sheet and are shown below: #slideTitle { font-family:Arial; font-size:21px; padding:5px; } #slideDescription { font-family:Arial; font-size:15px; padding:10px; text-align:justify; } #slideImage { padding:10px; border:2px solid #808080; } #prevButton, #nextButton { width:100px; padding:5px; } Make sure to add these CSS rules to a style sheet file and link that style sheet from the HTML page you just developed. 3. Write Server Side Code to Display the Initial Slide When a user visits the web page that houses the slide show, the slide show must display the first slide. The user can then use Previous and Next navigation buttons to navigate between the slides. To fetch and supply this initial slide to the HTML markup you need to write some server side code that retrieves the slide information from the Slides table you created earlier. This example uses ASP.NET MVC and Entity Framework for this purpose but again that's not mandatory. You can easily port this logic on whatever server side framework you are using. The code that serves the initial slide is shown below: public class SlidesController : Controller { public ActionResult Index(int id = 0) { SlideDbEntities db = new SlideDbEntities(); IQueryable<Slide> data = null; if (id == 0) { data = (from item in db.Slides orderby item.Id ascending select item).First(); } else { data = from item in db.Slides where item.Id == id select item; } return View(data.SingleOrDefault()); } } The above code shows the Index() action method from the Slides controller. The Index() method takes the id parameter and its default value is set to 0. The Index() method servers two purposes. Firstly, it serves the first slide when the slide show page is visited. In this case no id will be passed to it. Secondly, it serves a slide with a specific ID. This variation is used when History API pops a slide URL added to the history object. We won't go into too much detail of the Index() method. Suffice it to say that if the id parameter is 0, Index() method fetches the first slide data from the Slides table, otherwise it fetches a slide with the specified id. In both cases the slide information is stored in Slide object (Slide is an entity class for the Slides table). The Slide object is then passed to the Index view. Recollect that Index view contains the HTML markup that displays the slide information. 4. Write Server Side Code to Serve a Specific Slide to an Ajax Call As discussed earlier, clicking on the Previous and Next buttons cause an Ajax call to be made to the server in an attempt to fetch the slide details. To handle this Ajax call you need some server side code that serves a specified slide to the client side script. The following code shows another action method of the Slides controller class that does this job: public JsonResult GetSlide(int slideid,string direction) { SlideDbEntities db = new SlideDbEntities(); IQueryable<Slide> data = null; if (string.IsNullOrEmpty(direction)) { data = from item in db.Slides where item.Id == slideid select item; } if (direction == "N") { data = (from item in db.Slides where item.Id > slideid orderby item.Id ascending select item).Take(1); } if (direction == "P") { data = (from item in db.Slides where item.Id < slideid orderby item.Id descending select item).Take(1); } Slide slide = data.SingleOrDefault(); return Json(slide); } The GetSlide() action method accepts two parameters - slideid and direction). The slideid parameter indicates the ID of the slide that is currently displayed in the browser. The direction parameter indicates whether the Previous or Next button was clicked. Its value can be P or N accordingly. If a user clicks on the Next button you need to fetch the slide whose ID is next to the current slide. The slide IDs may not be in sequence and hence the code needs to fetch a slide whose ID is higher than the current slide ID. Similarly, logic needs to be executed if the user clicks on the Previous button. This time, however, you need to fetch a slide that is immediately before the current slide. Once the slide is retrieved, it is passed to the client using the Json() method. The Json() method converts the Slide object into the equivalent JSON format. Notice that the return value of GetSlide() is JsonResult because it will be accessed by an Ajax call. 5. Load and Display Slides Using jQuery $.ajax() Now comes the important part - displaying slides using Ajax. To display slides when a user clicks the Previous or Next button we will use jQuery $.ajax() method. So, add a <script> reference to the jQuery library in the head section of the HTML page you created earlier. Also add a <script> block in the head section. The following code shows how the <script> reference and the <script> block look: <script src="~/Scripts/jquery-2.0.0.js"></script> <script type="text/javascript"> $(document).ready(function () { $("#prevButton").click(function () { GetSlide("P"); }); $("#nextButton").click(function () { GetSlide("N"); }); }); The <script> block consists of the jQuery ready() handler function. The ready() handler wires click event handlers of the prevButton and the nextButton using the click() method. Both the click event handlers call a custom function - GetSlide(). The GetSlide() function fetches a slide from the server by making an Ajax request and accepts either P or N depending on the button pressed. The following code shows the GetSlide() function: function GetSlide(direction) { var data = {}; data.slideid = $("#slideId").val(); if (direction !== undefined) { data.direction = direction; } $.ajax({ url: "/Slides/GetSlide", type: "POST", data: JSON.stringify(data), dataType: "json", contentType:"application/json", success: function (slide) { $("#slideId").val(slide.Id); $("#slideTitle").html(slide.Title); $("#slideDescription").html(slide.Description); $("#slideImage").attr("src", slide.ImageUrl); }, error: function () { alert(err.status + " - " + err.statusText); } }) } The GetSlide() function retrieves the value of the current slide ID from the slideId hidden field. It then creates a JavaScript object (data) and stores the slideid and direction into it. Then the $.ajax() method is called to make an Ajax call to the GetSlide() server side method (see step 4). Various configuration options are passed to the $.ajax() method. The url setting points to the URL of the GetSlides() action method. The type setting specifies the request type to be POST. The data setting holds the JSON stringified version of the data JavaScript object. The dataType setting specifies the data type of the response and is set to json. The contentType property specifies the content type of the request and is set to application/json. The success function is called when the Ajax call succeeds and receives the Slide object as its parameter (recollect that GetSlide() action method returns Slide object). The success function then sets the values of slideId, slideTitle, slideDescription and slideImage according to the slide data returned from the server. Finally, the error function displays an error message (if any) in case there is any error while making the Ajax call. 6. Add an Entry in the Browser's History Using pushState() In its current form the slide show will be displayed as expected. That means clicking on Previous and Next buttons will fetch the slides accordingly and display them in the page. However, the browser address bar remains unchanged throughout this navigation. That's where the History API comes into the picture. To change the browser address bar when a user navigates to the new slide, add the following line to the success handler function you created in step 5. ... success: function (slide) { $("#slideId").val(slide.Id); $("#slideTitle").html(image.Title); $("#slideDescription").html(slide.Description); $("#slideImage").attr("src", slide.ImageUrl); history.pushState(slide, slide.Title, "/slides/index/" + slide.Id); } ... Notice the line of code marked in bold letters. The code calls the pushState() method of the history object. The pushState() method accepts three parameters. These parameters are described below: - statedata : The first parameter indicates the state associated with the new entry being added. You can access this state inside the popstate event handler (discussed later). In this case you store the entire slide object into the state. - title : The second parameter is a title that you wish to assign to the new entry. This title can be displayed by the browser in the History menu. Here we add slide's Title as the title. - url : The third parameter is a URL that you wish to add to the history object. In this example you add URLs of the form /slides/index/<slide_id> to the history. Notice that these URLs point to the Index() action method of the Slides controller you created in step 3. This is also the URL that will be displayed in the browser's address bar as soon as the pushState() call is made. After adding this code if you run the web page again, you will observe that as soon as the pushState() call is made the browser's address bar reflects the URL as mentioned in the third parameter. This URL can be bookmarked by the end user or navigated to later during the same session using the browser's back button. 7. Handle Popstate Event The popstate event is raised by the window object whenever the current history entry changes. The popstate event object has state property containing the statedata value you added while calling pushState(). In our example you use this value as follows: $(document).ready(function () { window.addEventListener("popstate", function (evt) { $("#slideId").val(evt.state.Id); GetSlide(); }, false); ... As you can see the above code has been added to the ready() handler. The addEventListener() method wires an event handler for the popstate event. The popstate event handler sets the value of slideId hidden field to the ID of the slide that is being displayed from the history. Notice how the evt.state.Id is used to read a slide ID from the state object. GetSlide() method is then called so as to make an Ajax call to the server in an attempt to retrieve the latest slide information. That's it! You can run the slide show and test whether it functions as expected by clicking on the navigation buttons and browser's back and forward buttons. Summary Modern web applications heavily use Ajax. While using Ajax the page URL remains the same even though its content might get change dynamically. History API allow you to programmatically add entries to history. Ajax calls can take advantage of History API and add entries that uniquely identify an Ajax call. The browser address bar also reflects these URLs. History API provides pushState() method to add an entry to the browser's history. When any item from the browser's history is accessed popstate event is raised on the window so that the page content can be synchronized (if required) as per the URL being displayed in the browser's address<<
https://www.developer.com/lang/jscript/creating-a-slide-show-using-the-history-api-and-jquery.html
CC-MAIN-2019-04
refinedweb
2,784
64.91
Introduction to JavaFX Script Pages: 1, 2, 3, 4, 5, else if (place_your_condition_here) { //do something } else if (place_your_condition_here) { //do something } else { //do something } The while statement is similar to while in Java. Curly braces are always required with this statement. while while (place_your_condition_here) { //do something } The for statement can be used to loop over an interval (intervals are represented using brackets [] and the .. symbol). for [] .. //i will take the values: 0, 1, 2, 3, 4, 5 for (i in [0..5]) { //do something with i } JavaFX procedures are marked by the operation keyword. Here is a simple example: operation extends. attribute The inverse clause is optional and it shows a bidirectional relationship to another attribute in the class of the attributes' type. In this case, JavaFX will automatically perform updates (insert, replace, and delete). inverse: System.out.println //expressions within quoted text import java.lang.System; var mynumber:Number = 10; System.out.println("Number is: {mynumber}"); Result: Number is: 10 JavaFX supports a useful facility known as the cardinality of the variable. This facility is implemented with the next three operators: ? null + * /: sizeof /: indexof /: insert as first as last before after Pages: 1, 2, 3, 4, 5, 6 Next Page © 2017, O’Reilly Media, Inc. (707) 827-7019 (800) 889-8969 All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
http://archive.oreilly.com/pub/a/onjava/2007/07/27/introduction-to-javafx-script.html?page=2
CC-MAIN-2017-13
refinedweb
227
56.96
Timer in Java is a utility class which is used to schedule tasks for both one time and repeated execution. Timer is similar to alarm facility many people use in mobile phone. Just like you can have one time alarm or repeated alarm, You can use java.util.Timer to schedule one time task or repeated task. In fact we can implement a Reminder utility using Timer in Java and that's what we are going to see in this example of Timer in Java. Two classes java.util.Timer and java.util.TimerTask is used to schedule jobs in Java and forms Timer API. TimerTask is actual task which is executed by Timer. Similar to Thread in Java, TimerTask also implements Runnable interface and overrides run method to specify task details. This Java tutorial will also highlight difference between Timer and TimerTask class and explains how Timer works in Java. By the way difference between Timer and Thread is also a popular Java questions on fresher level interviews. What is Timer and TimerTask in Java How Timer works in Java Timer class in Java maintains a background Thread (this could be either daemon thread or user thread, based on how you created your Timer object), also called as timer's task execution thread. For each Timer there would be corresponding task processing Thread which run scheduled task at specified time. If your Timer thread is not daemon then it will stop your application from exits until it completes all schedule task. Its recommended that TimerTask should not be very long otherwise it can keep this thread busy and not allow other scheduled task to get completed. This can delay execution of other scheduled task, which may queue up and execute in quick succession once offending task completed. Difference between Timer and TimerTask in Java I have seen programmers getting confused between Timer and TimerTask, which is quite unnecessary because these two are altogether different. You just need to remember: 1) Timer in Java schedules and execute TimerTask which is an implementation of Runnable interface and overrides run method to defined actual task performed by that TimerTask. 2) Both Timer and TimerTask provides cancel() method. Timer's cancel() method cancels whole timer while TimerTask's one cancels only a particular task. I think this is the wroth noting difference between Timer and TimerTask in Java. Canceling Timer in Java You can cancel Java Timer by calling cancel() method of java.util.Timer class, this would result in following: 1) Timer will not cancel any currently executing task. 2) Timer will discard other scheduled task and will not execute them. 3) Once currently executing task will be finished, timer thread will terminate gracefully. 4) Calling Timer.cancel() more than one time will not affect. second call will be ignored. In addition to cancelling Timer, You can also cancel individual TimerTask by using cancel() method of TimerTask itself. Timer and TimerTask example to schedule Tasks Here is one example of Timer and TimerTask in Java to implement Reminder utility. public class JavaReminder { Timer timer; public JavaReminder(int seconds) { timer = new Timer(); //At this line a new Thread will be created timer.schedule(new RemindTask(), seconds*1000); //delay in milliseconds } class RemindTask extends TimerTask { @Override public void run() { System.out.println("ReminderTask is completed by Java timer"); timer.cancel(); //Not necessary because we call System.exit //System.exit(0); //Stops the AWT thread (and everything else) } } public static void main(String args[]) { System.out.println("Java timer is about to start"); JavaReminder reminderBeep = new JavaReminder(5); System.out.println("Remindertask is scheduled with Java timer."); } } Output Java timer is about to start Remindertask is scheduled with Java timer. ReminderTask is completed by Java timer //this will print after 5 seconds Important points on Timer and TimerTask in Java Now we know what is Timer and TimerTask in Java, How to use them, How to cancel then and got an understanding on How Timer works in Java. It’s good time to revise Timer and TimerTask. 1.One Thread will be created corresponding ot each Timer in Java, which could be either daemon or user thread. 2.You can schedule multiple TimerTask with one Timer. 3.You can schedule task for either one time execution or recurring execution. 4.TimerTask.cancel() cancels only that particular task, while Timer.cancel() cancel all task scheduled in Timer. 5.Timer in Java will throw IllegalStateException if you try to schedule task on a Timer which has been cancelled or whose Task execution Thread has been terminated. That's all on what is Timer and TimerTask in Java and difference between Timer and TimerTask in Java. Good understanding of Timer API is required by Java programmer to take maximum advantage of scheduling feature provided by Timer. They are essential and can be used in variety of ways e.g. to periodically remove clean cache, to perform timely job etc. Other Java Multithreading Tutorials from Javarevisited Blog 6 comments : Hi Javin, The program which you have provided here is for one time execution. What are changes need to be done in program for recurring execution? Timer is great. I used it a lot until I found this class: From API: "This class is preferable to Timer when multiple worker threads are needed, or when the additional flexibility or capabilities of ThreadPoolExecutor (which this class extends) are required." @garima, You just need to use different schedule() method from Timer class. For recurring execution you can following schedule() method : public void schedule(TimerTask task, long delay, long period) This will schedule task for repeated execution, first execution will be after delay specified by second argument and than subsequent recurring execution will be separated by period, third argument. @Jiri Pinkas, Indeed ScheduledThreadPoolExecutor is good to know and as you said has a clear advantage when you need multiple worker thread. Hi , Facing problem while using timers. I have scheduled job like the below. But its not triggerng when the time comes. for(i=0;i<=3;i++) { Timer timer = new Timer() timer.schedule(new Timertask() { pubil void run() { System.out.println("triggereed"); } },timevalue); } For the first time its getting triggered and for the next two times its not printing. and no erro is also thrown. Is there a way to check the scheudle jobs list using the timer instance or any other way we could debug this. Please help me Hi Javin, Nice Explanation, but I have question, how can it knows that the task is complete or not?
http://javarevisited.blogspot.co.uk/2013/02/what-is-timer-and-timertask-in-java-example-tutorial.html
CC-MAIN-2014-15
refinedweb
1,087
55.84
Note: This post was originally written for and posted at the Xamarin blog. Are you ready to speed up the process of writing your cross-platform mobile app with Xamarin.Forms? If you’re new to Xamarin app development, or even if you’ve developed a few mobile apps, getting started on a new project can be a challenging task. While Xamarin provides tons of resources, when you create a new project and stare at the default templates, it can take hours before you’re ready to start writing your business logic. With Infragistics Ultimate UI for Xamarin, those hours turn into minutes. Infragistics Ultimate UI for Xamarin (which you can download and try for free ) enables you to write fast and run fast with a brand new set of feature-rich and high-performing controls, as well as a revolutionary new Productivity Pack that will change the way you create Xamarin applications. While I’d love to write about all the great controls you get in Ultimate UI for Xamarin, in this post I want to focus on all the productivity tools Infragistics has just released that could change the way you write Xamarin.Forms applications: Creating Xamarin.Forms applications one page at a time can be a daunting and time-consuming task. How convenient would it be to simply whiteboard out your next app, then have an entire MVVM based Xamarin.Forms app generated with a click of a button? That’s exactly what the Infragistics AppMap does. From File à New, select the Infragistics AppMap Project (Xamarin.Forms): Next, you can use the Infragistics Xamarin.Forms Project Wizard to choose the platforms you want to target. This is one of my favorite features, because I don’t always want to target every single available platform. Pay special attention to the checkbox that says “Show AppMap” — this is what you should really care about. Once you have selected your desired platforms and chosen your container (we’ll come back to this later), click the “Create Project” button to get to the brand-new AppMap dialog. As soon as the dialog appears, you’ll feel right at home with an intuitive UI that is modeled after a mixture of Microsoft Visio and Microsoft Visual Studio. As you can see, the Infragistics AppMap gives you the ability to drag various types of Xamarin.Forms pages from the toolbox onto the design surface and arrange them as you see fit. You can also create connections between the pages that represent either child relationships (such as a TabbedPage with Tabs), or how each page will navigate to others. Once you’re done designing the application in the AppMap designer, simply click the “Generate AppMap” button and watch the magic happen. Visual Studio will generate all the Views, ViewModels, and all the navigation code for you. You don’t have to do anything but press F5 to run the app. What use to take hours to do can now be done in a few minutes. There are a lot more features available in the AppMap; you can take a deeper dive into it by watching this introduction video: To make a long story short, the AppMap generates a Prism application. For the AppMap to generate a well architected MVVM application based on best patterns and practices, it must have some type of application framework to enable the generation of reliable MVVM-friendly code. Infragistics decided that the Prism Library was the best Xamarin.Forms application framework available, and based all generated code off the features available in Prism. Most notably, what makes AppMap even possible is the very powerful URI-based navigation framework that Prism provides. Also, remember when you had to choose a container in the Infragistics Xamarin.Forms New Project Dialog? Well, this is because Prism leverages dependency injection (DI) and requires the use of a container. Prism provides just about everything you need to be successful writing an MVVM-friendly Xamarin.Forms application. For more information on Prism, or to get the source, you can find the Prism Library GitHub at . After you’ve generated the entire application using the Infragistics AppMap, you can start adding controls and other elements to your pages. If you’re coming from other platforms like WPF, ASP.NET WebForms, or WinForms, you’ll notice a large gaping hole in the Xamarin.Forms development experience. There is no designer, and there is no toolbox! This creates a major barrier to your productivity. …Unless, of course, you’re using the world’s first Xamarin.Forms Toolbox: As you can see, the Infragistics Xamarin.Forms Toolbox provides all the standard Xamarin.Forms Layouts, Views, and Cells that are available out of the box from Xamarin. This makes it super simple to drag an element from the toolbox and drop it onto your XAML file, which will insert the XAML snippet at the drop point: It gets better. Not only does the toolbox provide standard drag and drop behavior, it also provides extended XAML snippets. When you hold the CTRL key and drop a control onto the XAML file, a full XAML snippet is created that provides much more generated code. For example, when you want to create a Grid, chances are you want to have a few rows and columns created. Instead of writing that XAML by hand, though, just hold the CTRL key and let the toolbox do the work for you. Not only is the Infragistics Xamarin.Forms Toolbox the world’s first toolbox for Xamarin.Forms, it’s also powered by NuGet packages. Yes, you read that right: Powered. By. NuGet. Since Infragistics also ships a ton of great Xamarin controls, it makes sense that they would show up in the toolbox whenever they are added to your project. To try this, simply add one of Infragistics Xamarin.Forms controls to your project via the NuGet Manager, and keep an eye on the toolbox. For every Infragistics NuGet package you add to your solution, an entry for that control will be added to the Infragistics Xamarin.Forms Toolbox. Now, drag an Infragistics control from the toolbox and drop it onto your XAML file. Two things happen. First — and the most obvious — is that the control is added to the XAML. Second, which is even more amazing, is that if you look at the top of your XAML file, the XMLNS declaration for the control has been added automatically. This is a huge timesaver. No more looking at docs or trying to use intellisense to try to find the namespace of the control you want to use. Heck, in VS2015 you don’t even have intellisense, so this new toolbox saves a ton of time and headaches. What’s even better is if you already have an existing XMLNS defined, the toolbox recognizes and uses it, rather than creating another one. I want to point out that when you first install Infragistics Ultimate UI for Xamarin, the toolbox is not shown in VS. You must manually display the toolbox by going to the View à Other Windows à Infragistics Toolbox menu from Visual Studio. To see the Infragistics Toolbox in action, check out this video: After you have designed and generated your entire application using the AppMap and then laid out your page’s structure by dragging and dropping controls from the Infragistics Xamarin.Forms toolbox, the last step is to start styling your controls, binding your controls to data, and configuring your controls to meet your application requirements. There is only one problem with that last step: Xamarin.Forms does not have a designer! This makes it extremely difficult to configure any control and know how it will work or what it will look like until you press F5 and run your app on a device or an emulator. Not only is this a pain, but it is very time-consuming. Make a change, run the emulator. Make another change, run the emulator again. Repeat until you’re happy with the result. This takes forever! Well, Infragistics has a solution to that problem too. Introducing the game-changing Infragistics Control Configurators! The Control Configurator it is a dialog you launch from the XAML editor from within Visual Studio that allows you to visually configure the Infragistics Xamarin.Forms controls. How do you launch it? After you drag an Infragistics Xamarin.Forms control into your XAML editor, click the control name to place your mouse cursor in the control XAML. When you do this, you will see the Visual Studio Suggestion Light Bulb appear. Open the suggestion light bulb and you will see a menu option called “Configure [ControlName]”. Since I am using the XamRadialGauge, the menu item says “Configure XamRadialGauge”. I personally like to use the CTRL+. shortcut to launch the suggestion lightbulb. Once you see the menu item, click it. You’ll see a dialog appear that has a design surface containing the control and then a ton of options. All the Control Configurators have a common layout: ribbon at the top, a property grid on the right, and on the left you’ll get several other options, depending on the configurator you are using. This example is using the XamRadialGauge Control Configurator, so the ribbon contains options to easily modify the ranges, the scale, and the needle. It even has QuickSets that allows you to use a predefined template to get you close to the gauge you have in mind. If you want more control than what the ribbon menus can give you, jump into the property grid and start modifying every little property until you’re happy. No matter what you do, you’ll see the changes visually reflected on the design surface. This example uses one of the many Quick Sets to create a gauge: The next step is to data bind the Value property of the XamRadialGauge to a property in the ViewModel. You may be thinking you have to do this in XAML…but you don’t. Infragistics has provided an awesome data binding editor to use on any bindable property. Just find the property you want in the property grid, and click on the little square to the right of the property value. Next, click the “Create Data Binding” menu option. You’ll see a dialog appear you can use to create your binding exactly as you see fit. Set the binding path, mode, converter (yes, it will automatically find all your converters), and provide a string format. Once the dialog launches, notice it automatically finds the BindingContext (ViewModel) for you using a convention of [PageName]ViewModel. If the dialog guessed wrong (or couldn’t find it), you can set the BindingContext yourself by picking it from a list of available classes. Once you have configured the control exactly as you want it, hit the “Apply & Close” button. BAM! Check out all the XAML code that was automatically generated for you: Now, I know your brains are oozing out of your head right about now, but there is more. After you generate all your XAML, make a change to the background color or some other property (in this example, I’m changing the background to LightBlue), then select the XamRadialGauge and show the Control Configurator again. Yep, it not only allows you to generate XAML, but it will also read it in and the Control Configurator will show you exactly what your XAML does. Infragistics ships configurator for the following controls: For a more detailed look at using the Control Configurators, you can check out this video: The best part about all these new productivity tools is that they are hosted on the Visual Studio Marketplace. This means that Infragistics can (and will) be pushing updates on a continuous delivery schedule to keep your installed extensions automatically updated. You don’t have to do anything. Let Visual Studio manage all the updating for you. You just concentrate on writing apps and being productive. I don’t know about you, but I am really excited about all these new productivity tools for Xamarin.Forms development. Don’t get me wrong, the Infragistics Xamarin.Forms controls are just as awesome, but these new productivity tools are going to change the way you write Xamarin.Forms applications going forward. From File -> New to production, Infragistics has set the bar for Xamarin.Forms productivity. The best part is that you can try these out for yourself right now. Head on over to Infragistics and download a trial of Infragistics Ultimate UI for Xamarin today , and you’ll be able to design, lay out, and build cross-platform mobile apps using Xamarin.Forms in a matter of minutes…instead of hours. Brian Lagunas is a Microsoft MVP, a Xamarin MVP, a Microsoft Patterns & Practices Champion, and co-leader of the Boise .Net Developers User Group (NETDUG). Brian works at Infragistics as a Product Manager for all things XAML, which includes the award-winning WPF, Silverlight, Windows Phone, Windows Store, and Xamarin.Forms control suites.
https://www.infragistics.com/community/blogs/infragistics/archive/2017/05/03/write-fast-with-ultimate-ui-controls-for-xamarin.aspx
CC-MAIN-2017-39
refinedweb
2,172
63.19
ROX-Filer is in Debian/stable. To install: # apt-get install rox-filer You can get all the other ROX software using AddApp or ROX-All. Dennis Tomas writes that he has "put together a package "rox-desktop" containing nothing but some (IMHO) good defaults, 0install-wrappers for some core software and a login-script. [...] I've also made a menu-method for debian, which places app-wrappers for on-rox-apps in /usr/share/rox/Apps/Debian. It's all available from. You can also add it to your /etc/apt/sources.list: deb binary/ Then update APT's cache with: # apt-get update There is also a (separate and less active) ROX-in-Debian Project at. After installing, you might like to read the Getting Started Guide. Existing (non-ROX) applications are available from /usr/share/applications. You can install gtk themes w/ apt too. apt-cache search gtk-engines apt-cache search gtk2-engines Then just select a theme from the GTk theme switcher or by runing ROX-session>SessionSetting>Display I tried this in a chroot and found a few missing deps with the default login. Probably they should be added to the rox-desktop package: sh: line 1: xmodmap: command not found /usr/share/rox-desktop/Apps/Terminal/AppRun: line 3: exec: x-terminal-emulator: not found /home/fred/.cache/0install.net/implementations/sha1=9a3adb6a6f19591db2e2d21a7fcee4643d293403/Linux-ix86/OroboROX: error while loading shared libraries: libXpm.so.4: cannot open shared object file: No such file or directory /home/fred/.cache/0install.net/implementations/sha1=a90ceaa0905d8143813f9c74bdb488c2457829af/SystemTrayN/Linux-ix86/SystemTray: error while loading shared libraries: libglitz.so.1: cannot open shared object file: No such file or directory Seriously need more information here! I installed rox-filer using apt-get, it did not appear in the KDE menu. I guessed that $ rox-filer would be worth a try. After some error messages, it did lauch. I downloaded ROX-All.tgz but have very little idea what to do with it, I think there's just enough doc's to get me started. My login page (KDM) does not offer to choose a window manager, KDE is the only one installed so far. Is KDM smart enough to add that after I install rox-all? Does rox-all set that? If not, then what? Thanks, Lance This worked for me (Debian/unstable): $ cp /etc/dm/Sessions/rox.desktop /usr/share/xsessions/rox.desktop but there's no "rox.desktop" in etc/dm/Sessions. In fact, there is no "etc/dm/", and no mention of "rox.desktop" anywhere. Also, running the rox script brings up several errors: metalgear:/home/vicky/Download/ROX-All-0.6# ./rox Xlib: connection to ":0.0" refused by server Xlib: Invalid MIT-MAGIC-COOKIE-1 key Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/zeroinstall/0launch-gui/0launch-gui", line 5, in ? import gui File "/usr/lib/python2.3/site-packages/zeroinstall/0launch-gui/gui.py", line 1, in ? import gtk, os, gobject, sys File "/usr/lib/python2.3/site-packages/gtk-2.0/gtk/__init__.py", line 37, in ? from _gtk import * RuntimeError: could not open display Actually, it looks like the rox-desktop package contains a /usr/share/xsessions/rox-desktop.desktop file already, so I'm not sure why it doesn't work for you. What version of kdm are you using? I have: $ dpkg --status kdm Version: 4:3.5.2-2+b1 A mailing list post from 2004 suggests that this command used to work: $ kdesu kcmshell System/kdm Select Sessions, "Add new" and enter "ROX". However, it doesn't show a session tab for me.: Unable to fetch file, server said '/pub/rox4debian/dists/etch/main/binary-i386/Packages.gz: No such file or directory ' You need to use the correct settings, that is copy the above line exactly. That means that inside the rox4debian/ there's a folder binary/, but not the dists/etch/main/ you apparently are using in your sources list.
http://roscidus.com/desktop/node/86
crawl-002
refinedweb
670
60.21
Let σ(n) be the sum of the positive divisors of n and let gcd(a, b) be the greatest common divisor of a and b. Form an n by n matrix M whose (i, j) entry is σ(gcd(i, j)). Then the determinant of M is n!. The following code shows that the theorem is true for a few values of n and shows how to do some common number theory calculations in SymPy. from sympy import gcd, divisors, Matrix, factorial def f(i, j): return sum( divisors( gcd(i, j) ) ) def test(n): r = range(1, n+1) M = Matrix( [ [f(i, j) for j in r] for i in r] ) return M.det() - factorial(n) for n in range(1, 11): print test(n) As expected, the test function returns zeros. If we replace the function σ above by τ where τ(n) is the number of positive divisors of n, the corresponding determinant is 1. To test this, replace sum by len in the definition of f and replace factorial(n) by 1. In case you’re curious, both results are special cases of the following more general theorem. I don’t know whose theorem it is. I found it here. For any arithmetic function f(m), let g(m) be defined for all positive integers m by Let M be the square matrix of order n with ij element f(gcd(i, j)). Then Here μ is the Möbius function. The two special cases above correspond to g(m) = m and g(m) = 1.
http://www.johndcook.com/blog/tag/sympy/
CC-MAIN-2014-41
refinedweb
260
71.24
# Dozen tricks with Linux shell which could save your time [![](https://habrastorage.org/r/w1560/webt/fs/43/05/fs4305wjukd5umg71ochqeqxxek.png)](https://habrahabr.ru/post/444890/) * *First of all, you can read this article in russian [here](https://habr.com/ru/post/340544/).* One evening, I was reading [Mastering regular expressions by Jeffrey Friedl](https://scanlibs.com/regulyarnyie-vyirazheniya-3-e-izdanie/) , I realized that even if you have all the documentation and a lot of experience, there could be a lot of tricks developed by different people and imprisoned for themselves. All people are different. And techniques that are obvious for certain people may not be obvious to others and look like some kind of weird magic to third person. By the way, I already described several such moments [here (in russian)](https://habrahabr.ru/post/339246/) . For the administrator or the user the command line is not only a tool that can do everything, but also a highly customized tool that could be develops forever. Recently there was a translated article about some useful tricks in CLI. But I feel that the translator do not have enough experience with CLI and didn't follow the tricks described, so many important things could be missed or misunderstood. Under the cut — a dozen tricks in Linux shell from my personal experience. Note: All scripts and examples in the article was specially simplified as much as possible — so maybe you can find several of tricks looks completely useless — perhaps this is the reason. But in any case, share your minds in the comments! #### 1. Split string with variable expansions People often use **cut** or even **awk** just to substract a part of string by pattern or with separators. Also, many people uses substring bash operation using ${VARIABLE:start\_position:length}, that works very fast. But bash provides a powerful way to manipulate with text strings using #, ##,% and %% — it called *bash variable expansions*. Using this syntax, you can cut the needful by the pattern without executing external commands, so it will work really fast. The example below shows how get the third column (shell) from the string where values separated by colon «username:homedir:shell» using **cut** or using variable expansions (we use the \*: mask and the ## command, which means: cut all characters to the left until the last colon found): ``` $ STRING="username:homedir:shell" $ echo "$STRING"|cut -d ":" -f 3 shell $ echo "${STRING##*:}" shell ``` The second option does not start child process (**cut**), and does not use pipes at all, which should work much faster. And if you are using bash subsystem on windows, where the pipes barely move, the speed difference will be significant. Let's see an example on Ubuntu — execute our command in a loop for 1000 times ``` $ cat test.sh #!/usr/bin/env bash STRING="Name:Date:Shell" echo "using cut" time for A in {1..1000} do cut -d ":" -f 3 > /dev/null <<<"$STRING" done echo "using ##" time for A in {1..1000} do echo "${STRING##*:}" > /dev/null done ``` **Results** ``` $ ./test.sh using cut real 0m0.950s user 0m0.012s sys 0m0.232s using ## real 0m0.011s user 0m0.008s sys 0m0.004s ``` The difference is several dozen times! Of course, the example above is too artificial. In real example we will not work with a static string, we want to read a real file. And for '**cut**' command, we just redirect /etc/passwd to it. In the case of ##, we have to create a loop and read file using internal '**read**' command. So who will win this case? ``` $ cat test.sh #!/usr/bin/env bash echo "using cut" time for count in {1..1000} do cut -d ":" -f 7 /dev/null done echo "using ##" time for count in {1..1000} do while read do echo "${REPLY##*:}" > /dev/null done ``` **Result** ``` $ ./test.sh $ ./test.sh using cut real 0m0.827s user 0m0.004s sys 0m0.208s using ## real 0m0.613s user 0m0.436s sys 0m0.172s ``` No comments =) A couple more examples: Extract the value after equal character: ``` $ VAR="myClassName = helloClass" $ echo ${VAR##*= } helloClass ``` Extract text in round brackets: ``` $ VAR="Hello my friend (enemy)" $ TEMP="${VAR##*\(}" $ echo "${TEMP%\)}" enemy ``` #### 2. Bash autocompletion with tab bash-completion package is a part of almost every Linux distributive. You can enable it in /etc/bash.bashrc or /etc/profile.d/bash\_completion.sh, but usually it is already enabled by default. In general, autocomplete is one of the first convenient moments on Linux shell that a newcomer first of all meets. But the fact that not everyone uses all of the bash-completion features, and in my opinion is completely in vain. For example not everybody knows, that autocomplete works not only with file names, but also with aliases, variable names, function names and for some commands even with arguments. If you dig into autocomplete scripts, which are actually shell scripts, you can even [add autocomplete](https://habrahabr.ru/post/115886/) for your own application or script. But let’s come back to the aliases. You don't need to edit PATH variable or create files in specified directory to run alias. You just need to add them to profile or startup script and execute them from any place. Usually we are using lowercase letters for files and directories in \*nix, so it could be very comfortable to create uppercase aliases — in that case bash-completion will ~~guess~~ your command almost with a single letter: ``` $ alias TAsteriskLog="tail -f /var/log/asteriks.log" $ alias TMailLog="tail -f /var/log/mail.log" $ TA[tab]steriksLog $ TM[tab]ailLog ``` #### 3. Bash autocompletion with tab — part 2 For more complicated cases, probably you would like to put your personal scripts to $HOME/bin. But we have functions in bash. Functions don't require path or separate files. And (attention) bash-completion works with functions too. Let’s create function LastLogin in **.profile** (don't forget to reload .profile): ``` function LastLogin { STRING=$(last | head -n 1 | tr -s " " " ") USER=$(echo "$STRING"|cut -d " " -f 1) IP=$(echo "$STRING"|cut -d " " -f 3) SHELL=$( grep "$USER" /etc/passwd | cut -d ":" -f 7) echo "User: $USER, IP: $IP, SHELL=$SHELL" } ``` *(Actually there is no important what this function is doing, it is just an example script which we can put to the separate script or even to the alias, but function could be better)*. In console (please note that function name have an uppercase first letter to speedup bash-completion): ``` $ L[tab]astLogin User: saboteur, IP: 10.0.2.2, SHELL=/bin/bash ``` #### 4.1. Sensitive data If you put space before any command in console, it will not appears in the command history, so if you need to put plain text password in the command, it is a good way to use this feature — look into example below, *echo «hello 2»* will not appears in history: ``` $ echo "hello" hello $ history 2 2011 echo "hello" 2012 history 2 $ echo "my password secretmegakey" # there are two spaces before 'echo' my password secretmegakey $ history 2 2011 echo "hello" 2012 history 2 ``` **It is optional**It is usually enabled by default, but you can configure this behavior in the following variable: export HISTCONTROL=ignoreboth #### 4.2. Sensitive data in command line arguments You want to store some shell scripts in git to share them across servers, or may be it is a part of application startup script. And you want this script will connect to database or do anything else which requires credentials. Of course it is bad idea to store credentials in the script itself, because git is not secure. Usually you can use variables, which was already defined on the target environments, and your script will not contain the passwords itself. For example, you can create small script on each environments with 700 permissions and call it using **source** command from the main script: ``` secret.sh PASSWORD=LOVESEXGOD ``` ``` myapp.sh source ~/secret.sh sqlplus -l user/"$PASSWORD"@database:port/sid @mysqfile.sql ``` But it is not secure. If somebody else can login to your host, he can just execute **ps** command and see your sqlplus process with the whole command line arguments including passwords. So, secure tools usually should be able to read passwords/keys/sensitive data directly from files. For example — secure **ssh** just even have no options to provide password in command line. But he can read ssh key from the file (and you can set secure permissions on ssh key file). And non-secure wget have an option "--password" which allows you to provide password in command line. And all the time wget will be running, everybody can execute ps command and see password you have provided. In additional, if you have a lot of sensitive data, and you want to control it from git, the only way is encryption. So you put to every target environment only master password, and all other data you can encrypt and put to git. And you can work with encrypted data from command line, using openssl CLI interface. Here is an example to encrypt and decrypt from command line: File secret.key contains master key — a single line: ``` $ echo "secretpassword" > secret.key; chmod 600 secret.key ``` Lets use aes-256-cbc to encrypt a string: ``` $ echo "string_to_encrypt" | openssl enc -pass file:secret.key -e -aes-256-cbc -a U2FsdGVkX194R0GmFKCL/krYCugS655yLhf8aQyKNcUnBs30AE5lHN5MXPjjSFML ``` You can put this encrypted string to any configuration file stored in git, or any other place — without secret.key it is almost impossible to decrypt it. To decrypt execute the same command just replace -e with -d: ``` $ echo 'U2FsdGVkX194R0GmFKCL/krYCugS655yLhf8aQyKNcUnBs30AE5lHN5MXPjjSFML' | openssl enc -pass file:secret.key -d -aes-256-cbc -a string_to_encrypt ``` #### 5. The grep command All should knows grep command. And be friendly with regular expressions. And often you can write something like: ``` tail -f application.log | grep -i error ``` Or even like this: ``` tail -f application.log | grep -i -P "(error|warning|failure)" ``` But don't forget that grep have a lot of wonderful options. For example -v, that reverts your search and shows all except «info» messages: ``` tail -f application.log | grep -v -i "info" ``` Additional stuff: Option -P is very useful, because by default grep uses pretty outdated «basic regular expression:», and -P enables PCRE which even doesn't know about grouping. -i ignores case. --line-buffered parses line immediately instead of waiting to reach standard 4k buffer (useful for tail -f | grep). If you know regular expression well, with --only-matching/-o you can really do a great things with cutting text. Just compare next two commands to extract myuser's shell: ``` $ grep myuser /etc/passwd| cut -d ":" -f 7 $ grep -Po "^myuser(:.*){5}:\K.*" /etc/passwd ``` The second command looks more compilcated, but it runs only **grep** instead of **grep** and **cut**, so it will take less time for execution. #### 6. How to reduce log file size In \*nix, if you delete the log file, that is currently used by an application, you can not just remove all logs, you can prevent application to write new logs until restart. Because file descriptor opens not the file name, but iNode structure, and the application will continue to write to file descriptor to the file, which have no directory entry, and such file will be deleted automatically after application stop by file system(*your application can open and close log file every time when it want to write something to avoid such issue, but it affects performance*). So, how to clear log file without deleting it: ``` echo "" > application.log ``` Or we can use truncate command: ``` truncate --size=1M application.log ``` Mention, that **truncate** command will delete the rest of the file, so you will lost the latest log events. Check another example how to store last 1000 lines: ``` echo "$(tail -n 1000 application.log)" > application.log ``` *P.S. In Linux we have standard service rotatelog. You can add your logs to automated truncate/rotate or use existing log libraries which can do that for you (like log4j in java).* #### 7. **Watch** is watching for you! There is a situation when you are waiting for some event being finished. For example, while another user logins to shell (you continuously execute **who** command), or someone should copy file to your machine using scp or ftp and you are waiting for the completion (repeating ls dozens of times). In such cases, you can use ``` watch ``` By default, will be executed every 2 seconds with pre-clear of screen until Ctrl+C pressed. You can configure how often should be executed. It is very useful when you want to watch live logs. #### 8. Bash sequence There is very useful construct to create ranges. For example instead of something like this: ``` for srv in 1 2 3 4 5; do echo "server${srv}";done server1 server2 server3 server4 server5 ``` You can write the following: ``` for srv in server{1..5}; do echo "$srv";done server1 server2 server3 server4 server5 ``` Also you can use **seq** command to generate formatted ranges. For example we can use **seq** to create values whitch will be automatically adjusted by width (00, 01 instead of 0, 1): ``` for srv in $(seq -w 5 10); do echo "server${srv}";done server05 server06 server07 server08 server09 server10 ``` Another example with command substitution — rename files. To get filename without extension we are using '**basename**' command: ``` for file in *.txt; do name=$(basename "$file" .txt);mv $name{.txt,.lst}; done ``` Also even more short with '%': ``` for file in *.txt; do mv ${file%.txt}{.txt,.lst}; done ``` P.S. Actually for renaming the files you can try '**rename**' tool which has a lot of options. Another example — lets create structure for new java project: ``` mkdir -p project/src/{main,test}/{java,resources} ``` **Result** ``` project/ !--- src/ |--- main/ | |-- java/ | !-- resources/ !--- test/ |-- java/ !-- resources/ ``` #### 9. tail, multiple files, multiple users... I have mentioned **multitail** to read files and watching multiple live logs. But it doesn't provided by default, and permissions to install something not always available. But standard tail can do it too: ``` tail -f /var/logs/*.log ``` Also lets remember about users, which are using 'tail -f' aliases to watch application logs. Several users can watch log files simultaneously using 'tail -f'. Some of them are not very accurate with their sessions. They could leave 'tail -f' in background for some reason and forget about it. If the application was restarted, there are these running 'tail -f' processes which are watching inexistent log file can hang for several days or even months. Usually it is not a big problem, but not neatly. In case, if you are using alias to watch the log, you can modify this alias with --pid option: ``` alias TFapplog='tail -f --pid=$(cat /opt/app/tmp/app.pid) /opt/app/logs/app.log' ``` In that case, all **tails** will be automatically terminated when the target application will be restarted. #### 10. Create file with specified size **dd** was one of the most popular tool to work with block and binary data. For example create 1 MB file filled with zero will be: ``` dd if=/dev/zero of=out.txt bs=1M count=10 ``` But I recommend use **fallocate**: ``` fallocate -l 10M file.txt ``` On file systems, which support allocate function (xfs, ext4, Btrfs...), **fallocate** will be executed instantly, unlike the dd tool. In additional, allocate means real allocation of blocks, not creation a spare file. #### 11. xargs Many people know popular **xargs** command. But not all of them use two following options, which could greatly, improve your script. First — you can get very long list of arguments to process, and it could exceed command line length (by default ~4 kb). But you can limit execution using -n option, so **xargs** will run command several times, sending specified number of arguments at a time: ``` $ # lets print 5 arguments and send them to echo with xargs: $ echo 1 2 3 4 5 | xargs echo 1 2 3 4 5 $ # now let’s repeat, but limit argument processing by 3 per execution $ echo 1 2 3 4 5 | xargs -n 3 echo 1 2 3 4 5 ``` Going ahead. Processing long list could take a lot of time, because it runs in a single thread. But if we have several cores, we can tell **xargs** to run in parallel: ``` echo 1 2 3 4 5 6 7 8 9 10| xargs -n 2 -P 3 echo ``` In the example above, we tell **xargs** to process list in 3 threads; each thread will take and process 2 arguments per execution. If you don't know how many cores you have, lets optimize this using "**nproc**": ``` echo 1 2 3 4 5 6 7 8 9 10 | xargs -n 2 -P $(nproc) echo ``` #### 12. sleep? while? read! Some time you need to wait for several seconds. Or wait for user input with read: ``` read -p "Press any key to continue " -n 1 ``` But you can just add timeout option to **read** command, and your script will be paused for specified amount of seconds, but in case of interactive execution, user can easily skip waiting. ``` read -p "Press any key to continue (auto continue in 30 seconds) " -t 30 -n 1 ``` So you can just forget about sleep command. I suspect that not all my tricks looks interesting, but it seemed to me that a dozen are a good number to fill out. At this I say goodbye, and I will be grateful for participating in the survey. Of course feel free to discuss the above and share your cool tricks in the comments!
https://habr.com/ru/post/444890/
null
null
2,923
63.39
Following on from the last post where we added a range operation to Java, we will add a simple iterator that allows you to read a file line by line the same way you would do in Python. import java.io.*; import java.util.Iterator; public class ReadFile implements Iterable<String>, Iterator<String> { private File file; private BufferedReader bufferedReader; private String line; public ReadFile(String filename) { this(new File(filename)); } public ReadFile(File file) { this.file = file; try { bufferedReader = null; bufferedReader = new BufferedReader(new FileReader(file)); } catch (FileNotFoundException e) { } } @Override public Iterator<String> iterator() { return this; } @Override public boolean hasNext() { if (bufferedReader != null) { try { line = bufferedReader.readLine(); if (line == null) bufferedReader.close(); } catch (IOException e) { line = null; } } return line != null; } @Override public String next() { return line; } } public static void main(String[] args) { for (String line : new ReadFile(“test.txt”)) { System.out.println(line); } } You can either pass a file name or a file handle, if you pass a file name then the file is opened. To make it so that we can use it in a loop, it needs to implement an iterator and also be iterable. The file is automatically closed after the iterator is completed, and no exceptions are thrown so you don’t need to add exception handlers to your code. You could extend this to allow you to read a csv file, and to automatically split the line on commas, deal with quoted string fields etc. If there are other language features you’d like to see implemented contact us, and make a suggestion, or if you are willing to pay then we can write code specifically for you to implement the code you desire. We have provided Java assignment help to thousands of students solutions in Java and many more in other programming languages. It is always better to send in your requests with plenty of time, as that gives you time to review the solution we provide and also that it allows us time to find an expert to fulfill your request (we can get busy especially near the end of term when multiple large projects may due at the same time). It is also worth sending course notes if they are available as we can ensure the solution provided matches the style and knowledge levels that are expected. At programmingassignmentexperts.com if you want someone to provide Java homework help, just visit our site and submit an assignment for a quote.
https://www.programmingassignmentexperts.com/blog/how-to-add-pythons-file-handler-to-java/
CC-MAIN-2019-26
refinedweb
408
55.58
Tutorials > Win32 > Creating Windows The basis of windows programming deals with windows not surprisingly. This tutorial will explain how to create windows to house your windows controls or graphical displays. There is quite a lot of code involved with creating a window but we'll try to go through it slowly and carefully. Contents of main.cpp : #include <windows.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { Every window must belong to a window class. The name of the class is specified as a normal string. Below, we give the name of the class we are going to use "ClassName". LPCTSTR className = "ClassName"; Next we have to create the windows class. This is done by filling a WNDCLASSEX structure. All properties need to be set. Each property will be explained separately below. WNDCLASSEX wc; UINT cbSize - This specifies the size of the structure and should always be set to sizeof(WNDCLASSEX). wc.cbSize = sizeof(WNDCLASSEX); UINT style - This is used to specify various properties of the windows class. These are known as Class Styles and each flag begins with a CS_. The most common styles are given below : Below, we only want to make sure the window is redrawn if moved or resized. wc.style = CS_HREDRAW | CS_VREDRAW; WNDPROC lpfnWndProc - This is a function pointer to the windows messaging function. It should point to the function that will be used to process windows messages sent to the window. We assign this to DefWindowProc. The DefWindowProc function is used to process any messages not explicitly processed by the application. In this tutorial we are not processing any messages, so we pass everything onto the DefWindowProc function. wc.lpfnWndProc = DefWindowProc; int cbClsExtra - This specifies the number of extra bytes to allocate after the WNDCLASSEX structure. We only need to allocate extra memory if we are storing the WNDCLASSEX information in some other structure. We can therefore set this to 0. wc.cbClsExtra = 0; int cbWndExtra - This specifies the number of extra bytes to allocate following the window instance. This we can also set to 0. wc.cbWndExtra = 0; HINSTANCE hInstance - This must be given the handle to the instance of your current application. We have this handle but if you didn't, you could use the GetModuleHandle function. This function takes 1 parameter which is used to specify the module name. If you pass it NULL it will return the current application's instance. wc.hInstance = hInstance; HICON hIcon - An HICON is a handle to an icon. This property is used to specify the icon that will appear in the top left of the window ie. in the title bar on the left. An icon can be loaded by using the LoadIcon function. This function takes 2 parameters. The first parameter takes the instance of the application ie. hInstance. The second parameter takes the name of the resource to be loaded. This would be the case if an icon was loaded in what is called a resource script. If you do not have your own icon you can load a predefined icon. This is done by passing NULL as the first parameter and specifying the ID for the icon. The most common of these ID's is given below : The code below will simply load the windows logo as the main icon. wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); HCURSOR hCursor - An HCURSOR is a handle to a cursor. This specifies the cursor that will be displayed when your mouse is within the window. The LoadCursor function can be used to load the appropriate cursror. The parameters for LoadCursor work in the exact same way as LoadIcon. The most commonly used predefined cursors are given below : We load the standard arrow below. wc.hCursor = LoadCursor(NULL, IDC_ARROW); HBRUSH hbrBackground - An HBRUSH is a handle to a brush. This is used to specify the background color of your window. A number of colors are available by using COLOR_*. These are the standard windows colors ie. COLOR_WINDOW, COLOR_SCROLLBAR, COLOR_MENU, COLOR_WINDOWTEXT, etc. An alternative to this method is to use the GetStockObject function. This retrieves the handle to a brush specified by you. This function takes a parameter which specifies the color of the brush eg. BLACK_BRUSH, GRAY_BRUSH, WHITE_BRUSH, DKGRAY_BRUSH, etc. Below, the COLOR_WINDOW + 1 specifies a white background. wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); LPCTSTR lpszMenuName - This specifies the name of the menu attached to the window. We do not have a menu and we therefore give it the value of NULL. wc.lpszMenuName = NULL; LPCTSTR lpszClassName - This specifies the name given to the class. We simply use the string we created at the beginning of the program. wc.lpszClassName = className; HICON hIconSm - This is used to specify the small icon for the program ie. the icon that is displayed in your taskbar. This works in the exact same way as the hIcon above. wc.hIconSm = LoadIcon(NULL, IDI_WINLOGO); Next we need to register the class. This is necessary to be able to create windows using this class. To register a class, the RegisterClassEx function is used. This function takes one parameter, being the WNDCLASSEX structure that was previously filled. The return value is 0 if there was any error. An UnregisterClass method is also available to unregister a class. This is not needed though as all classes are unregistered when the application terminates. if (!RegisterClassEx(&wc)) { MessageBox(NULL, "Error registering class", "Error", MB_OK | MB_ICONERROR); return 1; } The next function that will take a lot of explaining is the CreateWindowEx function. This creates a window using a previously registered class. If successful, a handle to a window (HWND) is returned. If any error occurred, 0 is returned. Each parameter will be explained separately. HWND hwnd = CreateWindowEx( DWORD dwExStyle - A DWORD is a 32-bit unsigned integer. This parameter specifies an extended style given to the window. These flags start with a WS_EX_* and can be separated using | (or) operators. Some common flags are given below : We do not want any of these extended styles, so we leave the parameter as 0. 0, LPCTSTR lpClassName - This is the name of the class that this window will belong to. We therefore pass it the class' name that was previously registered. className, LPCTSTR lpWindowName - This specifies the text that will appear in the title bar of the window. "05 - Creating Windows", DWORD dwStyle - This parameter specifies what style the window should use. This is different to the extended styles. There is an old function CreateWindow. The CreateWindowEX function was created to allow the extended styles to be added. The most commonly used flags are given below : We only need the WS_OVERLAPPEDWINDOW in this tutorial. WS_OVERLAPPEDWINDOW, int x & int y - These parameters specify the starting x and y positions of the window where (0,0) is the top left corner of the screen. You can use the system's defaults by using CW_USEDEFAULT. CW_USEDEFAULT, CW_USEDEFAULT, int nWidth & int nHeight - These parameters specify the width and height of the window in pixels. 300, 300, HWND hwndParent - This specifies the handle to the parent of the window. As we have no parent, NULL is passed. NULL, HMENU hMenu - An HMENU is a handle to a menu. This indicates the menu that is attached to the window. Because we do not have a menu, NULL is passed. HINSTANCE hInstance - This parameter is used to specify the instance of the current program. hInstance, LPVOID lpParam - This is not used unless we are creating an MDI client window. We therefore pass it the value of NULL. NULL ); if (!hwnd) { MessageBox(NULL, "Error creating window", "Error", MB_OK | MB_ICONERROR); return 1; } Because we didn't give the window a WS_VISIBLE style, we need to explicitly show the window. This can be done using the ShowWindow function. The function takes 2 parameters. The first is the handle to the window that you want to show and the second is how you want the window shown. As this is passed onto the program at startup, you can use the nShowCmd variable. If you want to specify your own action, you can use one of the commonly used flags below : ShowWindow(hwnd, nShowCmd); return 0; } Well done. This has been a very long tutorial. Hopefully you have found that it has been covered in great detail. You'll notice that when you run the program, the window quickly flashes up and then disappears. This is because we are not processing any messages for the window. This will be dealt with in the next tutorial. Please let me know of any comments you may have : Contact Me Back to Top Read the Disclaimer
http://www.zeuscmd.com/tutorials/win32/05-CreatingWindows.php
crawl-001
refinedweb
1,434
67.04
Java Specification Request (JSR) 286 introduced event-based coordination for portlets. JSR 286 allows portlets to send and receive events. Some portlets can define events to be published, and other portlets define which ones can receive such events. IBM® Rational® Application Developer provides the tools to create such events for portlets. In this part you will see how to enable event handling, for portlets in Rational Application Developer. These event-enabled portlets are wired together at run time to create a connection between the portlets. This tutorial, which is Part 4 of a five-part series, concentrates on enabling events for existing portlets, creation of new event-enabled portlets, and wiring together two event-enabled portlets so they can share data. - The first portlet, the Deals portlet, acts as an event publisher portlet i.e. it will emit an event to transfer data. - The second portlet, the ContactInformation portlet, acts as an Event Subscriber portlet, which receive an event and invoke a method that processes the exchanged data. This is the flow of events: - The Deals portlet publishes an event to pass the Contact Name to the ContactInformation portlet. - The ContactInformation portlet receives an event to invoke a method that processes the data, for example, the Contact Name. - Based on the Contact Name, an appropriate SDO method is invoked to fetch information from the CONTACT_PERSON DB2 table. Create a new portlet To enable eventing (event handling) between two portlets, the first step is to create a new portlet: - Right-click on the DealsProject and select New > Portlet. - Enter ContactInformationas the portlet name. - Also, make sure that the portlet type is set to Faces Portlet. (See Figure 1.) Figure 1. New Portlet creation page - Click Next, and make sure that the Generate a custom portlet class option is checked, as Figure 2 shows. Figure 2. Option to generate a custom portlet class - Click Finish. This will create a JSP called ContactInformationView.jsp and a portlet class named ContactInformationPortlet.java. Now that you have two portlets in place, you can enable them for \event handling (called eventing in the JSR). Enable the source portlet to publish an event To enable the Deals portlet to publish an event, follow these steps: - Open the DealsView.jsp file. - In the palette view, locate Event Source Trigger in the Portlet drawer. - Click Event Source Trigger and drag it onto the Name expression in the Contact Name column, as shown in Figure 3. Figure 3. Drag the event source trigger in the JSP This invokes the Insert Event Source Trigger dialog window shown in Figure 4. Figure 4. Insert Event Source Trigger dialog window - Click the New Event button to create a new event to publish. - In the "Event – Enable this portlet to Publish events" dialog window that opens, for Event Name, enter ContactId, as shown in Figure 5. Figure 5. Event creation dialog window - Click Finish to populate the Insert Event Source Trigger window shown in Figure 6. Figure 6. Event Source Trigger dialog - Type #{vardealsInformationList.CONTACT_ID}in the Value to Send field. - Click Finish. The NAME field will be hyperlinked, as shown in Figure 7. Figure 7. Hyperlinked column Also notice how the Deals portlet node is decorated with a Publish event icon (blue arrow preceded by a yellow flag) in the Enterprise Explorer view. The event name is listed below it as shown in Figure 8. Figure 8. Event decorated node - Save the file. Now you will need to create a JavaServer Faces Managed Bean to hold the data being exchanged between portlets through eventing. - Right-click the Java Resources node, and select New > Class, as shown in Figure 9. Figure 9. Creating a new class - Specify the Package as com.ibmand Name as ContactBean, as shown in Figure 10. - Click Finish. Figure 10. Specify class name - When the ContactBean.java file has been created and opens in the editor, replace its contents with the code in Listing 1. Listing 1. Replace contents of ContactBean.java file with this code package com.ibm; public class ContactBean { long id; String picURL; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getPicURL() { return picURL; } public void setPicURL(String picURL) { this.picURL = picURL; } } - Open the DealsView.jsp file. - 15.In the Page Data View, right-click on Faces Managed Bean and choose New > Faces Managed Bean as shown in Figure 11. Figure 11. Creating a Faces managed bean - Specify Name as contactbean, Class as com.ibm.ContactBean, and for Scope, select Session from the context menu, as shown in Figure 12. Figure 12. Specifying Faces Managed Bean properties - Click Finish. Create an SDO Relational Record Enabling the ContactInformation portlet for eventing is a two-step process. First, you need to create an SDO Relational Record using the DB2 table CONTACT_PERSON, and then you need to enable ContactInformation to receive an event. Note: Creation of a Services Data Object (SDO) has nothing to do with event enabling. You are creating an SDO because of the requirements of your use case. To create a SDO Relational Record, follow these steps: - Open ContactInformationView.jsp in the Page Designer, and open the Page Data view. - Right-click on SDO Relational Records, and choose New > SDO Relational Record. Figure 13. SDO Relational Record creation - In the Add Relational Record dialog window, provide contactInformationas the name, and click Next. Figure 14. Add Relational Record dialog window - For table, choose the CONTACT_PERSON table under the ADMINISTRATOR schema, and click Next (see Figure 15). Figure 15. Choose the table - Choose all the columns, as shown Figure 16, and click Finish. Figure 16. Select all of the columns As Figure 17 shows, a new Relational Record is created under the SDO Relational Records node in the Page Data view. Figure 17. SDO record in the Page Data view Generate JSP code Now that you have created the SDO Relational Record, you need to drag the Relational Record to the portlet JSP to be able to use data from the CONTACT_PERSON table: - Drag the contactInformation (CONTACT_PERSON) node to the portlet JSP (ContactInformationView.jsp) to invoke the Insert Record dialog window shown in Figure 18. Figure 18. Insert Record dialog window - Uncheck the column CONTACT_ID and click Finish. Notice that the code is generated in the portlet JSP. Enable the target portlet to receive the event information Now that you have created and generated the code to use data from the CONTACT_PERSON table, you need to put together a final piece: passing a contact ID to the ContactInformation portlet. This contact ID will be used to fetch a record of a particular person from the CONTACT_PERSON table to display the relevant information in the ContactInformation portlet. Recall that the Deals portlet publishes an event by the name of ContactId to pass the contact ID. Now you need to enable the ContactInformation portlet so that it subscribes to that event. - Locate the ContactInformation portlet under Portlet Deployment Descriptor in the Enterprise Explorer. - Right-click on the portlet, and select Event > Enable this Portlet to Process Event (see Figure 19). Figure 19. Enable the portlet to process events This invokes the "Events – Enable this Portlet to Process events" dialog window. - Select ContactId from the Event Name drop-down menu, as shown in Figure 20. Figure 20. Enable this Portlet to Process events dialog - Click Finish. Notice that the ContactId event node under the ContactInformation portlet node is decorated with a Subscribe event icon (yellow flag preceded by green arrow), as shown in Figure 21. Figure 21. Decorated event node The previous action also generates a processEvent method in the ContactInformationPortlet.java, the portlet class for the ContactInformation portlet. Listing 2 shows the generated code. Listing 2. The generated(); } facesContext.release(); } The processEvent method is invoked for each event targeted to the portlet, with an EventRequest and EventResponse object. Listing 3 modifies the code in Listing 2 to add the business logic to the processEvent method. Listing 3. Custom code added inside(); Application app = facesContext.getApplication(); ValueBinding binding = app.createValueBinding("# {contactbean}"); ContactBean mybean =(ContactBean) binding.getValue (facesContext); mybean.setId(Long.parseLong(sampleProcessObject.toString())); } In this listing, the code simply gets an instance of Faces managed bean, ContactBean, that you created earlier. This instance contains the contact ID that is transferred by the Deals portlet through eventing. The instance of the ContactBean, itself, is stored in a session variable so that it can be reused across the portlets, spanning different requests. Wire the portlets together To exchange data on invocation of events, you need to wire the portlets together so that they can exchange data. - Perform the Run on Server operation on the project as you did earlier. Figure 22 shows how the rendered portlets look in the browser. Figure 22. Two portlets rendered in browser - Now, to wire the portlets together, click the Edit Page option from the Actions menu, as shown in Figure 23. Figure 23. Edit Page option Note: This Edit Page option is present only when the theme is the PageBuilder one that is included with IBM® WebSphere® Portal, Version 7.0. For any custom themes, you can wire together the portlets by using the portal administration console wiring tool. - Right-click on the small arrow symbol for the drop-down menu (shown in Figure 24) at the top-left of the Deals portlet window, and choose the Edit Wiring menu item. Figure 24. Icon to choose the Edit Wiring option Figure 25. Edit Wiring option - Choosing the Edit Wiring menu item brings up the Wiring interface shown in Figure 26. The interface shows the available events that can be wired together. In this interface, you will find the events that you created earlier. - In the Wiring interface, choose the {}/ContactIdpublisher event under the Deals icon that appears under the Select content to send heading. - Choose the {}/ContactIdsubscriber event under the ContactInformation icon that appears under the Select a widget to receive content heading - Click Done. Figure 26. Wiring Interface - Click the Save & Exit button. - Now click on the individual Contact Names in the Deals portlet, and you will see the relevant information displayed in the Contact Information portlet (Figure 27). Figure 27. Event-enabled portlets sharing data Next in this series This concludes Part 4 of this five-part series. Part 5 shows how to create portlets that can fetch data from IBM® Connections. Download Resources Learn - For details, read Coordination between portlets in the JSR286 Java Portlet specification. - Find out more about Rational Application Developer: - Browse the Rational Application Developer for WebSphere Software page on developerWorks for links to technical articles and many related resources. - Explore the Information Center for detailed instructions, especially the section titled "Creating portlets and portlet projects" (Developing > Developing portal and portlet applications > Portlet development overview > Developing portlets) -.
http://www.ibm.com/developerworks/rational/library/create-multichannel-composite-portlet-application-4/index.html
CC-MAIN-2014-41
refinedweb
1,792
55.13
Welcome back to the Writing unit tests for Svelte series! Thanks for sticking with me! ❤️ In this part we’ll test an asynchronous onMount callback. It’s going to be a super short one! As ever, you can refer to the GitHub repository for all of the code samples. dirv / svelte-testing-demo A demo repository for Svelte testing techniques Important: What we’re about to do is something I don’t recommend doing in your production code. In the interests of simple testing, you should move all business logic out of components. In the next part we’ll look at a better way of achieving the same result. Checking that a callback was called Let’s started by defining the component. This is src/CallbackComponent.svelte: <script> import { onMount } from "svelte"; let price = ''; onMount(async () => { const response = await window.fetch("/price", { method: "GET" }); if (response.ok) { const data = await response.json(); price = data.price; } }); </script> <p>The price is: ${price}</p> To test this, we’re going to stub out window.fetch. Jasmine has in-built spy functionality—the spyOn function—which is essentially the same as Jest’s spyOn function. If you’re using Mocha I suggest using the sinon library (which, by the way, has really fantastic documentation on test doubles in general). When I mock out the fetch API I always like to use this helper function: const fetchOkResponse = data => Promise.resolve({ ok: true, json: () => Promise.resolve(data) }); You can define a fetchErrorResponse function in the same way, although I’m going to skip that for this post. You can use this to set up a stub for a call to window.fetch like this: spyOn(window, "fetch") .and.returnValue(fetchOkResponse({ /* ... your data here ... */})); Once that’s in place, you’re safe to write a unit test that doesn’t make a real network request. Instead it just returns the stubbed value. Let’s put that together and look at the first test in spec/CallbackComponent.spec.js. import { mount, asSvelteComponent } from "./support/svelte.js"; import CallbackComponent from "../src/CallbackComponent.svelte"; const fetchOkResponse = data => Promise.resolve({ ok: true, json: () => Promise.resolve(data) }); describe(CallbackComponent.name, () => { asSvelteComponent(); beforeEach(() => { global.window = {}; global.window.fetch = () => ({}); spyOn(window, "fetch") .and.returnValue(fetchOkResponse({ price: 99.99 })); }); it("makes a GET request to /price", () => { mount(CallbackComponent); expect(window.fetch).toHaveBeenCalledWith("/price", { method: "GET" }); }); }); Beyond the set up of the spy, there are a couple more important points to take in: - I’ve set values of global.windowand global.window.fetchbefore I call spyOn. That’s because spyOnwill complain if the function you’re trying to spy on doesn’t already exist. window.fetchdoes not exist in the Node environment so we need to add it. Another approach is to use a fetchpolyfill. - I do not need to use await any promise here. That’s because we don’t care about the result of the call in this test--we only care about the invocation itself. For the second test, we will need to wait for the promise to complete. Thankfully, Svelte provides a tick function we can use for that: import { tick } from "svelte"; it("sets the price when API returned", async () => { mount(CallbackComponent); await tick(); await tick(); expect(container.textContent).toContain("The price is: $99.99"); }); Complex unit tests are telling you something: improve your design! A problem with this code is that is mixing promise resolution with the rendering of the UI. Although I’ve made these two tests look fairly trivial, in reality there are two ideas in tension: the retrieval of data via a network and the DOM rendering. I much prefer to split all ”business logic” out of my UI components and put it somewhere else. It’s even questionable if the trigger for pulling data should be the component mounting. Isn’t your application’s workflow driven by something else other than a component? For example, perhaps it’s the page load event, or a user submitting a form? If the trigger isn’t the component, then it doesn’t need an onMount call at all. In the next part, we’ll look at how we can move this logic to a Svelte store, and how we can test components that subscribe to a store. Discussion (0)
https://practicaldev-herokuapp-com.global.ssl.fastly.net/d_ir/testing-the-onmount-callback-464g
CC-MAIN-2021-31
refinedweb
711
59.5
If we can't even clear the screen without ANSI escape codes and ANSI.SYS how are we supose to make programs?? Is there another way? This is a discussion on Im Frustrated! within the C++ Programming forums, part of the General Programming Boards category; If we can't even clear the screen without ANSI escape codes and ANSI.SYS how are we supose to make programs?? ... If we can't even clear the screen without ANSI escape codes and ANSI.SYS how are we supose to make programs?? Is there another way? Code:#include <stdlib.h> #include <iostream.h> int main() { cout<<"I am text"<<endl; system("CLS"); cout<<"My buddy is gone"<<endl; cin.get(); } Add return 0 to the above. Truth is a malleable commodity - Dick Cheney Eh.. not the best way to do it. The FAQ has all the answers "Queen and huntress, chaste and fair, Now the sun is laid to sleep, Seated in thy silver chair, State in wonted manner keep." >Add return 0 to the above. Not required with C++. If the return statement is omitted from main then the return value will be 0. -Prelude My best code is written with the delete key. #include<conio.h> #include<iostream.h> int main() { cout<<"Press a key to clear the screen..."; getch(); clrscr(); //requires conio.h return 0 } This function works on Borland C++ compilers. Try it on yours, it just might work. An alternative is to use system("CLS"). Last edited by sundeeptuteja; 06-26-2002 at 01:53 PM. Well, Prelude, I'll defer to you every time, but if that's so, why have you made such a big deal about it in previous posts? Just asking... Truth is a malleable commodity - Dick Cheney Yea, I forgot to put it in, and I think you are supposed to have a return statement unless you use void main(), which you shouldn't Thank you but theres still a problem: consider this snippet: cout << "Hi!\n"; getchar(); system("CLS"); cout << "Hi again!\n"; You would think it say 'Hi!',then wait for a carriage return/line-feed,then clear screen,and say 'Hi again!',but it doesn't.It waits for a carriage return/line-feed,then clears screen and prints Hi! Hi again! And please tell me c++ has a way to clear the screen on its own! It sure does. Try this:It sure does. Try this:Originally posted by Powerfull Army And please tell me c++ has a way to clear the screen on its own!: That should do it.That should do it.PHP Code: for (int i = 0; i < 25; i++) { for (int j = 0; j < 80; j++) cout << " "; } Truth is a malleable commodity - Dick Cheney READ THE FAQREAD THE FAQCode:#include <windows.h> #include <conio.h> #include <iostream> using namespace std; void clrscr() {); } int main(int argc, char *argv[]) { cout << "Hello"; getch(); clrscr(); cout << "Hello Again!"; return 0; } "There are three kinds of people in the world... Those that can count and those that can't." thanks okie smokie and salvenis but: salvenis,that isn't realy clearing the screen,its scrolling the screen,that'd be good for a replacement but i think c++ outa have a good,simple,complete,and authentic way to do such a simple task such as clearing the screen. And okiesmokie thanks for the function but it still clears the screen before couting. Do you mean it does this? Output: Hi! (clear screen) Hi Again! because if it does that's what it's supposed to do. No,it does this (wait for enter press) (clears screen) Hi! Hi again! Its frustrating isn't it? If anyone has an answer to this disgusting riddle please don't hide it I know people make full-blown applications with c++ all the time so theres got to be a simple way to clear the screen
http://cboard.cprogramming.com/cplusplus-programming/20452-im-frustrated.html
CC-MAIN-2014-42
refinedweb
653
85.18
Naming Perl modules is a subset of Choosing Identifiers, with all that entails. Some general guidelines exist (and yes I've read them). Authors who intend to upload to CPAN are encouraged to submit modules to modules@perl.org for review and suggestions on naming. CPAN Search itself does, of course, give helpful hints by example. But all this does not take the place of a straightforward top level module namespace table. I gather that most experienced Perlers see no need for this table; they say, in essence, "It's obvious what to call a new module. If it works with GD, put it under the GD:: namespace." I've discussed this table in several places and got comments in return that suggest I'm not being clear. So, here I insert a sort of stub or dummy of exactly what I seek: This is not a real table. Do not use. Do not copy. In the interest of terseness, words like "module(s)", "about", "related", "manipulate", and "interface with" are usually omitted. Namespaces marked ('*') are deprecated, or probably should be deprecated.::). ... [download] You get the point. If such a table exists, please be so kind as to push me that way. If not, I'll take suggestions on how to nurture its creation. At this point, I'm starting to think that this table does not exist; and my first thought is to set up a wiki page for the purpose. ---- I Go Back to Sleep, Now. OGB Amazing. * ** Lots Some Very few None Results (219 votes), past polls
http://www.perlmonks.org/?node_id=821356
CC-MAIN-2016-07
refinedweb
260
75.61
- Commonly used windows - Element creation - Constraint options - Display options Updates: - Hypershade button - Node Editor button - Locator visibility button How to run: import rr_main_rigging rr_main_rigging.window_creation() An updated video of the tool's interface can be viewed by clicking the following link. If you have any feedback or suggestions for the tool, please feel free to contact me at conley.setup@gmail.com Cheers and happy rigging, Jen Version 1.1.1 - Updated code for consistancy across RigBox Reborn scripts. Please use the Feature Requests to give me ideas. Please use the Support Forum if you have any questions or problems. Please rate and review in the Review section.
https://ec2-34-231-130-161.compute-1.amazonaws.com/maya/script/rigbox_reborn-rigging-tool-for-maya-47519
CC-MAIN-2022-40
refinedweb
108
50.23
Interface for user specific layout format of log4c_logging_event events. More... #include <log4c/defs.h> #include <log4c/logging_event.h> #include <stdio.h> Go to the source code of this file. Interface for user specific layout format of log4c_logging_event events. Helper macro to define static layout types. log4c layout class log4c layout type class Attributes description: namelayout type name format Destructor for layout. format a log4c_logging_event events to a string. Get a pointer to an existing layout. Constructor for layout. prints the layout on a stream sets the layout type sets the layout user data Get a pointer to an existing layout type. Use this function to register a layout type with log4c. Once this is done you may refer to this type by name both programatically and in the log4c configuration file. Example code fragment: free all layout types prints all the current registered layout types on a stream
http://log4c.sourceforge.net/layout_8h.html
CC-MAIN-2017-47
refinedweb
148
69.58
Timing computation in cycles From HaskellWiki Revision as of 00:17, 4 January 2007 by DonStewart (Talk | contribs) This page illustrates the use of the 'rdtsc' register on x86 machines to measure the number of cycles a chunk of Haskell code requires. We use lookup of a key in a map as an example. The Rdtsc library is available from the libraries page. import System.CPUTime.Rdtsc import qualified Data.Map as M import Text.Printf import System.Environment list = ["Baughn" ,"falconair" ,"Lemmih" ,"Philippa" ,"ToRA" ,"bd_" ,"felipe" ,"levitation[A" ,"Plareplane" ,"TSC" ,"bdash" ,"flux__" ,"lisppaste2" ,"Poeir" ,"tuukkah" ,"beelsebob" ,"fnordus" ,"lispy" ,"prb" ,"twanvl" ,"benc__" ,"fridim_" ,"liyang" ,"profmakx" ,"TwigEther" ,"benja_" ,"gaal" ,"LoganCapaldo" ,"Prozen" ,"uebayasi" ,"Betovsky" ,"gdsx" ,"lokadin" ,"psnl" ,"Ugarte" ,"bitshifter" ,"GeoBesh" ,"Lor" ,"pstickne" ,"ulfdoz" ,"bobwhoops" ,"george--" ,"loud-" ,"psykotic" ,"vegai" ,"bohanlon" ,"giksos" ,"lucca" ,"ptolomy" ,"vegaiW" ,"bos" ,"glguy" ,"Lunar^" ,"Pupeno" ,"Vq^" ,"bos31337" ,"gmh33" ,"Lunchy" ,"PupenoR" ,"waern" ,"Botje" ,"grumpy_old_one" ,"magagr" ,"pyronicide" ,"Wallbraker" ,"boulez" ,"GueNz" ,"mahogny" ,"quazaway" ,"wchogg" ,"cajole" ,"guillaumh" ,"makinen" ,"quetzal" ,"wilx`" ,"Cale" ,"gvdm_other" ,"MarcWeber" ,"qwr" ,"woggle" ,"calvins_" ,"Hirvinen" ,"maskd" ,"rafl" ,"wolverian" ,"cameron" ,"ibid" ,"mathrick" ,"ramkrsna" ,"xerox" ,"carp_" ,"Igloo" ,"mathrick_" ,"ramza3" ,"Xgc" ,"clanehin" ,"ikaros" ,"mattam" ,"rashakil_" ,"xian" ,"ClaudiusMaximus" ,"integral" ,"matthew-_" ,"ray" ,"xinming" ,"clog" ,"Jaak" ,"mauke" ,"rc-1" ,"xpika" ,"cmeme" ,"jbalint" ,"mbishop" ,"rds" ,"yaarg" ,"Codex_" ,"jcreigh" ,"metaperl" ,"reppie" ,"yosemite" ,"cods" ,"jdev" ,"Mitar" ,"resiak" ,"Z4rd0Z" ,"cognominal" ,"jgrimes" ,"mlh" ,"retybok" ,"zamez" ,"cpfr" ,"JKnecht" ,"moconnor" ,"rey_" ,"zeuxis" ,"ctkrohn" ,"jlouis" ,"monochrom" ,"saccade" ,"ziggurat" ,"daniel_larsson" ,"jmg_" ,"moonlite" ,"Saizan" ,"|shad0w|" ,"dany2k" ,"jmob" ,"mornfall" ,"SamB" ,"Daveman" ,"joene_" ,"mr_ank" ,"SamB_XP" ,"dblog" ,"johs_" ,"ms_" ,"scw" ,"dcoutts" ,"jrockway" ,"Muad_Dib" ,"shapr" ] main = do [v] <- getArgs -- force evaluation (don't want to time evaluation of lazy structures) length list `seq` return () let m = M.fromList (zip list [1..]) M.size m `seq` return () -- do the lookup t <- rdtsc k <- M.lookup v m u <- rdtsc print k printf "%d cycles\n" (fromIntegral (u - t) :: Int) Running this: $ ./A shapr 161 3058 cycles Categories: Tutorials | Code
http://www.haskell.org/haskellwiki/index.php?title=Timing_computation_in_cycles&direction=prev&oldid=11281
CC-MAIN-2013-20
refinedweb
307
52.94
Note: I’m coming from this from the perspective of a J programmer. Maybe K or Dyalog or something solved this already, I don’t know, but I would be pretty surprised if they did. The more I work with an APL, the more I notice a serious problem. Not the weird symbols, you get used to that pretty fast. Not the write-only aspect, that’s annoying but can be solved with a good syntax highlighter. The biggest problem with APLs, in my opinion, is discoverability: it’s hard to know what you’re supposed to be writing. I’ll use J to demonstrate what I mean. Here’s the J Vocabulary. There’s about 200 primitives there. There’s also the minimal beginning J which is ‘only’ 35 primitives. This isn’t, by itself, a problem. Part of an APL’s power comes from the diversity of primitives baked into the language. Using the right primitives will make your code fast, simple, and elegant. How do you find the right primitive, though? Here’s a python program that calculates the mode of a list using just ‘python primitives’: no high level functions, no modules, etc. def mode(l): max = None count = {} for x in l: if x not in count: count[x] = 0 count[x] += 1 if not max or count[x] > count[max]: max = x return max That’s 177 characters without golfing. It has to go through every single element in order, so it’s slow and not parallelizable. Now for the J: mode =: (i. >./) & (#/.~) { ~. That’s 22 characters. It’s fast, clean, and took 40 damn minutes to write. Most of it was poring through NuVoc to see what I actually needed to use. Was table something I should be using? Reducing? Maybe I was supposed to grade it and cluster the numbers? Sort? I was lucky and stumbled on a phrase for keys that got me closer, but I needed to figure out what to do with the counts. Find the max, I guess, but how would I use that? I started by trying to find the indice, then when that failed spent a while chasing an equality and tally as a solution before doubling back to using indices and succeeding. Not to mention finagling all of the operations together in the proper fork: I had to eventually draw it out in a whiteboard. I’m sure a J expert can look at this and say “no you’re supposed to use the Foobar primitive which makes it trivial”, but that’s my whole point: to find the right primitive I have to review 200 of them. I don’t think what I was doing was all that complicated, and all of the primitives I actually used are relatively simple. But when you load up the vocabulary you see nuts and bolts like { (select indice) and $ (get shape) mixed in with things like |: (rearrange axes of N-dimensional array) and #: (generalized antibase). And that’s just the basics. Note the /. dyadic adverb, aka “key”. x u/. y partitions elements of y based on the indices of x, then applies the u monad to each partition of y. When I use the same array for both x and y, it gives me the count of each element. Solving this problem meant knowing the right adverb and the right verb, and the right adverb isn’t immediately obvious. Here are some of the other modifiers that J provides: - The /.monadic adverb, which partitions y by its antidiagonals before applying u - The ^:_conjunction, which finds the fixed point of verb u on y - The ;._3dyadic adverb, which applies u to the subarrays in the regular tiling of y - The :;dyad, which partitions y based on a specified Mealy machine. All of these adverbs have extremely specific use cases, but they’re mixed in with more general purpose modifiers, like / (reduce) and & (bond). If I’m doing an arbitrary task, I might need \ but I probably won’t need :;. This gives me proposal one: label primitives by their complexity. I’m thinking roughly “basic”, “advanced”, and “expert”. This is under the assumption that ‘basic’ stuff is the most general, of course. ‘Advanced’ is probably anything that is mostly used in a few specified ways, and ‘expert’ is for crazy library builders (and anything involving gerunds). Note that the same symbol can have different complexities for the monad and dyad forms. { is a basic dyad but an advanced monad. That reduces the space I have to look over. To help me narrow in, it’d be good to label the useful primitives for a problem domain. If I’m finding or filtering my thoughts should immediately go to # i. = {, while for manipulating shapes I might want $ {. }. {: }:. If a verb has an unusual use case, we should also list what it belongs to that domain. For example, the -. monad is “not”. This is important because filtering is often done with a boolean array. fy # y filters y by array fy, and (-. fy) # y rejects from y by fy. And primitives can, of course, belong to multiple domains: -. is also good for boolean logic and probabilities. Certain primitives are useful to certain domains. In addition, you can construct versatile verbs out of multiple primitives. In contexts where # is used as filter, then the corresponding ‘reject’ verb is (#~ -.)~. \ is ‘infix’, /\ is the more commonly-used ‘accumulate’. J defines f . g as u@(v"(1+lv,_)), but most people only need it for +/ . *, which is ‘matrix product’. This gives us the last proposal: create a library of useful components. These can be both complete components you use directly ( ?&$ for ‘random matrix’) and partial components you parameterize ( f#] for ‘filter on f’). J has a phrasebook that’s supposed to kind of fill this role, but it gives you complete solutions to specific problems, not reusable pieces you can build with. I’m thinking more like intermediates you use to get your final answer. Here’s what the mode problem would look like with a good component library: I want to find the mode of a list. That will probably involve using an index, so I’ll be using the f { ] idiom where f’s top-level verb will be an i. dyad. Thinking it through, if I had the counts c for each element I could get the index of the max with (i. >./) c. I get the counts by checking the library and finding #/.~. I combine everything, watch it raise a length error, and realize the counts of the elements of a list is going to be smaller than the list, since it’s just the nub. I have to replace ] in the find-by-index idiom with ~., and the verb is complete. Instead of 40 minutes, it takes 5. In addition to making J more discoverable, a good component library might also make it more parsable. I have to work out what (f g h) y is supposed to do, but if I see (f # ]) y I immediately know it’s a boolean filter. One interesting possibility is adding semantic highlighting, where we highlight instantiated partial components and tooltip the description. In summary: when working with an APL finding the right primitive is really tough, and verb classification and a better phrasebook would go a long way towards fixing that.
https://www.tefter.io/bookmarks/46693/readable
CC-MAIN-2020-05
refinedweb
1,230
73.78
Panasonic's Lumix G5 Digital Camera with Lumix G Vario 14-42mm Lens is finally in stock after having been expected for so many days. If you have got the Panasonic G5 1080p AVCHD footages to iMovie and find all MTS files are greyed out, which means that iMovie can not recognize your MTS files. What causes the incompatibility problem of iMovie and Panasonic Lumix G5 footages? There are mainly two reasons why you can not transfer AVCHD files from Lumix G5 to put 1080/60p files to iMovie, you will sometimes meet the importing problem. How can the importing importing Panasonic Lumix G5 1080/60p files to Final Cut Pro, FCE, Avid Media Composer, Adobe Premiere, etc. If you are interested and want to get more info, please go to the MTS Converter for Mac. Related Guide: import Panasonic G5 1080p AVCHD footages to iMovie, edit Panasonic AVCHD files in iMovie, importing 1080/60p AVCHD to iMovie, transfer AVCHD files to iMovie, copy Panasonic AVCHD files to Mac, transcode AVCHD files to MOV for iMovie, make 1080/60p AVCHD editable in iMovie, convert 1080/60p AVCHD to AIC MOV, AVCHD Converter for iMovie, MTS Converter for Mac, Panasonic G5 importing problem with iMovie, MTS Converter for iMovie, AVCHD to iMovie Converter
http://www.brorsoft.com/how-to/import-panasonic-lumix-g5-1080p-avchd-footages-imovie-mac.html
CC-MAIN-2015-22
refinedweb
212
58.66
Hi all, Sorry noob here in JS and K6. So, I have these config files on my Cypress folder (config/dev.json) that I want to use for my k6 tests too. dev.json file contains the following: { “env”: { “host”: “”, “description”: “test” } } I usually access this on my Cypress spec / test files like the example below: const url = Cypress.env('host') I am trying to make this my config file for k6 too but it shows me an error when running via CLI even if it is a valid json format: k6 --config "../../cypress/config/dev.json" run script.js ERRO[0000] invalid character ‘ï’ looking for beginning of value I did the following on my k6 script.js and didn’t work either: import {env} from “…/…/cypress/config/dev.json”; const url = env.host; export default function() { http.get(url); sleep(1); }
https://community.k6.io/t/accessing-values-from-config-file-from-cypress-e2e-framework/926
CC-MAIN-2020-45
refinedweb
143
67.35
How We Use Redux & Redux-Observable with Vue (v3.0 Journal)November 14, 2018 We This article is the first chapter of our v3.0 Journal where we reveal interesting parts of our shopping cart’s rewrite. To read the entire thing: - Chapter One: How We Use Redux & Redux-Observable with Vue - Chapter Two: Exposing a Promise-Based API from a Reactive Core - Chapter Three: Template Overriding - Chapter Four: How We Generate Our Documentation with Nuxt & Sanity I’m thrilled to finally share some of our work on this newest version of Snipcart with you guys! Let’s start with a bit of context. What is that cart v3.0 you’re talking about? In the last few months, the whole team at Snipcart has been hard at work crafting a new version of our shopping cart for developers. Read our docs to understand how our HTLM/JS-powered cart works. The first thing we had to settle on was the goals this revamped cart had to achieve: - Offer next level checkout & cart template customization. - Let developers use any stack—it’s been Snipcart’s promise from the start. - Create the most kickass e-commerce development UX on the market. These pushed us to carefully select our new tech stack. It had to enable easy customization, sure. More importantly though: it had to empower seasoned AND junior developers to get shit done without getting in their way. We picked Vue.js for the UI. Mainly because the team loves this JS framework. But also because it includes all the building blocks needed to add template customization to our cart. This post is a companion piece to a talk our co-founder Charles gave at VueConf Toronto. We’ll cover our Vue.js experience more deeply in upcoming v3.0 posts. You might think the next obvious choice for state management would be Vuex. However, our goals forced us to think outside the box, where we found Redux. It became the most logical pick for us—we’ll tell you why soon enough. Let’s make sure we’re on the same page as to what Redux is, first. What are Redux & redux-observable? In a nutshell, Redux is a centralized state management library. If what follows sounds like gibberish to you, I suggest reading Redux’s basics here. It exposes a store, the place where your app’s state is kept safe, which can be represented by this interface: interface Store { getState(): State; subscribe(callback: (s: State) => void): void; dispatch(action: Action): Action; } A state is an immutable object that gets updated by reducers. When a change has to affect the state, we dispatch an action to the store, which gets handled by the reducers. Its consumers then receive a new instance of the updated state. It’s this simple contract that allows us to use Redux with almost anything. For display purposes, only getState and subscribe are actually required, which makes integrating it with view libraries very straightforward. Reducers are functions that receive the current state and actions, then return a new state. They are synchronous and cannot have any side effect: export function cartItemAdd(state: State, action: Action): State { const addedItem = action.payload.item; return { ...state, items: [...state.items, addedItem], }; } The crunchy part of state changes is fully isolated in the reducers and an additional mechanism, middlewares, makes it easier to augment the store with other functionalities. To keep it simple, we can see middlewares as plugins of the store. That’s where redux-observable fits in the puzzle: it’s a Redux middleware that leverages RxJS to allow asynchronous operations on the store. It’s similar in a way to redux-thunk or redux-saga but with all the power of the observer pattern. More about redux-observable later on! Why use Redux over Vuex? A question you might still have in the back of your mind is: “Wasn’t Vuex built to do all of this with Vue?” Yes, it was. But our v3.0 guidelines were strict—easy customization and dev freedom above everything else. So we’ve decided to split the cart into two parts: - A JavaScript SDK, hosting all the state management and cart logic. - A slim UI layer. We’ll first provide a default modal with great UX and easy customization. Then, developers should be able to build their own using any stack. In that particular context: → Vuex became a no-go as it’s tightly coupled to Vue.js. It’d force Vue usage upon our users. Redux was different and had everything we needed. → Redux has a very simple interface that can be used with most frameworks. Unlike Vuex, it’s framework-agnostic and built as a standalone library. It gave us the state management library we needed for our SDK to be universal. → It has a mature community around it. We got to try and play with many libraries leveraging Redux. Which brings us to our final addition to the stack: redux-observable. How to leverage redux-observable? In redux-observables, asynchronous API calls or side effects can be achieved with help from ‘Epics’, a core concept of the library. It’s a stream of actions from which we can handle specific actions we’re interested in and emit new ones for the reducers. We’ve simplified our epics to hide the complexity of RxJS for simple cases. Here’s a basic example of an epic: export const addItemEpic = createEpicFor(ADD_ITEM_ACTION, async ( action: Action, state: State, { api }: Dependencies ): Promise<Action | Action[]> => { const response = await api.post(`/cart/items`, action.payload); if (response.ok) { const payload = await response.json<ItemAddedResponse>(); return itemAddedAction(action, payload); } return await errorActionFromResponse( response, ADD_ERROR, action); } The observable part of RxJS and its streams comes in handy for debouncing—when a user does multiple operations rapidly. A user clicking to increase the quantity of an item in the cart, for instance. It wouldn’t make sense to fire as many API requests, so with ReactiveX’s operator we can batch these actions and commit them once. Rx is a powerful but complex beast; you can learn more about it here. Devs familiar with Node.js Express or other server-side frameworks with a middleware system shouldn’t be lost in Redux. It’s exactly the same—code can run before and after the call to the reducers. Epics run after the reducers which allows to react to a single action both in the reducers and the epics: - First to mark new items as being not yet saved. - Then, have an epic which will make the call to save it and dispatch a new action to mark the item as saved. We’ve also added our own middlewares that interact with the flow of actions in the store to expose a more traditional API. Even though going with a reactive store is the right approach, we have a lot of customers that are beginners in JavaScript programming: we can’t ask them to go all in with the store and dispatch synchronous actions. So we’ve built simple middlewares to expose an API that returns Promises and can be used with async/await, and another one that emits events that can be subscribed to. How we plugged Vue.js to a reactive store With the immense communities behind both Redux and Vue, a cross-over was bound to happen. As of now though, the choice of library is limited to: - vuejs-redux - redux-vuex - a few unmaintained ones We chose redux-vuex for its similarity with vuex: import { mapState, connect } from 'redux-vuex'; import Vue from 'vue'; import { Component } from 'vue-property-decorator'; import { sdk } from 'snipcart-sdk'; /** * we add a call to `connect` from `redux-vuex` * this bind our store to the Vue instance * and allow us to map its state in our components */ connect({ Vue, store: sdk.store, }); @Component({ components: { CartItem } }) export default class Cart extends Vue { data() { // pretty similar to vuex isn't it? :) return mapState({ items: state => state.cart.items, }).call(this); } render(h) { return ( <ul> <cart-item : </ul> ); } } As you can see, plugging Vue over Redux is effortless. We want our base Vue theme for the new cart to be a slim layer over the Redux store. A place where all the beefy logic lives. This way, anybody can make their own custom theme with the tech they love. Where do we go from here? I hope this clarifies our choice of stack for the cart’s rewrite. In all honesty, we would have loved to have this kind of resource when we started working on it. ;) This is only the foundation of the Snipcart’s v3.0. We’ll be back with more entries on the blog about the process of building it. Template overriding, packaging & distribution of the SDK, and exposing a promise-based API around a reactive core are all subjects we want to discuss on the blog in the next few weeks. So hang around! For now, if you need any more info about any section of this specific post let us know in the comments below. If you've enjoyed this post, please take a second to share it on Twitter. Got comments, questions? Hit the section below!
https://snipcart.com/blog/redux-vue?utm_campaign=Vue.js%20Developers&utm_medium=email&utm_source=Revue%20newsletter
CC-MAIN-2020-05
refinedweb
1,541
65.12
instance can't get IP from dhcp agent when using linux bridge plugin Hi list, I'm working under CentOS 6.4 + Havana. I'm using neutron with core_plugin = neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2 And, I have created a network with VLAN ID = 2002. After an instance created, everything works fine, but the instance can't get IP from DHCP agent. On the machine which is running dhcp agent: brctl show bridge name bridge id STP enabled interfaces brq5e04f269-94 8000.1239a4bc0e67 no eth4.2002 tap4647c381-05 tcpdump -i eth4.2002 15:47:58.339767 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from fa:16:3e:80:53:02 (oui Unknown), length 300 tcpdump -i tap4647c381-05 .... nothing ........ $ ip link 6: eth4: <broadcast,multicast,up,lower_up> mtu 1500 qdisc mq state UP qlen 1000 link/ether 90:e2:ba:42:41:c4 brd ff:ff:ff:ff:ff:ff 93: tap4647c381-05: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 12:39:a4:bc:0e:67 brd ff:ff:ff:ff:ff:ff 94: eth4.2002@eth4: <broadcast,multicast,up,lower_up> mtu 1500 qdisc noqueue state UP link/ether 90:e2:ba:42:41:c4 brd ff:ff:ff:ff:ff:ff 95: brq5e04f269-94: <broadcast,multicast,up,lower_up> mtu 1500 qdisc noqueue state UNKNOWN link/ether 12:39:a4:bc:0e:67 brd ff:ff:ff:ff:ff:ff Anyone know why this happen ???? Thanks. -chen Are you using IP namespaces? Are there any errors in the dhcp agent log? Can you append the output of 'ip link' to the question. Yes, I'm using default value for most configure, so I'm using IP namespaces I think. Only error in DHCP agent is when I start it: 2013-11-18 15:41:04.064 81923 ERROR neutron.common.legacy [-] Skipping unknown group key: firewall_driver, is this related ??? On the compute node and network node, does the linuxbridge agent log have any errors? For the network node, can you append the output of 'ip netns' to the question. @chen-li The question is a lot more readable if you add details editing your original question instead of comments
https://ask.openstack.org/en/question/7198/instance-cant-get-ip-from-dhcp-agent-when-using-linux-bridge-plugin/?sort=latest
CC-MAIN-2020-29
refinedweb
372
66.84
. Given how heavily recursive this function is, I went with Haskell instead of Python: [...] Programming News: Ackermann’s Function In the 1920s, Wilhelm Ackermann demonstrated a computable function that was not primitive-recursive, settling an important argument in the run-up to the theory of computation. Read full story => Programming Praxis [...] Feel free to laugh at me. I tried to use visual C# for this. Stack overflow or there is some arbitrary stack limit where visual C# in its infinite wisdom decided I didn’t know what I was doing. Fun times Toecutter: If your language doesn’t provide a sufficient stack, you must create your own stack; that’s the point of the exercise. A(4,1)=65533 should be within range of your function. Ha! Ackermann’s function. At least this can computer A(4,2) in python def ackermann(m, n): while m >= 4: if n == 0: n = 1 else: n = ackermann(m, n - 1) m = m - 1 if m == 3: return (1 << n + 3) - 3 elif m == 2: return (n << 1) + 3 elif m == 1: return n + 2 else: return n + 1 print ackermann(4,2) How about some q A:{[m; n] if [m ~ 0; : n+1]; $ [n ~ 0; if [0 < m; : A[m-1; 1]]; if [0 < n; : A[m-1; A[m; n-1]]]]; }; My solution written in Go lang: Using the closed form, recursion only is necessary for Ackerman(m, n) with m >= 4.
http://programmingpraxis.com/2012/05/25/ackermanns-function/?like=1&source=post_flair&_wpnonce=ca20eaf6a9
CC-MAIN-2014-10
refinedweb
242
63.93
J I also pointed out it doesn't change what they do, it has more to do with how they work underneath and that there may be some benefits in changing this. >>> def foo(x): ... return (not not x) != bool(x) ... >>> dis.dis(foo) 2 0 LOAD_FAST 0 (x) 3 UNARY_NOT 4 UNARY_NOT 5 LOAD_GLOBAL 0 (bool) 8 LOAD_FAST 0 (x) 11 CALL_FUNCTION 1 14 COMPARE_OP 3 (!=) 17 RETURN_VALUE In this case the lines... 5 LOAD_GLOBAL 0 (bool) 8 LOAD_FAST 0 (n) 11 CALL_FUNCTION 1 Would be replaced by... 5 LOAD_FAST 0 (n) 6 UNARY_BOOL The compiler could also replace UNARY_NOT, UNARY_NOT pairs with a single UNARY_BOOL. There may be other situations where this could result in different more efficient byte code as well. _Ron
https://mail.python.org/pipermail/python-ideas/2007-March/000267.html
CC-MAIN-2018-26
refinedweb
125
71.04
Linear Regression Using Python scikit-learn Linear Regression Using Python scikit-learn Let's say you have some people's height and weight data. Can you use it to predict other people's weight? Find out using Python scikit-learn. Join the DZone community and get the full member experience.Join For Free Did you know that 50- 80% of your enterprise business processes can be automated with AssistEdge? Identify processes, deploy bots and scale effortlessly with AssistEdge. In this article, I am going to explain how to use scikit-learn/sk-learn, a machine learning package in Python, to do linear regression for a set of data points. Below is a video tutorial on this: I am not going to explain training data, testing data, and model evaluation concepts here, but they are important. We know that the equation of a line is given by y=mx+b, where m is the slope and b is the intercept. Our goal is to find the best values of slope (m) and intercept (b) to fit our data. Linear regression uses the ordinary least squares method to fit our data points. import statement: from sklearn import linear_model I have the height and weight data of some people. Let's use this data to do linear regression and try to predict the weight of other people. height=[[4.0],[4.5],[5.0],[5.2],[5.4],[5.8],[6.1],[6.2],[6.4],[6.8]] weight=[ 42 , 44 , 49, 55 , 53 , 58 , 60 , 64 , 66 , 69] print("height weight") for row in zip(height, weight): print(row[0][0],"->",row[1]) Output: height weight 4.0 -> 42 4.5 -> 44 5.0 -> 49 5.2 -> 55 5.4 -> 53 5.8 -> 58 6.1 -> 60 6.2 -> 64 6.4 -> 66 6.8 -> 69 import statement to plot graph using matplotlib: import matplotlib.pyplot as plt Plotting the height and weight data: plt.scatter(height,weight,color='black') plt.xlabel("height") plt.ylabel("weight") Output: Declaring the linear regression function and call the fit method to learn from data: reg=linear_model.LinearRegression() reg.fit(height,weight) Slope and intercept: m=reg.coef_[0] b=reg.intercept_ print("slope=",m, "intercept=",b) Output: slope= 10.1936218679 intercept= -0.4726651480 Output:Output: plt.scatter(height,weight,color='black') predicted_values = [reg.coef_ * i + reg.intercept_ for i in height] plt.plot(height, predicted_values, 'b') plt.xlabel("height") plt.ylabel("weight") And that's it! Linear regression in python scikit learn | Quick KT Consuming AI in byte sized applications is the best way to transform digitally. #BuiltOnAI, EdgeVerve’s business application, provides you with everything you need to plug & play AI into your enterprise. Learn more. Published at DZone with permission of Vinay Kumar . See the original article here. Opinions expressed by DZone contributors are their own. {{ parent.title || parent.header.title}} {{ parent.tldr }} {{ parent.linkDescription }}{{ parent.urlSource.name }}
https://dzone.com/articles/linear-regression-using-python-scikit-learn
CC-MAIN-2019-04
refinedweb
485
61.63
A Windows Runtime type can declare (that is, publish) events, and client code in the same component or in other components can subscribe to those events by associating methods called event handlers with the event. Multiple event handlers can be associated with a single event. When the publishing object raises the event, it causes all event handlers to be invoked. In this way, a subscribing class can perform whatever custom action is appropriate when the publisher raises the event. An event has a delegate type that specifies the signature that all event handlers must have in order to subscribe to the event. Consuming events in Windows components Many components in the Windows Runtime expose events. For example, a LightSensor object fires a ReadingChanged event when the sensor reports a new luminescence value. When you use a LightSensor object in your program, you can define a method that will be called when the ReadingChanged event is fired. The method can do whatever you want it to do; the only requirement is that its signature must match the signature of the delegate that is For more information about how to create an delegate event handler and subscribe to an event, see Delegates. Creating custom events Declaration You can declare an event in a ref class or an interface, and it can have public, internal (public/private), public protected, protected, private protected, or private accessibility. When you declare an event, internally the compiler creates an object that exposes two accessor methods: add and remove. When subscribing objects register event handlers, the event object stores them in a collection. When an event is fired, the event object invokes all the handlers in its list in turn. A trivial event—like the one in the following example—has an implicit backing store as well as implicit add and remove accessor methods. You can also specify your own accessors, in the same way that you can specify custom get and set accessors on a property. The implementing class cannot manually cycle through the event subscriber list in a trivial event. The following example shows how to declare and fire an event. Notice that the event has a delegate type and is declared by using the "^" symbol. namespace EventTest { ref class Class1; public delegate void SomethingHappenedEventHandler(Class1^ sender, Platform::String^ s); public ref class Class1 sealed { public: Class1(){} event SomethingHappenedEventHandler^ SomethingHappened; void DoSomething() { //Do something.... // ...then fire the event: SomethingHappened(this, L"Something happened."); } }; } Usage The following example shows how a subscribing class uses the += operator to subscribe to the event, and provide an event handler to be invoked when the event is fired. Notice that the function that's provided matches the signature of the delegate that's defined on the publisher side in the EventTest namespace. namespace EventClient { using namespace EventTest; namespace PC = Platform::Collections; //#include <collection.h> public ref class Subscriber sealed { public: Subscriber() : eventCount(0) { // Instantiate the class that publishes the event. publisher= ref new EventTest::Class1(); // Subscribe to the event and provide a handler function. publisher->SomethingHappened += ref new EventTest::SomethingHappenedEventHandler( this, &Subscriber::MyEventHandler); eventLog = ref new PC::Map<int, Platform::String^>(); } void SomeMethod() { publisher->DoSomething(); } void MyEventHandler(EventTest::Class1^ mc, Platform::String^ msg) { // Our custom action: log the event. eventLog->Insert(eventCount, msg); eventCount++; } private: PC::Map<int, Platform::String^>^ eventLog; int eventCount; EventTest::Class1^ publisher; }; } Warning In general, it's better to use a named function, rather than a lambda, for an event handler unless you take great care to avoid circular references. A named function captures the "this" pointer by weak reference, whereas a lambda captures it by strong reference and creates a circular reference. For more information, see Weak references and breaking cycles (C++/CX). Custom add and remove methods Internally, an event has an add method, a remove method, and a raise method. When client code subscribes to an event, the add method is called and the delegate that's passed in is added to the event's invocation list. The publishing class invokes the event, it causes the raise() method to be called, and each delegate in the list is invoked in turn. A subscriber can remove itself from the delegate list, which causes the event's remove method to be called. The compiler provides default versions of these methods if you don't define them in your code; these are known as trivial events. In many cases, a trivial event is all that's required. You can specify custom add, remove, and raise methods for an event if you have to perform custom logic in response to the addition or removal of subscribers. For example, if you have an expensive object that is only required for event reporting, you can lazily defer the creation of the object until a client actually subscribes to the event. The next example shows how to add custom add, remove, and raise methods to an event: namespace EventTest2 { ref class Class1; public delegate void SomethingHappenedEventHandler(Class1^ sender, Platform::String^ msg); public ref class Class1 sealed { public: Class1(){} event SomethingHappenedEventHandler^ SomethingHappened; void DoSomething(){/*...*/} void MethodThatFires() { // Fire before doing something... BeforeSomethingHappens(this, "Something's going to happen."); DoSomething(); // ...then fire after doing something... SomethingHappened(this, L"Something happened."); } event SomethingHappenedEventHandler^ _InternalHandler; event SomethingHappenedEventHandler^ BeforeSomethingHappens { Windows::Foundation::EventRegistrationToken add(SomethingHappenedEventHandler^ handler) { // Add custom logic here: //.... return _InternalHandler += handler; } void remove(Windows::Foundation::EventRegistrationToken token) { // Add custom logic here: //.... _InternalHandler -= token; } void raise(Class1^ sender, Platform::String^ str) { // Add custom logic here: //.... return _InternalHandler(sender, str); } } }; } Removing an event handler from the subscriber side In some rare cases, you may want to remove an event handler for an event that you previously subscribed to. For example, you may want to replace it with another event handler or you may want to delete some resources that are held by it. To remove a handler, you must store the EventRegistrationToken that's returned from the += operation. You can then use the -= operator on the token to remove an event handler. However, the original handler could still be invoked even after it's removed. Therefore, if you intend to remove an event handler, create a member flag and set it if the event is removed, and then in the event handler, check the flag and return immediately if it's set. The next example shows the basic pattern. namespace EventClient2 { using namespace EventTest2; ref class Subscriber2 sealed { private: bool handlerIsActive; Platform::String^ lastMessage; void TestMethod() { Class1^ c1 = ref new Class1(); handlerIsActive = true; Windows::Foundation::EventRegistrationToken cookie = c1->SomethingHappened += ref new EventTest2::SomethingHappenedEventHandler(this, &Subscriber2::MyEventHandler); c1->DoSomething(); // Do some other work�..then remove the event handler and set the flag. handlerIsActive = false; c1->SomethingHappened -= cookie; } void MyEventHandler(Class1^ mc, Platform::String^ msg) { if (!handlerIsActive) return; lastMessage = msg; } }; } Remarks Multiple handlers may be associated with the same event. The event source sequentially calls into all event handlers from the same thread. If an event receiver blocks within the event handler method, it blocks the event source from invoking other event handlers for this event. The order in which the event source invokes event handlers on event receivers is not guaranteed and may differ from call to call. See Also Type System Delegates Visual C++ Language Reference Namespaces Reference
https://docs.microsoft.com/en-us/cpp/cppcx/events-c-cx
CC-MAIN-2017-17
refinedweb
1,200
52.29
#include <stdint.h> #include <rte_compat.h> #include <rte_common.h> #include <rte_config.h> #include <rte_mempool.h> #include <rte_prefetch.h> #include <rte_branch_prediction.h> #include <rte_mbuf_ptype.h> #include <rte_mbuf_core.h> Go to the source code of this file. RTE Mbuf The mbuf library provides the ability to create and destroy buffers that may be used by the RTE application to store message buffers. The message buffers are stored in a mempool, using the RTE mempool library. The preferred way to create a mbuf pool is to use rte_pktmbuf_pool_create(). However, in some situations, an application may want to have more control (ex: populate the pool with specific memory), in this case it is possible to use functions from rte_mempool. See how r rte_mbuf.h. When set, pktmbuf mempool will hold only mbufs with pinned external buffer. The external buffer will be attached to the mbuf at the memory pool creation and will never be detached by the mbuf free calls. mbuf should not contain any room for data after the mbuf structure. Definition at line 291 of file rte_mbuf.h. Returns non zero if given mbuf has a pinned external buffer, or zero otherwise. The pinned external buffer is allocated at pool creation time and should not be freed on mbuf freeing. External buffer is a user-provided anonymous buffer. Definition at line 300 of file rte_mbuf.h. check mbuf type in debug mode Definition at line 311 of file rte_mbuf.h. Mbuf prefetch Definition at line 473 of file rte_mbuf.h. For backwards compatibility. Definition at line 538 of file rte_mbuf.h. Detach the external buffer attached to a mbuf, same as rte_pktmbuf_detach() Definition at line 1076 of file rte_mbuf.h. A macro that returns the length of the packet. The value can be read or assigned. Definition at line 1522 of file rte_mbuf.h. A macro that returns the length of the segment. The value can be read or assigned. Definition at line 1532 of file rte_mbuf.h. Get the name of a RX offload flag Dump the list of RX offload flags in a buffer Get the name of a TX offload flag Dump the list of TX offload flags in a buffer Prefetch the first part of the mbuf The first 64 bytes of the mbuf corresponds to fields that are used early in the receive path. If the cache line of the architecture is higher than 64B, the second part will also be prefetched. Definition at line 109 of file rte_mbuf.h. Prefetch the second part of the mbuf The next 64 bytes of the mbuf corresponds to fields that are used in the transmit path. If the cache line of the architecture is higher than 64B, this function does nothing as it is expected that the full mbuf is already in cache. Definition at line 126 of file rte_mbuf.h. Get the application private size of mbufs stored in a pktmbuf_pool The private size of mbuf is a zone located between the rte_mbuf structure and the data buffer where an application can store data associated to a packet. Definition at line 810 of file rte_mbuf.h. Return the IO address of the beginning of the mbuf data Definition at line 147 of file rte_mbuf.h. Return the default IO address of the beginning of the mbuf data This function is used by drivers in their receive function, as it returns the location where data should be written by the NIC, taking the default headroom in account. Definition at line 165 of file rte_mbuf.h. Return the mbuf owning the data buffer address of an indirect mbuf. Definition at line 179 of file rte_mbuf.h. Return address of buffer embedded in the given mbuf. The return value shall be same as mb->buf_addr if the mbuf is already initialized and direct. However, this API is useful if mempool of the mbuf is already known because it doesn't need to access mbuf contents in order to get the mempool pointer. Definition at line 200 of file rte_mbuf.h. Return the default address of the beginning of the mbuf data. Definition at line 214 of file rte_mbuf.h. Return address of buffer embedded in the given mbuf. Definition at line 233 of file rte_mbuf.h. Return the starting address of the private data area embedded in the given mbuf. Note that no check is made to ensure that a private data area actually exists in the supplied mbuf. Definition at line 251 of file rte_mbuf.h. Return the flags from private data in an mempool structure. Definition at line 277 of file rte_mbuf.h. Adds given value to an mbuf's refcnt and returns its new value. Definition at line 393 of file rte_mbuf.h. Reads the value of an mbuf's refcnt. Definition at line 402 of file rte_mbuf.h. Sets an mbuf's refcnt to the defined value. Definition at line 411 of file rte_mbuf.h. Reads the refcnt of an external buffer. Definition at line 427 of file rte_mbuf.h. Set refcnt of an external buffer. Definition at line 441 of file rte_mbuf.h. Add given value to refcnt of an external buffer and return its new value. Definition at line 459 of file rte_mbuf.h. Sanity checks on an mbuf. Check the consistency of the given mbuf. The function will cause a panic if corruption is detected. Sanity checks on a mbuf. Almost like rte_mbuf_sanity_check(), but this function gives the reason if corruption is detected rather than panic. Sanity checks on a reinitialized mbuf in debug mode. Check the consistency of the given reinitialized mbuf. The function will cause a panic if corruption is detected. Check that the mbuf is properly reinitialized (refcnt=1, next=NULL, nb_segs=1), as done by rte_pktmbuf_prefree_seg(). Definition at line 529 of file rte_mbuf.h. Allocate an uninitialized mbuf from mempool mp. This function can be used by PMDs (especially in RX functions) to allocate an uninitialized mbuf. The driver is responsible of initializing all the required fields. See rte_pktmbuf_reset(). For standard needs, prefer rte_pktmbuf_alloc(). The caller can expect that the following fields of the mbuf structure are initialized: buf_addr, buf_iova, buf_len, refcnt=1, nb_segs=1, next=NULL, pool, priv_size. The other fields must be initialized by the caller. Definition at line 559 of file rte_mbuf.h. Put mbuf back into its original mempool. The caller must ensure that the mbuf is direct and properly reinitialized (refcnt=1, next=NULL, nb_segs=1), as done by rte_pktmbuf_prefree_seg(). This function should be used with care, when optimization is required. For standard needs, prefer rte_pktmbuf_free() or rte_pktmbuf_free_seg(). Definition at line 584 of file rte_mbuf.h. The packet mbuf constructor. This function initializes some fields in the mbuf structure that are not modified by the user once created (origin pool, buffer start address, and so on). This function is given as a callback function to rte_mempool_obj_iter() or rte_mempool_create() at pool creation time. This function expects that the mempool private area was previously initialized with rte_pktmbuf_pool_init(). A packet mbuf pool constructor. This function initializes the mempool private data in the case of a pktmbuf pool. This private data is needed by the driver. The function must be called on the mempool before it is used, or it can be given as a callback function to rte_mempool_create() at pool creation. It can be extended by the user, for example, to provide another packet size. The mempool private area size must be at least equal to sizeof(struct rte_pktmbuf_pool_private). Create a mbuf pool. This function creates and initializes a packet mbuf pool. It is a wrapper to rte_mempool functions. Create a mbuf pool with a given mempool ops name This function creates and initializes a packet mbuf pool. It is a wrapper to rte_mempool functions. Create a mbuf pool with external pinned data buffers. This function creates and initializes a packet mbuf pool that contains only mbufs with external buffer. It is a wrapper to rte_mempool functions. Get the data room size of mbufs stored in a pktmbuf_pool The data room size is the amount of data that can be stored in a mbuf including the headroom (RTE_PKTMBUF_HEADROOM). Definition at line 789 of file rte_mbuf.h. Reset the data_off field of a packet mbuf to its default value. The given mbuf must have only one segment, which should be empty. Definition at line 826 of file rte_mbuf.h. Reset the fields of a packet mbuf to their default values. The given mbuf must have only one segment. Definition at line 840 of file rte_mbuf.h. Allocate a new mbuf from a mempool. This new mbuf contains one segment, which has a length of 0. The pointer to data is initialized to have some bytes of headroom in the buffer (if buffer size allows). Definition at line 871 of file rte_mbuf.h. Allocate a bulk of mbufs, initialize refcnt and reset the fields to default values. Definition at line 893 of file rte_mbuf.h. Initialize shared data at the end of an external buffer before attaching to a mbuf by rte_pktmbuf_attach_extbuf(). This is not a mandatory initialization but a helper function to simply spare a few bytes at the end of the buffer for shared data. If shared data is allocated separately, this should not be called but application has to properly initialize the shared data according to its need. Free callback and its argument is saved and the refcnt is set to 1. rte_pktmbuf_attach_extbuf() Definition at line 968 of file rte_mbuf.h. Attach an external buffer to a mbuf. User-managed anonymous buffer can be attached to an mbuf. When attaching it, corresponding free callback function and its argument should be provided via shinfo. This callback function will be called once all the mbufs are detached from the buffer (refcnt becomes zero). The headroom length of the attaching mbuf will be set to zero and this can be properly adjusted after attachment. For example, rte_pktmbuf_adj() or rte_pktmbuf_reset_headroom() might be used. Similarly, the packet length is initialized to 0. If the buffer contains data, the user has to adjust data_len and the pkt_len field of the mbuf accordingly. More mbufs can be attached to the same external buffer by rte_pktmbuf_attach() once the external buffer has been attached by this API. Detachment can be done by either rte_pktmbuf_detach_extbuf() or rte_pktmbuf_detach(). Memory for shared data must be provided and user must initialize all of the content properly, especially free callback and refcnt. The pointer of shared data will be stored in m->shinfo. rte_pktmbuf_ext_shinfo_init_helper can help to simply spare a few bytes at the end of buffer for the shared data, store free callback and its argument and set the refcnt to 1. The following is an example: struct rte_mbuf_ext_shared_info *shinfo = rte_pktmbuf_ext_shinfo_init_helper(buf_addr, &buf_len, free_cb, fcb_arg); rte_pktmbuf_attach_extbuf(m, buf_addr, buf_iova, buf_len, shinfo); rte_pktmbuf_reset_headroom(m); rte_pktmbuf_adj(m, data_len); Attaching an external buffer is quite similar to mbuf indirection in replacing buffer addresses and length of a mbuf, but a few differences: Definition at line 1050 of file rte_mbuf.h. Copy dynamic fields from msrc to mdst. Definition at line 1087 of file rte_mbuf.h. Attach packet mbuf to another packet mbuf. If the mbuf we are attaching to isn't a direct buffer and is attached to an external buffer, the mbuf being attached will be attached to the external buffer instead of mbuf indirection. Otherwise, the mbuf will be indirectly attached. After attachment we refer the mbuf we attached as 'indirect', while mbuf we attached to as 'direct'. The direct mbuf's reference counter is incremented. Right now, not supported: Definition at line 1126 of file rte_mbuf.h. Detach a packet mbuf from external buffer or direct buffer. All other fields of the given packet mbuf will be left intact. If the packet mbuf was allocated from the pool with pinned external buffers the rte_pktmbuf_detach does nothing with the mbuf of this kind, because the pinned buffers are not supposed to be detached. Definition at line 1216 of file rte_mbuf.h. Decrease reference counter and unlink a mbuf segment This function does the same than a free, except that it does not return the segment to its pool. It decreases the reference counter, and if it reaches 0, it is detached from its parent for an indirect mbuf. Definition at line 1308 of file rte_mbuf.h. Free a segment of a packet mbuf into its original mempool. Free an mbuf, without parsing other segments in case of chained buffers. Definition at line 1360 of file rte_mbuf.h. Free a packet mbuf back into its original mempool. Free an mbuf, and all its segments in case of chained buffers. Each segment is added back into its original mempool. Definition at line 1376 of file rte_mbuf.h. Free a bulk of packet mbufs back into their original mempools. Free a bulk of mbufs, and all their segments in case of chained buffers. Each segment is added back into its original mempool. Create a "clone" of the given packet mbuf. Walks through all segments of the given packet mbuf, and for each of them: Create a full copy of a given packet mbuf. Copies all the data from a given packet mbuf to a newly allocated set of mbufs. The private data are is not copied. Adds given value to the refcnt of all packet mbuf segments. Walks through all segments of given packet mbuf and for each of them invokes rte_mbuf_refcnt_update(). Definition at line 1460 of file rte_mbuf.h. Get the headroom in a packet mbuf. Definition at line 1477 of file rte_mbuf.h. Get the tailroom of a packet mbuf. Definition at line 1491 of file rte_mbuf.h. Get the last segment of the packet. Definition at line 1506 of file rte_mbuf.h. Prepend len bytes to an mbuf data area. Returns a pointer to the new data start address. If there is not enough headroom in the first segment, the function will return NULL, without modifying the mbuf. Definition at line 1549 of file rte_mbuf.h. Append len bytes to an mbuf. Append len bytes to an mbuf and return a pointer to the start address of the added data. If there is not enough tailroom in the last segment, the function will return NULL, without modifying the mbuf. Definition at line 1582 of file rte_mbuf.h. Remove len bytes at the beginning of an mbuf. Returns a pointer to the start address of the new data area. If the length is greater than the length of the first segment, then the function will fail and return NULL, without modifying the mbuf. Definition at line 1613 of file rte_mbuf.h. Remove len bytes of data at the end of the mbuf. If the length is greater than the length of the last segment, the function will fail and return -1 without modifying the mbuf. Definition at line 1643 of file rte_mbuf.h. Test if mbuf data is contiguous. Definition at line 1667 of file rte_mbuf.h. Read len data bytes in a mbuf at specified offset. If the data is contiguous, return the pointer in the mbuf data, else copy the data in the buffer provided by the user and return its pointer. Definition at line 1699 of file rte_mbuf.h. Chain an mbuf to another, thereby creating a segmented packet. Note: The implementation will do a linear walk over the segments to find the tail entry. For cases when there are many segments, it's better to chain the entries manually. Definition at line 1724 of file rte_mbuf.h. For given input values generate raw tx_offload value. Note that it is caller responsibility to make sure that input parameters don't exceed maximum bit-field values. Definition at line 1771 of file rte_mbuf.h. Validate general requirements for Tx offload in mbuf. This function checks correctness and completeness of Tx offload settings. Definition at line 1794 of file rte_mbuf.h. Linearize data in mbuf. This function moves the mbuf data in the first segment if there is enough tailroom. The subsequent segments are unchained and freed. Definition at line 1844 of file rte_mbuf.h. Dump an mbuf structure to a file. Dump all fields for the given packet mbuf and all its associated segments (in the case of a chained buffer). Get the value of mbuf sched queue_id field. Definition at line 1871 of file rte_mbuf.h. Get the value of mbuf sched traffic_class field. Definition at line 1880 of file rte_mbuf.h. Get the value of mbuf sched color field. Definition at line 1889 of file rte_mbuf.h. Get the values of mbuf sched queue_id, traffic_class and color. Definition at line 1907 of file rte_mbuf.h. Set the mbuf sched queue_id to the defined value. Definition at line 1922 of file rte_mbuf.h. Set the mbuf sched traffic_class id to the defined value. Definition at line 1931 of file rte_mbuf.h. Set the mbuf sched color id to the defined value. Definition at line 1940 of file rte_mbuf.h. Set the mbuf sched queue_id, traffic_class and color. Definition at line 1958 of file rte_mbuf.h.
https://doc.dpdk.org/api/rte__mbuf_8h.html
CC-MAIN-2022-21
refinedweb
2,836
68.06
Client-Side Development Section Index | Page 86 How do you change the coffee cup icon that appears in the top corner of frames? The setIconImage() method of the Frame class permits you to alter the icon displayed. Image image = ...; aFrame.setIconImage(image); See How do I display an Image in an Applet or Application? f...more How do we build a TabbedPane component using AWT? Swing provides a component called JTabbedPane that is rather good. If you cannot (or don't want to) use Swing for some reason, there are several ways to do this. The most common one is to create...more How do I create a window that always stays on top of my application? Without resorting to native code, you cannot do this. Do the Swing components support displaying international character sets? Yes. Assuming you have the proper font installed, the following will display Kanji characters for the Japanese numbers: import javax.swing.*; import java.awt.*; public class TableSample { publi...more How do you create custom cursors with the Java 2 platform? The createCustomCursor() method of the Toolkit class provides for the ability to create a cursor out of an Image. When creating custom cursors, be sure to take advantage of the hints available fro...more Where can I find additional look and feel implementations? The slaf look and feel ( is one such that look and feel that is itself customizable. The Up to Speed with Swing book includes a (partial).. How are individual pixels represented in memory? Each pixel is stored as a 32 bit integer (int). The int packs four unsigned bytes within it, one for each of the alpha, red, green, and blue (ARGB) color planes, in that order. Alph...more What's the difference between the swing.jar and swingall.jar files? The swingall.jar file contains all of the various, standard Swing Look & Feel implementations. The swing.jar file only contains the default Swing Look & Feel implementation. more
http://www.jguru.com/faq/client-side-development?page=86
CC-MAIN-2017-39
refinedweb
326
67.35
1 JSR 299 here. Web Beans is open source framework currently in the Alpha release. Gaving King, who is also the founder of famous framework JBoss Seam is also the specification lead for the Web Beans. There is lot of welcome notes for this framework and it solves many issues which is not addressed by the Java EE specifications. It is expected to be shipped with Java EE 6.0 edition. Lets jump into the next sections to read more about the Web Beans. also read: 2.What is Web Beans? What exactly is the Web Beans?. If you want to understand the real need for Web Beans, then little recap to the Java EE evolution is needed.. If the Java Bean has the constructor with no parameter, then it is a Web Beans. Almost every Java Bean you are writing in your code is a Web Beans by its nature. If you have existing applications with thousands of classes, you can make use of the Web Beans specification without touching the code. This can be done by the XML configuration for all the beans. The following are the few points to consider while writing the Web Beans: - To qualify as the valid Web Beans implementation, the beans must have no argument constructor. Web Beans manager calls this constructor for the initialization purpose. It is called once when the web Beans instance is created. - Web Beans can be implemented without no argument constructor, If it defines constructor with @Initializer annotation or any of the method with the @Initializer annotation. The methods or constructors with @Initializer will be called while bean instance is created. - Web Beans must be annotated with @Component. This annotation helps Web Beans manager to identify all the Web Beans in the classpath. Web Beans manager scans the classpath and load all the beans annotated with @Component. - From the Web Beans specification “A Web Bean implementation may be a Java class, an EJB session or singleton bean class, a producer method or a JMS queue or topic,” - @Initializer must be used exactly for the one constructor or one method in the class. Otherwise, DefinitionException is thrown by the Web Beans manager. EJB 3.0 has simplified the EJB programming model and heavy use of annotations. But, even though EJB 3.0 has lot of gaps which is not addressed by the EJB 3.0 specification. One of the main problem with the EJBs are, still it cannot be used directly in the presentation layer. In the existing EJB 3.0 specification, it doesn’t provide any facilities to use EJB’s as the JSF backing beans. This gap is not filled by any of the existing technologies in the Java EE edition. The main goal of the web Beans is to enable JSF using the EJB 3.0 as the managed beans. In one word, it simplifies the interaction between application layer and the presentation layer. Unifying the two component models and enabling a considerable simplification to the programming model for web-based applications in Java. This will help the rapid application developement. Web Beans specification will be more generalized to use by any technologies in future other than EJB 3.0 and JSF. 3.Web Beans Constructor 3.1.declaration using @Initializer Web Bean manager calls the Web Beans constructor to create the instance. The constructors for the Web Bean can be defined using the @Initializer annotation. The same declaration as follows: [code lang=”java”]@RequestScoped public class WebBeansSample{ @Initializer public WebBeansSample(){ } }[/code] In the above code, WebBeansSample is a simple Web Bean and its WebBeansSample() constructor will be invoked while creating the instance. @RequestScoped annotation specifies that the bean is visible to the other beans in the request scope. If there is only constructor in the class with no arguments, then it is not necessary to use the @Initializer annotation. @Initializer is mandatory only when if there is constructors with arguments that has to be used for the initialization purposes. Note that @Initializer can be used exactly one place in the class. That must be constructor or a method. The following code will throw DefinitionException by the Web Bean manager: [code lang=”java”]@RequestScoped public class WebBeansSample{ @Initializer public WebBeansSample(){ } @Initializer public WebBeansSample(InjectObject obj){ } }[/code] the above code is not valid since @Initializer is used two times. 3.2.declaration using XML The Web Beans constructors can be declared using the XML file. Web Beans are declared in the web-beans.xml file. The constructors definition can be written inside the bean element. Look into the following example: [code lang=”java”] <myapp:WebBeansSample> <RequestScoped/> <myapp:InjectObject/> </myapp:WebBeansSample> [/code] In the above code, myapp:InjectObject tells the Web Bean manager about the constructor. If the constructor definition is missing in the XML file, then it looks for the default no argument constructor in the class. When the constructor has parameters, Web Bean manager calls the method Manager.getInstanceByType() to get the value for the parameters. 5.Web Beans Lifecycle Web Beans lifecycle depends upon the type nature of the Web Beans. Web Beans can be anything like EJBs, JMS end points or Simple Java Beans. So the lifecycle also will be different for the different type of web beans. Creating and destruction is the common lifecylcle events for all types of web beans. But, the two events behave differenetly for the different type of beans. In the next section we will look into the Creation and Destruction of the web beans. 5.1.Web Beans Creation The create() is called when Web Beans instance is created. This method is responsible for completing the certain tasks before the instance is created. The following are list of tasks to be performed: - Getting the instance for the Web Bean - Creating interceptors and decorator objects and binding to the web bean instance. - Injects all the dependencies - Setting the initial values defined in XML file for the Web Bean. - Calls the @PostConstruct method if it is required. If there is any exception thrown while creating the instance, it will be rethrown by the create() method as the CreateException only if it is checked exception. 5.2.Web Beans Destruction The destroy() method is responsible for destroying the web beans. The following are the tasks performed by the destroy() method: - Calls the Web Bean remove method or disposal method - Calls the @PreDestroy method, if required - Destroys all dependent objects of the instance. Web Bean manager is allowed to destroy @Dependent scoped beans at any time. Summary In this article you have learnt about the basic concepts behind the Web Beans specification and the main goal of the framework. Also we have explained you about the constructors and lifecycle for the Web Beans. This article doesn’t explain you about writing the example program for Web Beans. We will be publishing series of articles on the Web Beans. So, please wait we will be coming with another article on web Beans soon.
https://javabeat.net/what-is-web-beans/
CC-MAIN-2022-05
refinedweb
1,160
56.25
Data science: equivalencias entre SAS, SPSS y R Data science: equivalencias entre SAS, SPSS y ...a course and uploading data. +Managing student's list and view .. ...Read and write properties for each data member } // Task 2 public class Node<T> { private T item; private Node<T> next; // constructor public Node(T item, Node<T> next) { [log ind for at se URL] = item; [log ind for at se URL] = next; } // Read and write properties or getter/setter for each data member public T ge... Looking for someone to do data entry on cryptocurrencies. Have a list of 114 coins, each coin requires up to 10 different fields of information that can be found on the internet. The work requires attention to detail and cannot be incorrect. I need a list of all "Butchers" in Queensland Australia - from Yellow pages data. The information for each entry needed is: Name, Phone, Email, Address and others. [log ind for at se URL] I have pictures of building tenants that i need to be placed into a spread sheet and then you'll need to go onto their website...need to go onto their websites and find their contact details/email addresses/linkedin for the director of the business. This list is small now, but from time to time i will hire you to do more data entry to add to the list. .. details & I want to read xml rdf file and [log ind for at se URL] ... I need you to fill in a spreadsheet with data. I need data mining for real estate. I need lead generation and list scrubbing? .. ...[log ind for at se items from the url 2. Enter the scraped data into a csv file that]', &... This is a data research project for our client based in Australia. You will be given a list of [log ind for at se URL] need to search them on Google AU and note the data. It will take 10-15 min daily for this task.]', &... Data has to be extracted from the Wikipedia and should be typed/copy-pasted into the word document. Accuracy is needed for the project and a sharp mind and fast typing speed. English speakers will be preferred. part to the project, if code could be provided for bi ...environments with a strong shop floor focus." And list of modules (maybe bullet point?): "Production Scheduling & Inventory Control, Purchasing & Supply Chain Management, Material Requirements Planning, Integrated Financials, Machine Integration, Android Application, Shop Floor Messaging & Management, Electronic Data Interchange (EDI), Advanced Product Qual) Nw list for data collection .. ...back all the records that can be listed. If the domain is listed on 3 severs, you will visit each server. you will then produce a list of all the information (this can be stored in a dictionary) You must clean up and data you receive. The purpose of this script is to allow us to monitor when record change. You are queuing the DNS not doing a zone transfer .. page, but with multiple rows (3) Product page hello, i have list of few prospect companies around 10k, i need some data mining expert to extract details of their CEO including his name, email and phone and services his company is offering. budget is $20 only We need an app to be built. The app is on basic school data search, sort, edit, add, view, download. There would be around 10 activities, 5 list view. APIs would be provided from our side. .. to remember: Code ...going to bid anyway, please listen this. Application will connect to Remote-config to get information about what pages they should load for particular items. For example, a list will be fetched from remote-config with all values like, Menu A = "URI001" Menu B = "URL002" Those values I will be changing as per my requirement to stay safe from those malicious Finding someone data entry operator who can find all ISO 9001 certified company UK list and mail thanks ... Data science: equivalencias entre SAS, SPSS y R
https://www.dk.freelancer.com/job-search/data-list/
CC-MAIN-2018-43
refinedweb
669
72.97
First we will need to dump the memory in Ollydbg. We can do this by right click on code, Backup, Save data to file, then save it. The next step we will need the address of the import table. Once we have the import table address we will need to view it in Ollydbg's dump window. The best way to view the import table is using Ollydbg's Long Address view. Now we will need to select all the API names, copy them to the clipboard, and save them to a text file. This will give us an output as seen below. 0087E000 7C865B1F kernel32.CreateToolhelp32Snapshot 0087E004 7C80981E kernel32.InterlockedExchange 0087E008 7C809A1D kernel32.LocalAlloc 0087E00C 7C8017E9 kernel32.GetSystemTimeAsFileTime 0087E010 7C810E17 kernel32.WriteFile 0087E014 7C80BC06 kernel32.OpenFileMappingA 0087E018 7C81CAFA kernel32.ExitProcess 0087E01C 7C82F863 kernel32.CopyFileW 0087E020 7C810B07 kernel32.GetFileSize 0087E024 7C8094EE kernel32.CreateFileMappingA 0087E028 7C80B995 kernel32.MapViewOfFile 0087E02C 7C810FC2 kernel32.lstrcatW 0087E030 7C830779 kernel32.GetTempPathW 0087E034 7C80B55F kernel32.GetModuleFileNameA 0087E038 7C80AEDB kernel32.LoadLibraryW 0087E03C 7C8099BF kernel32.LocalFree 0087E040 7C90FE01 ntdll.RtlGetLastWin32Error Now we will need to open up the memory dump in IDA. The memory image base will need to be changed to the start of the allocated memory. In the example above the base address was 0x00870000. To do this in IDA click on Edit, Segments, Rebase program..., then add the address to the value field. Odds are when IDA loaded the file up it identified code. If not you will need to find the entry point or an address that we know is code and press 'c'. If we are lucky IDA will have found some jmps to some dwords. Cool. Now we just need to rename the dwords to the API name that we exported from Ollydbg. This is pretty easy using Python and IDA. We just need to open up a dialogue box to import the exported APIs from Ollydbg, parse the file for the addresses and the names, then rename the address. Once completed we will have something that looks like this. Update An anonymous user left a helpful comment "if you drop the DLL prefix and run auto-analysis once more, you even get parameter propagation, granted you have the proper type library loaded.". I have modified the original code and image to reflect their helpful comment. To reanalyze in IDA right click on the bottom left hand corner of IDA and the choose reanalyze the program. Code from idaapi import * import idautils import idc class OLLYDBG_ADDR_TO_IDA: def __init__(self): self.fileName = AskFile(0, "*.*", 'Ollydbg Address Exported') self.content = [] self.getFile() self.renameAddr() def getFile(self): try: self.content = open(self.fileName, 'r').readlines() except: return def renameAddr(self): for addr in self.content: list_addr_name = addr.split() if len(list_addr_name) != 3: continue api_addr = int(list_addr_name[0],16) api_name = list_addr_name[2].split('.')[1] MakeNameEx(api_addr, api_name, SN_NOWARN) OLLYDBG_ADDR_TO_IDA() If you didn't know IDAScope has been released. DOWNLOAD And if you drop the DLL prefix and run auto-analysis once more, you even get parameter propagation, granted you have the proper type library loaded. Awesome, thank you for the tip. I'll update the post with a second modified version in the next couple of hours. Updated to reflect your comment. Thanks. This works great. You just saved me a bunch of time. Thanks Alex!
http://hooked-on-mnemonics.blogspot.com/2012/09/importing-ollydbg-addresses-into-ida.html
CC-MAIN-2017-22
refinedweb
550
61.83
Let’s say we have the following form: from django import forms class EventForm(forms.Form): # ... other fields when = forms.DateTimeField(widget=forms.SplitDateTimeWidget) What I want to do is render each date/time part of the SplitDateTimeWidget individually in a template, just as if they were regular fields defined on the form class itself. Something like this: <div class="date">{{ form.when.0.label_tag }} {{ form.when.0 }}</div> <div class="time">{{ form.when.1.label_tag }} {{ form.when.1 }}</div> Is there a way to achieve that using only public/documented APIs? Bonus points if I could actually write {{ form.when.date }} and {{ form.when.time }} instead of {{ form.when.0 }} and {{ form.when.1 }} but I suspect that might be a lot more complicated (possibly using namedtuples somehow). So far, I’ve only been able to achieve this result partially using a custom widget that overrides the subwidgets method: class CustomSplitDateTimeWidget(forms.SplitDateTimeWidget): def subwidgets(self, *args, **kwargs): for multiwidget_data in super().subwidgets(*args, **kwargs): for subwidget in multiwidget_data['subwidgets']: yield subwidget This lets me do {{ form.when.0 }} to render the field itself but I can’t render the <label> individually. Actually, doing {{ form.when.X }} might render the label depending on the type of subwidget. If the subwidget is a checkbox for example, it will render the both the label and the field, like so: <label ...><input ...></label>). Thoughts? Ideas? Thanks
https://forum.djangoproject.com/t/rendering-individual-subwidgets-for-a-multiwidget/465
CC-MAIN-2022-21
refinedweb
234
52.15
approaching Bondarev's *PoF* book Expand Messages - I wrote the following text a week ago, but haven't had a chance to post it before now. It was an invitation to a discussion, but now it seems that I won't be getting event the little time online that I normally get. So I won't be engaging in any discussion, but you can take this as a think piece or discuss it without me. RM *** Now I've had a little while to look over Jeff B.'s forwarded file of the first part of the translation of Bondarev's book on *PoF*. And I have to say *look over*, for I surely haven't read it all yet, even though it amounts to only the beginning of Bondy's huge book. I would despair of reading that book even in I had it in English; I suppose I might need the better part of a year to work through it. So, for now, about all I can offer are some of my impressions on starting to approach the book. -- Perhaps if others are also starting into the book, we could compare our impressions? And I said *impressions*; for me, I might have said *whimpers of frustration*. As I said before, I got the feeling that the book is a work of genius, and I still have that opinion, but now I really get the feeling that this is a *foreign* genius at work -- so foreign that my mind strains and fails at trying to work my way into the thoughts of such a genius. I'll try to explain what I mean by *foreign*. -- This fragment, in Jeff's Word document, is 155 pages long (big pages), but Bondy doesn't actually start into his close analysis of the text of *PoF* until page 139. The pages leading up to that point are filled mostly with Bondy's own philosophical foreplay, as it were. And it is this philosophy that is so foreign to me. It is foreign in a geographical sense, but not only that; it is foreign in a cultural sense, and more, in the sense of the mode of consciousness that is producing the thoughts. For Bondy seems to be what the Brits, and by derivation we Americans, would call a "Continental" philosopher. Those of us who have had at least a brush with academic philosophy in the English- speaking world will probably have at least a glimmer on what that term implies. I'll try to explain a little more. -- Generalizing broadly (and hence somewhat inaccurately in some cases, but that can't be avoided when giving just brief impressions), the philosophical consciousness in the English- speaking world might be called "nominalistic" and "sense-bound"; the term *classical British empiricism* isn't used for no good reason. (And of course, it wasn't for no good reason that Francis Bacon -- who was, as Steiner tells us, the reincarnated Haroun al Rashid, the main opponent of Aristotle, who was a previous incarnation of our very same Steiner -- himself was a Brit.) In America this quality is even intensified; America is, after all, the home of so-called philosophical "pragmatism". So, the kind of philosophy that was most in vogue some 40-odd years ago when I passed briefly through an American university (very briefly; if you'd blinked, you would've have missed me) was "sense-bound"; one might even say *earth-bound*. That was during the afterglow of the heyday of so-called "ordinary language philosophy", but the atmosphere of modern "British empiricism" was also ambient. (The latter seemed to be in the form of a modified, patched-up "logical positivism", which itself had its heyday in 1930s Vienna, but nevertheless wasn't "Continental" in the sense that I am using here; it was really more of a transplanted British empiricism, but that's another story.) There were differences between "ordinary language philosophy" and the modernized empiricism, but they were joined at least in mutual incomprehension, and even derision, toward the kind of philosophy that was prevalent on the "Continent" (of Europe), both in the present and the recent past. (And this, 40-odd years ago, was in the heyday of "Existentialism", and before the advent of "post-modernism", "narrative theory", etc.) Texts from philosophers such as Heidegger or Sartre might be used as paradigmatic examples of "philosophical nonsense", for instance. And classical "German Idealism" (Fichte and Hegel especially) was as much or even more uncomprehended and incomprehensible. Hegelianism had a vogue in the upper strata of British philosophical academia in the 19th Century, but modern, "serious", philosophy was considered to have had its start early in the 20th Century when Bertrand Russell and George Moore rebelled against the prevalent Hegelianism at Cambridge. That anomalous British Hegelianiam was regarded as it were an embarrassing, perverse lapse between the classical British empiricism from Bacon through Hume (let's not talk about Reid now) and the modern empiricism that began and was exemplified in Russell, and that lapse was mostly passed over in silence, and John Stuart Mill seemed to be almost the only Brit in the 19th Century worth mentioning. (Actually, there was in Russell a little spark of "Realism" in the Scholastic sense, or "ontological Platonism", but let's not talk about that now either; I'm painting the picture in broad strokes here.) Now, what was so "foreign" in the Continental thinkers was their practice of using words and concepts that couldn't readily be nailed down somewhere in the physical-sensory world. (One might object that *physical* and *sensory* are not equivalent concepts, but I'm allowing myself to be sloppy with my broad strokes; I'm trying to present more of a feeling-attitude than a conceptual analysis.) And they used such concepts not in mathematics, which is allowed in modern empiricism, but in places that . . . well, seem impossible to "place". For example, when Heidegger speaks of *Dasein* (*being- there*) or the *Nichts* (the *nothing*), or even the *Nichts* that *nichtet* (*nots*)-- the average British or American thinker can't do much but screw up his face and smirk, or laugh out loud, and shake his head from side to side. And neither can he do much with German Idealism, especially Hegel and his "Absolute" and all that; it's just incomprehensible. He regards it as a kind of philosophical sickness that needs therapy. Of course, the educated British or American philosopher will have read the Greeks (Plato and Aristotle especially, but they're ancient history) and the "Continental Rationalists" (Descartes, Spinoza, and Leibniz, but they're still "history") and Kant (who was "awakened" from his "dogmatic slumbers" by Hume, so whatever might be worthwhile in Kant is really British) -- and he has probably gritted his teeth and struggled through a survey of modern Continental currents (e.g. Schopenhauer, Kierkegaard, Nietzsche, maybe a little Sartre) - - but all these amount to unavoidable, even irksome, obligations if one is to be "cultured". "Serious" philosophy, the kind "one does", must be "analytic": there's logic and there's the empirical, the physical-sensory; that's all that's real; all the rest is fluff and nonsense. -- I might be exaggerating a little, but not a whole lot; and this picture might be somewhat distorted by my subjective peculiarities, but not entirely. My basic point is that the kind of consciousness -- typical on the "Continent", and especially in the German world --- that produces philosophical thinking not tied to the logical-empirical is really "foreign" to the typical philosophical consciousness in the English-speaking world, and especially to the typical U-S-American. And I am very much a U-S-American in consciousness, though perhaps not so typical, and especially not so much since my ongoing encounter with Anthroposophy. I surely didn't understand *PoF* the first time I read it, but gradually (with help from Kühlewind and from Otto Palmer's collection of Steiner-saids about *PoF*) I came to understand (so I allow myself to believe, at least) what Steiner meant by *pure thinking*, *living thinking*. And more importantly, I learned how to *do* it, and of course "doing" is very typically "American". And of course Steiner was very much within the tradition of German Idealism, and often was at pains to explain it and uphold it. Indeed, during the First World War he wrote a book (*The Riddle of Man*) defending German Idealism "with his life's blood". But he was not merely "within" that tradition; he was its culmination and rose above it to the plane of universality. And that universality comes through in *PoF*; it, for me, even as difficult as it is, is more accessible than Teutonic Idealist philosophy; e.g. Hegel especially. For in *PoF* thinking reaches a culmination where it passes from "philosophy" to something else. (Bondarev quotes RS: "The age of philosophy has been fulfilled.") This "something else" is Anthroposophy; indeed, the title of the final chapter of Steiner's *Riddles of Philosophy* is "From Philosophy to Anthroposophy". For in the "living thinking" as is taught in *PoF* one is not merely "thinking about" whatever; one is *doing* something definite ("intuitive thinking"), and this "doing" is experienced. And such experience is as "empirical" as you can get, though it is not sensory experience. We might call the *PoF* thinking *supersensory empiricism*. And now my point is that the "empiricism" of *PoF* thinking is relatively easy to grasp for this naturally empiricist U-S-American, because I can do it; I can experience it ("relatively" as compared to Hegel, Heidegger, etc., I mean). I'm talking about myself of course, but I would like to hope that I could generalize to observation to "Anglophones" in general, and *a fortiori* to U-S-Americans in general. For Anthroposophy is not merely German, or Central European, or even "Continental", but it is "universal human". Anthroposophy offers all of us, even hard-headed Americans, the opportunity to rise above the limitations of our *Volk* nature to the plane of the "universal human", to the status of a "free spirit", through the essence of our human-ness experienced in thinking. So, what does all this have to do with Bondarev's book? -- What's so frustrating to me about this book isn't his treatment of *PoF* as such; again, in Jeff's fragment he barely starts his analysis of *PoF* itself. My difficulty is with Bondy's 138-page run-up to that analysis. That run-up seems to me to consist mostly (not entirely) of the most incomprehensible sort of "Continental philosophy". Again: so far I have only scanned through it, not read it closely; it's just so hard to read. Bondy sweeps through the history of philosophy from the ancient Greeks to the present, and in the present especially employs the kind of non-sensory concepts that are so foreign to the mind that lives in the English language and archetypal consciousness. Holy unintelligibility, Batman; there's Fichte and there's Heidegger; there's Husserl and even Bondy's favorite unknown (to us) Russian, Nikolai Lossky; there's lots of Kant in his most "transcendental" aspects; and there's Hegel, Hegel, and more Hegel. There're concepts such as *immanence*, *otherness*, *panlogism*, *ideal-realism*, *intuitivism*, *phenomenological*, *trans-individual subject*, *illusionism*, *hierarchical personalism*, *voluntarist*, *intentionality of consciousness*, *absolute givenness*, *recreationism*, *Dasein*, *Wesen*, *Bedingtheit*, and so on. And more: there's the most abstract, abstruse, theology of the Trinity. And so on. -- So, the question for me is this: Am I having such a hard time because I'm stuck in the English language and English-American *Volk* characteristics while Bondarev is writing in the Russian language and from the Russian *Volk* characteristics, after taking his concepts (mostly) from the German language and *Volk* characteristics? Or is it because I'm under- educated or maybe just plain dim? I think that it might be easier for me to accept that I'm a member of an inferior race, or at least a mentally impaired race, than to accept that I'm just plain stupid. -- Well, what do you think? Do any Continental Europeans reading this email have the same kind of difficulties working through *this* book of Bondy's? (*Crisis* [*Kreuzung*] isn't nearly as hard to read.) Is *anyone* having as much trouble as I am? But maybe I am making it sound harder than it really is? Bondy, after all, does seem to be familiar with the "Western" philosophy of science, and he does work mainly on themes that should already be familiar to Anthros, especially *beholding* (*Anschauen*) and Goethe's familiar (or what should be familiar) "power of judgment in beholding" (*anschauende Urteilskraft*). -- But I'm still having a lot of trouble with it. Maybe it's just hard to understand a genius? But again, Bondy's *Crisis* book isn't so hard to understand. So I really do have to wonder whether much of my trouble comes from the fact that Bondy's mind is Russian and my mind is American. The Russian *Volk* character is, so Steiner tells us, at the opposite pole of the trichotomy West-Middle-East from the American *Volk* character -- the Russian being the more naturally "spiritual" and the American being the more naturally "materialistic". And here we have a Russian who has taken concepts mostly from the "Middle" (German) language and mind into his Russian language and mind and written this book in Russian. And then the Russian has been translated back into the German language, and then translated into English. And more, we have the complication that this particular Russian was born in the deepest abyss of Stalin's hellish tyranny, educated in "dialectical materialism" in the Ahrimanic (or Asuric) Soviet state educational system, and lived most of his life under the pervasive censorship and terror of the Soviet system. Only in the last twenty years or so has he been living (off and on?) in the Middle (Switzerland) near the headquarters of the Dornach Society, where he has not been welcomed with open arms. -- Really, I do have to wonder whether my difficulties are due not only to my own inadequacies but maybe also to more general differences of *Volk* character and language. And again, I haven't even yet read all the text that I have, and I haven't seen the diagrams. Bondy is often a pictorial thinker, and I would expect that the diagrams would help a lot. Still I have understood that his philosophical ponderings are leading into a deep, close analysis of *PoF*, and that this analysis deserves much work and attention. For instance, he portrays *PoF* as a great Mystery Drama: >>. . . . the "Philosophie der Freiheit" isexperienced by anyone who really begins to understand it, as a Mystery Drama, whose main hero is the new Dionysos-Prometheus who battles with all that has become, for the sake of individual evolution and the overcoming of inherited sin. But the Mysteries pursued, at all times, the goal of bringing about in the participant catharsis, moral purification. In the case at hand catharsis of the soul is absolutely essential, in order to eradicate everything that disturbs pure thought and beholding.<< More, he outlines a sevenfold process of dialectics, beyond the familiar threefold dialectics of Hegel (thesis-antithesis- synthesis). He understands this sevenfold dialectic as "musical" (the seven major notes of the scale leading to the octave), and he sees this sevenfold dialectic process as running throughout the text of *PoF*. And in this fragment he starts to show this sevenfoldness in *PoF* line by line. >>. . . . the riddles of the "Philosophy ofFreedom", a book written according to the laws of the sounding word; the latter determine in it the character of thinking, of the development of the ideas. Consequently, they have in the book their "melodies" and "harmonies", which one can raise into the light of consciousness. All this must be borne in mind from the beginning if we are to be able to experience with our sense of thought the character of the thinking in the "Philosophy of Freedom", when we begin to regard the work as a collection of practical exercises which contribute to the development of the power of judgment in beholding.<< And he does seek to show how *PoF* is a book of world-historic, even cosmic, significance -- how it helps us to grasp and fulfill Man's essential task at this moment of cosmic evolution. This aspect has social implications reaching back into his previous book that we have in English: >>. . . . the crisis of culture and civilizationhas its roots in the crisis of knowledge.<< So, I do verily wish to understand how, for instance, he came to discern this sevenfold dialectic and how he found it in *PoF* . . . and maybe even how his philosophic-epistemological mind works. I'll be working on it, slowly . . . and it might help to get some cross- fertilization from others who are also working on it. Bondarev says: >>[RS] wrote the 'Philosophy of Freedom'(Spiritual Activity) at the crossing-point of the philosophy of pure thinking and the esotericism of thinking; it is, one could say, written with morphological thinking. This phenomenon is quite unique and it is so difficult, for this reason, to find a relation to it. The present work is an attempt to remove some of the difficulties on the path to a mastery of this qualitatively new thinking, which forms the central core of Anthroposophical methodology.<< Robert Mason Your message has been successfully submitted and would be delivered to recipients shortly.
https://groups.yahoo.com/neo/groups/steiner/conversations/topics/5091?l=1
CC-MAIN-2015-48
refinedweb
2,939
54.97
MAPMODE(3) Library Routines MAPMODE(3) _mapMode2GS, _mapMode2Unix, _getModeEmulation, _setModeEmulation - (mapMode) perform mappings between Unix and GS/OS file permissions. #include <sys/types.h> #include <gno/gno.h> mode_t _mapMode2GS (mode_t mode); mode_t _mapMode2Unix (mode_t mode); int _getModeEmulation (void); int _setModeEmulation (int newval); These routines are used to do mappings for file access bits between Unix and GS/OS file systems. Under Unix, the lower nine bits of a mode are broken into groups of three. From most to least significant, these sets of three bits are used for User, Group, and Other permissions. Within each set, the bits refer to Read, Write, and Execute permissions. Under GS/OS, each file has associated with it bits for Read, Write, Invisible, Backup, Rename, and Destroy. By default, the system calls chmod(2), creat(2), and open(2) expect their mode parameters to be Unix modes. Before the underlying GS/OS toolset calls are made, these system calls therefore do mode mapping via the _mapMode2GS call. (The system calls fstat(2), lstat(2), and stat(2) always return Unix modes in their st_mode fields). _mapMode2GS takes a Unix mode parameter and maps it the GS/OS equiva- lent. If the User Read bit is set in mode, the Read bit will be set in the result. If the User Write bit is set in mode, all of the Write, Rename, and Destroy bits will be set in the result. Regardless of the value of mode, the Invisible bit is always cleared and the Backup bit is always set. The reverse mapping may be achieved through _mapMode2Unix. This func- tion takes a GS/OS mode parameter and maps it the Unix equivalent. If the Read bit in mode is set, then the User, Group, and Others Read bits in the result will be set. If all of the Write, Rename, and Destroy bits are set in mode, then the User, Group and Others Write bits will be set in the result. (If any of these three are cleared, the Write bits will not be set.) The result is bitwise ANDed with the umask(2) before _mapMode2Unix returns the value. The high 7 bits (of 16) of the result are always cleared. There are times when it may be desirable to disable the mappings done by _mapMode2Unix and _mapMode2GS. This functionality is achieved through the _setModeEmulation function. If newval is zero, the mode mapping is turned off; the mapping functions act as null ops. This implies that the mode parameters of the above system calls will be interpreted as GS/OS modes, (see the CreatGS tool call in the GS/OS Reference Manual). If a non-zero value is given for newval, the mode mapping functions are reactivated. _getModeEmulation allows the application programmer to determine whether or not the mapping functions are currently active. The Orca/C implementations of chmod(2), creat(2), and open(2) expect GS/OS mode values, which is the opposite of the default for this imple- mentation. _getModeEmulation, _mapMode2Unix, and _mapMode2GS are thread safe. _setModeEmulation is not. _getModeEmulation and _setModeEmulation return the current or previous emulation value (zero or one), respectively. _mapMode2GS and _mapMode2Unix return the appropriately mapped mode or, if mapping has been disabled, the original value of mode. Since these routines don't known anything about file systems, nothing smart is done for permissions in an AppleShare environment. The mappings performed by these routines are by their nature not entirely reversable. Devin Reade <gdr@gno.org> chmod(2), creat(2), open(2), stat(2), umask(2), The Apple IIgs GS/OS Reference. GNO 14 December 1996 MAPMODE(3)
http://www.gno.org/gno/man/man3/mapMode.3.html
CC-MAIN-2018-47
refinedweb
601
56.05
This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers. We all know unit testing is an important aspect of developing and verifying the code we write in our .NET IDEs. We want our tests to cover the smallest isolated segments of code in our .NET solutions and to cover as many code paths as possible to ensure our code behaves as expected. Sometimes testing the logic of the code is not enough. While memory profilers are not the tools most of us use every day, we should use them more often. Usually, they only get used later in the development process when things go wrong or to fix bugs. What if we could leverage a memory profiler in our unit tests? Then we could have the peace of mind to know that our code is not only written well logically but also uses memory efficiently. Most developers will start up a memory profiler when there is a problem. We should make a plan on using memory profilers throughout the development process and not just when we think we have found a bug involving a memory leak in our code. That is a very valid reason, but it is like treating a sick person with medicine. Why not subscribe to preventive care as we do in our own lives? We should plan, exercise and be disciplined with testing our code to make sure that our applications consume and use the expected memory. What should we test with dotMemory Unit? First, we should identify the areas of the applications that we know consume the largest amount of memory. We should also test those areas that need to dispose of a large number of objects like loops involving data queries from our data sources. Last we should check how our applications use a lot of memory for data traffic. All of our tests can finally have their memory snapshots saved at the end of the unit tests runs for us to examine the consumption patterns and behaviors. We can also use dotMemory Unit to test to see if certain types of objects are being instantiated and used in code that our unit tests are covering. Also, we can use dotMemory Unit to test the differences between a saved snapshot and the current memory usage. As we have seen, there are quite a few areas during the entire development process that can benefit from using dotMemory Unit enhanced unit tests. In addition to using dotMemory Unit for unit tests, the tool also can support the need for functional and integration testing during the development process. Now let’s look at how we create and use these special unit tests. We will next look at how to work with dotMemory Unit in our .NET Framework and .NET Core solutions and projects. There are two ways to include dotMemory Unit in our .NET solutions. The first is to install the dotMemory Unit NuGet package into our project. In Visual Studio we can add the package through the Package Manager Console using the following command: Install-Package JetBrains.DotMemoryUnit In Rider IDE, we can add the JetBrains.DotMemoryUnit package using the NuGet window as shown below. We can also download the necessary files (including the standalone dotMemory launcher) and include and reference the libraries from our .NET solutions. You can find the download at the dotMemory Unit homepage. We can use most unit testing frameworks from the ReSharper’s Test Runner in ReSharper and the Rider with dotMemory Unit including xUnit, NUnit and MSTest. We can also run our unit tests from JetBrains’ dotCover product. Just understand that dotMemory Unit is not a test runner on its own and we will use it in cooperation with the supported unit testing frameworks. The features of dotMemory Unit go beyond just adding new capabilities in unit tests. After the unit tests have been run, we can save the memory profile snapshot that can be used to compare to future unit tests and also can be open and analyzed in JetBrains dotMemory tool. We can also run the unit tests created with dotMemory Unit tests from the standalone dotMemory Unit executable. This will allow us to include our tests in our DevOps workflows such as Continuous Integration (CI) and Delivery (CD). When running our unit tests, we will have available additional menu options to run our tests under dotMemory Unit. Let’s look at several different ways we can use dotMemory Unit in the unit testing we perform in our .NET and .NET Core solutions. We will start with something simple and get more advanced. As a note, I will be using xUnit framework for my unit testing examples. Note: when using xUnit, dotMemory Unit’s output will not be visible by default. In order to make it visible, we’ll have to instruct it to use xUnit’s output helper in the unit test class’ constructor: One of the most useful cases we can test for is finding a leak by checking memory for objects of a specific type. We use this type of test to identify performance issues caused by memory traffic in our applications. In the example above, we are passing a lambda to the Check() method. This will only be done if we run the test using Run Unit Tests under dotMemory Test. The memory object passed to the lambda contains all memory data for the current execution point. The GetObjects() method will return a set of Album objects passed in the second lambda. Finally, the Assert() will check to verify that only a single Album object was passed in the memory object. Check() GetObjects() Assert() The test for checking memory traffic is even simpler. All we need to do is mark the test with the <span lang="IT">AssertTraffic</span> attribute. In the example below, we assert that the amount of memory allocated by all the code in DotMemoryTrafficUnitTest() method does not exceed 1,000 bytes. <span lang="IT">AssertTraffic</span> DotMemoryTrafficUnitTest() We can use checkpoints not only to compare traffic but also for other kinds of snapshot comparisons. In the example below, we assert that no objects from the <span lang="NL">Chinook</span> namespace survived garbage collection in the interval between memoryCheckPoint1 and the second dotMemory.Check() call. <span lang="NL">Chinook</span> memoryCheckPoint1 dotMemory.Check() If we need to get more complex information about memory traffic, we can use a similar approach to the one from the first example. The lambdas passed to the dotMemory.Check() method verify that the total size of objects implementing the <span lang="PT">Album</span> class created in the interval between memoryCheckPoint1 and memoryCheckPoint2 is less than 1,000 bytes. <span lang="PT">Album</span> memoryCheckPoint2 What if we cannot use ReSharper and Rider because of where we work or our team’s selected development tools? What if we do want to run tests with a standalone unit test runner (rather than Visual Studio or Rider) or want to make memory tests a part of our continuous integration builds? JetBrains has made those scenarios easy to handle! We can use the standalone dotMemory Unit executable – the dotMemoryUnit.exe command-line tool. dotMemoryUnit.exe works as a mediator – it runs a standalone unit test runner and provides the support for dotMemory Unit calls in the running tests. In the simplest case, all we have to do is specify the path to our unit test runner and its arguments. For instance, in the following example we want to run NUnit tests from the MainTests.dll: dotMemoryUnit.exe "C:\NUnit 3.11.0\bin\nunit-console.exe" -- "E:\MyProject\bin\Release\MainTests.dll" By default, if the tool finishes its work successfully, its exit code is 0. This is not very convenient when we run the tool on the CI server as we will need to know whether there are any failed tests in the build. In such a case, the best option is to make dotMemoryUnit.exe return the exit code of the unit test runner. To do this, we should use the --propagate-exit-code argument. For example: dotMemoryUnit.exe "C:\NUnit 3.11.0\bin\nunit-console.exe" --propagate-exit-code -- "E:\MyProject\bin\Release\MainTests.dll" The workspaces that are generated and saved by dotMemory Unit can be opened with the stand-alone JetBrains’ app dotMemory. The location where dotMemory Unit saves the *.dmw files by default is our computer’s temp location (%temp%). In some cases, we may want to redefine the workspace files’ location. This is done with the help of DotMemoryUnitAttribute placed before an assembly, a test class, or a test method. DotMemoryUnitAttribute Opening dotMemory in this example will show the details of the two stored snapshots and allow us to see the comparisons and differences. dotMemory Unit is very flexible and allows you to check almost any aspect of app memory usage. Use "memory" tests in the same way as unit tests on app logic: Thanks for reading and don’t hesitate to try dotMemory Unit on your own! It’s absolutely free, and the only requirement is Rider, ReSharper or dotCover installed on your machine. This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
https://www.codeproject.com/Articles/1270862/Discovering-and-Fixing-Memory-Issues-with-dotMemor
CC-MAIN-2018-51
refinedweb
1,570
54.73
US5910960A - Signal processing apparatus and method - Google PatentsSignal processing apparatus and method Download PDF Info - Publication number - US5910960AUS5910960A US08480721 US48072195A US5910960A US 5910960 A US5910960 A US 5910960A US 08480721 US08480721 US 08480721 US 48072195 A US48072195 A US 48072195A US 5910960 A US5910960 A US 5910960A - Authority - US - Grant status - Grant - Patent type - - Prior art keywords - sub - data - circuit - signal -62—Setting decision thresholds using feedforward techniques only - division of application Ser. No. 08/481,107, filed Jun. 7, 1995, now U.S. Pat. No. 5,668,831. This Application is related to British Application GB 9511568.9, filed Jun. 7, 1995. 1. Field of the Invention This invention relates to processing signals received from a communications channel. More particularly this invention relates to an integrated signal processing system for receiving signals suitable for use in the transmission of video, "hi-fi" audio, images or other high bit rate signals. 2. Description of the Related Art Encoded transmission of inherently analog signals is increasingly practiced today as a result of advances in signal processing techniques that have increased the bit rate achievable in a channel. At the same time new data compression techniques have tended to reduce the bandwidth required to acceptably represent analog information. The art is presently striving to more efficiently transmit video and audio data in applications such as cable television using digital techniques. Various modulation techniques have been employed in digital communications. For example quadrature amplitude modulation (QAM) is a relatively sophisticated technique favored by practitioners of digital radio communications. This method involves two separate symbol streams, each stream modulating one of two carriers in quadrature. This system achieves spectral efficiencies, between 5-7 bits/sec-Hz in multilevel formats such as 64-QAM and 256-QAM. QAM is particularly useful in applications having a low signal-to-noise ratio. However double sideband modulation is required. Furthermore cross-coupled channel equalizers are generally needed, which adds to the overall complexity of the system. A variant of QAM is quadrature phase shift keying (QPSK), in which a signal constellation consisting of four symbols is transmitted, each having a different phase and a constant amplitude. The scheme is implemented as the sum of orthogonal components, represented by the equation. A.sub.m =be.sup.jB.sbsp.m where θm can be any of {0, π/2, π, 3π/2}. It is necessary to transmit both sidebands in order to preserve the quadrature information. Another modulation scheme known to the art is vestigial sideband (VSB) modulation, which is achieved by amplitude modulating a pulsed baseband signal, and suppressing a redundant sideband of the amplitude modulated (AM) signal, in order to conserve bandwidth. Usually the lower sideband is suppressed. In the digital form of VSB, a digital pulse amplitude modulated (PAM) signal is employed. It is proposed in Cifta et al., Practical Implementation of a 43 mbit/Sec (8 bit/Hz) Digital Modem for Cable Television, 1993 NCTA Technical Papers, pp 271-278, to implement a 16 level VSB modulation method in cable television applications, wherein symbols of 16 discrete methods are amplitude modulated, using carrier suppression and transmission of a vestigial sideband in a 6 MHz channel. Transmission of a low level pilot carrier, located approximately 310 kHz above the lower channel edge, is included to assist in signal detection. The arrangement provides for the transmission of 43 Mbit/sec, but requires a passband of 5.38 MHZ at 4 bits/symbol. It is therefore a primary object of the present invention to provide an improved system for the communication of digital data in a constrained channel. It is another object of the invention to provide an improved, economical apparatus for receiving and decoding data at high bit rates, such as video and audio signals. It is yet another object of the invention to provide an improved, highly accurate analog-to-digital converter which can operate at high speeds and is suitable for the processing of video signals. It is still another object of the invention to provide an improved compact filter that can reduce a modulated signal to a complex baseband representation and concurrently perform a Nyquist operation. It is a further object of the invention to provide an improved and highly compact deinterleaving circuit that can be economically implemented in a semiconductor integrated circuit. It is another object of the invention to provide an output interface for a digital receiver that synchronizes the data flow through the receiver with a transmission rate of the signal. These and other objects of the present invention are attained by a passband pulse amplitude modulation (PAM) receiver employing multilevel vestigial sideband modulation. A particular form of the invention is suitable for transmitting MPEG 2 transport layer data. MPEG is a standard well known to the art, in which data is grouped in a plurality of packets, each of which contains 188 bytes. This number was chosen for compatibility with asynchronous transfer mode (ATM) transmissions, another known telecommunication standard. The apparatus disclosed herein relies on randomization of the data prior to transmission, using a signal constellation having a zero mean. The invention provides a signal processing apparatus for the reception of data packets that are transmitted through a channel, wherein the data packets include information data and error correction data for correcting errors in the received data, and the packets are represented in a modulated signal having pretransmission characteristics, and are demodulated following transmission. The signal processing apparatus comprises an analog-to-digital converter for sampling an input signal following transmission of the input signal through a communications channel. A timing recovery circuit is coupled to the analog-to-digital converter output for adjusting the frequency and the phase of the sampling intervals. A carrier recovery circuit is coupled to the analog-to-digital converter output for adjusting the frequency and phase of the input signal. An automatic gain control circuit is also coupled to the analog-to-digital converter output, and provides an error signal that is indicative of a magnitude of the input signal and a reference magnitude. A filter conforms the analog-to-digital converter output to pretransmission characteristics of the input signal. An adaptive equalizer is coupled to the filter, and has characteristics that are adaptively varied in accordance with predetermined information encoded in the modulated signal, so that the equalizer output compensates for channel characteristics. An error correcting circuit is coupled to the equalizer and to an output interface. The timing recovery circuit, the carrier recovery circuit, the equalizer, the error correcting circuit, and the output interface are integrated on a semiconductor integrated circuit. In an aspect of the invention the modulated signal is modulated by vestigial sideband modulation, and there is provided an amplifier coupled to the channel and accepting the modulated signal therefrom, and a demodulator coupled to the amplifier for producing a demodulated signal. In another aspect of the invention a plurality of the data packets are grouped in frames, each frame further comprising a frame header, while the predetermined information comprises a training sequence in the frame header. In another aspect of the invention the equalizer comprises a first response filter, and a circuit for adjusting coefficients of the first response filter that is responsive to an error signal that is derived from a difference between an output of the first response filter and the predetermined information. The circuit for adjusting the coefficients executes the signed least-mean-square algorithm. The equalizer also includes a phase tracking circuit for producing an in-phase component and a quadrature component that is representative of the modulated signal in accordance with the formula data=a (t)cosφ'a (t)sinφ wherein data is an output; φ is phase error; a(t) is transmitted data; and a(t) is the quadrature component of a(t). The phase tracking circuit output is in accordance with the formula output.sub.c =a(t)(cosθ cosφ+sinθ sin φ)+a(t) (sinφ cosθ-cosφsinθ) wherein θ is an angle of rotation of a signal constellation of the modulated signal. The phase tracking circuit comprises a second response filter, and a circuit for estimating the angle θ according to the least-mean-square algorithm. In another aspect of the invention the first and second response filters are finite impulse response filters, and the second response filter performs a Hilbert transform. In another aspect of the invention blocks of the packets are interleaved at an interleaving depth, and a deinterleaving circuit is incorporated in the integrated circuit. The deinterleaving circuit comprises a random access memory for memorizing the interleaved packets, which has a capacity that does not exceed a block of interleaved data, and is organized in a plurality of rows and a plurality of columns, wherein the rows define a plurality of groups. A first circuit generates an address signal representing a sequence of addresses of the random access memory, wherein successive addresses differ by a stride. A second circuit successively reads and writes data out of and into the random access memory respectively at an address of the random access memory that is determined by the address signal. A third circuit increases the stride by the interleaving depth, wherein the stride is increased upon deinterleaving of a block of interleaved data. In another aspect of the invention the deinterleaving circuit further comprises a control circuit for operating the second circuit in a selected one of a first operating mode, wherein the random access memory is accepting incoming data and is not producing outgoing data; a second operating mode, wherein the random access memory is accepting incoming data and producing outgoing data; and a third operating mode, wherein the random access memory is not accepting incoming data and is producing outgoing data. The first circuit comprises a predecoder that preselects one of the groups of rows in the random access memory, and a row decoder that selects a row of the preselected group. An input of the analog-to-digital converter has a modulated input that exceeds baseband, and the filter has a plurality of coefficients that are arranged to reduce the output of the analog-to-digital converter to a complex baseband representation of the modulated signal. In an aspect of the invention the integrated circuit is a CMOS integrated circuit. In another aspect of the invention the filter is integrated in the integrated circuit. In another aspect of the invention the analog-to-digital converter is integrated in the integrated circuit. In another aspect of the invention the automatic gain control circuit is integrated in the integrated circuit. In another aspect of the invention the analog-to-digital converter comprises a comparator having first and second units, each of the units comprising a capacitor connected to a first node and a second node. A first switch means connects the first node to a selected one of an input voltage and a reference voltage. An inverter is connected to the second node and has an output, and the inverter has a small signal gain between the second node and the output thereof. A second switch means connects the output of the inverter of one of the first and second units to the first node of another of the first and second units, whereby the first and second units are cross-coupled in a positive feed back loop when the second switch means of the first unit and the second switch means of the second units are closed. The output of the inverter is representative of a comparison of the input voltage and the reference voltage. Each unit further comprises a third switch means for connecting the first node and the output of the inverter, whereby an input of the inverter is zeroed. In another aspect of the invention the inverter, the first switch means, the second switch means, and the third switch means comprise MOS transistors. In another aspect of the invention the filter down converts the input signal to complex baseband representation and performs a Nyquist operation on the input signal. In another aspect of the invention the error correcting circuit comprises a Reed-Solomon decoder, which comprises a circuit for executing a Berlekamp algorithm. The circuit comprises a first register for holding a portion of a locator polynomial Λ(x), a second register for holding a portion of a D polynomial, a first switch means for alternately selecting the first register and the second register in successive iterations of the Berlekamp algorithm. The circuit further comprises a third register for holding a portion of an evaluator polynomial Ω(x), a fourth register for holding a portion of an A polynomial, and a second switch means for alternately selecting the third register and the fourth register in successive iterations of the Berlekamp algorithm. The invention provides a method of signal processing received data packets that are transmitted through a channel, wherein the data packets include information data and error correction data for correcting errors in the received data, and the packets are represented in a modulated signal having pretransmission characteristics, and are demodulated following transmission, comprising the steps of sampling an input signal at sampling intervals following transmission of the input signal through a channel. While the step of sampling is being performed, a frequency and a phase of the sampling intervals and a frequency and a phase of the input signal are adjusted. An error signal is provided that represents a difference between the signal that is indicative of a magnitude of the input signal and a reference magnitude. The sampled input signal is filtered to conform a post-sampling characteristic thereof to a pretransmission characteristic thereof. The filtered input signal is adaptively equalized in accordance with predetermined information encoded in the modulated signal in order to conform the filtered input signal to characteristics of the channel. The adaptively equalized input signal is submitted to an error correcting circuit to produce corrected data, and the corrected data is output. The step of adjusting a frequency and a phase of the input signal, the step of providing an error signal, the step of filtering the sampled input signal, the step of adaptively equalizing the filtered input signal, and the step of submitting the adaptively equalized input signal to an error correcting circuit are performed using a semiconductor integrated circuit. The invention provides a filter for operating upon a sampled signal comprising an arrangement of adders, multipliers, and multiplexers having a pulse-shaping response, in which the multipliers are arranged to multiply factors corresponding to samples of the signal by constant coefficients, the constant coefficients are selected for use in simultaneously shifting the signal in frequency and shaping pulses of the sampled signal according to the pulse-shaping response. In one aspect of the invention the pulse-shaping response is a square-root raised cosine response. In an aspect of the invention the pulse-shaping response is a square-root raised cosine response. The invention provides a filter for operating upon a signal sampled at a rate exceeding the minimum Nyquist sampling frequency, which has an arrangement of multipliers, adders, and multiplexers arranged to operate upon a first portion of samples of the sampled signal while discarding a second portion of the samples, thereby preserving information transmitted within the bandwidth of the sampled signal, while reducing the number and frequency of the samples to be propagated. In an aspect of the invention the first portion of the samples corresponds to symbol pulses. In another aspect of the invention the first portion of the samples corresponds to one symbol per sample. The invention provides an output interface for transferring data from a data source operating at a first clock rate provided by a first clock signal to a data sink operating at a second clock rate provided by a second clock signal. The interface has a first latch operable at the first clock rate, a second latch operable at the second clock rate. The second latch receives data from the first latch. The interface includes a first signal generator operable at the first clock rate, producing a data valid signal, and includes at least one third latch operable at the second clock rate. The third latch receives the data valid signal from the first signal generator in response to the second clock signal. A second signal generator is operable at the second clock rate, and activates a load data signal to the second latch in response to receipt of the data valid signal from the third latch. Data is thereby transferred from the first latch to the second latch in response to receipt by the second latch of the second clock signal when the load data signal is active. The invention provides an output data error signaling system for signaling the presence or absence of an error in at least one multiple byte packet to an external processing environment. The multiple byte packet includes at least one error indicator, and has a buffer, the buffer storing at least one multiple byte packet. There is provided a packet error indicator, signaling an error condition of the packet to the external processing environment after receipt by the buffer of at least a portion of a packet containing an active error indicator bit. For a better understanding of these and other objects of the present invention, reference is made to the detailed description of the invention which is to be read in conjunction with the following drawings, by way of example wherein: FIG. 1 is a block diagram of a communication system that is embodied by the present invention; FIG. 2 is a diagram indicating mappings of a bitstream to 16-VSB symbols for transmission thereof by the system shown in FIG. 1; FIG. 3 is a diagram indicating mappings of a bitstream to 8-VSB symbols for transmission thereof by the system shown in FIG. 1; FIG. 4 is a block diagram of a digital receiver capable of receiving VSB signals from a channel similar to that shown in the data communication system of FIG. 1; FIG. 4a is a more detailed block diagram of a portion of the receiver shown in FIG. 4; FIG. 4b is a block diagram similar to FIG. 4 of an alternate embodiment of the invention; FIG. 5a is an electrical schematic illustrating a comparator that is helpful in understanding an aspect of the invention; FIG. 5b is a more detailed electrical schematic of a comparator in accordance with the invention; FIG. 6a is a schematic illustrating a preferred embodiment of the circuit shown in FIG. 5b; FIG. 6b is an electrical schematic of an inverter used in the circuit shown in FIG. 6a; FIG. 7 is a diagram indicating the format of a packet of data that is processed by the system illustrated in FIG. 1; FIG. 8 is a functional block diagram of the Reed-Solomon decoder that is incorporated in the system illustrated in FIG. 1; FIG. 9 is a block diagram of the Reed-Solomon decoder which operates according to the process illustrated in FIG. 8; FIG. 10 is a diagram of a hardware arrangement for generating entries of a Galois Field; FIG. 11 is a block diagram of a FIFO that is incorporated in the decoder illustrated in FIG. 8; FIG. 12 shows a hardware arrangement for generating syndromes in the process illustrated in FIG. 8; FIG. 13 shows a flow diagram of the Berlekamp algorithm used in a Reed-Solomon decoder in the prior art; FIG. 14 shows a block diagram of an apparatus used to perform the Berlekamp algorithm used in a Reed-Solomon decoder in accordance with the process illustrated in FIG. 8; FIG. 15 shows a block diagram of the arrangement for accomplishing a Chien search in the process shown in FIG. 8; FIG. 16 is a schematic showing aspects of a RAM used in the deinterleaver shown in FIG. 21; FIG. 17 is a timing diagram that illustrates the operation of the RAM shown in FIG. 16; FIG. 18 is a schematic of hardware for implementing an addressing arrangement in the deinterleaver shown in FIG. 21; FIG. 19 is a schematic of a circuit for determining the stride rate for the deinterleaver shown in FIG. 21; FIG. 20 is a schematic of a circuit for controlling the mode of operation of the RAM illustrated in FIG. 16; FIG. 21 is a schematic in block form for the deinterleaver used in the process shown in FIG. 4; FIG. 22 is a diagram illustrating a generator of cyclic redundancy data; FIG. 23 is a diagram illustrating the VSB frequency spectrum at the input to the analog-to-digital converter of the receiver illustrated in FIG. 4; FIG. 24 is a flow diagram illustrating the process of channel acquisition by the receiver shown in FIG. 4; FIG. 25 is a detailed flow diagram illustrating synchronization detection in the process illustrated in FIG. 24; FIG. 26 is a block diagram illustrating the automatic gain control circuit in the receiver shown in FIG. 4; FIG. 27 is an electrical schematic of the circuit shown in FIG. 26; FIG. 28 is a more detailed electrical schematic of a portion of the circuit illustrated in FIG. 27; FIG. 29 is a detailed block diagram of the automatic gain control circuit depicted in FIG. 26; FIG. 30 is an electrical schematic of the sigma-delta block of the automatic gain control circuit of FIG. 26; FIG. 31 is an electrical schematic of the lock detector block of the automatic gain control circuit of FIG. 26; FIG. 32 is a block diagram of a core of the adaptive equalizer of the receiver shown in FIG. 4; FIG. 33 is a schematic of a portion of the adaptive equalizer finite impulse response filter core illustrated in FIG. 32; FIG. 34 is a block diagram of the adaptive equalizer of the receiver shown in FIG. 4; FIG. 35 is a schematic of the derotater employed in the adaptive equalizer shown in FIG. 34; FIG. 36 is a block diagram generally showing a derotater; FIG. 37 is a more detailed diagram of a Hilbert filter used in the phase tracker shown in FIG. 35; FIG. 38 is a more detailed schematic of another portion of the phase tracker shown in FIG. 35; FIG. 39 is a block diagram of a state machine which controls the adaptive equalizer and the phase tracker shown in FIGS. 35 and 37-38; FIG. 40a is a detailed schematic of the adaptive equalizer shown in FIG. 34; FIGS. 40b and 40c show independent and joint adaptation mode of operation of the adaptive equalizer and phase tracker shown in FIG. 34; FIG. 41 is a block diagram of the descrambler used in the adaptive equalizer shown in FIG. 34; FIG. 42 is a diagram of a digital filter that is helpful in understanding the operation of the invention; FIG. 43 is a diagram of a digital filter illustrating an optimization process; FIG. 44 is a diagram of a matched filter according to the invention; FIG. 45 is a schematic of a portion of the even-numbered taps in the filter shown in FIG. 44; FIG. 46 is a schematic of a portion of the odd-numbered taps in the filter shown in FIG. 44; FIG. 47 is a schematic of a DC removal circuit according to the present invention; FIG. 48 is a block diagram of the carrier recovery circuit used in the receiver according to the present invention; FIG. 49 is a schematic of the carrier recovery circuit shown in FIG. 48; FIG. 50 is a representative prior art discrete time filter; FIG. 51 is an alternate embodiment of portions of the carrier recovery circuit shown in FIG. 49; FIG. 52 is a diagram illustrating the sigma-delta modulator in the circuit shown in FIG. 49; FIG. 53 is a block diagram of the timing recovery circuit as used in the receiver according to the present invention; FIG. 54 is a detailed electrical schematic of the timing recovery circuit according to the present invention; FIG. 55 is a schematic of a portion of the output interface in the receiver according to the present invention; and As used herein the notation sK.N indicates signed 2's complement integers having a magnitude varying from 0 to 2K -1, and N bits of fraction. An unsigned integer is represented as K.N. Turning now to the Drawing, and to FIG. 1 thereof, a communication system that is embodied by a preferred embodiment of the invention is generally referenced 10. A data source 12, such as a television signal, is submitted to a source encoder 14 to yield a bit stream that is processed through a channel encoder 16. It will be understood by those skilled in the art that the source encoder 14 is arranged to minimize the bit rate required to represent the data with a desired fidelity, and that the channel encoder 16 maximizes the information rate conveyed through a channel with less than a predetermined bit error probability. The arrangement of the data is discussed for convenience with reference to the MPEG2 (ISO/IEC JTC1/SC29/WG11N0702) digital transmission scheme, it being understood that many other kinds of data, grouped in packets of various sizes can be transmitted within the scope and spirit of the invention. In the preferred embodiment the transport stream from the data source 12 is formed by the source encoder 14 into 188 byte groups, in conformance with the MPEG 2 standard, and a Reed Solomon code is applied by the channel encoder 16, wherein each 188 byte group has 20 appended check bytes to form a 208 byte packet. Reed Solomon codes are known to provide high coding gains, and with this arrangement it is possible to correct up to 10 byte errors per packet. The details of the Reed-Solomon (208, 188) code are as follows: Galois Field (256) arithmetic is used. The field generator polynomial is given by x8 +x4 +x3 +x2 +1. A primitive element, ax, is the xth member of the Galois Field, and the code generator polynomial is given by: ##EQU1## The following C program correctly generates the Reed Solomon code. ______________________________________ #include <stdio.h> #define GEN.sub.-- POLY 0×1d int a 256!; int b 256!; static int gfmult (d1, d2) intd1, d2; { int result; if ((d1==0)∥(d2==0)) return (0); else { result = b d1!+b d2!; result = result%(255); return (a result!); } } main () { int in.sub.-- data; int i; int shift.sub.-- reg 20!; int feedback; int symbol.sub.-- count; int g 20!={174,165,121,121,198,228,22,187,36,69,150,112, 220,6,99,111,5,240,185,152}; a 0!=1; b 1!=0; a 1!=2; b 2!=1; for (i=2; i<256-1; i++) { a 1! = a i-1! << 1; if (a i! & 256) a i! = (a i!&(255)) GEN.sub.-- POLY;; b a i!! = i; } symbol.sub.-- count = 0; for (i=0; i<20; i++) shift.sub.-- reg i! =0; while ((scanf ("%d", &in.sub.-- data)) |= EOF) { symbol.sub.-- count++; feedback = in.sub.-- data shift.sub.-- reg 19!; for (i=(19); i>0; i--) shift.sub.-- reg i! = shift.sub.-- reg i-1! (gfmult (feedback,g i!)); shift.sub.-- reg 0! = (gfmult (feedback, g 0!)); printf ("%d\n", in.sub.-- data); if (symbol.sub.-- count == 188) { for (i=(19); i>=0; i--) printf ("%d\n", shift.sub.-- reg i!); symbol.sub.-- count = 0; for (i=0; i<20; i++) shift.sub.-- reg i! = 0; } }______________________________________ The bytes in the Reed-Solomon encoded packets are then subjected to 16-way interleaving in order to better tolerate burst errors that could exceed the correction capabilities of the Reed-Solomon technique. This is accomplished, as indicated in Table 1, by writing byte packets rowwise into a 208×16 byte array, and reading the data by columns. TABLE 1______________________________________Interleave Structure______________________________________ 0 1 2 . . . 206 207 208 209 210 . . . 414 415. . . . . . . . . . . . . . . . . .3120 3121 3122 . . . 3326 3327______________________________________ The 3328 bytes are written in the order 0, 1, 2, . . . , 3327, and read in the order 0, 208, 416, . . . ,3120, 1,209, . . . , 3121, . . . With this arrangement up to 42 microseconds of burst errors can be tolerated, assuming a transmission rate of 30 megabits/second using 16-VSB. The resultant interleaved block is passed through a transmit filter 18 and a modulator 20, as shown in FIG. 1. The digital communication scheme discussed herein assumes that randomized data is being transmitted with zero mean, to keep from transmitting with direct current (DC) bias. To achieve randomization, the data is subjected to a bit-wise exclusive OR operation with a pseudorandom sequence generated by a feedback shift register. The random number generator employs an 11 bit shift register (not shown) which is initialized to Is. The generator function is the polynomial 1+x9 +x11. Groups of interleaved blocks of data thus formed are transmitted along with a periodic frame header, which contains a frame synchronization sequence and a training sequence. The purpose of the latter will be explained in further detail below. The frame structure is shown in table 2. The frame header includes a 31 symbol frame sync, 775 symbol training sequence, and a 26 symbol user data field. TABLE 2______________________________________ Frame Header Data______________________________________16-VSB 832 symbols 320 packets (20 interleaved blocks)8-VSB 832 symbols 240 packets (15 interleaved blocks)4-VSB 832 symbols 160 packets (10 interleaved blocks)2-VSB 832 symbols 80 packets (5 interleaved blocks)______________________________________ The generator polynomial for the frame sync is x5 +x4 +x2 +x+1, with an initial condition of 00001 (binary). This yields the frame sync sequence: sseq=1,0,0,0,0,1,1,1,0,0,1,1,0,1,1,1,1,1,0,1,0,0,0,1,0,0,1,0,1,0,1. The generator polynomial for the training sequence is x5 +x3 +1, with initial condition 00100 (binary). This yields the training sequence: tseq=0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,0,1,1,1,1,1,0,0,1,1,0,1. The complete frame header consists of: sseq+12×(tseq'+tseq)+tseq'+userdata 0..25!, where tseq' is identical to tseq, except that the last bit is inverted from 1 to 0. The user data field contains two sets of two bits which each specify the modulation level (16-VSB, 8-VSB, 4-VSB or 2-VSB), two bytes of user data and a 6 bit cyclic redundancy check (CRC) field as shown in table 3. TABLE 3______________________________________User Data FieldVSB Levels VSB levels user.sub.-- reg() user.sub.-- reg1 CRC______________________________________2 bits 2 bits 8 bits 8 bits 6 bits______________________________________ The modulation level is defined in table 4. TABLE 4______________________________________VSB Modulation Level Fieldvsb-levels 1:0! VSB modulation______________________________________ 0 16-VSB11 8 VSB10 4 VSB01 2 VSB______________________________________ The CRC is generated as follows: the sequence "vsb-- levels 1:0!, vsb-- levels 1:0!, user-- reg0 7:0!, user-- reg 7:0!,0,0,0,0,0,0" forms the dividend of a CRC with generator polynomial G(x)=x6 +x5 +x4 +1. The remainder is CRC 5:0!. A user data CRC generator is shown in FIG. 22. The sequence "vsb-- levels 1:0!, vsb-- levels 1:0!, user-- reg0 7:0!, user-- reg 7:0!, CRC 5:0!" is scrambled by exclusive ORing with the first 26 bits of the training sequence tseq. Data is transmitted as symbols consisting of 4 bits for 16-VSB, 3 bits for 8-VSB, 2 bits for 4-VSB, or 1 bit for 2-VSB. Bytes from the interleaver must be converted to symbols MSB first. Mapping to 16-VSB is explained with reference to FIG. 2. A bitstream 34 is formed of three bytes 36a, 36b, 36c, which are also represented vertically in the central portion of FIG. 2, with the MSB at the top. Each of the three bytes 36a-c is broken into two symbols 38-43. Symbols 38 and 39 contain the 4 most significant and least significant bits respectively of byte 36a. The contents of symbols 40-43 relate to bytes 36b-c in like manner. FIG. 3 explains the mapping from bytes to symbols for 8-VSB. Here the bits of the three bytes 26A-C are arranged in groups of three bits, with crossing of byte boundaries, for example at symbol 44c of the three groups 46a, 46b and 46c. Symbols for 4-VSB and 2-VSB are formed in equivalent manners. The symbol constellations are shown in table 5. The frame header constellation, including the user data, is -8 (logical 0), and +8 (logical 1) for all modulation levels. TABLE 5______________________________________ ConstellationSymbol 16-VSB 8-VSB 4-VSB 2-VSB______________________________________0 × 8 -150 × 9 -130 × a -110 × b -90 × c -70 × d -50 × e -30 × f -10 × 0 +1 +2 +4 +80 × 1 +3 +6 +12 -80 × 2 +5 +10 -120 × 3 +7 +14 -40 × 4 +9 -140 × 5 +11 -100 × 6 +13 -60 × 7 +15 -2______________________________________ The transmit filter 18 (FIG. 1) is a square root raised cosine filter having a rolloff of 20%. Structural details of the source encoder 14, channel encoder 16, transmit filter 18, and modulator 20 are outside the scope of the invention and will not be further discussed. Channel 22 can be any channel, such as a fiber optic link, coaxial cable, microwave, satellite, etc. which is suitable for the transmission of television, video, "hi-fi" audio or other high bit rate signals. The digital receiver, which will be described in greater detail hereinbelow, comprises a first demodulator 24, the output of which is filtered through a band pass filter 26. A second demodulator 27 converts its input to base band. The output of the second demodulator 27 is passed through a receive filter 28. The signal then passes successively to a channel decoder 30, a source decoder 32, and finally into a data sink 34. The channel decoder 30 and the source decoder 32 reverse the encoding that was accomplished in the source encoder 14 and the channel encoder 16 respectively. The organization of a digital receiver 50 is shown in greater detail in FIG. 4. In the receiver front end 23, shown in yet greater detail in FIG. 4a, a radio frequency amplifier 52 is coupled to the channel 22 via a high pass filter 51. The output of the radio frequency amplifier 52 passes through radio frequency attenuater 53 and low pass filter 54 and is down converted to a first intermediate frequency by the first demodulator 24, and then passed through a low pass filter 25. The first demodulator 24 is of a known type. Its frequency is controlled by a voltage-controlled oscillator 33, programmed through a microprocessor interface operating through a digital-to-analog converter 37. The second demodulator 27 converts the signal to a second intermediate frequency, and is followed by a high pass filter 29, and another amplifier stage 31. The output of amplifier stage 31 is passed through a bandpass filter 26 to a third down converter 29 (FIG. 1), which converts the signal to a third intermediate frequency and then passes the signal to a low pass filter 58. A high speed analog to digital converter 60, provides an output which is used by timing recovery circuit 62, which ensures accurate sampling by analog-to-digital converter 60. FIG. 23 shows a graph of the signal spectrum at the input of the analog-to-digital converter 60, wherein frequencies and bandwidth values are shown in MHz. This spectrum shape can be achieved if the passband of band pass filter 26 is 4.75 MHz below the carrier to plus 0.75 MHZ above the carrier and there exists a transition band from carrier +0.75 MHz to carrier+1.25 MHz. The rolloff at the Data Nyquist frequency (1.875 MHz) is controlled by the bandpass pulse shaping by the transmit filter 18, discussed above. A filter 63 receives the output of the analog-to-digital converter 60, and converts the signal to complex base band representation. The output of the filter 63 is substantially real. DC bias in the signal is removed in DC Remover block 67. A carrier recovery circuit 64 controls the second demodulator 27 (FIG. 4a) such that the correct frequency and phase are recovered. An automatic gains control circuit 66 feeds back to radio frequency attenuater 53 through digital-to-analog converter 55. Both the automatic gain control circuit 66 and the carrier recovery circuitry 64 are coupled to the output of analog-to-digital converter 60. An adaptive equalizer 70 contends with various channel impairments such as echoes and multipath transmission. The main digital data stream from the analog-to-digital converter 60 is filtered by a matched filter, which matches the response of the transmit filter 18. The digital stream is also derandomized and deinterleaved in deinterleaver 69. The equalized signal is then subjected to Reed-Solomon decoding and error correction in error correction circuitry 72. Except for the front end 23, the receiver 50 is largely realized as an integrated CMOS device by well known methods. Analog-to-Digital Converter There are many applications which require a fast and accurate comparator, and achieving the design in CMOS makes integrating such applications an inexpensive alternative to using external support. An example of an application is the flash analog to digital converter (denoted FADC), where a linear array of comparators convert an analog voltage into a digital representation. CMOS comparators have a poor gain characteristic, which eventually limits the speed of comparison, and the input referred offsets are large, limiting the resolution of the comparison. Another set of problems are switching noise through the supplies and substrate from unrelated blocks of circuitry, and switch noise from sampling devices. These problems are usually solved by using a balanced differential system. Most amplification systems are characterized by a time constant, τ, and a gain G. The evolution of the output of a comparator is generally given by the form V.sub.out =G(V.sub.in -V.sub.ref)(1-e.sup.-t/τ) Obviously, after a time tk the output is determined solely by G and T. For CMOS, to make G large enough necessarily makes T larger, and so a small input (Vin -Vref) will take a long time to reach a clearly delimited logic level. This limits the speed of comparison, particularly when the design requires accuracy, that is a small (Vin -Vref) to resolve. The best performance in CMOS comes from using positive feedback. This gives a large gain G with a small T as desired. The drawbacks are a) a sampling system is required, since positive feedback is destructive; and b) more than two elements are required, and the probability of mismatch is thus increased. The input referred offsets are mainly due to the mismatch of the transistors used to implement the comparator. All the transistor mismatch can be modeled as a mismatch in a single parameter, usually the threshold voltage, Vt. The equation for the current in a MOS transistor is given by ##EQU2## where β is a physical gain term; W/L is the width/length ratio of the transistor; Vds is the voltage from the Drain to the Source; Vgs is the voltage from the Gate to the Source; and Vt is the threshold voltage, which is a physical characteristic. Even if two transistors are adjacent, well-matched, on the same substrate and are biased identically, the current which flows is different because the Vt is not controlled. A difference of +/-40 mV in a term of approximately 700 mV is common, particularly if standard available CMOS process is used. The input referred offset is shown in FIG. 5a, which illustrates a comparator 77. The input referred offset, Vo 78, appears in series with the input Vin, and affects directly the comparison of Vin and the reference voltage Vref. The comparison operation performs V.sub.in +V.sub.o -V.sub.ref and gives a result of a logic ONE if this sum is positive, and a logic ZERO otherwise. The offset Vo 78 can be positive or negative, since the mismatch can go either way, and so for a ONE it must be guaranteed that Vin >Vref +|Vo |, and for a logic ZERO it must be guaranteed that Vin <Vref -|Vo |. The offset voltage Vo 78 therefore appears as a window of magnitude Vo, centered around Vref, in which the output of the comparison is not guaranteed to be correct. By way of example, a 1V peak-to-peak input into an 8-bit FADC, requires the comparator to successfully resolve a difference of at least one LSB. Since the FADC resolves to 8-bit precision there are 28 or 256 levels. Therefore, the FADC must be capable of resolving to 1V/256=3.9 mv. In general, existing systems require a resolution capability of one half the voltage differential of an LSB. With the example Vt mismatch of 40 mV between two adjacent devices and the use of a two-transistor input stage this comparison is not achievable, since the comparator will not correctly resolve a difference of less than 40 mV. The usual solution is to use a system which zeros the offset voltage Vo. The two main techniques used are: a) use some down-time inherent in the system to visit each comparator, and deliberately offset the Vref using additional circuitry; and b) zero the offset voltage by using negative feedback and coupling the voltage difference onto a zeroed input. Both techniques have their drawbacks. Scheme (a) requires the system to have regular down-time, and the support circuitry is very large. Scheme (b) needs a sampled system, since time is needed to zero the input. The comparator of the present invention is shown schematically in FIG. 5b. The implementation of inverters 76 and 79 is not important, although it is assumed that the inverters 76, 79 have some small signal gain, g, greater than one. The operation of the comparator will be described in three phases. In phase 1, switches 80, 81, 82, and 83 are closed; the other switches in FIG. 5b are open. Switch 80 drives the node X to the voltage Vin. Switch 81 drives the node X to the voltage Vref. Switch 82 connects inverter 76 with negative feedback ensuring that the input voltage and the output voltage are the same. This voltage is Vth, the threshold voltage of the inverter 76, and does not depend on any input offset. The net effect is to zero the input to the inverter 76. Switch 83 zeroes inverter 79. It should be noted that the voltages on Y and Y are not necessarily the same. In phase 2, switches 84 and 85 are closed, the others open. Since nodes Y and Y are not driven, some fraction (near one) of the voltage change on X and X respectively will accrue due to the action of capacitors 86 and 87. Switch 84 drives the voltage Vref onto node X, thus causing a voltage change of (Vin -Vref). The voltage accrued on Y will be some fraction of (Vin -Vref), say f1(Vin -Vref), where f1 is approximately 1.0. Switch 85 drives the voltage Vin onto node X thus causing a voltage change of Vref -Vin. The voltage accrued on Y will be some fraction of (Vref -Vin) say f2 (Vref -Vin), where f2 is approximately 1.0. The small signal gain of an inverter is given by: V.sub.out -V.sub.th =g(V.sub.in -V.sub.th) and so the voltage on node Q will reach a value V given by: V-V1=g1(f1(V.sub.in -V.sub.ref)-V1) where V1 is the zero voltage for inverter 76; and the voltage on node Q will reach a value V given by: V-V2=g2(f2.(V.sub.ref -V.sub.in)-V2) where V2 is the zero voltage for inverter 79. In phase 3, switches 88 and 89 are closed, and switches 80, 81, 82, 83, 84 and 85 are open. To understand the operation, it is easier to assume that g1=g2=g and f1=f2=f and V1=V2=Vth. This is approximately correct, and is mathematically more clear. Switches 88 and 89 connect inverters 76 and 79 in positive feedback. The input voltage applied before feedback starts is just (V-V). V-V=gf(V.sub.in -V.sub.ref -(V.sub.ref -V.sub.in))=2gf(V.sub.in -V.sub.ref) Assuming the f is approximately 1.0, an amplifier is now connected in positive feedback with an input magnitude of 2g(Vin -Vref). The original signal has been amplified by a factor of 2g before positive feedback is applied. The system including inverters 76, 79 connected with positive feedback has an input referred offset, but if the designer ensures that 2g is large enough, then the comparison can be guaranteed. The circuit of FIG. 5b is fully symmetric, balanced and differential. Any common-mode switching noise will be rejected. Control of the switches according to phases 1-3 may be accomplished, for example by a 3:1 counter, or a 3 stage shift register. FIG. 6a is a CMOS circuit corresponding to the circuit of FIG. 5b, which is preferably used with transistors 90-97 replacing switches 80, 84, 81, 85, 82, 83, 88, 89 and the inverters 76, 79 implemented as shown in FIG. 6b, wherein inverter 98 is comprised of a PMOS transistor 99 and an NMOS transistor 100. The CMOS circuit of FIG. 6a is preferably included in the integrated circuit of the receiver 50. In FIG. 6a, switch control values of P1-P3 are as follows: ______________________________________P1 = HIGH PHASE 1 P2=P3=LOWP2 = HIGH PHASE 2 P1=P3=LOWP3 = HIGH PHASE 3 P1=P2=LOW______________________________________ Timing Recovery In order to properly detect the received data from the sampled signal emerging from the analog-to-digital converter 60 (FIG. 4), it is necessary to accurately follow the timing of the received signal. FIG. 53 shows a block diagram of the portion of the receiver controlling analog-to-digital converter sample timing, and FIG. 54 shows the timing recovery portion in detail. As described with reference to FIG. 53 and FIG. 23, samples of the received signal, x(t), emerge from the analog-to-digital converter as a 15 megasamples per second signal having a carrier frequency at 5.625 MHz and a rolloff at data Nyquist of 1.875 MHz. The output of analog-to-digital converter 60 is split, and each branch multiplied with a periodic signal to provide signal inphase (real) and quadrature (imaginary) components Itr and Qtr respectively, which have been down converted from the third intermediate frequency so that the data Nyquist frequency (1.875 MHz) has been shifted down to 0 Hz (DC). The timing recovery block 62 accepts inputs Itr and Qtr and outputs a digital error signal representative of the difference between the transmitted signal rate and the rate used to initially sample the incoming signal. It also outputs a lock detect signal 1130 to a lock detect circuit 1064, the operation of which will be described in further detail below. The digital error signal is converted to an analog signal by digital to analog converter 1060. The analog signal is passed to a voltage controlled crystal oscillator 1062 which controls the frequency at which the signal is sampled in the analog-to-digital converter 60. As shown in FIG. 54, inside the timing recovery circuit of the system there are provided delay feedback loops 1102 and 1104. The inphase and quadrature signal components Itr and Qtr are first attenuated by amplifiers 1106 and 1108 which each amplify the signal components with gain of 1/256. The delay feedback loops 1102 and 1104 each amplify the attenuated signal components with gain of 255/256 and delay the signal components as indicated by one cycle. This operation causes the timing recovery to be primarily dependent on the signal's past history while also remaining somewhat dependent on the present state of the signal, thereby providing low pass-filtered versions of the inphase and quadrature signal components Itr and Qtr. The resultant components are next multiplied together by multiplier 1110. This produces a signal Itr Qtr 1113 which is proportional to the sine of the frequency difference between the symbol rate and the frequency of the sampling rate which was used. The signal Itr Qtr 1113 is output directly as a lock detect signal 1130. At the same time, the signal Itr Qtr 1113 is applied to a proportional integral loop filter 1111. In the proportional integral loop filter 1111, the result is applied to two selective gain amplifiers 1112 and 1114 which can be operated alternately with a non-steady state gain value and with a steady state gain value. Thus, the gain on the integral side of the proportional integral loop filter 1111 is switched by selector 1116 to tmr-- i-- gain-- ac during the acquisition phase in "locking" onto the signal timing. Once lock has been acquired, selector 1116 switches the gain to the steady state value, tmr-- i-- gain-- run. The process occurs in parallel on the proportional side of the filter, as the amplifier gain is switched by selector 1118 between acquisition gain tmr-- p-- gain-- ac and steady state gain tmr-- p-- gain-- run. The signal on the proportional side of the proportional integral loop filter is amplified without integration and passed forward. The signal on the integral side of the filter, however, is integrated and then passed to an adder 1120 to be combined with the signal emerging from the proportional gain amplifier. The two signals are recombined by adder 1120 and output as a 9-bit error signal 1132 which is then sigma-delta modulated in a sigma-delta modulator 1134 to form the single bit output TCTRL 1136. The output TCTRL 1136 is filtered by low pass filter 1138 and presented to the input of the voltage-controlled crystal oscillator 1062. The lock condition is detected from the unprocessed lock detect signal 1130 of the filter in a sequence of operations as performed by a lock detect circuit 1064 which is implemented as a state machine. The following C code fragment is illustrative of the operation of the state machine: ______________________________________if (clock.sub.-- count == 0) count = 0; irr.sub.-- val = 0; lock = False;{if ((clock.sub.-- count %8192) == 0) count++;/* irr.sub.-- val is the average error */iir.sub.-- val = err + irr.sub.-- val- (irr.sub.-- val>>13);if ((abs (iir.sub.-- val) > pow (2, (tmr.sub.-- lock.sub.-- value+1))) count = 0of (count > tmr.sub.-- lock.sub.-- time) lock = True;______________________________________ Upon detection of the lock condition, the proportional integral loop filter 1111, changes modes from the "acquisition" state in which "acquisition" gain values tmr-- i-- gain-- ac and tmr-- p-- gain-- ac have been used, to the locked condition in which the "run" gain values tmr-- i-- gain-- run and tmr-- p-- gain run are used. The acquisition condition is better suited for the broadband case where, for example, the receiver has just been turned on or the channel selector has just been switched. The lock condition is intended for use when a steady state condition has been achieved, i.e. the signal has been locked upon, and a finer, narrow band control over the timing recovery has been made possible. The gain values used in the proportional-integral loop filter should be chosen to provide the required values of the loop natural frequency ωn and damping factor zeta (ζ), given the characteristics of the voltage controlled crystal oscillator, the external analog low pass filter and the input signal magnitude. Carrier Recovery The operations of carrier recovery, phase and frequency locking are performed on the discrete time sampling of the signal output from the analog-to-digital converter. These functions are performed by the carrier recovery block 64 shown in FIG. 4. The carrier recovery and locking functions are performed with hardware that is similar to that used for the timing recovery operation. FIG. 48 shows a block diagram of the carrier recovery block, 64 as used in the receiving system of the present invention. As is evident from FIG. 48, the carrier recovery block 64 receives input in the form of an 8-bit-wide pulse train at 15 megasamples per second from the analog-to-digital converter 1204 and provides output in the form of a 10-bit-wide data signal to digital-to-analog converter 1206. The output from digital-to-analog converter 1206 is low pass filtered through low pass filter 1208, and provides a control signal to voltage controlled oscillator 1210. The voltage controlled oscillator 1210 in turn is used in the down conversion process of the incoming analog signal as shown in FIGS. 4 and 4a. The blocks used to perform the functions of the carrier recovery block are a down converter 1212, a frequency and phase locked loop (FPLL) 1214, and a sigma-delta modulator 1216. Down Conversion Inside the carrier recovery block 64 (FIG. 48) a down conversion from the third intermediate frequency to baseband is performed. Down conversion is performed in a manner similar to that used by the matched filter, as herein described below with respect to FIGS. 42-46. Successive pulses of the 15 megasamples per second analog-to-digital converter output signal 1204 are multiplied by complex coefficients representative of a 5.625 MHz periodic function in superheterodyne manner to convert the signal down to baseband. The resultant baseband inphase and quadrature components Icr and Qcr are then passed to the frequency and phase locked loop 1214. Frequency and Phase-Locked Loop Frequency and phase locked loop 1214 operates upon 8-bit in-phase and quadrature signal components Icr and Qcr to generate a 14-bit wide output signal to sigma-delta modulator 1216 which itself, in turn, outputs a 10-bit wide signal to digital-to-analog converter 1206 for controlling voltage controlled oscillator 1210. The use of a 10 bit wide digital-to-analog converter 1206 permits a relatively high degree of precision to be obtained in controlling voltage controlled oscillator 1210. It is possible that a lower degree of precision will be sufficient, even desirable, for operating the receiver of the present invention. In such case, a fewer bit input digital-to-analog converter can be operated simply by connecting the higher order bits to the digital-to-analog converter and not using the least significant bits of the output of the sigma-delta modulator. Alternatively, the lowest order bits not output to the digital-to-analog converter can be used in the feedback loop of the sigma-delta modulator 1216. A block diagram of the frequency and phase locked loop 1214 is shown in FIG. 49. As shown in the figure, the "real" or inphase component of the signal is applied to infinite-impulse response (IIR) filter 1220, while the imaginary or quadrature component of the signal is applied directly to the multiplier. Infinite-impulse response filter 1220 is used as a low pass filter in the path of the real signal components to filter out the double frequency harmonics which remain after the superheterodyne down-conversion. From the output of infinite-impulse response filter 1220, only the sign information of the signal remains important. The sign information is then gated by AND gate 1222 to multiplier 1224 to produce a signal p(t) of value, either "Imag" or "-Imag." The resultant signal p(t) is then applied to a proportional integral loop filter 1226. The proportional integral loop filter 1226 operates in a manner similar to that described for the proportional integral loop filter 1111 of the timing recovery block. Proportional integral loop filter 1226 has a proportional side wherein signal p(t) is multiplied by a coefficient P1 or P2. Proportional integral loop filter 1226 also has an integral side wherein the signal p(t) is multiplied by a different coefficient I1 or I2 and then integrated by a delay unit plus adder feedback loop. The sum resulting from the addition of signal parts arriving from the proportional and integral sides of the proportional integral loop filter 1226 forms the output 1230 which is transferred to the sigma-delta modulator 1216. The proportional integral loop filter 1226 is constructed to operate in two different modes. In the first mode, the proportional integral loop filter 1226 is used to lock onto the frequency of the received carrier. In this mode, constant coefficients I1 and P1 are used to tune the receiver to the close frequency range until frequency lock is detected. In the first mode the sign 1232 of the real signal component is passed by AND gate 1222 to multiplier 1224. After lock is detected, the proportional integral loop filter 1226 operates in a second mode to make finer adjustments to the tuning frequency. In the second (fine) adjustment mode, constant coefficients I2 or P2 are used as inputs to the multipliers. However, in the second mode, the sign of the signal component is not passed by AND gate 1222, and is not used in that mode. In this discrete time signal filtering embodiment, constant coefficients I1, I2, P1, and P2 are discrete time pulse trains which default on "power-up" to predetermined sequences but which can be altered through manipulation by connected digital devices. As such, the coefficients have the potential to be altered to adjust for different conditions. Sigma-delta Modulator Sigma-delta modulator 1216 receives fifteen bit input SDIN(14:0) from frequency and phase locked loop 1214, and outputs a ten bit wide signal to digital-to-analog converter 1206. At the head of the sigma-delta modulator 1216, adder 1254 (see FIG. 51) produces a 16-bit wide output. The 16-bit output is fed into a limiter 1262 which saturates when the 16 bit number exceeds 14 bit number capability, outputting the limited 14 bit number. The resultant 14-bit stream 13:0! is then divided into two parts: the ten most significant bits are fed directly into the digital-to-analog converter 1206, while the four least significant bits are fed back to the adder 1254 through delay unit 1266. In FIGS. 49 and 52 another feature of the carrier recovery block of the present invention is shown. Should the proportional integral loop filter 1226 be unable to lock onto the frequency of the received intermediate frequency signal, an adder 1260 can be used to add a discrete frequency shift value HOP(3:0) to the five higher order bits of the current frequency value SDIN 1258 in the proportional integral loop filter 1226. Then, the output HOPPED(4:0) 1252 of the adder 1260 is then recombined with the 10 lower order current frequency bits SDIN(9:0) 1256 by the adder 1254 at the input to the sigma-delta modulator. Derandomization Derandomizing is performed on the output of the analog-to-digital converter 60 (FIG. 4) by reversing the randomization performed prior to transmission as discussed above. FIG. 41 is a block diagram of a descrambler 820 which packs the symbols into bytes and derandomizes them. The descrambling function that is performed is the reverse of the randomization performed prior to transmission which was discussed above. The output of a 4 bit shift register 822 is exclusive ORed with the randomization sequence 824. The output is conditionally shifted into a serial-to-parallel shift register 826, enabling unwanted bits in 8-VSB, 4-VSB, and 2-VSB to be discarded as symbols are packed into output bytes. The deinterleaver 69 (FIG. 4) processes the derandomized output. Deinterleaver As discussed above with reference to Table 1, data on the channel is 16-way interleaved in order to improve burst error performance. Thus a burst of 16 erroneous bytes (32 symbols) will introduce single byte errors in 16 packets. The error correction circuitry 72 (FIG. 4) disclosed hereinbelow can cope with 10 erroneous bytes in a 208 byte packet. Thus the deinterleaver combined with the error correction circuitry 72 can cope with isolated 32×10 symbol burst errors. The deinterleaver 69 is explained with reference to FIGS. 16-21. FIG. 21 shows a high level schematic. The RAM 300, a component of block 458 of the deinterleaver circuit, is shown in more detail in FIG. 16. FIG. 17 is a timing diagram illustrating the read-write cycle in the RAM 300. The addressing scheme for the RAM 300 is described with reference to FIGS. 18 and 19. Control of the mode of operation for the RAM 300 is discussed with reference to FIG. 20. The deinterleave buffer reassembles packets from the interleaved data stream. Deinterleaving is discussed with reference to the 16-VSB transmission scheme and FIG. 16, but is similar with other VSB levels. Each frame of data carries a payload of N interleave blocks, wherein each interleave block is 16 packets, or 208×16=3328 bytes long. N=20 for 16-VSB, 15 for 8-VSB, 10 for 4-VSB, and 5 for 2-VSB. In operation the data is first synchronized by correlation with the 31 frame sync symbol sequence transmitted in the frame header discussed above. Once these are identified, a check is made for the frame sync sequence at expected intervals to assure integrity of the data stream. A block of interleaved derandomized data is read into an internal RAM buffer, elements of which are shown generally at 300. It is an aspect of the invention that only one 3328 byte RAM is required for the deinterleaver, because, as explained in further detail below, as data is being output from the RAM 300, new data from the succeeding interleave block is being written to the same location. This approach nearly minimizes the amount of on-chip RAM required at the expense of a slightly more complicated addressing scheme. Further reduction of RAM could only be attained at the expense of significantly increasing the complexity of the control structure with very little gain. The RAM 300 is organized as 128 columns by 208 rows, and uses a 6T cell and regenerative sense amplifier/precharge circuit. The row decoder 305 is simplified by an additional predecoder 310. Each column has its own sense amplifier. A column multiplexer (not shown) follows the sense amplifiers. Timing is controlled by an eight cycle state machine which is hardwired to perform read-modify-write cycles. No analog timing pulse generators or overlap/underlap circuitry is used. The RAM requires five timing strobes, which are explained with reference to FIGS. 16 and 17. The output of EQUATE strobe 325 is referenced 350a in FIG. 17. The cycle is initiated by shorting the bit line 312 to the not-bit line 314. The strobe DRIVE WL 316, referenced as line 350b, enables the row decoder 305 to drive one word line 318 high. It is important that EQUATE strobe 325 does not overlap the strobe DRIVE WL 316; hence they are separated by one clock. Otherwise data could be corrupted as the accessed cells would be driving equated lines 312, 314. The address must be held until after the strobe DRIVEWL 316 has been removed, so that other lines do not become corrupted by a changing address. The strobe SENSE 315 should not be enabled until the word line has been asserted long enough to produce a reasonable differential. If the strobe SENSE 315 is enabled too early it can flip incorrectly and corrupt the data. There is plenty of time available, so the timing generator is a simple eight cycle gray code counter. Its primary outputs, indicated in FIG. 17, are decoded to control the RAM timing strobes. The standard row decoder 305 is built from 6 input AND gates which limits the number of rows to 64; however RAM 300 requires 208 rows. Adding two more inputs to the AND gate would make the wordline driver difficult to lay out in a desired cell height pitch. Therefore predecoding is employed in predecoder 310. Instead of bussing A0, NOTA0, A1, NOTA1 to all wordline drivers, NOTA0 & NOTA1, NOTAO & A0, A1 & NOTA1, A0 & A1 are bussed instead. Each wordline driver now connects to one from each group of four, where in the simple case it connected to two in every group of four. Now each wordline driver need only be a 4 input AND gate. The generation of addresses is shown in further detail with reference to FIG. 18. In the addressing scheme according to the invention, addresses in the RAM 300 are selected such that successive selections differ in location by an interval termed the "stride". Initially the stride has a value of 1. On the left hand side, block 360 is an adder which adds the stride to the current address. The stride is input from register STRIDE REG 11:0! 364. The output of block 360 is submitted to a subtracter 362, which subtracts the constant BLOCKSIZE-1 to form a result T 11:0!, referenced 366. If the result 366 of the subtraction is less than zero, there will be a carry-out which is used to select whether the value was greater than BLOCKSIZE-1. If the value was greater than BLOCKSIZE-1, the result of the subtraction T 11:0! is used to form the next address. Otherwise the result 367 of the adder 360 is used to form the next address. A multiplexer 368 is used to select between the adder and subtracter outputs. In the special case where the adder output equals the BLOCKSIZE-1, corresponding to the last address in the block, the combinatorial logic 370 detects this case and forces the selection of the adder output. The address value is latched in latch 378, and also snooped latches 380, 382. These snooped latches are used only for testing of the chip. The output of the adder will never be more than twice the blocksize. This is because the maximum address value is BLOCKSIZE - 1. The maximum value of register STRIDE REG 11:0! 364 is BLOCKSIZE - 1, so the sum is limited. This means that a modulus operation can be easily performed by subtracting zero or subtracting BLOCKSIZE - 1. Generation of the stride value held in STRIDE REG 11:0! 364 is explained with reference to FIG. 19. The signal ACCEPT BLOCK 392 is generated at the end of each block, and causes STRIDEREG 11:0! 364 to be updated with a new stride value. While a block of data is being read out, a new stride value is being concurrently generated in the circuitry referenced generally at 390. ACCEPT BLOCK 392 triggers the operation of a simple counter state machine, comprising latches 394, 396. This simply counts four times. The stride value is multiplied by 16, the interleave depth, after each block has been processed, and this has been implemented by shifting its value left four times. The purpose of the latches 394, 396 is simply to count four cycles. At each cycle the value of register NEXTS-- REG 11:0! 398, the output of latch 400, is multiplied by 2, i.e. shifted left one place and held in register NEXTS-- REG 10:0! 404. A multiplexer 406 selects either the register NEXTS-- REG 10:0! 404, or the register T 11:8!NEXTS-- REG 6;0! 402. The latter represents the output of a subtracter and contains the shifted left value--(BLOCKSIZE - 1) to update register NEXTS-- REG 11:0! 398. This cycle of doubling and conditionally subtracting BLOCKSIZE - 1 is performed four times. The end result, after completion of 4 cycles, is a new value of STRIDEREG 11:0! 364 on bus 408, equal to 16 times the current value of register STRIDEREG 11:0! 364 modulo (BLOCKSIZE - 1). Control of the read-write-modify operation in the RAM 300 is explained with reference to the following fragment of C code: ______________________________________full = empty = (addr == 3327);unexpected.sub.-- eof = (eof && |full);switch (state) filling : if (full) next.sub.-- state = running; break; running : if (change.sub.-- channel) next.sub.-- state = emptying; break; emptying : if (empty) next.sub.-- state = filling; break;}if (unexpected.sub.-- eof) ∥ (filling && change.sub.-- channel))6{ next.sub.-- state = filling; next.sub.-- stride = 1; next.sub.-- addr = 0;}.______________________________________ Initially the RAM 300 is empty, and state is filling. During filling the buffer is consuming incoming data but not producing any output. When the first block has been read in, addr has reached the value 3227, and a full strobe line (not shown) is asserted. State is then changed to running. Here data from a succeeding block is concurrently consumed while deinterleaved data is output from the RAM 300. The running state persists until a channel change occurs, at which point the RAM 300 is allowed to read out until the end of the current interleaved block. State is changed to emptying and data is output until the end of the interleaved block. No further data is consumed during the emptying state. Operation of the state logic can also be appreciated with reference to FIG. 20, which illustrates a logical network that is incorporated in block 456 (FIG. 21). The current state is stored in latches 420, 422, encoded as shown in table 6. TABLE 6______________________________________ 00 filling 01 running 10 emptying 11 reserved______________________________________ The signals CONSUMING 426 and PRODUCING 424 are generated by decoding these states in logical networks 428, 430 (FIG. 20). Referring now to FIG. 21, the complete deinterleave block 69 (FIG. 4) is shown. A latch module 450 latches the incoming interleaved data. Block 452 is the address generating block, and also generates control signals CONSUMING 426 and PRODUCING 424, as discussed previously. The signal PRODUCING 424 is used to generate the output valid signal OUT VALID 454. The signal CONSUMING 426 is used to enable the input latch module 450. The address bus ADDR REG 460, the write data bus 462, and control strobes EQUATE 325, DRIVEWL 316, SENSE 315, NONSENSE 317, WRITESTROBE 321, and READSTROBE 323 generated by block 456 control the memory core block 458 containing RAM 300, which was described earlier. Block 464 is the simple 8 cycle counter which is decoded in block 456 to generate the 6 strobes required to control the memory core block 458. Block 466 is an output data latch. Referring once again to FIGS. 17 and 21, the strobes READSTROBE 323, and WRITESTROBE 321 are asserted while the strobe DRIVEWL 316 and the address held in the address bus ADDR REG 460 is asserted, resulting in the sequential production of deinterleaved data OUT-- DATA 455 and consumption of interleaved data 462 from and to the same address in the RAM 300 of the memory core block 458. Automatic Gain Control The automatic gain control circuit 66 (FIG. 4) is part of a loop which contains a variable gain amplifier in the radio frequency section of the demodulator. An output (the AGC pin) is provided to feed back the error. The automatic gain control circuit 66 works by causing the gain of the signal to be adjusted until the mean absolute value of the incoming data converges on the set level. The operation of the automatic gain control circuit is explained in more detail with reference to FIGS. 26 and 27. As explained below with reference to operation of the receiver 50, the automatic gain control circuit 66 operates in an averaging mode in which the outputs are based on a prior knowledge of the mean values of the entire input waveform, and in a training mode in which they are not. Operation is essentially the same in averaging mode or training mode, except that different constants agc-- av-- gain 604 and agc-- train-- gain 606 are used respectively, as selected by the mode signal 602 in multiplexer 608. The abs block 610 takes the absolute value of the incoming data 614. The value in the integrator register INTEG-- D 672 (FIG. 27), preferably a 16 bit register, is updated as follows: agc.sub.-- value=agc.sub.-- value+(((abs(data)-bias)>>gain)+1)>>1 where bias is either agc-- av-- bias 618 or agc-- train-- bias 620, as selected by the mode signal 602 in multiplexer 616, and gain is either agc-- av-- gain 604 or agc-- train-- gain 606, depending on the mode. The top 11 bits of the agc-- value register are used in the sigma-delta circuit 624, and the lock detect circuit 626. The single bit sigma-delta modulated automatic gain control output 628 is preferably filtered externally using an appropriate analog filter (not shown). The automatic gain control output 628 may be inverted by setting the agc-- invert bit (see Signals and Registers section below). During averaging mode all incoming data is used in the automatic gain control circuit 66. During training mode the automatic gain control circuit 66 is only enabled while processing the frame header; however the automatic gain control output 628 always remains active. On channel change the lock signal 631 is set to false. The operation of the lock detect circuit is as described by the following code fragment: ______________________________________if (clock.sub.-- count == 0) count = 0; latched.sub.-- val = 0; lock = False;}if ((clock.sub.-- count%4096) == 0) count++;agc.sub.-- val = agc.sub.-- value>>5;if ((abs(latched.sub.-- val - agc.sub.-- val) > (agc.sub.-- lock.sub.--value<<2)) { latched.sub.-- val = agc.sub.-- val; count = 0; }if (count > agc.sub.-- lock.sub.-- time) lock = True;.______________________________________ Here clock-- count is a count of T/2 clock periods and agc-- lock-- value and agc-- lock-- time refer to the register values. Referring now to FIGS. 27 and 28, operation of the block 610, and its equivalent representation, block 652 (FIG. 27) is now explained. Input data is clocked into register 630 at 15 MHz, and is held in latch 632. Line 634 is driven according to the sign bit of the input data in latch 632 and is used as a selector for multiplexer 636. If the sign bit is positive, then line 638 is selected, resulting in an output 642 that is identical to the contents of the input register 630. But if the sign bit is negative, the magnitude is converted and appropriately rounded up in block 644, and then passed through the multiplexer 636. A bias value is subtracted from output 642 in block 646, according to the mode signal 602. This value comprises an average or training bias value. Scaling of the output of the bias adjusted data 648 occurs in scale block 650. The scaled data then enters an integrator 672 where it is initially rounded, and the resulting fractional data added to yield an automatic gain control level which is optionally inverted in block 654. Referring to FIG. 29, the integrated data is also fed to the sigma-delta block 656, corresponding to zone 664 in FIG. 29, where it is truncated, and a one bit error signal 668 is developed, representing the MSB of the modulated sigma-delta output. The error signal is then passed to a 1 bit digital-to-analog converter 660, and pulse shaping of the output of the digital-to-analog converter 660 is accomplished in an infinite impulse response filter 662. The error signal is fed back to adjust the gain of amplifier 52 (FIG. 4). The sigma-delta block 656 is shown in greater detail in FIG. 30, wherein the LSB of the integrator output 674 is held in latch 676, where it is added to the truncated integrator output in adder 678 to yield a 10 bit result 680. An additional function of the automatic gain control circuit 66 (FIG. 4) is to provide a signal indicating that a lock on the channel signal has effectively been achieved. This is accomplished by the lock detector circuit 626 (FIG. 26), which is shown in greater detail in FIG. 31. A previous version of the integrated data output 674 is held in a latch 682, and is subtracted from the current integrated data output 674 in a subtracter 684. The absolute value of the difference 685 is determined in block 686, similar to the determination described above with reference to block 610 (FIG. 26). This result is subtracted from a constant in subtracter 688, and an error signal 690 produced. When convergence is determined to have occurred as described above, lock has been achieved. Matched/Nyquist Filter Referring once again to FIG. 4, a matched filter 63 is placed in the path of the received signal after the analog-to-digital converter 60. The filter 63 is known as a matched filter because its response matches the response of a similar filter in the transmitter and therefore maximizes the signal-to-noise (SNR) ratio for the bandwidth available. The filter 63 is also known as a Nyquist filter because its combined response and the response of the transmit filter 18 obey the Nyquist criterion, i.e. the Fourier transform of the combined response satisfies the relation: ##EQU3## Obeying the Nyquist criterion is necessary if the filter is to provide zero intersymbol interference. By having a response which is matched and satisfies the Nyquist criterion, the matched filter provides a signal response which has high SNR. Referring now to FIGS. 4 and 42, the matched filter of the present invention performs several functions. First, in block 1073, it shapes the received pulses so as to minimize intersymbol interference. This is accomplished while the matched filter 63 preserves the SNR at least as high as received. Second, the matched filter 63 down converts the signal received from the analog-to-digital converter 60 from an intermediate frequency down to complex baseband, i.e. from 5.625 MHZ to 0 Hz. Third, in block 1075 the matched filter 63 reduces the number of samples to be passed for further processing in that it receives the input signal from the analog-to-digital converter at the sampling rate higher than minimum Nyquist sampling rates, and selectively eliminates a portion of the samples to provide a signal containing exactly one sample for every symbol. Nyquist Pulse-shaping As stated earlier, the preferred transmitting system includes a filter 63 which shapes the received signal pulses so that their amplitude versus time characteristic is optimum for the channel over which the pulses travel. The shape which has been found to be optimum for transmission is that of a raised cosine pulse. The application of such pulse-shaping enables each cycle of the periodic waveform to carry two pulses. To preserve maximum SNR over the bandwidth available without increasing the sampling rate, a filter having identical characteristics, i.e. a "matched filter" must be provided in the receiving system. However, since both the transmitter and receiver have such matched filters, the combination of the shaping performed by the filters of both the transmitter and the receiver must be equal to a raised cosine pulse. Thus, the transmitter and the receiver each contain a `matched` Nyquist filter which has a square root raised cosine pulse response. An example of a square root raised cosine pulse filter is provided by the time response function of the following equation: ##EQU4## Down conversion The matched filter 63 also performs a conversion down in frequency from the intermediate frequency used by the analog-to-digital converter and preceding processing blocks to the baseband frequency. Down conversion is accomplished through a superheterodyne method of multiplying the intermediate frequency pulse train by a pulse train which conforms to a complex periodic function at the same (carrier) frequency, 5.625 MHZ. That is, the intermediate frequency pulse train is multiplied by a pulse train which conforms to: exp(-2π×5.625×10.sup.6 xt) and then only the real-valued portion of the resulting signal is propagated for further processing. In the system of the present invention, the pulse-shaping and down conversion operations of the matched filter are performed simultaneously by the same hardware. Reduction in sample propagation rate A pulse train representative of the received data arrives at the input to the matched filter from the analog-to-digital converter 60 (FIG. 4) at the rate of 15 megasamples per second. However the data is transmitted at a rate of only 7.5 megasymbols per second. Since two pulses can be transmitted within each cycle of the f0 =3.75 MHZ periodic signal bandwidth and only one pulse is required to transmit a symbol, the minimum Nyquist sampling frequency is still 2f0 =7.5 megasamples per second. Therefore, after down-conversion to baseband, the pulse train signal received from the analog-to-digital converter 60 contains a portion of samples which are not necessary for recovery of the original symbols. These unnecessary samples are known as intersymbol samples because they tend to occur at the time boundary between symbols, and therefore do not contain useful information about the symbol which was transmitted. Only a portion of the samples entering the matched filter are propagated on to further stages, and these are the ones which are required for symbol recovery. The intersymbol samples are not passed on further in the system; they are discarded. Implementation FIG. 50 shows a representative prior art discrete time signal filter. The filter accepts as input 1077 x0, x1, . . . xn discrete time signal pulses forming a signal pulse train x(T) and produces output 1078 y(T). The filter has taps 1076. As evident from FIG. 50, the filter performs the following operation to produce each output sample, y(N): ##EQU5## where xn are successive samples and cn are the coefficients. x, c, and y are all complex. Thus at each tap 1076 r.sub.n =(x.sub.nr +jx.sub.ni)(c.sub.nr +jc.sub.ni) where Xr represents the real part of the complex-valued input signal sample x and xi represents the imaginary part. When the multiplication is completed the result is x.sub.r c.sub.r -x.sub.i c.sub.i +j(x.sub.r c.sub.i +x.sub.i c.sub.r). However, further operations with the imaginary part of the result are not necessary, and the imaginary part can be discarded. In fact, the imaginary part of the results need not even be calculated. Therefore, in the system of FIG. 50, for an input stream such as: x.sub.0, x.sub.1, x.sub.2, . . . the following output stream would be generated: ##EQU6## where the product cn xn is equal to cnr xnr +cni xni. In the present invention, the matched filter has been optimized in several important ways. The first reduction occurs in incorporating the down sampler 1075 (FIG. 42) into the filter, reducing the number of output samples by half. Since there is now twice as much time to produce each output, a smaller implementation can be used. The hardware reduction is accomplished by applying the odd-ordered samples of the input signal to one set of multipliers and delay units, doing the same with the even-ordered samples, and then adding the two streams of processed samples back together. FIG. 43 shows an example of such a reduced hardware filter. The filter of FIG. 43 has input x 1024, output y 1026, 1-interval delay unit z-1, 2-interval delay units z-2, adders 1027 and multipliers 1028. As is apparent from the figure, odd samples x1, X3 and x5 are conducted to one set of multipliers having coefficients c1 and c3 while the even samples are conducted to other multipliers having coefficients c0 and c2. From a review of FIG. 43 it is apparent that the output y 1026 will be as follows: ______________________________________ t.sub.3 x.sub.1 c.sub.3 + x.sub.0 c.sub.2 t.sub.4 t.sub.5 x.sub.3 c.sub.3 + x.sub.2 c.sub.2 + x.sub.0 c.sub.0 + x.sub.3 c.sub.1 t.sub.6 . . .______________________________________ Thus, the resultant output signal is composed of a pulse train at intervals of only half the frequency of the original samples. In so doing, the timing recovery and carrier portions of the receiver system of the present invention are so adjusted to operate in conjunction with the matched filter to cause only the intersymbol samples to be discarded. A second hardware reduction is achieved as follows. As discussed above, the matched filter 1074 (FIG. 42) of the present invention is also combined with a superheterodyne down converter 1073. Down conversion is accomplished by multiplying the train of sample pulses by coefficients which correspond to a complex-valued periodic pulse train at the 5.625 MHz carrier frequency. The complex periodic signal used in the process can be expressed as the sum of real and imaginary coefficients of cosine and sine functions, i.e.: cos(-2π×5.625×10.sup.6 xt)+jsin(-2π×5.625×10.sup.6 xt) When combined with the 15 megasamples per second pulse train input signal, the time response of the above functions reduces to coefficients to be multiplied with the signal pulses at discrete time intervals (-0.75 nπ) with respect to the input signal, as follows: ______________________________________n cos(-0.75 nπ) sin(-0.75 nπ)______________________________________0 1 01 -1/√2 -1/√22 0 13 1/√2 -1/√24 -1 05 1/√2 1/√26 0 -17 -1/√2 1/√2.______________________________________ Since in the matched filter of the present invention odd input samples are applied only to odd taps of the filter, and even input samples are applied only to even taps, a reduction in multiplier hardware can be readily achieved since even samples are always multiplied by ±1 or 0 and odd samples are always multiplied by ±1/√2. Since the even samples are always multiplied by ±1 or 0, so long as sign bits are managed separately, the even coefficients required for down conversion can be combined with the coefficients of the Nyquist pulse-shaping filter simply by passing or not passing the samples occurring at those intervals. Similarly, the odd coefficients required for down conversion can be combined with the coefficients of the Nyquist pulse-shaping filter simply by scaling those coefficients by 1/√2. A third way in which the hardware usage is reduced in the present invention is by reusing the same multiplication and addition hardware to reflect the symmetrical nature of the square root raised cosine filter response. The filter coefficients are real and imaginary, which can be represented as even functions and odd functions respectively. Thus, for real coefficients, cr n!=cr -n! and for imaginary coefficients ci n!=-ci -n!. Since the resultant output at each tap 1029, 1030 is r n!=x k!c.sub.r n!-x k!c.sub.i n! it follows that r -n!=x k!c.sub.r n!+x k!c.sub.i n!. Thus, the multiplication operation x k!c n! need only be performed once for symmetrically situated coefficients, and the real and imaginary results either added or subtracted. Thus, the matched filter can be simplified to the structure 1031 shown in FIG. 44. Finally, another way in which hardware is conserved is by rearranging the arithmetic performed by the filter to use logic elements which are less costly in terms of area used on a semiconductor device on which the present receiving system can be implemented. The equations for each tap can be re-written as: r n!=x k!(C.sub.r n!-C.sub.i n!) r -n!=x k!(C.sub.r n!+C.sub.i n!) For even taps, it will be noted that for every tap, either Cr n! or Ci n! is zero. Therefore, if signs are considered separately, x k!Cr n! and x k!Ci n! can be calculated and multiplexed according to sign to form the difference and sum terms as required. For odd taps, (Cr n!-Ci n!) and (Cr n!+Ci n!) are used as the coefficients of the multipliers and the results multiplexed to form the sum and difference terms. The resulting tap structures are shown in FIGS. 45-46, where the sign inputs to the exclusive-or gates 1034, 1036, 1044, 1046, and the select lines of the multiplexers, 1033, 1035, 1043, 1045 are controlled according to a combination of the signs of the data, the real and imaginary coefficients, and the current position of the down-conversion sequence. The replacement of adders with exclusive-or gates and multiplexers conserves area as these components are smaller than adders. Moreover, no carry chain is present, a factor which significantly reduces the overall delay. Since the coefficients of each multiplier are always the same, constant coefficient multipliers can be used. These provide a major area saving, especially since Ci n! and Cr n! are small for high absolute values of n. DC Remover The signal received by the matched filter from the analog-to-digital converter contains a component which does not vary or varies relatively slowly with time. This is called a DC component. This results from the pilot carrier which has been down-converted to DC. The DC component must be removed from the signal prior to data detection because signal amplitude levels will otherwise be skewed by the amplitude of the DC component. The way in which the DC component is removed in the receiver system, according to the present invention, is by a DC remover 1050, shown in FIG. 47. As can be seen from FIG. 47, the DC remover 1050 operates similarly to a discrete time function integrator in that a portion (1/256) of the signal from the previous interval is used to form the signal output 1052 in the present interval. Thus, the DC remover circuit of FIG. 47 will operate to provide the result: y.sub.n =x.sub.n -(1/256) z.sup.-1 x.sub.n-1 +(1/256) (1/256)z.sup.-1 z.sup.-1 x.sub.n-2 +. . . Over time, with the feedback loop thus established, an equilibrium will be established in which the DC component of the signal will be subtracted out. Adaptive Equalizer The adaptive equalizer 70 (FIG. 4) disclosed hereinbelow essentially comprises a 28 tap finite impulse response (FIR) filter adapted according to the sign least-mean-square (LMS) algorithm. The phase tracker associated with the adaptive equalizer 70 employs a single tap full LMS adapted "phase estimate" to estimate and correct phase errors introduced by local oscillator jitter and carrier noise. The LMS algorithm and its sign variant is well known, and will not be further explained herein. It is discussed, for example, in Digital Communication, Second Edition, by Edward A. Lee and David G. Messerschmitt, Kluwer Academic Publishers, Chap. 11. The equalizer and phase tracker 754 is implemented as 3 main blocks as shown in FIG. 34: a finite impulse response filter adaptive equalizer block 729; a derotator and phase tracking block 730; and a general control block 800. The symbol period T of the data entering the adaptive equalizer 70 is 133.3 ns, corresponding to 7.5 Mbaud. The symbols are input in the format s5.2. Coefficients are stored as 16 bit s1.15 integers. Referring to FIG. 32, a finite impulse response filter core 700 has seven cells 702a-702g, of which cell 702a is illustrated in greater detail and particularly discussed, it being understood that the structure of cells 702b-702g is identical. Each cell corresponds to 4 taps of the finite impulse response filter. The outputs of the cells 702a-702g are summed with a tree of adders 704 to produce the final result out adeq 706. This is a 12 bit signal, format S5.6. The adaptive equalizer 70 and the cells 702a-702g are clocked at T/4, whereas data arrives at periods T. Referring now to FIG. 33, which shows the cell 702a in greater detail, it will be noted that the cells 702a-702g exploit this fact by sharing a multiplier and accumulation stage for each 4 tap data values and 4 coefficients. The multiplier-accumulator unit 705 of the cell 702a will now be described in further detail, again with reference to FIG. 33. The data shift register 708 comprises registers 710, 711, 712, and 713, and is also clocked at T. The outputs from the shift registers 710-713 therefore only change every 133 ns. The cell could be implemented by associating a multiplier with each of the registers 710-713, for a total of 4 multipliers. However because the multiplier 716 operates in only 33 ns, that is T/4, the cells 702a-702g have been designed to have one multiplier 716 which is switched by switch 714 between the four data registers 710-713. Four coefficient registers 720-723 are provided to supply the multiplier 716. Of course it is also required that the coefficient registers 720-723 also be switched, as indicated by switch 724 in FIG. 33. The filter structure requires that the cell output 727 be formed according to the equation ##EQU7## where CCout is the cell output 727; Dn is the contents of the nth data shift register; and Cn is the contents of the nth coefficient register. The cell output 727 is accumulated using the adder 726. The individual outputs CCout of each of the cells 702a-702g is latched, and summed in the adder tree 704. With this approach only 7 multipliers are required in the finite impulse response filter core 700, instead of 28. As the multiplier requires the largest area of each cell, a large amount of chip area has thus been conserved. Additional logic, generally referenced 742, is provided in the cells 702a-703g for adaptation. The LMS algorithm feeds back a final error value which is added to or subtracted from each of the coefficients according to the sign of the data that caused the error. For example if a positive data value in a particular tap of the finite impulse response filter produces a positive error on the output, it is assumed that the coefficient associated with that tap is too large. A small amount is therefore subtracted from the coefficient, and an updated value of the coefficient installed in the appropriate coefficient register. The logic 742 which performs the adaptation is clocked 4 times each symbol period and is thus shared among the data clocked through shift register 708. A delayed version of the sign 741 is used to control an adder or subtracter 736 which increments or decrements a coefficient register value in registers 720-723 by the value of the error adeq-- error 738. The delayed sign 741 is there to model the delay between the multiplication of the data in multiplier 716, and tot allow for the time required for the data to flow through the system and generate an error value. It is important that the sign used is the sign that was in the tap when the error was generated, or which caused the error to be generated. A delayed sign shift register 740 operates in parallel with the main data register 708, and is switched by switch 734, which operates similarly to switch 714. The same process is performed on all the taps. The data flow through the system can be appreciated with reference to FIG. 34, wherein the finite impulse response filter is referenced generally at 750. The data then flows through a phase tracker 754, which requires several cycles. Finally a slicer 756 which samples the data and returns an error signal to cells 702a-702g in the finite impulse response filter 750. The phase tracker 754 is explained with reference to FIGS. 35 and 37. The principle of the phase tracker 754 is that of derotation of the signal to align the symbol constellation in the I, Q axis. Rotation occurs because the carrier phase and the demodulator phase are not identical and there is noise associated with them. This causes the constellation to rotate slightly. This is corrected with a derotator 760, which requires both the in phase component 770 and the quadrature component 772 to be generated from the original signal in-- data 706, the latter initially only having an in phase component. The Hilbert filter 764 produces 90 degrees rotation to generate a quadrature component. Rotation by an angle θ is performed using the multipliers 774, 780. By exploiting the fact that for small θ, sinθ≈θ, and cosθ≈1, it is thus possible as an approximation to replace the multiplier 774 with a hardwired multiply-by-1, and replace the sinθ input to multiplier 780 with its approximation, θ. The phase tracker 754 adapts the value of θ using an error signal also derived from the LMS algorithm, as shown in FIGS. 34, 35 and 37. The Hilbert filter is an eleven tap finite impulse response filter which has been implemented in much the same way as the finite impulse response filter 750, except that the coefficient values are hardwired. One cell is referenced generally at 782. Again, to reduce hardware, the multiplier 786 is shared. Referring again to FIG. 35, the phase estimate is adapted, using the full LMS algorithm: θ'=θ+(Q×Δerror). With no phase error the input in-- data 762 is simply a(t). If there is a phase error in in-- data 762, then data=a(t)cosφ+a(t)sinφ where data is in-- data 762 φ is the phase error; and a is the quadrature component of a(t). The Hilbert filter 764 operates on the result out-- adeq 706 (FIG. 32), producing a Hilbert transform of data and yielding -a (t)sinφ+a(t)cosφ The phase tracker output, phaset-- out 766 is given by ##EQU8## If θ=φ, then the first term becomes cos2 θ+sin2 θ=1, and the second term becomes 0, so that phaset-- out 766=a(t). Referring to FIGS. 34 and 38, the multiplier and adder unit 790 is shared to do both the generation of the phase corrected output 766, and also adapt the estimate of θ, referenced at 900. It is clocked at T/4. During the first two T/4 cycles the multiplier 792 is used to generate Hilbert output x θ901, and the adder 794 adds Hilbert output x error 902 to the old value of θ to give a new value of θ. During the second two T/4 cycles the multiplier 792 generates Hilbert output x error 902, and the adder 794 adds Hilbert output x θ901 to the in-phase data 770 to generate the phase corrected output 766. The state machine which controls the adaptive equalizer, phase tracker, and descrambler is shown in FIG. 39. The state machine 910 changes state as symbols enter the equalizer. The state is reset to s-- correlate 920 after a channel change. In this state the sync detector uses correlation to locate the synchronization signature. When found the state machine behaves as a counter, counting symbols to determine whether the input data is training sequence s-- train 922, data s-- run 923, or s-- signature 924. There is an implicit delay in the equalizer and in the phase tracker which must be accounted for in assertion of control signals which control later stages of the system. Delayed versions of the state are used. The slicer unit 756 is shown in further detail in FIGS. 40a-40c. A slicer 810 generates a 4 bit output symbol 905. A training sequence generator 906 generates a reference training sequence 907. Subtracter 912 takes the difference between the phase tracker output 766 (FIG. 35) and the sliced data, output symbol 905, or the reference training sequence 907 during training mode, to produce an error value 908. The error is multiplied by the appropriate scaling factor to generate the phase tracker error 909, which is used to adapt the estimate of θ900 (FIG. 34). Referring again to FIG. 34, error value 908, or a similarly derived error based on the adeq-- output value 706, is multiplied by the appropriate scaling factors to generate the equalizer error 738 used to adapt the adaptive equalizer block 729. Switches 938, operated by the control block 800, control the mode of operation, determining whether the equalizer and phase tracker adapt independently or jointly, as shown in FIGS. 40b and 40c respectively. FIG. 36 shows an alternative embodiment of a derotator and phase tracker circuit 950 which could be used in a quadrature based modulation system. Reed-Solomon (208,188) Decoding Error correction herein is disclosed with reference to Reed-Solomon decoding. As is known to those skilled in the art, Reed-Solomon decoding is a specialized block code. Other block codes could be employed without departing from the spirit of the invention. Reed-Solomon decoding of a 208 byte packet is explained with reference to FIGS. 8-15. Unless otherwise noted, it will be understood that all arithmetic is Galois Field arithmetic. As submitted to the error correction circuitry 72 (FIG. 4), a packet 150 of (N, K) data has the general format shown in FIG. 7, wherein d is an information byte; p is a parity check byte; c is a byte of the transmitted packet; and N is the number of bytes in the packet. In the preferred embodiment, (N, K) are (208, 188). It will be evident that there are 20 parity check bytes. (N-K)=20 Also, the maximum number of bytes that can be corrected are T=(N-K)/2=10. In the discussion, the following notation is used. C(x) is the transmitted packet; E(x) is the error injected between assembly of the packet and its reception; R(x) is C(x)+E(x) S(x) is the syndrome polynomial of order 2T-1; Λ(x) is the locator polynomial; and Ω(x) is the evaluator polynomial. Those skilled in the art will appreciate that S(x) contains information on corruption in R(x). A(x) has a maximum order of T, and its roots determine the error locations in R(x). The evaluation of Ω(x) at an error location leads to the error value at that location. The approach selected for decoding is explained with reference to FIGS. 8 and 9. A 208 byte packet R(x) 152 is input into a FIFO 160, which is realized as a RAM capable of storing 448 bytes. The FIFO 160 simply acts as a delay while the decoding proceeds. Only the 188 information bytes are required to be stored. The 20 parity bytes may be discarded as they are not employed after calculation of the syndromes S(x) 154. The decoder 180 receives deinterleaved data R(x) 152. a VALID flag 184 indicates that the current byte of R(x) 152 is a valid byte in the current packet. The end-of-packet flag EOP 182 is raised at the same time as the Valid flag 184 indicates that the last byte of a packet has been received. An error flag OS 186 is raised in the event that a packet was prematurely terminated by the deinterleaver. This results in a resetting operation for the entire decoder 180. Bus CORRECT 187 contains corrected data. Line RS-VALID 189 indicates that data is on the bus CORRECT 187. This line is only raised when data bytes are on the line. Line RS-- EOP 190 is a line indicating that the end of a packet has been detected. The line PACK-- ERR 192 goes high when line RS-- EOP 190 is raised. It indicates, that the decoder 180 has been unable to correct a previously released packet. The Line RS-- OS 194 signifies that a significant error condition has occurred within the packet. This signal is propagated through the system, and indicates that the current block will not provide any more valid data. Referring to FIG. 11, The first 188 bytes of R(x) appear on line WD 176 of the FIFO 160, and are written into an address of RAM 170 according to the state of counter 168. Similarly a delayed version of R(x) is read on line RD 178 from addresses selected according to the state of counter 172. Syndromes are calculated in syndrome calculation block 162 according to the following equation. ##EQU9## wherein Sj is the jth syndrome; n is the number of bytes in a packet; m0 is an arbitrary integer (which equals zero); rxi is the ith byte in a packet; and αx is the xth α in a Galois Field. The syndrome is generated by a bank of three units 212, 212, 214 operating in parallel, as shown with reference to FIGS. 10 and 12.8-14. The Galois Field entries αj+m0 are produced by a tapped feedback shift register 200, comprising a plurality of flip-flops 202 having adders 204, 204, the positions of which are determined by the field polynomial, x8 +x4 +x3 +x2 +1. While 24 syndromes are determined for convenience, only S0 -S19 are actually used by the rest of the decoder 180. The Berlekamp algorithm executed in block 164 is a known method used to derive the locator polynomial, Λ(x) 156, and the evaluator polynomial, Ω(x) 158. Its flow diagram is shown in FIG. 13. The following notation is used: R1 is the Shift Register containing Syndrome bytes produced by the Syndrome block; R2 contains the locator polynomial, Λ(x), with Λ0 =1; R3 contains the D polynomial; R4 contains the evaluator polynomial, Ω(x), with ΩB0 =0; R5 is temporary storage for the A polynomial; dn is delta; l is the order of the polynomial in R1; and n is a counter. On STOP 224, l represents the number of errors found by the algorithm, and is maintained in register 239 (FIG. 14). In block 220, it is necessary to repetitively exchange the contents of registers R2 232 and R3 233 for subsequent iterations of the algorithm. The value dn is calculated according to the formula ##EQU10## FIG. 14 differs from the algorithm in FIG. 13. Instead of exchanging the contents of register R2 232 with register R3 233, and exchanging register R4 234 with register R5 235, a toggle switch is used to remember which register contains the respective polynomial. This approach is economical, as temporary storage is not required. Control block 230 is a 5 bit state machine, with decoding from each state determining (a) the next state; (b) enables of each of the shift registers 231-236; (c) the multiplexer selects for multiplexers 238, 240, 242, 244 to select input to registers 231-235, corresponding to R1-R5 in block 220; (d) controlling the time during which each state is active; (e) recalculating the variables n and l as necessary; (f) and maintaining an indication of which registers contain Λ(x) and Ω(x). The Chien Search block 166 exhaustively evaluates every possible location to determine if it is a root of Λ(x). Evaluation at a location is accomplished according to the equation ##EQU11## Although only 208 locations have been received, checking is done for all 255 possible locations, beginning at x=α254 ; for example Λ(α.sup.-254)=Λ(α.sup.1)=Λ.sub.10 (α.sup.10)+Λ.sub.9 (α.sup..sup.9)+ . . . +Λ.sub.2 (α.sup.2)+Λ.sub.1 (α.sup.1)+1 Λ(α.sup.-253)=Λ(α.sup.2)=Λ.sub.10 (α.sup.20)+Λ.sub.9 (α.sup..sup.18)+ . . . +Λ.sub.2 (α.sup.4)+Λ.sub.1 (α.sup.2)+1 Λ(α.sup.-252)=Λ(α.sup.3)=Λ.sub.10 (α.sup.30)+Λ.sub.9 (α.sup..sup.27)+ . . . +Λ.sub.2 (α.sup.6)+Λ.sub.1 (α.sup.3)+1, etc. The Chien Search Block 166 (FIG. 8) is shown in greater detail in FIG. 15. The terms of Λ(x) are computed using two parallel units. The top unit 280, having a pair of shift registers 250,270 that feed into a multiplier 260 concerns the coefficients α1 -α5 will be discussed. The other units 282, 286, 288 operate identically. The two top units in FIG. 15 are used to compute Λ(x). In each iteration the products are subjected to a rotate operation, so that they recycle through the shift registers. Thus In the sixth iteration the next location is being evaluated, and the rightmost cell of the shift register contains the product Λ5 (a5). The product Λ5 (α10) is immediately required, and it is only now necessary to multiply the product of the first iteration by α5. Counter 290 is incremented each time Λ(x)=0, in order to count the number of error locations found. There are two checks performed to determine if the received packet contained more than the maximum of 10 erroneous bytes. Firstly the value in the counter 290 is compared with the value in register 239 (FIG. 14). A difference between these two values indicates a packet having more than 10 errors. Secondly an error in bytes 254-208 found in the Chien search would invalidate the block. These are bytes not received, but only used to simplify the Chien search block 166. The equation used to calculate the magnitude of error is given by ##EQU12## This result is only added to the received byte if the evaluation of Λ(x) at that location equals zero. The evaluation of Ω(x) and Λ'(x) is performed similarly to Λ(x), using the lower two units 286, 288. Unit 288 produces Λ'(x), and the reciprocal is obtained with a look-up table in a ROM (not shown). Output Interface The output interface of the present invention performs the following functions: resynchronization, buffering and handshaking control with the external processing environment. Resynchronization is necessary in order to correctly transfer data from the Reed Solomon decoder at the 7.5 MHz symbol rate clock into the external processing environment which may operate at a different clock rate. Buffering is necessary because the data is received from the channel at a relatively slow speed in relation to the transfer speed required by the external processing environment. Handshaking control is necessary to ensure that the data is properly transferred from the receiving system of the present invention to the external processing system. The output interface first assembles bytes together into 32-bit words. With reference to FIG. 55, bytes arrive one at a time from the Reed Solomon decoder 72 (FIG. 4) over an 8-bit data path once every second cycle at the 7.5 MHz decoder clock rate, (except during gaps corresponding to discarded frame headers and check bytes), i.e. once every eighth cycle at the 30 MHz internal clock. Each byte that arrives is gated into one of four latches 1302, in sequence by selector inputs LD1, LD2, LD3, and LD4 by a control 1306, until all four latches have been loaded. Then the contents of latches 1302 are loaded with the internal clock signal 1316 into a 32-bit-wide latch 1304. The resynchronization process continues, as is evident from FIG. 55, with the propagation of a control signal DATA-- VALID 1308 from the control 1306 into latch 1310, which is clocked at the external processing environment's clock rate, e.g. 27 MHz. Because of the difference between the clock rates of the receiving system and the external processing environment, the possibility exists at the time that the outgoing signal DATA-- VALID 1308 is accepted into latch 1310, the signal has not yet settled to a definite level. The signal condition at such times can be referred to as indeterminate. The potential propagation of an indeterminate signal condition (and the resultant error that can be induced thereby) is avoided in the output interface according to the present invention by gating the outgoing control signal DATA-- VALID 1308 from the receiving system's internally clocked control element, control 1306, through a series of latches 1310,1312 and 1314 which are all clocked by the external processing environment's clock 1316. After passing through the series of latches 1310,1312, and 1314, the likelihood that the signal emerging from the final latch 1314 will remain in an indeterminate condition becomes vanishingly low. Once the signal DATA-- VALID 1308 is fully propagated through latches 1310, 1312 and 1314, it is input into another control element 1318. In response to receipt of the signal DATA-- VALID 1308 from latch 1314, the control element 1318 activates a signal LD 1319 which, in combination with the external clock 1316, signals the 32-bit latch 1320 that it is time to latch the data in from latch 1304. For reasons of efficiency, data words received in latch 1320 are preferably placed in an output buffer and then transferred to the external processing environment as needed. The data words are transferred over a 32-bit wide data path into a FIFO buffer 1322. Once a full packet of data words has been loaded into the FIFO buffer 1322, the external processor can then draw upon the data words as needed. Whole packet data buffering in this manner permits the error detection and correction operations to be completed prior to outbound transfer of data to the external processing environment. In the preferred embodiment, as the data is being written into the FIFO buffer 1322, it is simultaneously being processed by the error correction circuitry 72 (FIG. 4). Upon completion of the error correction and detection operation by the decoder 180 (FIG. 9) of the error correction circuitry 72, the signal PACK-- ERR 192 is asserted in the event an uncorrectable error is detected. An appropriate error bit is then set in the packet to inform the external processing environment of the fact that the packet currently in the FIFO buffer 1322 is corrupted. For example, in the case of MPEG 2 transport packets, the first bit of the second byte of the packet is set when the signal PACK-- ERR 192 is asserted. Thus, error indicators such as may be found in appropriate bytes of the transport packet are identified to the external processing environment before actual packet transfer has occurred. It will be apparent that without buffering in the FIFO buffer 1322, the second byte of the MPEG 2 packet would have already been transmitted to the external processing environment before the fact that the packet was corrupted had been determined. But with the use of a buffer in the manner described, unnecessary processing time and/or other error handling can be avoided. Published European patent application number EP A-057-6749 provides a description of the preferred structure of the output interface between FIFO buffer 1322 and the external processing environment, including handshaking signals which control the transfer of data between the FIFO 1322 and the external processing environment for use in an external processing environment such as MPEG-2 (ISO/IEC JTC1/SC29/WG11N0702). Operation Acquisition of a channel, or a channel change is explained with reference to FIG. 24. The process is initiated at step 500. In step 505 the automatic gain control is set into averaging mode, in which the outputs are based on a prior knowledge of the mean values of the entire input waveform. Once the frame sync has been detected, the values are adjusted on the basis of the known characteristics of the training sequence. This mode provides improved accuracy. Stability of the automatic gain control is tested at decision step 510. If the automatic gain control has not tracked to a stable value, then step 505 is repeated. It is possible to override decision step 510 if the system is operating under microprocessor control. When the automatic gain control has been determined to be stable, the frequency lock loop circuitry is enabled at step 515. An initial frequency offset of ±450 KHz is permitted. As this is outside the pull range of the carrier recovery phase lock loop circuit, a separate frequency lock loop is used. Frequency lock is evaluated at decision step 520. If this test succeeds, the frequency lock loop circuitry is switched out, and timing recovery is initiated at step 525. The timing recovery lock detect operates similarly to the frequency lock loop detect, as has been discussed above. Then, at step 530 the phase lock loop circuit switched in for accurate phase tracking. The sync detect sequence is initiated at step 540. This is explained in further detail with reference to FIG. 25. In step 568 a search is carried out for a frame sync during the time required to transmit a complete frame. The result of the search is tested at decision step 570. If the test fails a further test is conducted at step 572 to determine if the maximum time allotted to the search has elapsed. If not the process returns to step 568. Otherwise it is assumed that there was an error in steps 500-535 of the channel change sequence. The process then exits at step SCREAM 578, and the channel change sequence then restarts at step 500. If sync was successfully detected at step 570 then the adaptive equalizer is trained at step 574 using a large step size. Also a "training mode on" signal is announced. This signal has concurrently been tested at step 550 (FIG. 24), and when it is detected at step 555, the automatic gain control and DC remover are switched into their more accurate training modes. The channel changing process then exits at step 560. Referring again to FIG. 25, it should be noted that in training mode the automatic gain control and DC remover only adapt during the second and subsequent training sequences following sync detection. The adaptive equalizer may take two training sequences to adapt. Data in the first frame is regarded as unreliable, and is therefore discarded in step 576. Following the first frame, a second sync sequence is expected in the frame header of the second frame, and this is tested at decision step 580. If the second sync does not appear correctly, it is assumed that the first sync was falsely detected, or there was an error in the channel change sequence in steps 500-535. The sync detection sequence is then terminated at step SCREAM 578 and control then returns to step 500 to restart the channel change sequence. If a second sequence is detected, then the adaptive equalizer is trained in step 582 using a fine step size. Data from this and subsequent frames is decoded and output in step 584. Sync is tested in a third sequence in decision step 586. The sync detect process normally will recycle through steps 582, 584, and decision step 586; however if at any time a frame sync does not appear as expected for two successive frames, as indicated in steps 588, 590, and decision step 592, wherein the process of steps 582, 584, and decision step 586 is repeated, then a signal SHOUT is generated in step 594. This can have two optional effects, depending on whether the system is under microprocessor control. In one embodiment, a signal NO-- SYNC-- EVENT (not shown) is generated, which interrupts a host microprocessor. In another embodiment, the channel change sequence is restarted at step 500. Electrical Specifications The electrical specifications are given in the following tables: TABLE 7______________________________________Absolute maximum ratingsSymbol Parameter Min. Max. Units______________________________________V.sub.DD Nominal 5V supply voltage -0.5 6.5 V relative to GNDV.sub.IN Input voltage on any pin. GND - 0.5 VDD + 0.5 VT.sub.A Operating temperature -40 +85 ×CT.sub.S Storage temperature -55 +125 ×C______________________________________ TABLE 8______________________________________DC Operating conditions______________________________________V.sub.DD Nominal 5V supply voltage 4.75 5.25 V relative to GNDGND Ground 0 0 VT.sub.A Operating temperature 0 70 ×CI.sub.DD RMS power supply current 500 mAI.sub.VCCref RMS current drawn by V.sub.CCref 5 mA______________________________________ Two different signal interface types are implemented. Standard (5V) TTL levels are employed by the microprocessor interface. 5V CMOS levels are used by the other interfaces. In the following tables, where a signal type is indicated, the meaning of each symbol is as shown in Table 9. TABLE 9______________________________________Signal typesType Logic levels employed______________________________________C 5V CMOS levelsT 5V TTL levelsT o/c 5V TTL levels (open collector signal)______________________________________ TABLE 10______________________________________TTL (5V) DC CharacteristicsSymbol Parameter Min. Max. Units @ Notes______________________________________V.sub.IL Input LOW GND - 0.8 V a voltage 0.5V.sub.IH Input HIGH 2.0 VDD + V voltage 0.5V.sub.OL Output LOW 0.4 V I.sub.OL max voltageV.sub.OLoc Open collector 0.4 V I.sub.OLoc max output LOW voltageV.sub.OH Output HIGH 2.4 V I.sub.OH min voltageI.sub.OL Output current, 16 mA V.sub.OL max LOWI.sub.Ooc Open collector 4.0 8.0 mA V.sub.OLoc max output current, LOWI.sub.OH Output current, -400 mA V.sub.OH min HIGHI.sub.OZ Output off state ±20 mA leakage currentI.sub.IN Input leakage ±10 mA currentC.sub.IN Input capaci- 5 pF tanceC.sub.OUT Output/IO 5 pF capacitance______________________________________ TABLE 11______________________________________CMOS (5V) DC CharacteristicsSymbol Parameter Min. Max. Units @ Notes______________________________________V.sub.IL Input LOW GND - 0.5 1.4 V V.sub.DD = a voltage 4.75V.sub.IH Input HIGH 3.7 V.sub.DD + V V.sub.DD = voltage 0.5 5.25V.sub.OL Output LOW 0.4 V ≦4mA voltage 0.1 V ≦1mAV.sub.OH Output HIGH V.sub.DD - 0.4 V ≧4mA voltage V.sub.DD - 0.1 V ≧- 1mAI.sub.OZ Output off state ±20 mA leakage currentI.sub.IN Input leakage ±10 mA b currentI.sub.JIL Leakage; JTAG -50 -180 mA GND c with pull-upI.sub.JIH Leakage; JTAG 10 mA VDD with pull-upC.sub.IN Input capaci- 5 pF tanceC.sub.OUT Output/ 5 pF IO capacitance______________________________________ a. AC input parameters are measured at a 2.5 V measurement level. b. Except JTAG signals with internal pull-up resistors (TRST, TDI, and TMS). c. For JTAG pins with pull-up resistors (TRST, TDI, and TMS). TABLE 12______________________________________OUT.sub.-- CLK requirementsNum. Characteristic Min. Max. Unit______________________________________#1 Clock high period 33 53 ns#2 Clock high period 10 ns#3 Clock low period 10 ns______________________________________ RESET is the main chip reset signal, all circuitry is reset and adopts the reset state indicated in the various tables in this data sheet. RESET must be asserted (LOW) for at least four IN-- CLK cycles after the power and clocks are stable to ensure a correct reset. Signals and registers TABLE 13______________________________________ JTASignal Name I/O Type G Description______________________________________IN.sub.-- DATA 7:0! I C I A/D Converter InterfaceSAMPLE O C TVSB.sub.-- IN I -- A Analog signal inputPOS.sub.-- REF I -- A ADC positive reference voltageNEG.sub.-- REF I -- A ADC negative reference voltageIN.sub.-- CLK I C I Sample timing controlTCTRL O C TTCLK O C T Symbol rate clockAGC O C T Sigma-delta modulated AGCFCTRL 9:0! O C T Carrier recovery feedback.OUT.sub.-- DATA 15:0! O T T Output interface pins.OUT.sub.-- VALID O T TOUT.sub.-- ACCEPT I T IOUT.sub.-- MODE I C IOUT.sub.-- WIDTH I C IOUT.sub.-- CLK I C IRESET I C R Micro processor interface (MPI).ME 1:0! I T IMR/W I T IMA 7:0! I T IMD 7:0! I/O T BIRQ O T o/c DVSB.sub.-- LEVEL 1:0! O C TTCK I C J JTAG test access port.TDI I C JTDO O C JTMS I C JTRST I C JVDD -- -- A 5V power railGND -- -- A GroundTPH0 I C I Test clocksTPH1 I C IMONSEL 1:0! I C I Monitor bus source selectMONITOR 8:0! O C T Monitor bus______________________________________ TABLE 14______________________________________Register Overview MapAddress (he × ) Register name______________________________________0 × 00 . . . 0 × 01 Interrupt service0 × 02 . . . 0 × 27 Operation control0 × 28 . . . 0 × 5f Adaptive equalizer coefficients0 × 60 . . . 0 × 7e Test and diagnostic registers0 × 7f Revision register______________________________________ TABLE 15______________________________________Interrupt Service AreaAddress (hex) Bit no. Register name______________________________________0 × 00 7 chip.sub.-- event 6 output.sub.-- overflow.sub.-- event 5 packet.sub.-- error.sub.-- event 4 no.sub.-- sync.sub.-- event 3 user.sub.-- data.sub.-- event 2 time.sub.-- out event 1:0 (not used)0 × 01 7 chip.sub.-- mask 6 output.sub.-- overflow.sub.-- mask 5 packet.sub.-- error.sub.-- mask 4 no.sub.-- sync.sub.-- mask 3 use.sub.-- data.sub.-- mask 2 time.sub.-- out mask 1:0 (not used)______________________________________ TABLE 16__________________________________________________________________________Operation control registersAddr(Hex)Bit no. dir/reset Register name Description__________________________________________________________________________2 0 R/W/1 change.sub.-- channel Writing 1 causes to initiate the channel change sequence. All other operation is terminated, but output will always stop at a packet boundary. If this bit is read, it will be 1 during channel change (channel change state machine is active.3 5 R/W/0 agc.sub.-- lock.sub.-- mode If agc.sub.-- lock.sub.-- mode is set to 0 the internal AGC lock detect circuit is used in the channel change sequence. If it is set to 1 then the channel change sequence will4 R/W/0 set.sub.-- agc.sub.-- lock proceed to the next state when set.sub.-- agc.sub.-- lock is set to 1 (or immediately if set.sub.-- agc.sub.-- lock is already set to 1).3 R/W/0 fll.sub.-- lock.sub.-- mode If fll.sub.-- lock.sub.-- mode is set to 0 the internal FLL lock detect circuit is used in the channel change sequence. If it is set to 1 then the channel change sequence will proceed to the next2 R/W/0 set.sub.-- fll.sub.-- lock state when set.sub.-- fll.sub.-- lock is set to 1 (or immediately if set.sub.-- fll.sub.-- lock is already set to 1).1 R/W/0 tmr.sub.-- lock.sub.-- mode If tmr.sub.-- lock.sub.-- mode is set to 0 the internal FLL lock detect circuit is used in the channel change sequence. If it is set to 1 then, depending on whether the PLL is locked the0 R/W/0 set.sub.-- tmr.sub.-- lock channel change sequence may proceed to the next state when set.sub.-- tmr.sub.-- lock is set to 1 (or immediately if set.sub.-- tmr.sub.-- lock is already set to 1).4 2 R agc.sub.-- locked AGC internal lock detect. 1 if AGC is in lock, 0 if it is not1 R fll.sub.-- lock FLL internal lock detect. 1 if FLL is in lock, 0 if it is not.0 R tmr.sub.-- locked Timing recovery internal lock detect. 1 if timing recovery is in lock, 0 if it is not.5 3.2 R/W/00 adc.sub.-- selec 00 selects the external Analog to Digital converter (digital input on IN.sub.-- DATA 7:0!) 01 selects the internal Analog to Digital converter (analog input on VSB.sub.-- IN)1 R/W/1 sync.sub.-- err.sub.-- action Controls the effect of failing to detect two frame syncs in a row in their expected locations). 0 selects no action. 1 causes the channel change sequence to be initiated.0 R/W/1 fec.sub.-- err.sub.-- action Controls the effect of the Reed- Solomon decoder finding uncorrectable errors in two adjacent packets. 0 selects no action. 1 causes the channel change sequence to be initiated. In both cases the packet.sub.-- error.sub.-- event bit is set.6 6:4 R/W/ fil.sub.-- time.sub.-- out The frequency "hop" time out used 0×4 during frequency acquisition. The number specified is a multiple of 4096*T/2 (15 MHz) clock periods. i.e. fil.sub.-- time.sub.-- out = 1 gives a time out of about 0.27 μs.3:0 R/W/ seq.sub.-- time.sub.-- out The time out for the channel change 0×8 sequence in multiples of 32768 × T/2 clock periods.7 7:0 R/W/0× fec.sub.-- err.sub.-- count This value in this register is 00 incremented by one every time the Reed Solomon decoder corrects an error in the data stream. If the value 0×00 is written to this register immediately after it has been read then the value will be the number of errors since the last read. The value has no meaning if an uncorrectable error has occured.8 7:0 R/W/? nyq.sub.-- gain Gain applied to the output of the Nyquist filter.09 7:0 R/W/? dc.sub.-- key.sub.-- value The value used by the DC remover in keyed mode.0a (not used)0b (not used)oc 4 R/W/0 agc.sub.-- invert Setting this bit to 1 causes the sigma- delta modulated AGC output to be inverted.3:2 R/W/ agc.sub.-- av.sub.-- gain The gain constant used in the AGC 0b11 circuit in averaging mode. 00 selects 2.sup.-13 01 selects 2.sup.-14 10 selects 2.sup.-15 11 selects 2.sup.-161:0 R/W/ agc.sub.-- train.sub.-- gain The gain constant used in the AGC 0b10 circuit in training mode. 00 selects 2.sup.-13 01 selects 2.sup.-14 10 selects 2.sup.-15 11 selects 2.sup.-160d 7:0 R/W/ agc.sub.-- av.sub.-- bias The mean constellation value used 0×34 by the AGC circuit in averaging mode.0e 7:0 R/W/ agc.sub.-- train.sub.-- bias The mean constellation value used 0×30 by the AGC circuit in averaging mode.0f 7:4 R/W/0× agc.sub.-- lock.sub.-- value These values are used by the internal 4 AGC lock detect circuit to determine whether the AGC is in lock.3:0 R/W/ agc.sub.-- lock.sub.-- time agc.sub.-- lock.sub.-- time is in units of symbol 0×4 periods × 64.10 5:3 R/W/0b tmr.sub.-- p.sub.-- gain.sub.-- acq Proportional gain of the timing 011 recovery loop filter used during acquisition 000 selects 2.sup.3 001 selects 2.sup.4 010 selects 2.sup.5 011 selects 2.sup.6 100 selects 2.sup.7 101 selects 2.sup.7 110 selects 2.sup.7 111 selects 2.sup.710 2:0 R/W/ tmr.sub.-- i.sub.-- gain.sub.-- acq Integral gain of the timing recovery 0b110 loop filter used during acquisition. 000 selects 2.sup.-14 001 selects 2.sup.-13 010 selects 2.sup.-12 011 selects 2.sup.-11 100 selects 2.sup.-10 101 selects 2.sup.-9 110 selects 2.sup.-8 111 selects 2.sup.-711 5:3 R/W/ tmr.sub.-- p.sub.-- gain.sub.-- run Proportional gain of the timing 0b001 recovery loop filter used once lock has been established. Selections as for tmr.sub.-- p.sub.-- gain.sub.-- acq.2.0 R/W/ 0tmr.sub.-- i.sub.-- gain.sub.-- run Integral gain of the timing recovery 0b01 loop filter used once lock has been established. Selections as for tmr.sub.-- i.sub.-- gain.sub.-- acq.12 5:4 R/W/ tmr.sub.-- lock.sub.-- value Used for timing recovery lock detect. 0×33:0 R/W/ tmr.sub.-- lock.sub.-- time Used for timing recovery lock detect. 0×213 (not used) - timing recovery address space14 0 R/W/ fll.sub.-- p.sub.-- gain The proportional gain of the PLL loop15 7:0 0×0c5 filter.16 0 R/W/ pll.sub.-- p.sub.-- gain Integral gain of the PLL loop filter.17 7:0 0×01d18 2:0 R/W/ fll.sub.-- i.sub.-- gain Integral gain of the PLL loop filter.19 7:0 0×24a1a 2:0 R/W/ pll.sub.-- i.sub.-- gain Integral gain of the PLL loop filter.1b 7:0 0×00d1c 4:0 R/W/ fll.sub.-- lock.sub.-- value Used for FLL lock detect. 0×081d 3:0 R/W/ fll.sub.-- lock.sub.-- time Used for FLL lock detect. 0×41e 3:0 R/W/ dac.sub.-- bits Number of bits output by the FPLL Sigma-Delta.1f (not used)20 7:0 R/W/ user.sub.-- reg0 User byte 0. 0×0021 7:0 R/W/ user.sub.-- reg1 User byte 1. 0×0022 1 R/W/0 vsb.sub.-- levels.sub.-- mode 0 selects automatic mode; the VSB modulation is set automatically from the information in the user data field of the frame header. 1 selects manual mode; the VSB modulation is the value written to the vsb.sub.-- levels register.23 7:5 R/W/0b adeq.sub.-- run.sub.-- step The step size used to train the 100 adaptive equalizer during the data portion of the frame (i.e. not during the/40964:2 R/W/0b adeq.sub.-- train.sub.-- step The step size used to train the 100 adaptive equalizer during "slow train" training sequences. 000 selects 0 (adaptation disabled) 001 selects 1/2 * 1/512 010 selects 3/4 * 1/512 011 selects 7/8 * 1/512 100 selects 1 * 1/512 101 selects 9/8 * 1/512 110 selects 5/4 * 1/512 111 selectes 3/2 * 1/5121:0 R/W/0b vsb.sub.-- levels The VSB constellation to be used. If 00 vsb.sub.-- levels.sub.-- mode is 0, this value is loaded from the user data field of the frame header. If vsb.sub.-- levels.sub.-- mode is 1 the value should be written from the MPI (if the reset value of 16 VSB is not to be used). 00 selects 16 VSB 11 selects 8 VSB6(not used) 10 selects 4 VSB 01 selects 2 VSB24 7 R/W/0 indy.sub.-- loops When set to 0, the adaptive equalizer and phase tracker are jointly adaptive. When set, adaptive equalizer and phase tracker are adapted independently using independent error values.6 (not used)24 5:3 R/W/0b adeq.sub.-- fast.sub.-- step The step size used to train the(cont.) 100 adaptive equalizer during "fast train"/40962:0 R/W/0b sync.sub.-- mask The number of signature symbols 011 whose sign must be correctly detected in order for the signature to be correctly detected: 000 selects 31 001 selects >= 30 011 selects >= 28 111 selects >= 24 Values other than these should not be used.25 7:5 R/W/0b pht.sub.-- run.sub.-- step The step size used to adapt the 100 phase tracker during the data portion of the frame (i.e. not during the training sequence) 000 selects 0 (adaptation disabled) 001 selects 1/2 * 1/1024 010 selects 3/4 * 1/1024 011 selects 7/8 * 1/1024 100 selects 1 * 1/1024 101 selects 9/8 * 1/1024 110 selects 5/4 * 1/1024 111 selects 3/2 * 1/10244:2 R/W/0b pht.sub.-- train.sub.-- step The step size used to adapt the 100 phase tracker during training sequence. Selections as for pht.sub.-- run.sub.-- step.1 R/W/0 input.sub.-- double If set to 1 the input data to the adaptive equalizer will be multiplied by 2. Use to increase the dynamic range of the data used in the adaptive equalizer if the dynamic range would otherwise be less then a half of the range available.0 R/W/0 scramble.sub.-- disable 0 selects descrambler enabled 1 selects descrambler disabled (use if the transmiffed data has not been scrambled.26 7:0 R/W/0× phase.sub.-- estimate The phase estimate of the phase27 7:0 0000 tracker.__________________________________________________________________________ TABLE 17__________________________________________________________________________Adaptive Equalizer Coefficient RegisterAddr(Hex) Bit no. Dir/reset Register name Description__________________________________________________________________________28 7:0 R/W adeq.sub.-- coeff.sub.-- 0 Adaptive equalizer coefficient value.29 7:0 R/W2a 7:0 R/W adeq.sub.-- coeff.sub.-- 1 Adaptive equalizer coefficient value.2b 7:0 R/W2c 7:0 R/W adeq.sub.-- coeff.sub.-- 2 Adaptive equalizer coefficient value.2d 7:0 R/W2 7:0 R/W adeq.sub.-- coeff.sub.-- 3 Adaptive equalizer coefficient value.2f 7:0 R/W30 7:0 R/W adeq.sub.-- coeff.sub.-- 4 Adaptive equalizer coefficient value.31 7:0 R/W32 7:0 R/W adeq.sub.-- coeff.sub.-- 5 Adaptive equalizer coefficient value.33 7:0 R/W34 7:0 R/W adeq.sub.-- coeff.sub.-- 6 Adaptive equalizer coefficient value.35 7:0 R/W36 7:0 R/W adeq.sub.-- coeff.sub.-- 7 Adaptive equalizer coefficient value.37 7:0 R/W38 7:0 R/W adeq.sub.-- coeff.sub.-- 8 Adaptive equalizer coefficient value.39 7:0 R/W3a 7:0 R/W adeq.sub.-- coeff.sub.-- 9 Adaptive equalizer coefficient value.3b 7:0 R/W3c 7:0 R/W adeq.sub.-- coeff.sub.-- 10 Adaptive equalizer coefficient value.3d 7:0 R/W3 7:0 R/W adeq.sub.-- coeff.sub.-- 11 Adaptive equalizer coefficient value.3f 7:0 R/W40 7:0 R/W adeq.sub.-- coeff.sub.-- 12 Adaptive equalizer coefficient value.41 7:0 R/W42 7:0 R/W adeq.sub.-- coeff.sub.-- 13 Adaptive equalizer coefficient value.43 7:044 7:0 R/W adeq.sub.-- coeff.sub.-- 14 Adaptive equalizer coefficient value.45 7:0 R/W46 7:0 R/W adeq.sub.-- coeff.sub.-- 15 Adaptive equalizer coefficient value.47 7:0 R/W48 7:0 R/W adeq.sub.-- coeff.sub.-- 16 Adaptive equalizer coefficient value.49 7:0 R/W4a 7:0 R/W adeq.sub.-- coeff.sub.-- 17 Adaptive equalizer coefficient value.4b 7:0 R/W4c 7:0 R/W adeq.sub.-- coeff.sub.-- 18 Adaptive equalizer coefficient value.4d 7:0 R/W4e 7:0 R/W adeq.sub.-- coeff.sub.-- 19 Adaptive equalizer coefficient value.4f 7:0 R/W50 7:0 R/W adeq.sub.-- coeff.sub.-- 20 Adaptive equalizer coefficient value.51 7:0 R/W52 7:0 R/W adeq.sub.-- coeff.sub.-- 21 Adaptive equalizer coefficient value.53 7:0 R/W54 7:0 R/W adeq.sub.-- coeff.sub.-- 22 Adaptive equalizer coefficient value.55 7:0 R/W56 7:0 R/W adeq.sub.-- coeff.sub.-- 23 Adaptive equalizer coefficient value.57 7:0 R/W58 7:0 R/W adeq.sub.-- coeff.sub.-- 24 Adaptive equalizer coefficient value.59 7:0 R/W5a 7:0 R/W adeq.sub.-- coeff.sub.-- 25 Adaptive equalizer coefficient value.5b 7:0 R/W5c 7:0 R/W adeq.sub.-- coeff.sub.-- 26 Adaptive equalizer coefficient value.5d 7:0 R/W5e 7:0 R/W adeq.sub.-- coeff.sub.-- 27 Adaptive equalizer coefficient value.5f 7:0 R/W__________________________________________________________________________ TABLE 18______________________________________Input interface signalsSignal Name Type Description______________________________________IN.sub.-- DATA 7:0! Input The input signal, as sampled by the A/D converter.SAMPLE Output Generated by dividing IN.sub.-- CLK by 2 inside.VSB.sub.-- IN Analog The analog equivalent of IN.sub.-- DATA. This is sampled using the internal A/D converter.POS.sub.-- REF Analog Reference voltages for the A/D converter.NEG.sub.-- REF AnalogIN.sub.-- CLK Input Generated by an external VCXO which is controlled by the timing recovery block to produce an accurate sample clock. Sampling is at twice the symbol rate.TCTRL Output Feedback signal to control the timing recovery VCXO. This signal is 1-bit signal-delta modulated.AGC Output Feedback signal to control the gain of the RF section. 1-bit sigma-delta modulatedFCTRL 9:0! Output Feedback signal to control the frequency of the RF demodulator. Sigma-delta modulated 14 bit valueVSB.sub.-- LEVEL 1:0! Output VSB modulation level.______________________________________ TABLE 19______________________________________FPLL data widths ConceptualSignal bit positions Note______________________________________ADC output s5.2 Input to chipI, Q inputs s5.3Error signal (Err) s5.3I coefficient -9.20I coeff * Err s-4.18 Rounded result of multiplicationIntegrator register s1.18I - integrator s1.12 Truncated integrator register valueoutputP coefficient -3.12P coeff * Err s2.12I + P s2.12Sigma-delta input s2.12 Limited to allow larger excursions of I + P than DAC dynamic range allocation. The sigma-delta modulator outputs the 10 MSBs and feeds back the 4 LSBs.______________________________________ TABLE 20______________________________________Timing recovery data widths Conceptual bitSignal positions Note______________________________________ADC output S5.2Itr, Qtr s5.6IIR filter states s1.14Multiplier inputs s1.6 Truncated filter state.Multiplier output = Error s0.12Integrator register Programmable shift in the range 2.sup.-7 . . . 2.sup.-14Error * I coefficient s - 6.18 Actual data is shifted right by value selected by tmr.sub.-- i.sub.-- gain and truncatedIntegrator register s4.18Integrator output s3.7 Truncated register valueProportionality Programmable shift incoefficient the range 2.sup.3 . . . 2.sup.7P coeff * Err s6.7P + I s6.7Delta-sigma input s1.7 Limited to allow larger excursions than DAC dynamic range during acquisition______________________________________ Output interface Specifications TABLE 21______________________________________Output interface signalsSignal Name Type Description______________________________________OUT.sub.-- DATA 15:0! Output Output data bus. This may be used in either 8-bit or 16-bit mode. In 8-bit mode only bits 7:0 are used.OUT.sub.-- VALID Output Output data valid.OUT.sub.-- ACCEPT Input Data accept from MPEG2 System Demux.OUT.sub.-- CLK Input Output data clock. All output interface signals are synchronous to this clock.OUT.sub.-- WIDTH Input Selects width of out.sub.-- data, 0 => 8 bits, 1 => 16 bitsOUT.sub.-- MODE Input 0 => "Fast" mode, 1 => "DMA" mode.______________________________________ TABLE 22______________________________________Output interface timingNum. Characteristic Min Max Unit Notes______________________________________#4 OUT.sub.-- VALID set-up time 8 ns#5 OUT.sub.-- ACCEPT set-up time 0 ns Fast#6 OUT.sub.-- CLK to data 10 ns Mode#7 OUT.sub.-- ACCEPT high to 2 ns DMAOUT.sub.-- CLK rising Mode#8 OUT.sub.-- ACCEPT low to OUT.sub.-- CLK 8 nsfalling#9 OUT.sub.-- ACCEPT high to data 0 10 nsdriven#10 OUT.sub.-- CLK to data high 0 10 nsimpedance______________________________________ A digital receiver for use in a cable TV system implemented in accordance with the aforedescribed preferred embodiment will acquire lock, and maintain an output symbol error rate of less than 1.0×10-12 after correction in a channel having the following impairments: Carrier/Noise (NTSC)>43 dB Signal/Noise (16-VSB)>33 dB Composite triple beat and composite second order>51 dB Microreflections<2.5 μs (for reflections>35 dB) Burst error duration<38 μs Intermediate Frequency Surface Acoustic Wave Filter: Passband magnitude ripple<0.75 dB Passband group delay<80 ns peak-to-peak Phase noise<81 dBc/Hz @ 20 KHz off carrier FM hum--120 Hz sine wave frequency modulated with peak deviation of 5 KHz Initial frequency offset on channel change<450 KHz Second Embodiment A second embodiment is explained with reference to FIG. 4b. This is constructed in the same manner as the first embodiment, except that the carrier recovery 64 and automatic gain control 66 outputs are multiplexed by selector 45 with corresponding outputs from an analog NTSC receiver 46. In this way the receiver embodiment, referenced generally at 48, can share tuner and analog IF sections for both analog NTSC and digital modes, leading to a lower system cost. We have herein disclosed a digital receiver that is implemented in an integrated CMOS circuit that is suitable for use in cable systems or other broadcast systems in which some channels are allocated to analog transmissions such as NTSC, PAL, PAL-D, or SECAM, and other channels are allocated to digital transmission using VSB. The receiver is optimized for MPEG 2 transport packets. It shares a tuner and analog IF sections for operation in both analog and digital modes, leading to a low system cost. Using 16-VSB, the system operates at a net data rate of 27 Mbits/sec and has a low framing overhead. In case of unreliable channels, there is provided a progressive fall back to 8-VSB, 4-VSB and 2-VSB. In operation the symbol error rate is less than 1.0×10-12 after error correction. Acquisition time on channel change is less than 100 ms. While this invention has been explained with reference to the structure disclosed herein, it is not confined to the details set forth and this application is intended to cover any modifications and changes as may come within the scope of the following claims:
https://patents.google.com/patent/US5910960A/en
CC-MAIN-2018-43
refinedweb
24,163
55.44
4. Script Structure¶ Let’s learn how to program your OpenMV Cam now! Note that this tuturial assumes you know how the python language works. If you don’t know how python works please study up on it. There are plenty of web tuturials about how to write python code (finally, if you know any other C like programming language you can pick up python easily since it’s VERY similar). Anyway, any script you write is going to have three distinct parts: import ... ... one time setup ... ... while(True): # Loop ... The first part of your OpenMV Cam code should include some header comments, import statements to bring modules into scope, and finally constants and global variables in your code. Next, you’re going to want to do one-time setup code. This includes things like creating I/O pin objects, setting up the camera, defining helper functions, etc. Finally, you’ll create a while(True): loop under which you’ll put all code that gets called in a loop repeatedly until power-off. Here’s an example of this: ### Header comments, import statements, etc. # Hello World Example # # Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script! import sensor, image, time ### One time setup. ### Infinite loop while(True): clock.tick() # Update the FPS clock. img = sensor.snapshot() # Take a picture and return the image. print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected # to the IDE. The FPS should increase once disconnected. Note that if you do not have an infinite while loop in your code then once your OpenMV Cam finishes running the script it will sit there and do nothing.
http://docs.openmv.io/openmvcam/tutorial/script_structure.html
CC-MAIN-2018-22
refinedweb
283
74.9
Associate an externally allocated buffer with a pixmap. #include <screen/screen.h> int screen_attach_pixmap_buffer(screen_pixmap_t pix, screen_buffer_t buf) The handle of a pixmap that does not already have a buffer created or associated to it. A buffer that was allocated by the application. Function Type: Flushing Execution This function can be used to force a pixmap to use a buffer that was allocated by the application. Since pixmaps can have only one buffer, it is not possible to call this function or screen_create_pixmap_buffer() more than once. Whoever allocates the buffer is required to meet all alignment and granularity constraints required for the usage flags. The buffer buf must have been created with the function screen_create_buffer(), screen_create_pixmap_buffer(), or screen_create_window_buffers(). 0 if the buffer was used by the specified pixmap, or -1 if an error occurred (errno is set; refer to /usr/include/errno.h for more details). Note that the error may also have been caused by any delayed execution function that's just been flushed.
http://www.qnx.com/developers/docs/6.6.0_anm11_wf10/com.qnx.doc.screen/topic/screen_attach_pixmap_buffer.html
CC-MAIN-2018-43
refinedweb
165
55.44
This. - Contact:. - Contact: tech-kern - Mentors: Taylor R Campbell - Duration estimate: 2-3 months The kernel entropy pool provides unpredictable secrets via the : The single global queue is a point of contention for gathering observations: every disk seek, every network packet, every page fault must acquire a global lock to enter data into the global queue for processing.. - Contact: tech-kern - Mentors: Taylor R Campbell - Duration estimate: 2-3 months three main miletones to this project: Design a machine-independent high-resolution timer API, implement it on a couple machines, and develop tests to confirm that it works, in order to enable high-resolution sleeps. Convert all the functions of the periodic 10 ms timer, `hardclock', to schedule activity only when needed. Convert the various software subsystems that rely on periodic timer interrupts every tick, or every second, via callouts, either to avoid periodic work altogether, or to batch it up only when the machine is about to go idle, in order to reduce the number of wakeups and thereby reduce power consumption. - Contact: tech-kern - Mentors: Taylor R Campbell, Matthew R. Green, Chuck Silvers - Duration estimate: 2-3 months. - Contact: Christos Zoulas, tech-userlevel - Mentors: Christos Zoulas - Duration estimate: 2 months Get the open source POSIX test suite working on NetBSD. This involves: Get the code compiling (mostly adding missing sysconf parameters, and portability issues. For the hard missing functionality discuss with mentor - either open PR's or implement). Get the code running. Problems include: permission checks (some tests need to be run by root), wrong errno values returned, or incorrect handling of errors. Programmatic interfaces in the system (at various levels) are currently specified in C: functions are declared with C prototypes, constants with C preprocessor macros, etc. While this is a reasonable choice for a project written in C, and good enough for most general programming, it falls down on some points, especially for published/supported interfaces. The system call interface is the most prominent such interface, and the one where these issues are most visible; however, other more internal interfaces are also candidates. Declaring these interfaces in some other form, presumably some kind of interface description language intended for the purpose, and then generating the corresponding C declarations from that form, solves some of these problems. The goal of this project is to investigate the costs and benefits of this scheme, and various possible ways to pursue it sanely, and produce a proof-of-concept implementation for a selected interface that solves a real problem. Note that as of this writing many candidate internal interfaces do not really exist in practice or are not adequately structured enough to support this treatment. Problems that have been observed include: Using system calls from languages that aren't C. While many compilers and interpreters have runtimes written in C, or C-oriented foreign function interfaces, many do not, and rely on munging system headers in (typically) ad hoc ways to extract necessary declarations. Others cut and paste declarations from system headers and then break silently if anything ever changes. Generating test or validation code. For example, there is some rather bodgy code attached to the vnode interface that allows crosschecking the locking behavior observed at runtime against a specification. This code is currently generated from the existing vnode interface specification in vnode_if.src; however, the specification, the generator, and the output code all leave a good deal to be desired. Other interfaces where this kind of validation might be helpful are not handled at all. Generating marshalling code. The code for (un)marshalling system call arguments within the kernel is all handwritten; this is laborious and error-prone, especially for the various compat modules. A code generator for this would save a lot of work. Note that there is already an interface specification of sorts in syscalls.master; this would need to be extended or converted to a better description language. Similarly, the code used by puffs and refuse to ship file system operations off to userland is largely or totally handwritten and in a better world would be automatically generated. Generating trace or debug code. The code for tracing system calls and decoding the trace results (ktrace and kdump) is partly hand-written and partly generated with some fairly ugly shell scripts. This could be systematized; and also, given a complete specification to work from, a number of things that kdump doesn't capture very well could be improved. (For example, kdump doesn't decode the binary values of flags arguments to most system calls.) Add your own here. (If proposing this project for GSOC, your proposal should be specific about what problem you're trying to solve and how the use of an interface definition language will help solve it. Please consult ahead of time to make sure the problem you're trying to solve is considered interesting/worthwhile.) The project requires: (1) choose a target interface and problem; (2) evaluate existing IDLs (there are many) for suitability; (3) choose one, as roll your own should be only a last resort; (4) prepare a definition for the target interface in your selected IDL; (5) implement the code generator to produce the corresponding C declarations; (6) integrate the code generator and its output into the system (this should require minimal changes); (7) implement the code generator and other material to solve your target problem. Note that while points 5, 6, and 7 are a reasonably simple matter of programming, parts 1-3 and possibly 4 constitute research -- these parts are as important as the code is, maybe more so, and doing them well is critical to success. The IDL chosen should if at all possible be suitable for repeating steps 4-7 for additional choices of target interface and problem, as there are a lot of such choices and many of them are probably worth pursuing in the long run. Some things to be aware of: - syscalls.master contains a partial specification of the functions in the system call interface. (But not the types or constants.) - vnode_if.src contains a partial specification of the vnode interface. - There is no specification, partial or otherwise, of the other parts of the VFS interface, other than the code and the (frequently outdated) section 9 man pages. - There are very few other interfaces within the kernel that are (as of this writing) structured enough or stable enough to permit using an IDL without regretting it. The bus interface might be one. - Another possible candidate is to pursue a specification language for handling all the conditional visibility and namespace control material in the userspace header files. This requires a good deal of familiarity with the kinds of requirements imposed by standards and the way these requirements are generally understood and is a both large and extremely detail-oriented. Note: the purpose of an IDL is not to encode a parsing of what are otherwise C-language declarations. The purpose of an IDL is to encode some information about the semantics of an interface. Parsing the input is the easy part of the problem. For this reason, proposals that merely suggest replacing C declarations with e.g. equivalent XML or JSON blobs are unlikely to be accepted. (Also note that XML-based IDLs are unlikely to be accepted by the community as XML is not in general considered suitable as a source language.) The fdiscard system call, and the file-system-level discard operation backing it, allow dropping ranges of blocks from files to create sparse files with holes. This is a simple generalization of truncate. Discard is not currently implemented for FFS; implement it. (For regular files.) It should be possible to do so by generalizing the existing truncate code; this should be not super-difficult, but somewhat messy. Implement the block-discard operation (also known as "trim") for RAIDframe. Higher-level code may call discard to indicate to the storage system that certain blocks no longer contain useful data. The contents of these blocks do not need to be preserved until they are later written again. This means, for example, that they need not be restored during a rebuild operation. RAIDframe should also be made to call discard on the disk devices underlying it, so those devices can take similar advantage of the information. This is particularly important for SSDs, where discard ("trim") calls can increase both the performance and write lifetime of the device. The complicating factor is that a block that has been discarded no longer has stable contents: it might afterwards read back as zeros, or it might not, or it might change to reading back zeros (or trash) at any arbitrary future point until written again. The first step of this project is to figure out a suitable model for the operation of discard in RAIDframe. Does it make sense to discard single blocks, or matching blocks across stripes, or only whole stripe groups, or what? What metadata should be stored to keep track of what's going on, and where does it go? Etc. - Contact: tech-kern - Mentors: Greg Oster - Duration estimate: two months Implement component 'scrubbing' in RAIDframe. RAIDframe (raid(4)) provides various RAID levels to NetBSD, but currently has no facilities for 'scrubbing' (checking) the components for read errors. Milestones: - implement a generic scrubbing routine that can be used by all RAID types - implement RAID-level-specific code for component scrubbing - add an option to raidctl (raidctl(8)) to allow the system to run the scrubbing as required - update raidctl (raidctl(8)) documentation to reflect the new scrubbing capabilities, and discuss what scrubbing can and cannot do (benefits and limitations) Bonus: - Allow the user to select whether or not to attempt to 'repair' errors - Actually attempt to repair errors Abstract: Xen now supports the ARM cpu architecture. We still don't have support in NetBSD for this architecture. A dom0 would be the first start in this direction. Deliverables: - toolstack port to arm - Fully functioning dom0 This project would be much easier once pvops/pvh is ready, since the Xen ARM implementation only supports PVH. See Abstract: The blktap2 method provides a userland daemon to provide access to on disk files, arbitrated by the kernel. The NetBSD kernel lacks this support and currently disables blktap in xentools. Deliverables: - blktap2 driver for /dev/blktapX - Tool support to be enabled in xentools - Enable access to various file formats (Qcow, VHD etc) , via the [ tap: ] disk specification. Implementation: The driver interacts with some areas of the kernel that are different from linux - eg: inter-domain page mapping, interdomain signalling. This may make it more challenging than a simple driver, especially with test/debug/performance risk. Note: There's opportunity to compare notes with the FUSE/rump implementations. See and - Contact: port-xen - Mentors: Cherry G. Mathew - Duration estimate: 37 hours Abstract: The NetBSD boot path contains conditional compiled code for XEN. In the interests of moving towards unified pvops kernels, the code can be modified to be conditionally executed at runtime. Deliverables: - Removal of #ifdef conditional code from all source files. - New minor internal API definitions, where required, to encapsulate platform specific conditional execution. - Performance comparison figures for before and after. - Clear up the API clutter to make way for pvops. Note: Header files are exempt from #ifdef removal requirement. Implementation: The number of changes required are estimated as follows: drone.sorcerer> pwd /home/sorcerer/src/sys drone.sorcerer> find . -type f -name '*.[cSs]' -exec grep -H "^#if.* *\\bXEN\\b" '{}' \; | wc -l 222 drone.sorcerer> The effort required in this task is likely to be highly variable, depending on the case. In some cases, minor API design may be required. Most of the changes are likely to be mechanical. Abstract: NetBSD Dom0 kernels currently operate in fully PV mode. On amd64, this has the same performance drawbacks as for PV mode in domU. Instead, PVH mode provides a HVM container over pagetable management, while virtualising everything else. This mode is available on dom0, we attempt to support it. Note: Xen/Linux is moving to this dom0 pvh support model. Deliverables: PVH mode dom0 operation. Implementation: This project depends on the domU pvops/pvh project. The main work is in configuration and testing related (bringing in native device drivers as well as backend ones). The bootstrap path may need to be tweaked for dom0 specific things. Dependencies: This project depends on completion of the domU pvops/pvh project. This project can enable the NetBSD/Xen/ARM dom0 port. See Abstract: Abstract: This is the final step towards PVH mode. This is relevant only for DomU. Xen is moving to this eventual dom0 pvh support model. This project depends on completion of pv-on-hvm. Deliverables: - operational interrupt (event) handling - PV only drivers. Implementation: Following on from the pv-on-hvm project, this project removes all remaining dependencies on native drivers. All drivers are PV only. Interrupt setup and handling is via the "event" mechanism. Scope (Timelines): This project has some uncertainty based on the change in the interrupt mechanism. Since the interrupt mechanism moves from apic + IDT based, to event based, there's room for debug/testing spillover. Further, private APIs may need to be developed to parition the pv and native setup and management code for both mechanisms. See: Abstract: Although Xen has ACPI support, the kernel needs to make explicit hypercalls for power management related functions. sleep/resume are supported, and this support needs to be exported via the dom0 kernel. Deliverables: - sleep/resume support for NetBSD/Xen dom0 Implementation: There are two approaches to this. The first one involves using the kernel to export syscall nodes for ACPI. The second one involves Xen aware power scripts, which can write directly to the hypercall kernfs node - /kern/privcmd. Device tree suspend could happen via drvctl(8), in theory.: Abstract: Make the dom0 kernel use and provide drm(4) support. This enable gui use of dom0. Deliverables: Functioning X server using native kernel style drmkms support. Implementation: - mtrr support for Xen - high memory RAM extent allocation needs special attention (See: kern/49330) - native driver integration and testing.. Abstract: The NetBSD Xen kernel currently doesn't have module support. This would be important towards a unified kernel for native and Xen, since the kernel could load modules on demand depending on the mode of running. Deliverables: - Loadable Module support for xen kernels - Reduce driver memory footprint for pvhvm kernels. Abstract: This project involves allowing SCSI devices on the dom0 to be passed through to the domU. Individual SCSI high performance SCSI device to PV and PVHVM domains. See Abstract: Abstract: Current libvirt support in NetBSD doesn't include Xen support. Rationale: Enables gui based domU managers. Enables the pvfb work to be easily accessible Deliverables: - Fully functioning libvirt with Xen "driver" support. See and - Contact: port-xen - Mentors: Cherry G. Mathew - Duration estimate: 16 hours Abstract: NetBSD/Xen currently doesn't support __HAVE_DIRECT_MAP Deliverables: - Direct Mapped functioning NetBSD/Xen, both dom0 and domU - Demonstrable performance numbers - Reduce TLB contention and clean up code for pvops/pvh Implementation: This change involves testing for the Xen and CPU featureset, and tweaking the pmap code so that 1G superpages can be requested from the hypervisor and direct mapped the same way native code does. - Contact:. - Contact: tech-userlevel - Mentors: Martin Husemann - Duration estimate: 3 months. - Contact: tech-kern - Mentors: Christos Zoulas - Duration estimate: two months Test and debug the RAID 6 implementation in RAIDframe. NetBSD uses RAIDframe (raid(4)) and stub code exists for RAID6 but is not very documented or well tested. Obviously, this code needs to be researched and vetted by an interested party. Other BSD projects should be consulted freely. Milestones: * setup a working RAID 6 using RAIDFrame * document RAID6 in raid(4) manual page * port/develop a set of reliability and performance tests * fix bugs along the way * automate RAID testing in atf Bonus: * Document how to add new RAID levels to RAIDframe * (you're awesome bonus) add RAID 1+0, etc Net. The mlock() system call locks pages in memory; however, it's meant for real-time applications that wish to avoid pageins. There's a second class of applications that want to lock pages in memory: databases and anything else doing journaling, logging, or ordered writes of any sort want to lock pages in memory to avoid pageouts. That is, it should be possible to lock a (dirty) page in memory so that it does not get written out until after it's unlocked. It is a bad idea to try to make mlock() serve this purpose as well as the purpose it already serves, so add a new call, perhaps mlockin(), and implement support in UVM. Then for extra credit ram it through POSIX and make Linux implement it - Contact: tech-kern, tech-net, David Holland. - Contact: tech-kern, tech-embed - Duration estimate: 2-3 months. While. - Contact: tech-kern - Mentors: Taylor R Campbell - Duration estimate: 2-3 months project, which also requires substantial revisions to the I/O path, naturally combines with this project.. brcmsmac and brcmfmac WiFi device drivers for Linux supports BCM43XX and BCM43XXX based WiFi adapters. And source code is included in Linux kernel tree, but it is licensed under ISC license. You can find these devices on Apple MacBook. - Contact: tech-ports Xilinx MicroBlaze is RISC processort for Xilinx's FPGA chip. MicroBlaze can have MMU, and NetBSD can support it. Google Chrome is widely used nowadays, and it has some state-of-the-art functionalities. Chromium web browser is open source edition of Google Chrome. A good starting point can be the www/chromium package available in FreeBSD Ports and OpenBSD Ports. - Contact: tech-repository Background and description NetBSD is one of the first projects to use internet-available source control. It has been using CVS since the very beginning of the project (over 21 years) and the repository is vast. NetBSD also hosts the pkgsrc repository which has many small files, many "imports" and other technical challenges associated with VCS. NetBSD also has various small internal repositories (like this wiki). During the last twenty years tooling has improved and popular developer culture has shifted to new workflows. The purpose of this project is to identify: - existing 'workflows' in common use among developers - existing 'tooling' within NetBSD the organization - how much memory/disk is required to host NetBSD? - how are backups performed? - can the tools be cross-build? - security requirements like - how do we validate commits? - how do we ensure commits originated from developers? - release engineering requirements such as - how does a pullup request work? - how do we ensure the correct files are included in the correct release branches? - how do we checkout a release branch - how do we look at the history of a release branch - how do we get different revisions of a file on a branch major parts of the technical work like "how to convert FROM CVS to git/hg/fossil" has already been done, which is why we are able to now ask "how would the project continue to function?" Our decision matters You're reading this because you care about the future of NetBSD and you understand that good tools act as a force multiplier. Our decision is not obvious If it were, we'd have made it already (and wouldn't be disagreeing so persistently about which one it needs to be ;-). Our decision needs to be about the whole elephant We all understand the basics of using source control. This level of understanding is necessary but not sufficient to make an informed decision about whether to migrate any or all of NetBSD's repositories to another VCS, and if so which, or how. Our choice of VCS carries implications not only about how developers hack on NetBSD, but also about how non-developers contribute and become developers, and how Project sysadmins keep our valuable code secure. Therefore, any choice of VCS other than the default (sticking with CVS for a while longer) necessarily implies that as a group, we all need to learn how we're going to do what we expect to need to do. Not all of this learning needs to happen before we can make a reasonably confident decision for our Project. But if we want to arrive at consensus, much of it does. There is no available choice of VCS that entirely avoids tradeoffs for us. Therefore, to choose intelligently, we must first consider all the tradeoffs we can think of, then decide which ones we can live with and which we can not. Our decision needs to be made together We're a community. The only way a complicated, interconnected set of changes like this can be implemented is for us to arrive at rough consensus that some particular VCS: - is sufficiently well suited to our project's needs in theory, - is sufficiently easily adapted to our needs in practice, - has a sufficiently fail-safe migration plan, - is worth the effort to switch, and - has volunteers to do the work. How you can help, right now What are some considerations you think are important? Are they listed here? If not, edit this page and add them. Some previously collected considerations Considerations Humans - People who administer Project resources - People who administer release branches - People who administer security updates - People who can commit directly to NetBSD - People who can't commit directly to NetBSD Machines - Some ports/machines are memory constraint or rather slow (by todays standards), a VCS different than CVS should be able to used on these machines as well. (e.g. git has parameters to tune memory usage, and there exists git-cvsserver which allows a git repository to be accessed using a CVS client) Workflow / Commonly used actions - Create a branch - Merge a branch with the head/main branch - Create a tag - Commit local changes to a branch - Commit local changes to the main branch - Revert a commit - Fix a commit message - Create a diff between two versions of a file Tools - Command line tool - Web based source code browsing and maybe riffing (in the style of e.g. trac) - Availability on different platforms (pkgsrc is not NetBSD only) - Contact: port-amd64, port-i386. If one embarks on a set of package updates and it doesn't work out too well, it is nice to be able to roll back to a previous state. This entails two things: first, reverting the set of installed packages to what it was at some chosen prior time, and second, reverting changes to configuration, saved application state, and other such material that might be needed to restore to a fully working setup. This project is about the first part, wihch is relatively tractable. The second part is Hard(TM), but it's pointless to even speculate about it until we can handle the first part, which we currently can't. Also, in many cases the first part is perfectly sufficient to recover from a problem. Ultimately the goal would be to be able to do something like pkgin --revert yesterday but there are a number of intermediate steps to that to provide the infrastructure; after that adding the support to pkgin (or whatever else) should be straightforward. The first thing we need is a machine-readable log somewhere of package installs and deinstalls. Any time a package is installed or removed, pkg_install adds a record to this log. It also has to be possible to trim the log so it doesn't grow without bound -- it might be interesting to keep the full history of all package manipulations over ten years, but for many people that's just a waste of disk space. Adding code to pkg_install to do this should be straightforward; the chief issues are - choosing the format - deciding where to keep the data both of which require some measure of community consensus. Preferably, the file should be text-based so it can be manipulated by hand if needed. If not, there ought to be some way to recover it if it gets corrupted. Either way the file format needs to be versioned and extensible to allow for future changes. The file format should probably have a way to enter snapshots of the package state in addition to change records; otherwise computing the state at a particular point requires scanning the entire file. Note that this is very similar to deltas in version control systems and there's a fair amount of prior art. Note that we can already almost do this using /var/backups/work/pkgs.current,v; but it only updates once a day and the format has assorted drawbacks for automated use. The next thing needed is a tool (maybe part of pkg_info, maybe not) to read this log and both (a) report the installed package state as of a particular point in time, and (b) print the differences between then and now, or between then and some other point in time. Given these two things it becomes possible to manually revert your installed packages to an older state by replacing newer packages with older packages. There are then two further things to do: Arrange a mechanism to keep the .tgz files for old packages on file. With packages one builds oneself, this can already be done by having them accumulate in /usr/pkgsrc/packages; however, that has certain disadvantages, most notably that old packages have to be pruned by hand. Also, for downloaded binary packages no comparable scheme exists yet. Provide a way to compute the set of packages to alter, install, or remove to switch to a different state. This is somewhat different from, but very similar to, the update computations that tools like pkgin and pkg_rolling-replace do, so it probably makes sense to implement this in one or more of those tools rather than in pkg_install; but perhaps not. There are some remaining issues, some of which aren't easily solved without strengthening other things in pkgsrc. The most notable one is: what about package options? If I rebuild a package with different options, it's still the "same" package (same name, same version) and even if I record the options in the log, there's no good way to distinguish the before and after binary packages. Right now if you install NetBSD with native X11 you get the same default X session that X has shipped forever, complete with TWM. Just like it's 1989. Obviously this behavior can be improved after installation by adding suitable packages and choosing a different window manager, or installing one of the full desktop environments. Veteran NetBSD users know how to do this. Veteran Unix and X users who aren't veteran NetBSD users can figure it out pretty easily. Most such people have an X setup they've been using for years that they can and do just plop into place on a new machine. This project does not affect those users, even the ones who for some crazy reason want to use twm. It also does not affect users who just want to install GNOME, KDE, or whatever other desktop. The goal of this project is to provide a less knobby default X environment for users who are willing to run plain X rather than a full desktop but do not have their own X setup. The project is: choose a window manager suitable for replacing twm in base; import it into base; and update the default X config to provide a decent default session using it. Note that it needs to be a mainstream window manager; tiling window managers and other exotica are not really suitable for the purpose. It should also not depend on anything that isn't in base (that is, base with native X), it should be smallish and not a bloatmonster, and ideally it should be BSD-licensed. Based on the window managers in pkgsrc, there are two chief candidates: fluxbox and golem. Each has pluses and minuses. Some of these are: - golem is prettier and fully themeable - golem is written in C, fluxbox in C++ - golem is a lot smaller (less than 1/10th the code size) - golem currently needs some work, chiefly on the config system; fluxbox appears to be ready to go - golem is just about dead upstream; fluxbox is not very active but is still getting occasional releases Currently it looks like golem is a better choice, especially since ideally we'd like to pick something that will run decently on older/slower ports. But it requires more work. Note that we could (AFAIK) become upstream for golem; this is not necessarily a bad thing. There might be other possible choices; these two are the ones in pkgsrc that seem viable. Note: this project is not listed as a GSoC project (although doing the needed work on golem maybe could be one) because much of it has to do with build system integration and ancient X things and other stuff that requires experience a student probably won't have. Update: current state is that a window manager has been chosen and imported; however, the themes are not ready and the default session has not been switched over yet. - Contact:. - Contact:. - Contact: tech-userlevel, tech-x11, Support for "real" desktops on NetBSD is somewhat limited and also scattershot. Part of the reason for this is that most of the desktops are not especially well engineered, and they contain poorly designed infrastructure components that interact incestuously with system components that are specific to and/or make sense only on Linux. Providing the interfaces these infrastructure components wish to talk to is a large job, and Linux churn being what it is, such interfaces are usually moving targets anyway. Reimplementing them for NetBSD is also a large job and often presupposes things that aren't true or would require that NetBSD adopt system-level design decisions that we don't want. Rather than chase after Linux compatibility, we are better off designing the system layer and infrastructure components ourselves. It is easier to place poorly conceived interfaces on top of a solid design than to reimplement a poorly conceived design. Furthermore, if we can manage to do a few things right we should be able to get at least some uptake for them. The purpose of this project, per se, is not to implement any particular piece of infrastructure. It is to identify pieces of infrastructure that the desktop software stacks need from the operating system, or provide themselves but ought to get from the operating system, figure out solid designs that are compatible with Unix and traditional Unix values, and generate project descriptions for them in order to get them written and deployed. For example, GNOME and KDE rely heavily on dbus for sending notifications around. While dbus itself is a more or less terrible piece of software that completely fails to match the traditional Unix model (rather than doing one thing well, it does several things at once, pretty much all badly) it is used by GNOME and KDE because there are things a desktop needs to do that require sending messages around. We need a transport for such messages; not a reimplementation of dbus, but a solid and well-conceived way of sending notices around among running processes. Note that one of the other things dbus does is start services up; we already have inetd for that, but it's possible that inetd could use some strengthening in order to be suitable for the purpose. It will probably also need to be taught about whatever message scheme we come up with. And we might want to e.g. set up a method for starting per-user inetd at login time. (A third thing dbus does is serve as an RPC library. For this we already have XDR, but XDR sucks; it may be that in order to support existing applications we want a new RPC library that's more or less compatible with the RPC library parts of dbus. Or that may not be feasible.) This is, however, just one of the more obvious items that arises. Your goal working on this project is to find more. Please edit this page and make a list, and add some discussion/exposition of each issue and possible solutions. Ones that become fleshed out enough can be moved to their own project pages. The ZFS port to NetBSD is half-done, or maybe more than half. Finish it and get it really running. Now, OpenZFS is the main location of ZFS in the Free Software community, and supports FreeBSD, Illumos, Linux and Mac. Probably the right approach is to get the most recent OpenZFS working with NetBSD. This could either be via pkgsrc or via importing and reachover makefiles. The hard part is probably in the ZFS/NetBSD kernel interface bits. - Contact: tech-kern, David Holland - Duration estimate: 6-12 months. - Contact:). Deliverables of this project: - Make U-Boot build on NetBSD, using a bsd style makefile and environment variables pointing at ${TOOLDIR} - Discuss the changes needed for [1] with U-Boot upstream developers, follow their advice and try to upstream the changes - Create a pkgsrc entry for the native U-Boot - Add a FFS module to U-Boot, using NetBSD system headers Items [2] and [4] will not be required for GSoC success. An important part of a binary-only environment is to support something similar to the existing options framework, but produce different combinations of pkgs. There is an undefined amount of work required to accomplish this, and also a set of standards and naming conventions to be applied for the output of these pkgs. This project should also save on having to rebuild "base" components of software to support different options: see amanda-base for an example. OpenBSD supports this now and should be leveraged heavily for borrowing. - Contact: tech-pkg - Mentors: Thomas Klausner - Duration estimate: 6 months Improve support for NetBSD in various GNOME packages. The easy targets are adding more support for NetBSD to various system and network monitoring infrastructure (which support some stuff already). A harder step is to port the devicekit and libudev parts of GNOME. WIP. - Contact: tech-pkg - Mentors: Emile 'iMil' Heitor, Jonathan Perkin - To be confirmed / discussed: -. - Contact: - Contact: tech-userlevel - Mentors: TBD - Duration estimate: 3 months WARNING: This project is very preliminary and incomplete. NPF is a packet filter for the NetBSD system. The goal of this project is to create a web-based user interface for NetBSD + NPF as a firewall system. High level deliverables are the following: - Web UI interface using HTML, CSS, Python or other languages. No PHP, sorry! - The interface should be able to manage the following: set the interface addresses and route, configure DHCP, manage firewall rules, NAT (including port redirection), wireless AP. - Ideally, it would be packaged and integrated with NetBSD's startup system. Comparable products: - Contact:. - Contact: Currently,. - Contact:. - Contact: - Contact:. This. This project proposal is a subtask of smp networking and is elegible for funding independently. The goal of this project is to implement lockless, atomic and generic Radix and Patricia trees. BSD systems have always used a radix tree for their routing tables. However, the radix tree implementation is showing its age. Its lack of flexibility (it is only suitable for use in a routing table) and overhead of use (requires memory allocation/deallocation for insertions and removals) make replacing it with something better tuned to today's processors a necessity. Since a radix tree branches on bit differences, finding these bit differences efficiently is crucial to the speed of tree operations. This is most quickly done by XORing the key and the tree node's value together and then counting the number of leading zeroes in the result of the XOR. Many processors today (ARM, PowerPC) have instructions that can count the number of leading zeroes in a 32 bit word (and even a 64 bit word). Even those that do not can use a simple constant time routine to count them: int clz(unsigned int bits) { int zeroes = 0; if (bits == 0) return 32; if (bits & 0xffff0000) bits &= 0xffff0000; else zeroes += 16; if (bits & 0xff00ff00) bits &= 0xff00ff00; else zeroes += 8; if (bits & 0xf0f0f0f0) bits &= 0xf0f0f0f0; else zeroes += 4; if (bits & 0xcccccccc) bits &= 0xcccccccc; else zeroes += 2; if (bits & 0xaaaaaaaa) bits &= 0xaaaaaaaa; else zeroes += 1; return zeroes; } The existing BSD radix tree implementation does not use this method but instead uses a far more expensive method of comparision. Adapting the existing implementation to do the above is actually more expensive than writing a new implementation. The primary requirements for the new radix tree are: Be self-contained. It cannot require additional memory other than what is used in its data structures. Be generic. A radix tree has uses outside networking. To make the radix tree flexible, all knowledge of how keys are represented has to be encapsulated into a pt_tree_ops_t structure with these functions: bool ptto_matchnode(const void *foo, const void *bar, pt_bitoff_t max_bitoff, pt_bitoff_t *bitoffp, pt_slot_t *slotp); Returns true if both fooand barobjects have the identical string of bits starting at *bitoffpand ending before max_bitoff. In addition to returning true, *bitoffpshould be set to the smaller of max_bitoffor the length, in bits, of the compared bit strings. Any bits before *bitoffpare to be ignored. If the string of bits are not identical, *bitoffpis set to the where the bit difference occured, *slotpis the value of that bit in foo, and false is returned. The fooand bar(if not NULL) arguments are pointers to a key member inside a tree object. If bar is NULL, then assume it points to a key consisting of entirely of zero bits. bool ptto_matchkey(const void *key, const void *node_key, pt_bitoff_t bitoff, pt_bitlen_t bitlen); Returns true if both keyand node_keyobjects have identical strings of bitlenbits starting at bitoff. The keyargument is the same key argument supplied to ptree_find_filtered_node. pt_slot_t ptto_testnode(const void *node_key, pt_bitoff_t bitoff, pt_bitlen_t bitlen); Returns bitlenbits starting at bitofffrom node_key. The node_keyargument is a pointer to the key members inside a tree object. pt_slot_t ptto_testkey(const void *key, pt_bitoff_t bitoff, pt_bitlen_t bitlen); Returns bitlenbits starting at bitofffrom key. The keyargument is the same key argument supplied to ptree_find_filtered_node. All bit offsets are relative to the most significant bit of the key, The ptree programming interface should contains these routines: void ptree_init(pt_tree_t *pt, const pt_tree_ops_t *ops, size_t ptnode_offset, size_t key_offset); Initializes a ptree. If ptpoints at an existing ptree, all knowledge of that ptree is lost. The ptargument is a pointer to the pt_tree_tto be initialized. The opsargument is a pointer to the pt_tree_ops_tused by the ptree. This has four members: The ptnode_offsetargument contains the offset from the beginning of an item to its pt_node_tmember. The key_offsetargument contains the offset from the beginning of an item to its key data. This is used if 0 is used, a pointer to the beginning of the item will be generated. void *ptree_find_filtered_node(pt_tree_t *pt, const void *key, pt_filter_t filter, void *filter_ctx); The filter argument is either NULLor a function bool (*)(const void *, void *, int);, const pt_tree_ops_t *ops, void *item); This project proposal is a subtask of smp networking and is elegible for funding independently.. This project proposal is a subtask of smp networking and is elegible for funding independently. The goal of this project is to make the SYN cache optional. For small systems, this is complete overkill and should be made optional. such as: pr_init-> int pr_init(void *dsc); int pr_fini(void *dsc) This project proposal is a subtask of smp networking and is elegible for funding independently. The goal of this project is to implement full virtual network stacks. A virtual network stack collects all the global data for an instance of a network stack (excluding AF_LOCAL). This includes routing table, data for multiple domains and their protocols, and the mutexes needed for regulating access to it all. Instead, a brane is an instance of a networking stack. An interface belongs to a brane, as do processes. This can be considered a chroot(2) for networking, e.g. chbrane(2).. Most. - Contact: tech-toolchain - Duration estimate: 2 months BSD make (aka bmake) uses traditional suffix rules (.c.o: ...) instead of pattern rules like gmake's (%.c:%.o: ...) which are more general and flexible. The suffix module should be re-written to work from a general match-and-transform function on targets, which is sufficient to implement not only traditional suffix rules and gmake pattern rules, but also whatever other more general transformation rule syntax comes down the pike next. Then the suffix rule syntax and pattern rule syntax can both be fed into this code. Note that it is already possible to write rules where the source is computed explicitly based on the target, simply by using $(.TARGET) in the right hand side of the rule. Investigate whether this logic should be rewritten using the match-and-transform code, or if the match-and-transform code should use the logic that makes these rules possible instead. Implementing pattern rules is widely desired in order to be able to read more makefiles written for gmake, even though gmake's pattern rules aren't well designed or particularly principled.. - Contact: tech-embed - Duration estimate: 2 months NetBSD version of compressed cache system (for low-memory devices):. Heavily. The.) - Contact:. - Contact: tech-userlevel Use puffs or refuse to write an imapfs that you can mount on /var/mail, either by writing a new one or porting the old existing Plan 9 code that does this. Note: there might be existing solutions, please check upfront and let us know. There are many caches in the kernel. Most of these have knobs and adjustments, some exposed and some not, for sizing and writeback. Add support for Apple's extensions to ISO9660 to makefs, especially the ability to label files with Type & Creator IDs. See. Implement a BSD licensed JFS. A GPL licensed implementation of JFS is available at. Alternatively, or additionally, it might be worthwhile to do a port of the GPL code and allow it to run as a kernel module. - Contact:. - Contact: tech-kern, David Holland - Duration estimate: 2-3 months and/or a mechanism for checking new values for validity.).. - Contact:. - Contact: netbsd-users, tech-install. - Contact:? - Contact: port-mips, tech-ports NetBSD currently supports the MIPS32 ISA, but does not include support for the MIPS16e extension, which would be very useful for reducing the size of binaries for some kinds of embedded systems. This is very much like the ARM thumb instructions. - Contact: tech-misc, tech-ports - Duration estimate: 4 months NetBSD currently requires a system with an MMU. This obviously limits the portability. We'd be interested in an implementation/port of NetBSD on/to an MMU-less system. To. The policy code in the kernel that controls file caching and readahead behavior is necessarily one-size-fits-all, and the knobs available to applications to tune it, like madvise() and posix_fadvise(), are fairly blunt hammers. Furthermore, it has been shown that the overhead from user<->kernel domain crossings makes syscall-driven fine-grained policy control ineffective. Is it possible to create a BPF-like tool (that is, a small code generator with very simple and very clear safety properties) to allow safe in-kernel fine-grained policy control? Caution: this is a research project. - Contact:! - Contact: tech-userlevel - Duration estimate: 2 months Create a BSD licensed drop-in replacement for rsync that can handle large numbers of files/directories and large files efficiently. The idea would be to not scan the filesystem for every client to detect changes that need transfer, but rather maintain some database that can be queried (and that also needs updating when files are changed on the server). See supservers(8) for some ideas of how this could work. Compatibility with existing rsync clients should be retained.. - Contact: port-sgimips Currently booting a sgimips machine requires different boot commands depending on the architecture. It is not possible to use the firmware menu to boot from CD. An improved primary bootstrap should ask the firmware for architecture detail, and automatically boot the correct kernel for the current architecture by default. A secondary objective of this project would be to rearrange the generation of a bootably CD image so that it could just be loaded from the firmware menu without going through the command monitor. - Contact: port-sgimips. - Contact: port-sgimips. - Contact: port-sparc, tech-ports It would be nice to support these newer highly SMP processors from Sun. A Linux port already exists, and Sun has contributed code to the FOSS community. (Some work has already been done and committed.) - Contact: tech-install, tech-misc. Which is a diplomatic way of saying that this project has been attempted repeatedly and failed every time. Apply. Add memory-efficient snapshots to tmpfs. A snapshot is a view of the filesystem, frozen at a particular point in time. The snapshotted filesystem is not frozen, only the view is. That is, you can continue to read/write/create/delete files in the snapshotted filesystem. The interface to snapshots may resemble the interface to null mounts, e.g., 'mount -t snapshot /var/db /db-snapshot' makes a snapshot of /var/db/ at /db-snapshot/. You should exploit features of the virtual memory system like copy-on-write memory pages to lazily make copies of files that appear both in a live tmpfs and a snapshot. This will help conserve memory. - Contact: tech-userlevel While we now have mandoc for handling man pages, we currently still need groff in the tree to handle miscellaneous docs that are not man pages. This is itself an inadequate solution as the groff we have does not support PDF output (which in this day and age is highly desirable) ... and while newer groff does support PDF output it does so via a Perl script. Also, importing a newer groff is problematic for assorted other reasons. We need a way to typeset miscellaneous articles that we can import into base and that ideally is BSD licensed. (And that can produce PDFs.) Currently it looks like there are three decent ways forward: Design a new roff macro package that's comparable to mdoc (e.g. supports semantic markup) but is for miscellaneous articles rather than man pages, then teach mandoc to handle it. Design a new set of markup tags comparable to mdoc (e.g. supports semantic markup) but for miscellaneous articles, and a different less ratty syntax for it, then teach mandoc to handle this. Design a new set of markup tags comparable to mdoc (e.g. supports semantic markup) but for miscellaneous articles, and a different less ratty syntax for it, and write a new program akin to mandoc to handle it. These are all difficult and a lot of work, and in the case of new syntax are bound to cause a lot of shouting and stamping. Also, many of the miscellaneous documents use various roff preprocessors and it isn't clear how much of this mandoc can handle. None of these options is particularly appealing. There are also some less decent ways forward: Pick one of the existing roff macro packages for miscellaneous articles (ms, me, ...) and teach mandoc to handle it. Unfortunately all of these macro packages are pretty ratty, they're underpowered compared to mdoc, and none of them support semantic markup. Track down one of the other older roff implementations, that are now probably more or less free (e.g. ditroff), then stick to the existing roff macro packages as above. In addition to the drawbacks cited above, any of these programs are likely to be old nasty code that needs a lot of work. Teach the groff we have how to emit PDFs, then stick to the existing roff macro packages as above. In addition to the drawbacks cited above, this will likely be pretty nasty work and it's still got the wrong license. Rewrite groff as BSD-licensed code and provide support for generating PDFs, then stick to the existing roff macro packages as above. In addition to the drawbacks cited above, this is a horrific amount of work. Try to make something else do what we want. Unfortunately, TeX is a nonstarter and the only other halfway realistic candidate is lout... which is GPLv3 and at least at casual inspection looks like a horrible mess of its own. These options are even less appealing. Maybe someone can think of a better idea. There are lots of choices if we give up on typeset output, but that doesn't seem like a good plan either. - Contact:. - Contact:). - Contact:. - Contact:). - Contact: port-xen - Mentors: Jean-Yves Migeon - Duration estimate: 3-6 months. Implement a BSD licensed XFS. A GPL licensed implementation of XFS is available at. Alternatively, or additionally, it might be worthwhile to do a port of the GPL code and allow it to run as a kernel module. See also FreeBSD's port. Enhance zeroconfd, the Multicast DNS daemon, that was begun in NetBSD's Google Summer of Code 2005 (see work in progress:). Develop a client library that lets a process publish mDNS records and receive asynchronous notification of new mDNS records. Adapt zeroconfd to use event(3) and queue(3). Demonstrate comparable functionality to the GPL or APSL alternatives (Avahi, Howl, ...), but in a smaller storage footprint, with no dependencies outside of the NetBSD base system.. This project is currently claimedfor route changes. pr_ctlinputfor: - Lockless, atomic FIFO/LIFO queues - Lockless, atomic and generic Radix/Patricia trees - Fast protocol and port demultiplexing - Implement per-interface interrupt handling - Kernel continuations - Lazy receive processing - Separate nexthop cache from the routing table - Make TCP syncache optional - Revamped struct protosw - Virtual network stacks Work plan Aside from the list of tasks above, the work to be done for this project can be achieved by following these steps: Move ARP out of the routing table. See the nexthop cache project. Make the network interfaces MP, which are one of the few users of the big kernel lock left. This needs to support multiple receive and transmit queues to help reduce locking contention. This also includes changing more of the common interfaces to do what the tsecdriver does (basically do everything with softints). This also needs to change the *_inputroutines to use a table to do dispatch instead of the current switch code so domain can be dynamically loaded. Collect global variables in the IP/UDP/TCP protocols into structures. This helps the following items. Make IPV4/ICMP/IGMP/REASS MP-friendly. Make IPV6/ICMP/IGMP/ND MP-friendly. Make TCP MP-friendly.. - Contact: tech-userlevel - Mentors: Andreas Gustafsson - Duration estimate: 3 months Anita is a tool for automated testing of NetBSD. Anita automates the process of downloading a NetBSD distribution, installing it into a fresh virtual machine and running the ATF tests in the distribution in a fully-automated manner. Originally, the main focus of Anita was on testing the sysinst installation procedure and on finding regressions that cause the system to fail to install or boot, but Anita is now used as the canonical platform for running the ATF test suite distributed with NetBSD. (You can see the results of such tests in the Test Run Logs page.) At the moment, Anita only supports qemu as the system to create the virtual machine with. qemu gives us the ability to test several ports of NetBSD (because qemu emulates many different architectures), but qemu is very slow because it lacks hardware virtualization support in NetBSD. The goal of this project is to extend Anita to support other virtual machine systems. There are many virtual machine systems out there, but this project focuses on adding support to, at least, the following two: Xen and VirtualBox. Xen because NetBSD has native support to run as a dom0 and a domU so Anita could be used out of the box. VirtualBox because it is the canonical free virtual machine system for workstation setups. This project has the following milestones, in this order: - Abstract the VM-specific code in Anita to provide a modular interface that supports different virtual machines at run time. This will result in one single module implementation for qemu. - Create a module to provide support for Xen dom0. - Create a module to provide support for VirtualBox. - Update the pkgsrc package misc/py-anita to support the different virtual machine systems. This must be done by providing new packages, not by using package options. - If time permits: add extra modules. The obvious deliverable is a new version of Anita that can use any of the three mentioned virtual machines at run time, without having to be rebuilt, and the updated pkgsrc packages to install such updated version. The candidate is supposed to know Python and be familiar with at least one virtual machine system. - Contact: tech-userlevel - Mentors: David Young - Duration estimate: 3 months. - Contact: tech-kern, tech-userlevel - project milestones. - Contact:. The goal of this project is to generate a package or packages that will set up a cross-compiling environment for one (slow) NetBSD architecture on another (fast) NetBSD architecture, starting with (and using) the NetBSD toolchain in src.. Use available packages, like eg pkgtools/pkg_comp to build the cross-compiling environment where feasible. As test target for the cross-compiling environment, use pkgtools/pkg_install, which is readily cross-compilable by itself. If time permits, test and fix cross-compiling pkgsrc X.org, which was made cross-compilable in an earlier GSoC project, but may have suffered from feature rot since actually cross-compiling it has been too cumbersome for it to see sufficient use. - Contact:. -.? - Contact: tech-userlevel - Mentors: David Young - Duration estimate: 3 months. - Contact:. Milestones: - Produce optimizations for clock_gettime - Produce optimizations for gettimeofday - Show benchmarks before and after - start evolving timecounters in NetBSD, demonstrating your improvements See also the Paper on Timecounters by Poul-Henning Kamp. - Contact: tech-userlevel - Duration estimate: 3 months milestones?" - Contact: - Contact:. - Contact: tech-embed - Mentors: Matthias Drochner - Duration estimate: 3 months Produce lessons and a list of affordable parts and free software that NetBSD hobbyists can use to teach themselves JTAG. Write your lessons for a low-cost embedded system or expansion board that NetBSD already supports. - Contact:. Milestones: - report of FreeBSD efforts (past and present) - launchd port replacing: init - launchd port replacing: rc - launchd port compatible with: rc.d scripts - launchd port replacing: watchdogd Nice to have: - launchd port replacing/integrating: inetd - launchd port replacing: atd - launchd port replacing: crond - launchd port replacing: (the rest) - Contact: - Contact: tech-userlevel, atf-devel - Mentors: Brett Lymn - Duration estimate: 3 months.. - Contact: tech-net - Mentors: David Young - Duration estimate: 3 months." - Contact: tech-userlevel - Mentors: Brett Lymn - Duration estimate: 3 months Updating an operating system image can be fraught with danger, an error could cause the system to be unbootable and require significant work to restore the system to operation. The aim of this project is to permit a system to be updated while it is running only requiring a reboot to activate the updated system and provide the facility to rollback to a "known good" system in the event that the update causes regressions. Milestones for this project: - Make a copy of the currently running system - Either apply patches, install binary sets, run a source build with the copy as the install target - Update critical system files to reference the copy (things like fstab) - Update the boot menu to make the copy the default boot target, the current running system should be left as an option to boot to The following link shows how live upgrade works on Solaris: The aim is to implement something that is functionally similar to this which can not only be used for upgrading but for any risky operation where a reliable back out is required. - Contact:.) - Contact: tech-kern, tech-security - Mentors: Matthias Drochner - Duration estimate: 3 months swcrypto could use a variety of enhanacements Milestones/deliverables: - use multiple cores efficiently (that already works reasonably well for multiple request streams) - use faster versions of complex transforms (CBC, counter modes) from our in-tree OpenSSL or elsewhere (eg libtomcrypt) - add support for asymmetric operations (public key) Extra credit: - Tie public-key operations into veriexec somehow for extra credit (probably a very good start towards an undergrad thesis project). - Contact: - Contact: - Contact: tech-pkg - Mentors: Thomas Klausner - Duration estimate: 3 months, ... Milestones: - identify example packages installing users, groups, and documentation - demonstrate pkgsrc packages which add users, etc - Also add support for actions that happen once after a big upgrade session, instead of once per package (e.g. ls-lR rebuild for tex). - convert some existing packages to use this new framework - allow options framework to configure these resources per-package An intermediate step would be to replace various remaining INSTALL scripts by declarative statements and install script snippets using them. - Contact: tech-pkg - Mentors: Aleksej Saushev - Duration estimate: 3 months. Note that ?obache has ported pkgsrc to Cygwin. The goal of this project is to port pkgsrc tools to MinGW to the extent of building at least infrastructural packages. - Contact:. - Contact: tech-userlevel -. - - Contact: tech-userlevel - Mentors: Christos Zoulas - Duration estimate: 3 months All architectures suffer from code injection issues because the only writable segment is the PLT/GOT. RELRO (RELocation Read Only) is a mitigation technique that is used during dynamic linking to prevent access to the PLT/GOT. There is partial RELRO which protects that GOT but leaves the PLT writable, and full RELRO that protects both at the expense of performing a full symbol resolution at startup time. The project is about making the necessary modifications to the dynamic loader (ld_elf.so) to make RELRO work. If that is completed, then we can also add the following improvement: Currently kernels with options PAX_MPROTECT can not execute dynamically linked binaries on most RISC architectures, because the PLT format defined by the ABI of these architectures uses self-modifying code. New binutils versions have introduced a different PLT format (enabled with --secureplt) for alpha and powerpc. Milestones: - For all architectures we can improve security by implementing relro. - Once this is done, we can improve security for the RISC architectures by adding support for the new PLT formats introduced in binutils 2.17 and gcc4.1 This will require changes to the dynamic loader (ld.elf_so), various assembly headers, and library files. - Support for both the old and new formats in the same invocation will be required. - Contact: tech-pkg - Mentors: Aleksej Saushev - Duration estimate: 3 months. - Contact:.. References: Port valgrind to NetBSD for pkgsrc, then use it to do an audit of any memory leakage. See also and for work in progress. - Contact: tech-toolchain - Mentors: Jörg Sonnenberger - Duration estimate: 3 months. goals/milestones: - replace the manual labour with an automatic tool This tool should allow both verification / generation of structure definitions for use in netbsd32 code allow generation of system call stubs and conversion functions. Generated stubs should also ensure that no kernel stack data is leaked in hidden padding without having to resort to unnecessary large memset calls. For this purpose, the Clang C parser or the libclang frontend can be used to analyse the C code.
https://wiki.netbsd.org/projects/all-flat/
CC-MAIN-2016-18
refinedweb
9,877
52.09
Ebooks, Fiction, Non-Fiction 1000s of Free books and stories online to read now ~ Main Page Ragged Lady, V1 Vf." That evening Mrs. Milray came to their table from where she had been dining alone, and asked in banter: "Well, have you made up your minds to go over with me?" Mrs. Lander said bluntly, "We can't ha'dly believe y tune.ina smiled at her vehemence. "Why, it's nothing. And I don't know whether I should like to." "Oh, yes," urged Lord Lioncourt. "Such a good cause, you know." "What is it?" Mrs. Milray insisted. "Is it something you could do alone?" "It's just a dance that I learned at Woodlake. The teacha said that all the young ladies we'e leaning it. It's a skut-dance"-- "The very thing!" Mrs. Milray shouted. "It'll be the hit of the evening." "But I've never done it before any one," Clementina faltered. "They'll all be doing their turns," the Englishman said. "Speaking, and singing, and playing." Clementina felt herself giving way, and she pleaded in final reluctance, "But I haven't got a pleated skut in my steama trunk." "No matter! We can manage that." Mrs. Milray jumped to her feet and took Lord Lioncourt's arm. "Now we must go and drum up somebody else." He did not seem eager to go, but he started. "Then that's all settled," she shouted over her shoulder to Clementina. "No, no, Mrs. Milray! "Clementina called after her. "The ship tilts so"-- "Nonsense! It's the smoothest run she ever made in December. And I'll engage to have the sea as steady as a rock for you. Remember, now, you've promised." Mrs. Milray whirled her Englishman away, and left Clementina sitting beside her husband. "Did you want to dance for them, Clementina?" he asked. "I don't know," she said, with the vague smile of one to whom a pleasant hope has occurred. "I thought perhaps you were letting Mrs. Milray bully you into it. She's a frightful tyrant." "Oh, I guess I should like to do it, if you think it would be--nice." "I dare say it will be the nicest thing at their ridiculous show." Milray laughed as if her willingness to do the dance had defeated a sentimental sympathy in him. "I don't believe it will be that," said Clementina, beaming joyously. "But I guess I shall try it, if I can find the right kind of a dress." "Is a pleated skirt absolutely necessary," asked Milray, gravely. "I don't see how I could get on without it," said Clementina. She was so serious still when she went down to her state-room that Mrs. Lander was distracted from her potential ailments to ask: "What is it, Clementina?" "Oh, nothing. Mrs. Milray has got me to say that I would do something at a concert they ah' going to have on the ship." She explained, "It's that skut dance I learnt at Woodlake of Miss Wilson." . You ah' just lovely in that dance, Clementina." "Do 'Asia Minor', and stood about in front of the sofas and chairs so many deep that it was hard to see or hear through them. They each paid a shilling admittance; they were prepared to give munificently besides when the hat came round; and after the first burst of blundering from Lord Lioncourt, they led the magnanimous applause. He said he never minded making a bad speech in a good cause, and he made as bad a one as very well could be. He closed it by telling Mark Twain's whistling story so that those who knew it by heart missed the paint; but that might have been because he hurried it, to get himself out of the way of the others following. When he had done, one of the most ardent of the Americans proposed three cheers for him. The actress whom he had secured in spite of Mrs. Milray appeared in woman's dress contrary to her inveterate professional habit, and followed him with great acceptance in her favorite variety-stage song; and then her husband gave imitations of Sir Henry Irving, and of Miss Maggie Kline in "T'row him down, McCloskey," with a cockney accent. A frightened little girl, whose mother had volunteered her talent, gasped a ballad to her mother's accompaniment, and two young girls played a duet on the mandolin and guitar. A gentleman of cosmopolitan military tradition, who sold the pools in the smoking-room, and was the friend of all the men present, and the acquaintance of several, gave selections of his autobiography prefatory to bellowing in a deep bass voice, "They're hanging Danny Deaver," and then a lady interpolated herself into the programme with a kindness which Lord Lioncourt acknowledged, in saying "The more the merrier," and sang Bonnie Dundee, thumping the piano out of all proportion to her size and apparent strength. Some advances which Clementina had made for Mrs. Milray's help about the dress she should wear in her dance met with bewildering indifference, and she had fallen back upon her own devices. She did not think of taking back her promise, and she had come to look forward to her part with a happiness which the good weather and the even sway of the ship encouraged. But her pulses fluttered, as she glided into the music room, and sank into a chair next Mrs. Milray. She had on an accordion skirt which she had been able to get out of her trunk in the hold, and she felt that the glance of Mrs. Milray did not refuse it approval. "That will do nicely, Clementina," she said. She added, in careless acknowledgement of her own failure to direct her choice, "I see you didn't need my help after all," and the thorny point which Clementina felt in her praise was rankling, when Lord Lioncourt began to introduce her. He made rather a mess of it, but as soon as he came to an end of his well-meant blunders, she stood up and began her poses and paces. It was all very innocent, with something courageous as well as appealing. She had a kind of tender dignity in her dance, and the delicate beauty of her face translated itself into the grace of her movements. It was not impersonal; there was her own quality of sylvan, of elegant." "Thank. "Now, listen!" urged Mrs. Milray. "You think I'm just saying it because, if you don't take it I shall have to tell Mr. Milray I was so hateful to you, you couldn't. Well, I should hate to tell him that; but that isn't the reason. There!" She tore the letter in pieces, and threw it on the floor. Clementina did not make any sign of seeing this, and Mrs. Milray dropped upon her chair again. "Oh, how hard you are! Can't you say something to me?" Clementina did not lift her eyes. "I don't feel like saying anything just now." Mrs. Milray was silent a moment. Then she sighed. "Well, you may hate me, but I shall always be your friend. What hotel are you going to in Liverpool? "I don't know," said Clementina. "You had better come to the one where we go. I'm afraid Mrs. Lander won't know how to manage very well, and we've been in Liverpool so often. May I speak to her about it?" "If you want to," Clementina coldly assented. "I see!" said Mrs. Milray. "You don't want to be under the same roof with me. Well, you needn't! But I'll tell you a good hotel: the one that the trains start out of; and I'll send you that letter for Miss Milray." Clemeutina was silent. "Well, I'll send it, anyway." Mrs. Milray went away in sudden tears, but the girl remained dry-eyed. Mrs. Lander realized when the ship came to anchor in the stream at Liverpool that she had not been seasick a moment during the voyage. In the brisk cold of the winter morning, as they came ashore in the tug, she fancied a property of health in the European atmosphere, which she was sure would bring her right up, if she stayed long enough; and a regret that she had never tried it with Mr. Lander mingled with her new hopes for herself. But Clementina looked with home-sick eyes at the strangeness of the alien scene: the pale, low heaven which seemed not to be clouded and yet was so dim; the flat shores with the little railroad trains running in and out over them; the grimy bulks of the city, and the shipping in the river, sparse and sombre after the gay forest of sails and stacks at New York. She did not see the Milrays after she left the tug, in the rapid dispersal of the steamer's passengers. They both took leave of her at the dock, and Mrs. Milray whispered with penitence in her voice and eyes, I will write," but the girl did not answer. Before Mrs. Lander's trunks and her own were passed, she saw Lord Lioncourt going away with his heavily laden man at his heels. Mr. Ewins came up to see if he could help her through the customs, but she believed that be had come at Mrs. Milray's bidding, and she thanked him so prohibitively that he could not insist. The English clergyman who had spoken to her the morning after the charity entertainment left his wife with Mrs. Lander, and came to her help, and then Mr. Ewins went his y. . 1anda, just now. She isn't very well, and I shouldn't like to leave her alone." "But we're just as much obliged to you as if she could come," Mrs. Lander interrupted; I bands. , yon haven't asked me to. You'll know what to do, if you haven't done it already; girls usually have, when they want advice. Was there something you were going to say?" "Oh,." "Oh,. He came back late in the afternoon, looking jaded and distraught. Hinkle, who looked neither, was with him. "Well," he began, "this is the greatest thing in my experience. Belsky's not only alive and well, but Mr. Gregory and I are both at large. I did think, one time, that the police would take us into custody on account of our morbid interest in the thing, and I don't believe we should have got off, if the Consul hadn't gone bail for us, so to speak. I thought we had better take the Consul in, on our way, and it was lucky we did." Clementina did not understand all the implications, but she was willing to take Mr. Hinkle's fun on trust. "I don't believe you'll convince Mrs. Landa that Mr. Belsky's alive and well, till you bring him back to say so." "Is that so!" said Hinkle. "Well, we must have him brought back by the authorities, then. Perhaps they'll bring him, anyway. They can't try him for suicide, but as I understand the police, here, a man can't lose his hat over a bridge in Florence with impunity, especially in a time of high water. Anyway, they're identifying Belsky by due process of law in Rome, now, and I guess Mr. Gregory"--he nodded toward Gregory, who sat silent and absent "will be kept under surveillance till the whole mystery is cleared up." Clementina responded gayly still, but with less and less sincerity, and she let Hinkle go at last with the feeling that he knew she wished him to go. He made a brave show of not seeing this, and when he was gone, she remembered that she had not thanked him for the trouble he had taken on her account, and her heart ached after him with a sense of his sweetness and goodness, which she had felt from the first through his quaint drolling. It was as if the door which closed upon him shut her out of the life she had been living of late, and into the life of the past where she was subject again to the spell of Gregory's mood; it was hardly his will. He began at once: "I wished to make you say something this morning that I have no right to hear you say, yet; and I have been trying ever since to think how I could ask you whether you could share my life with me, and yet not ask you to do it. But I can't do anything without knowing-- You may not care for what my life is to be, at all!" Clementina's head drooped a little, but she answered distinctly, "I do ca'e, Mr. Gregory." "Thank you for that much; I don't count upon more than you have said. Clementina, I am going to be a missionary. I think I shall ask to be sent to China; I've not decided yet. My life will be hard; it will be full of danger and privation; it will be exile. You will have to think of sharing such a life if you think"-- He stopped; the time had come for her to speak, and she said, "I knew you wanted to be a missionary"-- "And--and--you would go with me? You would" --He started toward her, and she did not shrink from him, now; but he checked himself. "But you mustn't, you know, for my sake." MR. GREGORY: "I have been thinking about what you said yesterday, and I have to tell you something. Then you can do what is right for both of us; you will know better than I can. But I want you to understand that if I go with you in your missionary life, I shall do it for you, and not for anything else. I would go anywhere and live anyhow for you, but it would be for you; I do not believe that I am religious, and I know that I should not do it for religion. "That is all; but I could not get any peace till I let you know just how I felt. "CLEMENTINA CLAXON." The letter went early in the morning, though not so early but it was put in Gregory's hand as he was leaving his hotel to go to Mrs. Lander's. He tore it open, and read it on the way, and for the first moment it seemed as if it were Providence leading him that he might lighten Clementina's heart of its doubts with the least delay. He had reasoned that if she would share for his sake the life that he should live for righteousness' sake they would be equally blest in it, and it would be equally consecrated in both. But this luminous conclusion faded in his thought as he hurried on, and he found himself in her presence with something like a hope that she would be inspired to help him. His soul lifted at the sound of the gay voice in which she asked, "Did you get my letta?" and it seemed for the instant as if there could be no trouble that their love could not overcome. "Yes," he said, and he put his arms around her, but with a provisionality in his embrace which she subtly perceived. "And what did you think of it?" she asked. "Did you think I was silly?" He was aware that she had trusted him to do away her misgiving. "No, no," he answered, guiltily. "Wiser than I am, always. I--I want to talk with you about it, Clementina. I want you to advise me." He felt her shrink from him, and with a pang he opened his arms to free her. But it was right; he must. She had been expecting him to say that there was nothing in her misgiving, and he could not say it. "Clementina," he entreated, "why do you think you are not religious?" "Why, I have never belonged to chu'ch," she answered simply. He looked so daunted, that she tried to soften the blow after she had dealt it. "Of course, I always went to chu'ch, though father and motha didn't. I went to the Episcopal--to Mr. Richling's. But I neva was confirmed." "But-you believe in God?" "Why, certainly!" "And in the Bible?" "Why, of cou'se!" "And that it is our duty to bear the truth to those who have never heard of it?" "I know that is the way you feel about it; but I am not certain that I should feel so myself if you didn't want me to. That's what I got to thinking about last night." She added hopefully, "But perhaps it isn't so great a thing as I"-- ah' trying to think so," sighed the girl. "Tell me about it!" Miss Milray pulled her down on the sofa with her, and modified her embrace to a clasp of Clementina's bands. "Why, there isn't much to tell," she began, but she told what there was, and Miss Milray kept her countenance concerning the scruple that had parted Clementina and her lover. "Perhaps he wouldn't have thought of it," she said, in a final self-reproach, if I hadn't put it into his head." "Well, then, I'm not sorry you put it into his head," cried Miss Milray. "Clementina, may I say what I think of Mr. Gregory's performance?" "Why, certainly, Miss Milray!" I think he's not merely a gloomy little bigot, but a very hard-hearted little wretch, and I'm glad you're rid of him. No, stop! Let me go on! You said I might! she persisted, at a protest which imparted itself from Clementina's restive hands. "It was selfish and cruel of him to let you believe that he had forgotten you. It doesn't make it right now, when an accident has forced him to tell you that he cared for you all along." "Why, do you look at it that way, Miss Milray? If he was doing it on my account?" "He may think he was doing it on your account, but I think he was doing it on his own. In such a thing as that, a man is bound by his mistakes, if he has made any. He can't go back of them by simply ignoring them. It didn't make it the same for you when he decided for your sake that he would act as if he had never spoken to you." "I presume he thought that it would come right, sometime," Clementina urged. "I did." "Yes, that was very well for you, but it wasn't at all well for him. He behaved cruelly; there's no other word for it." "I don't believe he meant to be cruel, Miss Milray," said Clementina. "You're not sorry you've broken with him?" demanded Miss Milray, severely, and she let go of Clementina's hands. "I shouldn't want him to think I hadn't been fai'a." "I don't understand what you mean by not being fair," said Miss Milray, after a study of the girl's eyes. "I mean," Clementina explained, "that if I let him think the religion was all the'e was, it wouldn't have been fai'a." Why, weren't you sincere about that?" "Of cou'se I was!" returned the girl, almost indignantly. "But if the'e was anything else, I ought to have told him that, too; and I couldn't." "Then you can't tell me, of course?" Miss Milray rose in a little pique. "Perhaps some day I will," the girl entreated. "And perhaps that was all." Miss Milray laughed. "Well, if that was enough to end it, I'm satisfied, and I'll let you keep your mystery--if it is one--till we meet in Venice; I shall be there early in June. Good bye, dear, and say good bye to Mrs. Lander for me."ina smiled discreetly. "They have their faults like everybody else, I presume." "Ah, that's a regular Yankee word: presume," said Hinkle. "Our teacher, my first one, always said presume. She was from your State, too." In the time of provisional quiet that followed for Clementina, she was held from the remorses and misgivings that had troubled her before Hinkle came. She still thought that she had let Dr. Welwright go away believing that she had not cared enough for the offer which had surprised her so much, and she blamed herself for not telling him how doubly bound she was to Gregory; though when she tried to put her sense of this in words to herself she could not make out that she was any more bound to him than she had been before they met in Florence, unless she wished to be so. Yet somehow in this time of respite, neither the regret for Dr. Welwright nor the question of Gregory persisted very strongly, and there were whole days when she realized before she slept that she had not thought of either. She was in full favor again with Mrs. Lander, whom there was no one to embitter in her jealous affection. Hinkle formed their whole social world, and Mrs. Lander made the most of him. She was always having him to the dinners which her landlord served her from a restaurant in her apartment, and taking him out with Clementina in her gondola. He came into a kind of authority with them both which was as involuntary with him as with them, and was like an effect of his constant wish to be doing something for them. One morning when they were all going out in Mrs. Lander's gondola, she sent Clementina back three times to their rooms for outer garments of differing density. When she brought the last Mrs. Lander frowned. "This won't do. I've got to have something else--something lighter and warma." "I can't go back any moa, Mrs. Landa," cried the girl, from the exasperation of her own nerves. "Then I will go back myself," said Mrs. Lander with dignity, "and we sha'n't need the gondoler any more this mo'ning," she added, "unless you and Mr. Hinkle wants to ride." She got ponderously out of the boat with the help of the gondolier's elbow, and marched into the house again, while Clementina followed her. She did not offer to help her up the stairs; Hinkle had to do it, and he met the girl slowly coming up as he returned from delivering Mrs. Lander over to Maddalena. "She's all right, now," he ventured to say, tentatively. "Is she?" Clementina coldly answered. In spite of her repellent air, he persisted, "She's a pretty sick woman, isn't she?" "The docta doesn't say." "Well, I think it would be safe to act on that supposition. Miss Clementina--I think she wants to see you." "I'm going to her directly." Hinkle paused, rather daunted. "She wants me to go for the doctor." ," $xed beween you and me?" His dont could;?" "No-no." "When I got to thinking about some one else at fust it was only not thinking about him--I was ashamed. Then I tried to make out that I was too young in the fust place, to know whether I really ca'ed for any one in the right way; but after I made out that I was, I couldn't feel exactly easy--and I've been wanting to ask you, Miss Milray"-- "Ask me anything you like, my dear!" "Why, it's only whether a person ought eva to change." "We change whether we ought, or not. It isn't a matter of duty, one way or another." "Yes, but ought we to stop caring for somebody, when perhaps we shouldn't if somebody else hadn't come between? That is the question." "No," Miss Milray retorted, "that isn't at all the question. The question is which you want and whether you could get him. Whichever you want most it is right for you to have." "Do you truly think so?" "I do, indeed. This is the one thing in life where one may choose safest what one likes best; I mean if there is nothing bad in the man himself." "I was afraid it would be wrong! That was what I meant by wanting to be fai'a with Mr. Gregory when I told you about him there in Florence. I don't believe but what it had begun then." "What had begun?" "About Mr. Hinkle." Miss Milray burst into a laugh. "Clementina, you're delicious!" The girl looked hurt, and Miss Milray asked seriously, Why do you like Mr. Hinkle best--if you do?" Clementina sighed. Oh, I don't know. He's so resting." "Then that settles it. From first to last, what we poor women want is rest. It would be a wicked thing for you to throw your life away on some one who would worry you out of it. I don't wish to say any thing against Mr. Gregory. I dare say be is good--and conscientious; but life is a struggle, at the best, and it's your duty to take the best chance for resting." Clementina did not look altogether convinced, whether it was Miss Milray's logic or her morality that failed to convince her. She said, after a moment, "I should like to see Mr. Gregory again." "What good would that do?" "Why, then I should know." "Know what?" "Whether I didn't really ca'e for him any more--or so much." "Clementina," said Miss Milray, "you mustn't make me lose patience with you"-- "No. But I thought you said that it was my duty to do what I wished." "Well, yes. That is what I said," Miss Milray consented. "But I supposed that you knew already." "No," said Clementina, candidly, "I don't believe I do." "And what if you don't see him?" "I guess I shall have to wait till I do. The'e will be time enough." Miss Milray sighed, and then she laughed. "You ARE young!" Miss Milray went from Clementina to call upon her sister-in-law, and found her brother, which was perhaps what she hoped might happen. "Do you know," she said, "that that old wretch is going to defraud that poor thing, after all, and leave her money to her husband's half-sister's children?" "You wish me to infer the Mrs. Lander--Clementina situation?" Milray returned. "I'm glad you put it in terms that are not actionable, then; for your words are decidedly libellous." "What do you mean?" "I've just been writing Mrs. Lander's will for her, and she's left all her property to Clementina, except five thousand apiece to the half- sister's three children." "I can't believe it!" "Well," said Milray, with his gentle smile, "I think that's safe ground for you. Mrs. Lander will probably have time enough to change her will as well as her mind several times yet before she dies. The half-sister's children may get their rights yet." "I wish they might!" said Miss Milray, with an impassioned sigh. "Then perhaps I should get Clementina--for a while." Her brother laughed. "Isn't there somebody else wants Clementina? "Oh, plenty. But she's not sure she wants anybody else." "Does she want you?" "No, I can't say she does. She wants to go home." "That's not a bad scheme. I should like to go home myself if I had one. What would you have done with Clementina if you had got her, Jenny?" "What would any one have done with her? Married her brilliantly, of course." "But you say she isn't sure she wishes to be married at all?" Miss Milray stated the case of Clementina's divided mind, and her belief that she would take Hinkle in the end, together with the fear that she might take Gregory. "She's very odd," Miss Milray concluded. "She puzzles me. Why did you ever send her to me?" Milray laughed. "I don't know. I thought she would amuse you, and I thought it would be a pleasure to her." They began to talk of some affairs of their own, from which Miss Milray returned to Clementina with the ache of an imperfectly satisfied intention. If she had meant to urge her brother to seek justice for the girl from Mrs. Lander, she was not so well pleased to have found justice done already. But the will had been duly signed and witnessed before the American vice-consul, and she must get what good she could out of an accomplished fact. It was at least a consolation to know that it put an end to her sister-in-law's patronage of the girl, and it would be interesting to see Mrs. Milray adapt her behavior to Clementina's fortunes. She did not really dislike her sister-in-law enough to do her a wrong; she was only willing that she should do herself a wrong. But one of the most disappointing things in all hostile operations is that you never can know what the enemy would be at; and Mrs. Milray's manoev the fortnight of Belsky's stay in Venice Mrs. Lander was much worse, and Clementina met him only once, very briefly-- She felt that he had behaved like a very silly person, but that was all over now, and she had no wish to punish him for it. At the end of his fortnight he went northward into the Austrian Tyrol, and a few days later Gregory came down from the Dolomites to Venice. It was in his favor with Clementina that he yielded to the impulse he had to come directly to her; and that he let her know with the first words that he had acted upon hopes given him through Belsky from Mrs. Milray. He owned that he doubted the authority of either to give him these hopes, but he said he could not abandon them without a last effort to see her, and learn from her whether they were true or false. If she recognized the design of a magnificent reparation in what Mrs. Milray had done, she did not give it much thought. Her mind was upon distant things as she followed Gregory's explanation of his presence, and in the muse in which she listened she seemed hardly to know when he ceased speaking. "I know it must seem to take something for granted which I've no right to take for granted. I don't believe you could think that I cared for anything but you, or at all for what Mrs. Lander has done for you." "Do you mean her leaving me her money?" asked Clementina, with that boldness her sex enjoys concerning matters of finance and affection. "Yes," said Gregory, blushing for her. "As far as I should ever have a right to care, I could wish there were no money. It could bring no blessing to our life. We could do no good with it; nothing but the sacrifice of ourselves in poverty could be blessed to us." "That is what I thought, too," Clementina replied. "Oh, then you did think"-- But afterwards, I changed my Mind. If she wants to give me her money I shall take it." Gregory was blankly silent again. "I should. Ii," the vice-consul pleaded, "it's only about forty francs for the whole thing"-- "I don't care if it's only fotty cents. And I must say, Mr. Bennam, you're about the strangest vice-consul, to want me to do it, that I eva saw." The vice-consul laughed unresentfully. "Well, shall I send you a lawyer?" "No!" Mrs. Lander retorted; and after a moment's reflection she added, "I'm goin' to stay my month, and so you may tell him, and then I'll see whetha he can make me pay for that breakage and the candles and suvvice. I'm all wore out, as it is, and I ain't fit to travel, now, and I don't know when I shall be. Clementina, you can go and tell Maddalena to stop packin'. Or, no! I'll do it." She left the room without further notice of the consul, who said ruefully to Clementina, "Well, I've missed my chance, Miss Claxon, but I guess she's done the wisest thing for herself." "Oh, yes, she's not fit to go. She must stay, now, till it's coola. Will you tell the landlo'd, or shall"-- "I'll tell him," said the vice-consul, and he had in the landlord. He received her message with the pleasure of a host whose cherished guests have consented to remain a while longer, and in the rush of his good feeling he offered, if the charge for breakage seemed unjust to the vice- consul, to abate it; and since the signora had not understood that she was to pay extra for the other things, he would allow the vice-consul to adjust the differences between them; it was a trifle, and he wished above all things to content the signora, for whom he professed a cordial esteem both on his own part and the part of all his family. "Then that lets me out for the present," said the vice-consul, when Clementina repeated Mrs. Lander's acquiescence in the landlord's proposals, and he took his straw hat, and called a gondola from the nearest 'traghetto', and bargained at an expense consistent with his salary, to have himself rowed back to his own garden-gate. The rest of the day was an era of better feeling between Mrs. Lander and her host than they had ever known, and at dinner he brought in with his own hand a dish which he said he had caused to be specially made for her. It was so tempting in odor and complexion that Mrs. Lander declared she must taste it, though as she justly said, she had eaten too much already; when it had once tasted it she ate it all, against Clementina's protestations; she announced at the end that every bite had done her good, and that she never felt better in her life. She passed a happy evening, with renewed faith in the air of the lagoon; her sole regret now was that Mr. Lander had not lived to try it with her, for if he had she was sure he would have been alive at that moment. She. . It had been made out for three thousand pounds, in Clementina's name as well as her own; but she had lived wastefully since she had come abroad, and little money remained to be taken up. With the letter Clementina handed the vice-consul the roll of Italian and Austrian bank-notes which she had drawn when Mrs. Lander decided to leave Venice; they were to the amount of several thousand lire and golden. She offered them with the insensibility to the quality of money which so many women have, and which is always so astonishing to men. "What must I do with these?" she asked. "Why, keep them! returned the vice-consul on the spur of his surprise. "I don't know as I should have any right to," said Clementina. "They were hers." "Why, but"-- The vice-consul began his protest, but he could not end it logically, and he did not end it at all. He insisted with Clementina that she had a right to some money which Mrs. Lander had given her during her life; he took charge of the bank-notes in the interest of the possible heirs, and gave her his receipt for them. In the meantime he felt that he ought to ask her what she expected to do. "I think," she said, "I will stay in Venice awhile." The vice-consul suppressed any surprise he might have felt at a decision given with mystifying cheerfulness. He answered, Well, that was right; and for the second time he asked her if there was anything he could do for her. "Why, yes," she returned. "I should like to stay on in the house here, if you could speak for me to the padrone." "I don't see why you shouldn't, if we can make the padrone understand it's different." "You mean about the price?" The vice-consul nodded. "That's what I want you should speak to him about, Mr. Bennam, if you would. Tell him that I haven't got but a little money now, and he would have to make it very reasonable. That is, if you think it would be right for me to stay, afta the way he tried to treat Mrs. Lander." The vice-consul gave the point some thought, and decided that the attempted extortion need not make any difference with Clementina, if she could get the right terms. He said he did not believe the padrone was a bad fellow, but he liked to take advantage of a stranger when he could; we all did. When he came to talk with him he found him a man of heart if not of conscience. He entered into the case with the prompt intelligence and vivid sympathy of his race, and he made it easy for Clementina to stay till she had heard from her friends in America. For himself and for his wife, he professed that she could not stay too long, and they proposed that if it would content the signorina still further they would employ Maddalena as chambermaid till she wished to return to Florence; she had offered to remain if the signorina stayed. "Then that is settled," said Clementina with a sigh of relief; and she thanked the vice-consul for his offer to write to the Milrays for her, and said that she would rather write herself. She meant to write as soon as she heard from Mr. Hinkle, which could not be long now, for then she could be independent of the offers of help which she dreaded from Miss Milray, even more than from Mrs. Milray; it would be harder to refuse them; and she entered upon a passage of her life which a nature less simple would have found much more trying. But she had the power of taking everything as if it were as much to be expected as anything else. If nothing at all happened she accepted the situation with implicit resignation, and with a gayety of heart which availed her long, and never wholly left her. While the suspense lasted she could not write home as frankly as before, and she sent off letters to Middlemount which treated of her delay in Venice with helpless reticence. They would have set another sort of household intolerably wondering and suspecting, but she had the comfort of knowing that her father would probably settle the whole matter by saying that she would tell what she meant when she got round to it; and apart from this she had mainly the comfort of the vice-consul's society. He had little to do besides looking after her, and he employed himself about this in daily visits which the padrone and his wife regarded as official, and promoted with a serious respect for the vice-consular dignity. If the visits ended, as they often did, in a turn on the Grand Canal, and an ice in the Piazza, they appealed to the imagination of more sophisticated witnesses, who decided that the young American girl had inherited the millions of the sick lady, and become the betrothed of the vice-consul, and that they were thus passing the days of their engagement in conformity to the American custom, however much at variance with that of other civilizations. This view of the affair was known to Maddalena, but not to Clementina, who in those days went back in many things to the tradition of her life at Middlemount. The vice-consul was of a tradition almost as simple, and his longer experience set no very wide interval between them. It quickly came to his telling her all about his dead wife and his married daughters, and how, after his home was broken up, he thought he would travel a little and see what that would do for him. He confessed that it had not done much; he was always homesick, and he was ready to go as soon as the President sent out a consul to take his job off his hands. He said that he had not enjoyed himself so much since he came to Venice as he was doing now, and that he did not know what he should do if Clementina first got her call home. He betrayed no curiosity as to the peculiar circumstances of her stay, but affected to regard it as something quite normal, and he watched over her in every way with a fatherly as well as an official vigilance which never degenerated into the semblance of any other feeling. Clementina rested in his care in entire security. The world had quite fallen from her, or so much of it as she had seen at Florence, and in her indifference she lapsed into life as it was in the time before that with a tender renewal of her allegiance to it. There was nothing in the conversation of the vice-consul to distract her from this; and she said and did the things at Venice that she used to do at Middlemount, as nearly as she could; to make the days of waiting pass more quickly, she tried to serve herself in ways that scandalized the proud affection of Maddalena. It was not fit for the signorina to make her bed or sweep her room; she might sew and knit if she would; but these other things were for servants like herself. She continued in the faith of Clementina's gentility, and saw her always as she had seen her first in the brief hour of her social splendor in Florence. Clementina tried to make her understand how she lived at Middlemount, but she only brought before Maddalena the humiliating image of a contadina, which she rejected not only in Clementina's behalf, but that of Miss Milray. She told her that she was laughing at her, and she was fixed in her belief when the girl laughed at that notion. Her poverty she easily conceived of; plenty of signorine in Italy were poor; and she protected her in it with the duty she did not divide quite evenly between her and the padrone. The date which Clementina had fixed for hearing from Hinkle by cable had long passed, and the time when she first hoped to hear from him by letter had come and gone. Her address was with the vice-consul as Mrs. Lander's had been, and he could not be ignorant of her disappointment when he brought her letters which she said were from home. On the surface of things it could only be from home that she wished to hear, but beneath the surface he read an anxiety which mounted with each gratification of this wish. He had not seen much of the girl while Hinkle was in Venice; Mrs. Lander had not begun to make such constant use of him until Hinkle had gone; Mrs. Milray had told him of Clementina's earlier romance, and it was to Gregory that the vice-consul related the anxiety which he knew as little in its nature as in its object. Clementina never doubted the good faith or constancy of her lover; but her heart misgave her as to his well-being when it sank at each failure of the vice-consul to bring her a letter from him. Something must have happened to him, and it must have been something very serious to keep him from writing; or there was some mistake of the post-office. The vice- consul indulged himself in personal inquiries to make sure that the mistake was not in the Venetian post-office; but he saw that he brought her greater distress in ascertaining the fact. He got to dreading a look of resolute cheerfulness that came into her face, when he shook his head in sign that there were no letters, and he suffered from the covert eagerness with which she glanced at the superscriptions of those he brought and failed to find the hoped-for letter among them. Ordeal for ordeal, he was beginning to regret his trials under Mrs. Lander. In them he could at least demand Clementina's sympathy, but against herself this was impossible. Once she noted his mute distress at hers, and broke into a little laugh that he found very harrowing. "I guess you hate it almost as much as I do, Mr. Bennam." "I guess I do. I've half a mind to write the letter you want, myself." "I've half a mind to let you--or the letter I'd like to write." It had come to her thinking she would write again to Hinkle; but she could not bring herself to do it. She often imagined doing it; she had every word of such a letter in her mind; and she dramatized every fact concerning it from the time she should put pen to paper, to the time when she should get back the answer that cleared the mystery of his silence away. The fond reveries helped her to bear her suspense; they helped to make the days go by, to ease the doubt with which she lay down at night, and the heartsick hope with which she rose up in the morning. One day, at the hour of his wonted visit, she say the vice-consul from her balcony coming, as it seemed to her, with another figure in his gondola, and a thousand conjectures whirled through her mind, and then centred upon one idea. After the first glance she kept her eyes down, and would not look again while she told herself incessantly that it could not be, and that she was a fool and a goose and a perfect coot, to think of such a thing for a single moment. When she allowed herself, or forced herself, to look a second time; as the boat drew near, she had to cling to the balcony parapet for support, in her disappointment. The person whom the vice-consul helped out of the gondola was an elderly man like himself, and she took a last refuge in the chance that he might be Hinkle's father, sent to bring her to him because he could not come to her; or to soften some terrible news to her. Then her fancy fluttered and fell, and she waited patiently for the fact to reveal itself. There was something countrified in the figure of the man, and something clerical in his face, though there was nothing in his uncouth best clothes that confirmed this impression. In both face and figure there was a vague resemblance to some one she had seen before, when the vice- consul said: "Miss Claxon, I want to introduce the Rev. Mr. James B. Orson, of Michigan." Mr. Orson took Clementina's hand into a dry, rough grasp, while he peered into her face with small, shy eyes. The vice-consul added with a kind of official formality, "Mr. Orson is the half-nephew of Mr. Lander," and then Clementina now knew whom it was that he resembled. "He has come to Venice," continued the vice-consul, "at the request of Mrs. Lander; and he did not know of her death until I informed him of the fact. I should have said that Mr. Orson is the son of Mr. Lander's half- sister. He can tell you the balance himself." The vice-consul pronounced the concluding word with a certain distaste, and the effect of gladly retiring into the background. "Won't you sit down?" said Clementina, and she added with one of the remnants of her Middlemount breeding, "Won't you let me take your hat?" Mr. Orson in trying to comply with both her invitations, knocked his well worn silk hat from the hand that held it, and sent it rolling across the room, where Clementina pursued it and put it on the table. "I may as well say at once," he began in a flat irresonant voice, "that I am the representative of Mrs. Lander's heirs, and that I have a letter from her enclosing her last will and testament, which I have shown to the consul here"-- "Vice-consul," the dignitary interrupted with an effect of rejecting any part in the affair. "Vice-consul, I should say,--and I wish to lay them both before you, in order that"-- "Oh, that is all right," said Clementina sweetly. "I'm glad there is a will. I was afraid there wasn't any at all. Mr. Bennam and I looked for it everywhe'e." She smiled upon the Rev. Mr. Orson, who silently handed her a paper. It was the will which Milray had written for Mrs. Lander, and which, with whatever crazy motive, she had sent to her husband's kindred. It provided that each of them should be given five thousand dollars out of the estate, and that then all should go to Clementina. It was the will Mrs. Lander told her she had made, but she had never seen the paper before, and the legal forms hid the meaning from her so that she was glad to have the vice-consul make it clear. Then she said tranquilly, "Yes, that is the way I supposed it was." Mr. Orson by no means shared her calm. He did not lift his voice, but on the level it had taken it became agitated. "Mrs. Lander gave me the address of her lawyer in Boston when she sent me the will, and I made a point of calling on him when I went East, to sail. I don't know why she wished me to come out to her, but being sick, I presume she naturally wished to see some of her own family." He looked at Clementina as if he thought she might dispute this, but she consented at her sweetest, "Oh, yes, indeed," and he went on: "I found her affairs in a very different condition from what she seemed to think. The estate was mostly in securities which had not been properly looked after, and they had depreciated until they were some of them not worth the paper they were printed on. The house in Boston is mortgaged up to its full value, I should say; and I should say that Mrs. Lander did not know where she stood. She seemed to think that she was a very rich woman, but she lived high, and her lawyer said he never could make her understand how the money was going. Mr. Lander seemed to lose his grip, the year he died, and engaged in some very unfortunate speculations; I don't know whether he told her. I might enter into details"-- "Oh, that is not necessary," said Clementina, politely, witless of the disastrous quality of the facts which Mr. Orson was imparting. "But the sum and substance of it all is that there will not be more than enough to pay the bequests to her own family, if there is that." Clementina looked with smiling innocence at the vice-consul. "That is to say," he explained, "there won't be anything at all for you, Miss Claxon." "Well, that's what I always told Mrs. Lander I ratha, when she brought it up. I told her she ought to give it to his family," said Clementina, with a satisfaction in the event which the vice-consul seemed unable to share, for he remained gloomily silent. "There is that last money I drew on the letter of credit, you can give that to Mr. Orson." "I have told him about that money," said the vice-consul, dryly. "It will be handed over to him when the estate is settled, if there isn't enough to pay the bequests without it." "And the money which Mrs. Landa gave me before that," she pursued, eagerly. Mr. Orson had the effect of pricking up his ears, though it was in fact merely a gleam of light that came into his eyes. "That's yours," said the vice-consul, sourly, almost savagely. "She didn't give it to you without she wanted you to have it, and she didn't expect you to pay her bequests with it. In my opinion," he burst out, in a wrathful recollection of his own sufferings from Mrs. Lander, "she didn't give you a millionth part of your due for all the trouble she made you; and I want Mr. Orson to understand that, right here." Clementina turned her impartial gaze upon Mr. Orson as if to verify the impression of this extreme opinion upon him; he looked as if he neither accepted nor rejected it, and she concluded the sentence which the vice- consul had interrupted. "Because I ratha not keep it, if there isn't enough without it." The vice-consul gave way to violence. "It's none of your business whether there's enough or not. What you've got to do is to keep what belongs to you, and I'm going to see that you do. That's what I'm here for." If this assumption of official authority did not awe Clementina, at least it put a check upon her headlong self-sacrifice. The vice- consul strengthened his hold upon her by asking, "What would you do. I should like to know, if you gave that up?" "Oh, I should get along," she returned, Light-heartedly, but upon questioning herself whether she should turn to Miss Milray for help, or appeal to the vice-consul himself, she was daunted a little, and she added, "But just as you say, Mr. Bennam." "I say, keep what fairly belongs to you. It's only two or three hundred dollars at the outside," he explained to Mr. Orson's hungry eyes; but perhaps the sum did not affect the country minister's imagination as trifling; his yearly salary must sometimes have been little more. The whole interview left the vice-consul out of humor with both parties to the affair; and as to Clementina, between the ideals of a perfect little saint, and a perfect little simpleton he remained for the present unable to class her.,""--. "I didn't know," he returned, "but that in view of the circumstances--all the circumstances--you might be intending to defer your departure to some later steamer." "No, no, no ! I must go, now. I couldn't wait a day, an hour, a minute after the first chance of going. You don't know what you are saying! He might die if I told him I was not coming; and then what should I do?" This was what Clementina said to herself; but what she said to Mr. Orson, with an inspiration from her terror at his suggestion was, "Don't you think a little chicken broth would do you good, Mr. Osson? I don't believe but what it would." A wistful gleam came into the preacher's eyes. "It might," he admitted, and then she knew what must be his malady. She sent Maddalena to a trattoria for the soup, and she did not leave him, even after she had seen its effect upon him. It was not hard to persuade him that he had better come home with her; and she had him there, tucked away with his few poor belongings, in the most comfortable room the padrone could imagine, when the vice-consul came in the evening. "He says he thinks he can go, now," she ended, when she had told the vice-consul. "And I know he can. It wasn't anything but poor living." "It looks more like no living," said the vice-consul. "Why didn't the old fool let some one know that he was short of money? "He went on with a partial transfer of his contempt of the preacher to her, "I suppose if he'd been sick instead of hungry, you'd have waited over till the next steamer for him." She cast down her eyes. "I don't know what you'll think of me. I should have been sorry for him, and I should have wanted to stay." She lifted her eyes and looked the vice-consul defiantly in the face. "But he hadn't the fust claim on me, and I should have gone--I couldn't, have helped it!--I should have gone, if he had been dying!" "Well, you've got more horse-sense," said the vice-consul, " than any ten men I ever saw," and he testified his admiration of her by putting his arms round her, where she stood before him, and kissing her. "Don't you mind," he explained. "If my youngest girl had lived, she would have been about your age." "Oh, it's all right, Mr. Bennam," said Clementina. When the time came for them to leave Venice, Mr. Orson was even eager to go. The vice-consul would have gone with them in contempt of the official responsibilities which he felt to be such a thankless burden, but there was really no need of his going, and he and Clementina treated the question with the matter-of-fact impartiality which they liked in each other. He saw her off at the station where Maddalena had come to take the train for Florence in token of her devotion to the signorina, whom she would not outstay in Venice. She wept long and loud upon Clementina's neck, so that even Clementina was once moved to put her handkerchief to her tearless eyes. At the last moment she had a question which she referred to the vice consul. "Should you tell him?" she asked. "Tell who what?" he retorted. "Mr. Osson-that I wouldn't have stayed for him." "Do you think it would make you feel any better?" asked the consul, upon reflection. "I believe he ought to know." "Well, then, I guess I should do it." The time did not come for her confession till they had nearly reached the end of their voyage. It followed upon something like a confession from the minister himself, which he made the day he struggled on deck with her help, after spending a week in his berth. "Here is something," he said, "which appears to be for you, Miss Claxon. I found it among some letters for Mrs. Lander which Mr. Bennam gave me after my arrival, and I only observed the address in looking over the papers in my valise this morning." He handed her a telegram. "I trust that it is nothing requiring immediate attention." Clementina read it at a glance. "No," she answered, and for a while she could not say anything more; it was a cable message which Hinkle's sister must have sent her after writing. No evil had come of its failure to reach her, and she recalled without bitterness the suffering which would have been spared her if she had got it before. It was when she thought of the suffering of her lover from the silence which must have made him doubt her, that she could not speak. As soon as she governed herself against her first resentment she said, with a little sigh, "It is all right, now, Mr. Osson," and her stress upon the word seemed to trouble him with no misgiving. "Besides, if you're to blame for not noticing, so is Mr. Bennam, and I don't want to blame any one." She hesitated a moment before she added: "I have got to tell you something, now, because I think you ought to know it. I am going home to be married, Mr. Osson, and this message is from the gentleman I am going to be married to. He has been very sick, and I don't know yet as he'll be able to meet me in New Yo'k; but his fatha will." Mr. Orson showed no interest in these facts beyond a silent attention to her words, which might have passed for an open indifference. At his time of life all such questions, which are of permanent importance to women, affect men hardly more than the angels who neither marry nor are given in marriage. Besides, as a minister he must have had a surfeit of all possible qualities in the love affairs of people intending matrimony. As a casuist he was more reasonably concerned in the next fact which Clementina laid before him. "And the otha day, there in Venice when you we'e sick, and you seemed to think that I might put off stahting home till the next steamer, I don't know but I let you believe I would." "I supposed that the delay of a week or two could make no material difference to you." "But now you see that it would. And I feel as if I ought to tell you-- I spoke to Mr. Bennam about it, and he didn't tell me not to--that I shouldn't have staid, no not for anything in the wo'ld. I had to do what I did at the time, but eva since it has seemed as if I had deceived you, and I don't want to have it seem so any longer. It isn't because I don't hate to tell you; I do; but I guess if it was to happen over again I couldn't feel any different. Do you want I should tell the deck-stewahd to bring you some beef-tea?" "I think I could relish a small portion," said Mr. Orson, cautiously, and he said nothing more. Clementina left him with her nerves in a flutter, and she did not come back to him until she decided that it was time to help him down to his cabin. He suffered her to do this in silence, but at the door he cleared his throat and began: "I have reflected upon what you told me, and I have tried to regard the case from all points. I believe that I have done so, without personal feeling, and I think it my duty to say, fully and freely, that I believe you would have done perfectly right not to remain." "Yes," said Clementina, "I thought you would think so." They parted emotionlessly to all outward effect, and when they met again it was without a sign of having passed through a crisis of sentiment. Neither referred to the matter again, but from that time the minister treated Clementina with a deference not without some shadows of tenderness such as her helplessness in Venice had apparently never inspired. She had cast out of her mind all lingering hardness toward him in telling him the hard truth, and she met his faint relentings with a grateful gladness which showed itself in her constant care of him. This helped her a little to forget the strain of the anxiety that increased upon her as the time shortened between the last news of her lover and the next; and there was perhaps no more exaggeration in the import than in the terms of the formal acknowledgment which Mr. Orson made her as their steamer sighted Fire Island Light, and they both knew that their voyage had ended: "I may not be able to say to you in the hurry of our arrival in New York that I am obliged to you for a good many little attentions, which I should be pleased to reciprocate if opportunity offered. I do not think I am going too far in saying that they are such as a daughter might offer a parent." "Oh, don't speak of it, Mr. Osson!" she protested. "I haven't done anything that any one wouldn't have done." "I presume," said the minister, thoughtfully, as if retiring from an extreme position, "that they are such as others similarly circumstanced, might have done, but it will always be a source of satisfaction for you to reflect that you have not neglected them.". "Oh, yes," she said, "here is Mr. Osson that came ova with me, fatha; he's a relation of Mr. Landa's," and she presented him to them all. He shifted his valise to the left hand, and shook hands with each, asking, "What name?" and then fell motionless again. "Well," said her father, "I guess this is the end of this paht of the ceremony, and I'm goin' to see your baggage through the custom-house, Clementina; I've read about it, and I want to know how it's done. I want to see what you ah' tryin' to smuggle in." "I guess you won't find much," she said. "But you'll want the keys, won't you?" She called to him, as he was stalking away. "Well, I guess that would be a good idea. Want to help, Miss Hinkle?" "I guess we might as well all help," said Clementina, and Mr. Orson included himself in the invitation. He seemed unable to separate himself from them, though the passage of Clementina's baggage through the customs, and its delivery to an expressman for the hotel where the Hinkles said they were staying might well have severed the last tie between them. "Ah' you going straight home, Mr. Osson?" she asked, to rescue him from the forgetfulness into which they were all letting him fall. "I think I will remain over a day," he answered. "I may go on to Boston before starting West." "Well, that's right," said Clementina's father with the wish to approve everything native to him, and an instinctive sense of Clementina's wish to befriend the minister. "Betta come to oua hotel. We're all goin' to the same one." "I presume it is a good one?" Mr. Orson assented. "Well," said Claxon, "you must make Miss Hinkle, he'a, stand it if it ain't. She's got me to go to it." Mr. Orson apparently could not enter into the joke; but he accompanied the party, which again began to forget him, across the ferry and up the elevated road to the street car that formed the last stage of their progress to the hotel. At this point George's sister fell silent, and Clementina's father burst out, "Look he'a! I guess we betty not keep this up any Tonga; I don't believe much in surprises, and I guess she betta know it now!" He looked at George's sister as if for authority to speak further, and Clementina looked at her, too, while George's father nervously moistened his smiling lips with the tip of his tongue, and let his twinkling eyes rest upon Clementina's face. "Is he at the hotel?" she asked. "Yes," said his sister, monosyllabic for once. "I knew it," said Clementina, and she was only half aware of the fullness with which his sister now explained how he wanted to come so much that the doctor thought he had better, but that they had made him promise he would not try to meet her at the steamer, lest it should be too great a trial of his strength. "Yes," Clementina assented, when the story came to an end and was beginning over again. She. "But it is; I haven't changed a bit." "You ha'n't changed for the wohse, anyway." "Didn't I always try to do what I had to?" "I guess you did, Clem." "Well, then!" Mr. Orson, after a decent hesitation, consented to perform the ceremony. It took place in a parlor of the hotel, according to the law of New York, which facilitates marriage so greatly in all respects that it is strange any one in the State should remain single. He had then a luxury of choice between attaching himself to the bridal couple as far as Ohio on his journey home to Michigan, or to Claxon who was going to take the boat for Boston the next day on his way to Middlemount. He decided for Claxon, since he could then see Mrs. Lander's lawyer at once, and arrange with him for getting out of the vice-consul's hands the money which he was holding for an authoritative demand. He accepted without open reproach the handsome fee which the elder Hinkle gave him for his services, and even went so far as to say, "If your son should ever be blest with a return to health, he has got a helpmeet such as there are very few of." He then admonished the young couple, in whatever trials life should have in store for them, to be resigned, and always to be prepared for the worst. When he came later to take leave of them, he was apparently not equal to the task of fitly acknowledging the return which Hinkle made him of all the money remaining to Clementina out of the sum last given her by Mrs. Lander, but he hid any disappointment he might have suffered, and with a brief, "Thank you," put it in his pocket. Hinkle told Clementina of the apathetic behavior of Mr. Orson; he added with a laugh like his old self, "It's the best that he doesn't seem prepared for." "Yes," she assented. " He wasn't very chee'ful. But I presume that he meant well. It must be a trial for him to find out that Mrs. Landa wasn't rich, after all." It was apparently never a trial to her. She went to Ohio with her husband and took up her life on the farm, where it was wisely judged that he had the best chance of working out of the wreck of his health and strength. There was often the promise and always the hope of this, and their love knew no doubt of the future. Her sisters-in-law delighted in all her strangeness and difference, while they petted her as something not to be separated from him in their petting of their brother; to his mother she was the darling which her youngest had never ceased to be; Clementina once went so far as to say to him that if she was ever anything she would like to be a Moravian. The question of religion was always related in their minds to the question of Gregory, to whom they did justice in their trust of each other. It was Hinkle himself who reasoned out that if Gregory was narrow, his narrowness was of his conscience and not of his heart or his mind. She respected the memory of her first lover; but it was as if he were dead, now, as well as her young dream of him, and she read with a curious sense of remoteness, a paragraph which her husband found in the religious intelligence of his Sunday paper, announcing the marriage of the Rev. Frank Gregory to a lady described as having been a frequent and bountiful contributor to the foreign missions. She was apparently a widow, and they conjectured that she was older than he. His departure for his chosen field of missionary labor in China formed part of the news communicated by the rather exulting paragraph. "Well, that is all right," said Clementina's husband. "He is a good man, and he is where he can do nothing but good. I am glad I needn't feel sorry for him, any more." Clementina's father must have given such a report of Hinkle and his family, that they felt easy at home in leaving her to the lot she had chosen. When Claxon parted from her, he talked of coming out with her mother to see her that fall; but it was more than a year before they got round to it. They did not come till after the birth of her little girl, and her father then humorously allowed that perhaps they would not have got round to it at all if something of the kind had not happened. The Hinkles and her father and mother liked one another, so much that in the first glow of his enthusiasm Claxon talked of settling down in Ohio, and the older Hinkle drove him about to look at some places that were for sale. But it ended in his saying one day that he missed the hills, and he did not believe that he would know enough to come in when it rained if he did not see old Middlemount with his nightcap on first. His wife and he started home with the impatience of their years, rather earlier than they had meant to go, and they were silent for a little while after they left the flag-station where Hinkle and Clementina had put them aboard their train. "Well?" said Claxon, at last. "Well?" echoed his wife, and then she did not speak for a little while longer. At last she asked, "D'he look that way when you fust see him in New Yo'k?" Claxon gave his honesty time to get the better of his optimism. Even then he answered evasively, "He doos look pootty slim." "The way I cypher it out," said his wife, "he no business to let her marry him, if he wa'n't goin' to get well. It was throwin' of herself away, as you may say." "I don't know about that," said Claxon, as if the point had occurred to him, too, and had been already argued in his mind. "I guess they must 'a' had it out, there in New York before they got married--or she had. I don't believe but what he expected to get well, right away. It's the kind of a thing that lingas along, and lingas along. As fah fo'th as Clem went, I guess there wa'n't any let about it. I guess she'd made up her mind from the staht, and she was goin' to have him if she had to hold him on his feet to do it. Look he'a! W hat would you done?" "Oh, I presume we're all fools!" said Mrs. Claxon, impatient of a sex not always so frank with itself. "But that don't excuse him." "I don't say it doos," her husband admitted. "But I presume he was expectin' to get well right away, then. And I don't believe," he added, energetically, "but what he will, yet. As I undastand, there ain't anything ogganic about him. It's just this he'e nuvvous prostration, resultin' from shock, his docta tells me; and he'll wo'k out of that all right." They said no more, and Mrs. Claxon did not recur to any phase of the situation till she undid the lunch which the Hinkles had put up for them, and laid out on the napkin in her lap the portions of cold ham and cold chicken, the buttered biscuit, and the little pot of apple-butter, with the large bottle of cold coffee. Then she sighed, "They live well." "Yes," said her husband, glad of any concession, "and they ah' good folks. And Clem's as happy as a bud with 'em, you can see that." "Oh, she was always happy enough, if that's all you want. I presume she was happy with that hectorin' old thing that fooled her out of her money." "I ha'n't ever regretted that money, Rebecca.," said Claxon, stiffly, almost sternly, "and I guess you a'n't, eitha." "I don't say I have," retorted Mrs. Claxon. "But I don't like to be made a fool of. I presume," she added, remotely, but not so irrelevantly, "Clem could ha' got 'most anybody, ova the'a." "Well," said Claxon, taking refuge in the joke, "I shouldn't want her to marry a crowned head, myself." It was Clementina who drove the clay-bank colt away from the station after the train had passed out of sight. Her husband sat beside her, and let her take the reins from his nerveless grasp; and when they got into the shelter of the piece of woods that the road passed through he put up his hands to his face, and broke into sobs. She allowed him to weep on, though she kept saying, "Geo'ge, Geo'ge," softly, and stroking his knee with the hand next him. When his sobbing stopped, she said, "I guess they've had a pleasant visit; but I'm glad we'a together again." He took up her hand and kissed the back of it, and then clutched it hard, but did not speak. "It's strange," she went on, "how I used to be home-sick for father and motha"--she had sometimes lost her Yankee accent in her association with his people, and spoke with their Western burr, but she found it in moments of deeper feeling--" when I was there in Europe, and now I'm glad to have them go. I don't want anybody to be between us; and I want to go back to just the way we we'e befo'e they came. It's been a strain on you, and now you must throw it all off and rest, and get up your strength. One thing, I could see that fatha noticed the gain you had made since he saw you in New Yo'k. He spoke about it to me the fust thing, and he feels just the way I do about it. He don't want you to hurry and get well, but take it slowly, and not excite yourself. He believes in your gleaner, and he knows all about machinery. He says the patent makes it puffectly safe, and you can take your own time about pushing it; it's su'a to go. And motha liked you. She's not one to talk a great deal--she always leaves that to father and me--but she's got deep feelings, and she just worshipped the baby! I neva saw her take a child in her ahms before; but she seemed to want to hold the baby all the time." She stopped, and then added, tenderly, "Now, I know what you ah' thinking about, Geo'ge, and I don't want you to think about it any more. If you do, I shall give up." They. Six presently in Miss Milray's room talking in their old way. From time to time Miss Milray broke from the talk to kiss the little girl, whom she declared to be Clementina all over again, and then returned to her better behavior with an effect of shame for her want of self-control, as if Clementina's mood had abashed her. Sometimes this was almost severe in its quiet; that was her mother coming to her share in her; but again she was like her father, full of the sunny gayety of self-forgetfulness, and then Miss Milray said, "Now you are the old Clementina!" Upon the whole she listened with few interruptions to the story which she exacted. It was mainly what we know. After her husband's death Clementina had gone back to his family for a time, and each year since she had spent part of the winter with them; but it was very lonesome for her, and she began to be home-sick for Middlemount. They saw it and considered it. "They ah' the best people, Miss Milray!" she said, and her voice, which was firm when she spoke of her husband, broke in the words of minor feeling. Besides being a little homesick, she ended, she was not willing to live on there, doing nothing for herself, and so she had come back. "And you are here, doing just what you planned when you talked your life over with me in Venice!" "Yes, but life isn't eva just what we plan it to be, Miss Milray." "Ah, don't I know it!" Clementina surprised Miss Milray by adding, "In a great many things-- I don't know but in most--it's better. I don't complain of mine"-- "You poor child! You never complained of anything--not even of Mrs. Lander!" "But it's different from what I expected; and it's--strange." "Yes; life is very strange." "I don't mean-losing him. That had to be. I can see, now, that it had to be almost from the beginning. It seems to me that I knew it had to be from the fust minute I saw him in New Yo'k; but he didn't, and I am glad of that. Except when he was getting wohse, he always believed he should get well; and he was getting well, when he"-- Miss Milray did not violate the pause she made with any question, though it was apparent that Clementina had something on her mind that she wished to say, and could hardly say of herself. She began again, "I was glad through everything that I could live with him so long. If there is nothing moa, here or anywhe'a, that was something. But it is strange. Sometimes it doesn't seem as if it had happened." "I think I can understand, Clementina." "I feel sometimes as if I hadn't happened myself." She stopped, with a patient little sigh, and passed her hand across the child's forehead, in a mother's fashion, and smoothed her hair from it, bending over to look down into her face. "We think she has her fatha's eyes," she said. "Yes, she has," Miss Milray assented, noting the upward slant of the child's eyes, which gave his quaintness to her beauty. "He had fascinating eyes." After a moment Clementina asked, "Do you believe that the looks are all that ah' left?" Miss Milray reflected. "I know what you mean. I should say character was left, and personality--somewhere." "I used to feel as if it we'e left here, at fust--as if he must come back. But that had to go." "Yes." "Everything seems to go. After a while even the loss of him seemed to go." "Yes, losses go with the rest." "That's what I mean by its seeming as if it never any of it happened. Some things before it are a great deal more real." "Little things?" "Not exactly. But things when I was very young." Miss Milray did not know quite what she intended, but she knew that Clementina was feeling her way to something she wanted to say, and she let her alone. "When it was all over, and I knew that as long as I lived he would be somewhere else, I tried to be paht of the wo'ld I was left in. Do you think that was right?" "It was wise; and, yes, it was best," said Miss Milray, and for relief from the tension which was beginning to tell upon her own nerves, she asked, "I suppose you know about my poor brother? I'd better tell you to keep you from asking for Mrs. Milray, though I don't know that it's so very painful with him. There isn't any Mrs. Milray now," she added, and she explained why. Neither of them cared for Mrs. Milray, and they did not pretend to be concerned about her, but Clementina said, vaguely, as if in recognition of Mrs. Milray's latest experiment, "Do you believe in second marriages?" Miss Milray laughed, "Well, not that kind exactly." "No," Clementina assented, and she colored a little. Miss Milray was moved to add, "But if you mean another kind, I don't see why not. My own mother was married twice." "Was she?" Clementina looked relieved and encouraged, but she did not say."
http://vickysands.com/01/15/368.htm
CC-MAIN-2018-05
refinedweb
14,219
79.9
# unique integer ID generator, at first call gives 1, then 2, 3, ... proc intgen {{seed 0}} { set self [lindex [info level 0] 0] proc $self [list [list seed [incr seed]]] [info body $self] return $seed } # Lambda proc with caller scope life dependency. # When the caller scope dies so does the lambda proc. proc sproc {args body} { set name sproc[intgen] uplevel 1 set __$name - uplevel 1 "trace variable __$name u {rename $name {} ;#}" proc $name $args $body return $name } # Use this proc to run the sprocs stored in arrays. # The value from the array - sproc - is eval'ed to produce # the proc and name. This proc name and the args list is # then eval'ed again to produce the output. proc call {sproc args} { eval [eval $sproc] $args }The sproc procedure is just a lambda procedure from Lambda in Tcl. To use the above do something like - note the use of the global namespace for accessing the array value: set s(spfac) { sproc x { expr {$x<2? 1: $x * [call $::s(spfac) [incr x -1]]} } }Which is the same as: proc pfac x { expr {$x<2? 1: $x * [pfac [incr x -1]]} }You use the sproc like: call $s(spfac) 30 1409286144Another simple example would be: set arr(hello) { sproc var { puts $var } } call $arr(hello) "hello world" hello worldThe overall affect is almost what I wanted. The way of calling the sprocs is a bit gludgy, but all other ways I could think of used traces, which I didn't want. I wanted everything to be in the array and a few handler procs. Creating and destroying procs is not the fastest process in the world but there are other ways - see below: puts pfac:[time {pfac 30} 1] pfac:81 microseconds per iteration puts spfac:[time {call $s(spfac) 30} 1] spfac:2749 microseconds per iterationBut hell it was fun figuring it all out. These could even be combined with Persistent arrays or Tequila for something interesting. KPV My biggest problem with ideas like this and also things like Arrays of function pointers and even object inheritance is that it can make it very hard for someone new to a code base to read code and understand what's going on. Trying to determine which actual procedure gets call at a given line of code can be almost impossible to determine without actually stepping the code in a debugger.Also, how do you debug a procedure stored in an array? RS: The procs themselves are not in the array - that contains only the generated names. Having that, you can introspect e.g. with info body $s(spfac)WW: Actually the arrays don't store the names but the code to generate the procedure, so the above would not work. The procedure names, and the procedures, are only stored as long as the call proc is active. The above could be got with: [lindex $s(spfac) 2] RS: If I read your code right, call creates a new lambda every time, with constant body. I think it's much easier to do it like this: set s(spfac) [sproc x {...}] ;# define only once $s(spfac) 30 ;# call by dereferencing the array element..and for easier reading I would still use lambda for sproc, 'cause that's what it's called in the literature too... WW: The above is not really what I wanted. I wanted to store the procedure in an array, so that if the array was modified, the procedure when run again would use the updated code, and I wanted this without traces present, unless this could be combined some how so that it was all automatic. I also wanted to be able to use the standard array procs for copying, changing etc. the sprocs.I called the lambda part of the helper procs sproc as I was going to add some additional stuff which moved sproc away from a lambda proc, infact away from a proc all together. The stuff below is what I was going to add. Your all too fast for me :o) proc call {sproc args} { if {[llength $sproc] != 3} { error "wrong # args: should be \"sproc args body\"" } elseif {[lindex $sproc 0] != "sproc"} { error "Not a stored procedure: should be \"{sproc args body}\"" } else { set locals [lindex $sproc 1] set body [lindex $sproc 2] set vals $args set len_locals [llength $locals] set len_vals [llength $vals] # Set the variables to the given args after checking validity. if {$len_vals < $len_locals} { error "wrong # args: should be \"$locals\"" } elseif {($len_vals > $len_locals) && ([lindex $locals end] != "args")} { error "wrong # args: should be \"$locals\"" } else { # Create all the variables and assign the arguments passed in. foreach $locals $vals {} # Set "args" if it exists. if {[lindex $locals end] eq "args"} { set args [lrange $vals [expr $len_locals - 1] end] } # Run the body. eval $body } } }The above proc replaces the three (sproc, intgen, and call) original helper procedures with just the one call proc. The sproc is kept as a flag, so that arrays which store procedures and data together can differentiate easily between them. The single call proc is also faster: puts spfac:[time {call $s(spfac) 30} 10] spfac:803 microseconds per iterationThe only thing that stored procedures don't implement is default values, but this could easily be added to the above call proc.The stored procedures can be traced like any other variable to show when one has been called or altered etc...: set s(hello) {sproc {var} {puts $var}} trace variable s(hello) r {puts "hello called" ;#} call $s(hello) "hello there" hello called hello thereBuilt in procs can be wrapped in an sproc so that changes can be made to the sproc without affecting the builtin one: set builtIn(puts) { sproc {args} {eval puts $args}}Lambda procs can be simulated with: call {sproc args body} argsWell I think that wraps it up. I might try a small fully distributed and persistent app. with these at some point, just for fun. :o) ulis, 2005-08-07. If you want to have an array of procs, the simplest way is: for {set i 0} {$i < 10} {incr i} \ { proc p($i) {} [list puts "proc p($i)"] } for {set i 0} {$i < 10} {incr i} \ { p($i) }AMG: Clever. This isn't really an array, but it looks and behaves much like one. It's not even a variable. DKF: Now that Tcl 8.5 is out, consider using apply's efficient lambda terms instead. AMG: See also sproc.
http://wiki.tcl.tk/4755
CC-MAIN-2016-50
refinedweb
1,080
67.89
Consider the following scenario. You have a computer that has the Microsoft .NET Framework 2.0 Service Pack 2 (SP2) or the .NET Framework 3.5 SP1 installed. You use an ASMX service method that includes a property, and the property has an internal setter. The serialization may fail. This problem occurs in a scenario that resembles the following: The public type T includes a public property that has a public getter and an internal setter. For example, the source code may resemble the following. public class T { … public <Type> <Propertyname1> { get; internal set; } … } In a Web service, the return type or the out argument of at least one Web service method returns objects of type T or objects that contain T in their object graphs. For example, the source code may resemble one of the following examples. public T MyWebMethod(…) { … } public void MyWebMethod(…, out U) { … } ... public Class U { public T <Propertyname2> { get; set; } } Type T or type U is not used in any Web service methods as a non-out-only argument. Note If a method has more than one out argument, the out arguments are called non-out-only arguments. The type of the property that has an internal setter is not Enumerable or Collection. Before you applied the .NET Framework 2.0 SP2 or the .NET Framework 3.5 SP1, you generated proxy code to the previously mentioned Web service by using the Wsdl.exe tool or the Visual Studio Add Web reference feature. After you deployed the Web service and clients, you applied the .NET Framework 2.0 SP2 or the .NET Framework 3.5 SP1. In this scenario, the return type or the out argument from the previously mentioned Web service method will not be serialized. This Web service method is an object of type T or an object that contains T in their object graphs. Note Currently, there is no separate package for the .NET Framework 2.0 SP2. The .NET Framework 2.0 SP2 is included in the package for the .NET Framework 3.5 SP1. Symptoms Hotfix Replacement Information The hotfix that corresponds to KB952883 has been superseded with the hotfix KB976814, which contains all fixes that were previously included in KB952883. You should use the hotfix KB976814 to fix the issues described in KB952883. For more information, click the following article number to view the article in the Microsoft Knowledge Base: 976814 FIX: A System.InvalidOperationException exception occurs when you use a WCF client proxy that is generated by the ServiceModel Metadata Utility tool from the service metadata that is in the .NET Framework 3.5
https://support.microsoft.com/es-es/topic/fix-the-return-type-or-the-out-argument-of-an-asmx-service-method-that-includes-a-property-that-has-an-internal-setter-may-not-be-serialized-on-a-computer-that-has-the-net-framework-installed-d3107b8e-2bd1-55df-79ff-27be80f8b481
CC-MAIN-2021-31
refinedweb
435
68.77
Hi View Complete Post? Hello,? hi all, i desinged a gridivew, there first column will be a Checkbox, if the user clicks on the header of the Checkbox then all the child should be select/deselect, its working fine in IE but, in Mozila Firefox its not working. below is my code <Columns> <asp:TemplateField <ItemTemplate> <asp:CheckBox & Hello , Iam developing a custom checkbox control deriving from the 'compositecontrol' which i need to use it for a composite control purpose. public class TngCheckBox : CompositeControl { i have written the required properties which are working fine except the "checked" property. he { i have written the required properties which are working fine except the "checked" property. he...? Hi all, I am having some management problems and need to prove that the cubes are available for browsing. I have had a look at SSIS to see if there is a task but I suspect I need to script something out. Can anyone give me any pointers ? Many thanks. Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend
http://www.dotnetspark.com/links/34847-databound-checkbox-default-check-not-working.aspx
CC-MAIN-2017-04
refinedweb
179
60.04
GETS(3) OpenBSD Programmer's Manual FGETS(3) NAME fgets, gets - get a line from a stream SYNOPSIS #include <stdio.h> char * fgets(char *str, int size, FILE . In any case in- put line, if any, is sufficiently short to fit in the string. RETURN VALUES Upon successful completion, fgets() and gets() return a pointer to the string. If end-of-file or an error occurs before any characters are read, they return NULL. The fgets() and functions gets()). CAVEATS The following bit of code illustrates a case where the programmer assumes a string is too long if it does not contain a newline: char buf[1024], *p; while (fgets(buf, sizeof(buf), fp)) { if (!(p = strchr(buf, '\n')) { fprintf(stderr, "input line too long.0); exit(1); } *p = '\0'; printf("%s\n", p); } While the error would be true if a line >. SEE ALSO feof(3), ferror(3), fgetln(3) STANDARDS The functions fgets() and gets() conform to ANSI X3.159-1989 (``ANSI C''). BUGS''). OpenBSD 2.6 June 4, 1993 2
http://www.rocketaware.com/man/man3/fgets.3.htm
crawl-001
refinedweb
173
75.61
Marvin Humphrey wrote on 1/13/10 3:56 PM: >> Of course, my next question is predictable: when will 0.30 be fully cooked? > > The goal has been to get the KS dev branch file format and API stable before > displacing the stable branch. However, there are still difficult file format > problems to solve, particularly with regards to term dictionaries and posting > lists -- such as support for multi-stream posting formats and indexing of > non-text field types. Are the file format problems actually bugs in the current format, or features you would like to see added? IMO there's a big difference. I understand your long-time aversion to changing the index format between releases, and how that can break existing indexes in the wild. I've been bitten by that situation with other Perl projects from CPAN where ModuleA gets installed as part of a regular sysadmin upgrade because it is pulled in as a dependency by ModuleB, and then my code that depends on ModuleA suddenly stops working. CPAN's versioning is not ideal in that regard. However, there are already checks in Build.PL for incompatible index formats, and KS is not likely to be pulled in blindly as a dependency. That is, if someone is installing KS from CPAN, they are doing it intentionally and Build.PL will (or could be made to) help prevent them from shooting themselves. Rebuilding an index is not the end of the world. We (and by we I mean search developers) do it all the time, even with big doc corpora. The perfect is the enemy of the good. I.e., if we wait until the perfect, ultimate file format is finished, a stable KS 0.30 releases might never see CPAN till KS is made obsolete by Lucy. That would be too bad, I think, because there are sooo many good improvements in the .30 branch, stable and trunk, that people could be taking advantage of without having to install a dev release or keep up with svn trunk. Small, stable, incremental and frequent releases to CPAN. I've been converted to that idea. I'm trying now to convince you, Marvin. How am I doing? :) > > I haven't really been working on those problems too much lately. After > reaching our goals for index opening speed and integration of memory mapped > sort caches last year, I could have gone back to that -- but instead, I've > gone to work on Lucy. Lucy isn't that far off at this point: N months. > That's great. Really. And as one of your faithful commit list readers, I applaud everything you've achieved so far. It's monumental. It's good. I just worry about the perfect being the enemy of the good. It's something I've struggled with myself wrt Swish3, which has been gestating about as long as KS has. > There are some people who are using stable branch KS and who would be > disrupted if we simply clobber the stable branch by releasing the dev branch > on top of it, e.g. the MojoMojo folks > (<>). I'm reluctant to do that, since > we haven't reached our goals for file format and API stability. Yeah, they > were warned by the "alpha" label, but KS has also been promising a level of > stability which we have yet to deliver. A one-time painful switch might have > been OK, but forcing them back into an ongoing dev cycle isn't. It's only painful and disruptive if existing users install the newest KS. They don't have to. And as above, we could come up with a reasonable system to help them be very intentional about it. It could be as simple as changing the magic version number in Build.PL (which is currently 0.20) whenever the index format changes in some backwards incompatible way. > > To avoid disrupting such users, we could take one of two paths: > > * Fork the current stable release under "KinoSearch0" and expect existing > users to switch. > * Move the dev branch (svn trunk) under "KinoSearch2" and release it as an > alpha. (I lean towards this option because it sets a precedent for how I > think we'll need to handle versioning in Lucy.) > What about #3: stabilize svn trunk and release it as KS 0.30. When there's another index compat change, release it as KS 0.40, etc. > If we'd managed to launch Lucy by now, this question would be academic, > because Lucy would have become the successor to the KS dev branch. And I've > kind of been working on Lucy with that in mind. > > Lucy remains my main goal. From a marketing perspective, I'm not sure that > it's ideal to launch "KinoSearch2" as an alpha, then deprecate it in favor of > Lucy a few months later. And once Lucy is launched in earnest and people > outside our small circle start contributing, KS will have to be deprecated > because licensing issues will eventually prevent us from backporting some > important chunk of Lucy code to KS. Deprecating KS in the future is fine and good. Between now and then, though, let's get 0.30 released. > > So that's why I've been kind of keeping my head down and working feverishly on > Lucy. I figured we'd get Lucy out as an alpha, grow its user base by > releasing Ruby and Python bindings, then harness the excitement from that to > work on the difficult problems that have held back KS. Designing a pluggable > indexing framework is hard; it's almost impossible without a large user base, > since only a small subset of users will be in a situation where they can test > drive the pluggability features and help us refine the API. That makes total sense to me. Lucy is the future. And its viability to date depends upon ideas worked out in the past years in KS. I expect that kind of cross-fertilization to continue as long as the IP issues remain compatible. And I expect to continue to help as I can. > >> And, how can I help? > > You and Nate have been very helpful with regards to code and API review. If > we go down the current path towards Lucy, I'd ask you to continue exploring > new areas and providing feedback about how it went. Will do. > > If we decide to make a formal CPAN release of dev branch somehow, there will > be some mechanical work to do. If you wanted to do that, you could -- but I'm > under the impression that you don't have that much time (compared with the 60 > or so hours I've been putting in each week) and I don't want to squander a > limited resource. I wouldn't call it squandering. I would call it sharing. :) Regarding time, I have some at the moment because I want to use KS at $work. > > If I could go back in time, I would have released the KS 0.20 branch under the > namespace "KinoSearch2" and the 0.30 branch under "KinoSearch3". Maybe that > points the way forward. Whatever we do, though, I'm determined not to let > progress towards Lucy flag again. > I agree. Lucy should remain your primary concern. How can I help move toward a KS 0.30 release? -- Peter Karman . . peter@peknet.com
http://mail-archives.apache.org/mod_mbox/lucy-dev/201001.mbox/%3C4B4F4452.2080803@peknet.com%3E
CC-MAIN-2019-30
refinedweb
1,229
72.76
This C++ program demonstrates the reverse_copy() algorithm. The function reverse_copy() takes three iterators as parameters – two iterators to the beginning and the end of the container elements to be reversed and the third iterator to the container where reversed elements are to be saved. The program demonstrates the use of the algorithm which doesn’t modify the order of the container whose order is being reversed. Here is the source code of the C++ program which demonstrates the reverse_copy() algorithm. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below. /* * C++ Program to reverse the order of elements using reverse_copy() algorithm */ #include <iostream> #include <algorithm> #include <vector> #include <iomanip> #include <iterator> using namespace std; void print(string a[], int N) { for(int i = 0; i < N; i++) { cout << (i + 1) << ". " << setw(5) << a[i] << " "; } cout << endl; } int main() { string s[] = {"George", "John", "Lucy", "Alice", "Bob", "Watson"}; string t[6]; cout << "Original order : "; print(s, 6); cout << "Reversing the order ... " << endl; // Doesn't modify original array s[] reverse_copy(s, s + 6, t); cout << "Original order : "; print(s, 6); cout << "Reversed order : "; print(t, 6); } $ a.out Original order : 1. George 2. John 3. Lucy 4. Alice 5. Bob 6. Watson Reversing the order ... Original order : 1. George 2. John 3. Lucy 4. Alice 5. Bob 6. Watson Reversed order : 1. Watson 2. Bob 3. Alice 4. Lucy 5. John 6. George 4 Sanfoundry Global Education & Learning Series – 1000 C++ Programs. If you wish to look at all C++ Programming examples, go to C++ Programs.
http://www.sanfoundry.com/cpp-program-demonstrate-reverse_copy-algorithm/
CC-MAIN-2017-30
refinedweb
262
54.52
PyMetabuilder 0.2.6 Small framework for creating Builders and entities Introduction Small framework to create entities and Builders with Metaprogramming features in Python. Creating Builders Metabuilder objective is to help to create Builders and instances or entities with validations easy and fast. In order to create a new Builder just define a class extending from MetaBuilder class, and defining an stub class in any place you want. For eg. from PyMetaBuilder import MetaBuilder #Stub Class to create instances from class Kite(object): pass class KiteBuilder(MetaBuilder): pass Note from version 0.2.1 onwards you can define the class model with the method model_by_name, thus you don’t have to define a stub class in your code. For ex. calling model_by_name(‘Kite’) instead of model(Kite) After that just initiate the superclass and start defining the properties you want KiteBuilder to have, for eg. class KiteBuilder(MetaBuilder): def __init__(self): MetaBuilder.MetaBuilder.__init__(self) self.defineKite() def define_kite(self): #define the model klass to get instances from self.model(Kite) self.property("design",one_of=["Indoor","Water Kite","Kythoon"]) self.property("line_material",type=str) self.property("StringLength",type=int) You can also define a property as a mandatory one, with the required method. In this way, when you set the builder with the respecting properties and try to get a new instance, the framework will check if the properties that you previously set as mandatory were set. def define_kite(self): #define the model klass to get instances from self.model(Kite) self.property("StringLength",type=int) #code defining properties.... self.required("design") Creating instances from a Builder After you defined a builder and its properties, just set the parameters, if you want at this time and if they’re not mandatory and build an instance. kiteBuilder=KiteBuilder() kiteBuilder.design="Indoor" kiteBuilder.StringLength=23 kite=kiteBuilder.build() #get a Kite instance When you set a property that you previously defined, it’ll validate the value passed, given the fact that you have set it with validators, and will generate the appropriate exception when it fails. - Author: Ernesto Bossi - Keywords: MetaBuilder Metaprogramming - License: GPL v3 - Requires six - Categories - Package Index Owner: bossiernesto - DOAP record: PyMetabuilder-0.2.6.xml
https://pypi.python.org/pypi/PyMetabuilder/0.2.6
CC-MAIN-2016-44
refinedweb
367
51.58
There are probably two main thoughts in your head while you read this introduction: - What is ClojureScript? - This isn’t relevant to my interests. But wait! That’s where you’re wrong—and I will prove it to you. If you’re willing to invest 10 minutes of your time, I will show you how ClojureScript can make writing front-end and React-y applications fun, fast, and—most importantly—functional. Some ClojureScript Tutorial Prerequisites - Lisp knowledge is not required. I will do my best to explain any code samples that are scattered within this blog post! - However, if you do want to do a little pre-reading, I would highly recommend, the one-stop shop for getting started with Clojure (and by extension, ClojureScript). - Clojure and ClojureScript share a common language—I will often refer to these at the same time as Clojure[Script]. - I do assume that you have knowledge of React and general front-end know-how. How to Learn ClojureScript: The Short Version So you don’t have much time to learn ClojureScript, and you just want to see where this whole thing is going. First things first, what is ClojureScript? From the ClojureScript website: ClojureScript is a compiler for Clojure that targets JavaScript. It emits JavaScript code which is compatible with the advanced compilation mode of the Google Closure optimizing compiler. Amongst other things, ClojureScript has a lot to offer: - It’s a multiparadigm programming language with a functional programming lean—functional programming is known to improve code legibility as well as help you write more with less code. - It supports immutability by default—say goodbye to a whole suite of runtime issues! - It’s data-oriented: code is data in ClojureScript. Most Clojure[Script] applications can be reduced to a set of functions that operate on some underlying data structure, which makes debugging simple and code super-legible. - It’s simple! Getting started with ClojureScript is easy—there are no fancy keywords and very little magic. - It has a fantastic standard library. This thing has everything. With that out of the way, let’s open up this can of worms with an example: (defn component [] [:div "Hello, world!"]) Note for those not familiar with Lisp dialects or ClojureScript: The most important parts of this example are the :div, the [], and the (). :div is a keyword representing the <div> element. [] is a vector, much like an ArrayList in Java, and () is a sequence, much like a LinkedList. I will touch on this in more detail later in this post! This is the most basic form of a React component in ClojureScript. That’s it—just a keyword, a string, and a whole bunch of lists. Pshaw! you say, that’s not significantly different from “hello world” in JSX or in TSX: function component() { return ( <div> "Hello, world!" </div> ); } However, there are some crucial differences that we can spot even from this basic example: - There are no embedded languages; everything within the ClojureScript example is either a string, a keyword, or a list. - It is concise; lists provide all of the expressivity we need without the redundancy of HTML closing tags. These two small differences have huge consequences, not just in how you write code but in how you express yourself as well! How is that, you ask? Let’s jump into the fray and see what else ClojureScript has in store for us… Building Blocks Throughout this ClojureScript tutorial, I will endeavor to not dig too far into what it is that makes Clojure[Script] great (which is a lot of things, but I digress). Nonetheless, it will be useful to have some basic concepts covered so it is possible to grasp the breadth of what we can do here. For those experienced Clojuristas and Lispians, feel free to jump forward to the next section! There are three main concepts I will need to cover first: Keywords Clojure[Script] has a concept called a Keyword. It lies somewhere between a constant string (say, in Java) and a key. They are symbolic identifiers that evaluate to themselves. As an example, the keyword :cat will always refer to :cat and never to anything else. Just as in Java you might say: private static const String MY_KEY = "my_key"; // ... myMap.put(MY_KEY, thing); // ... myMap.get(MY_KEY); …in Clojure you would simply have: (assoc my-map :my-key thing) (my-map :my-key) ; equivalent to (:my-key my-map) ...nice and flexible! Also note: In Clojure, a map is both a collection (of keys to values, just like a Java HashMap) and a function for accessing its contents. Neat! Lists Clojure[Script] being a Lisp dialect means that it places a lot of emphasis on lists. As I mentioned earlier, there are two main things to be aware of: []is a vector, much like an ArrayList. ()is a sequence, much like a LinkedList. To build a list of things in Clojure[Script], you do the following: [1 2 3 4] ["hello" "world"] ["my" "list" "contains" 10 "things"] ; you can mix and match types ; in Clojure lists! For sequences, it’s a little different: '(1 2 3 4) '("hello" "world") The prepending ' is explained in the next section. Functions Finally, we have functions. A function in Clojure[Script] is a sequence that is typed out without the prepending '. The first element of that list is the function itself, and all the following elements will be the arguments. For example: (+ 1 2 3 4) ; -> 10 (str "hello" " " "world") ; -> "hello world" (println "hi!") ; prints "hi!" to the console (run-my-function) ; runs the function named `run-my-function` One corollary of this behavior is that you can build up a definition of a function without actually executing it! Only a ‘naked’ sequence will be executed when the program is evaluated. (+ 1 1) ; -> 2 '(+ 1 1); -> a list of a function and two numbers This will become relevant later! Functions can be defined in a few ways: ; A normal function definition, assigning the function ; to the symbol `my-function` (defn my-function [arg1 arg2] (+ arg1 arg2)) ; An anonymous function that does the same thing as the above (fn [arg1 arg2] (+ arg1 arg2)) ; Another, more concise variation of the above #(+ %1 %2) A Closer Examination So now that we’ve covered the basics, let’s drill into a little more detail to see what is happening here. React in ClojureScript is generally done using a library called Reagent. Reagent uses Hiccup and its syntax to represent HTML. From the Hiccup repo’s wiki: “Hiccup turns Clojure data structures like this:” [:a {:href ""} "GitHub"] “Into strings of HTML like this:” <a href="">GitHub</a> Simply put, the first element of the list becomes the HTML element type, and the remaining become the contents of that element. Optionally, you can provide a map of attributes which will then be attached to that element. Elements can be nested within each other simply by nesting them within the list of their parent! This is easiest seen with an example: [:div [:h1 "This is a header"] [:p "And in the next element we have 1 + 1"] [:p (+ 1 1)]] Notice how we can put any old function or general Clojure syntax within our structure without having to explicitly declare an embedding method. It’s just a list, after all! And even better, what does this evaluate to at runtime? [:div [:h1 "This is a header"] [:p "And in the next element we have 1 + 1"] [:p 2]] A list of keywords and contents of course! There are no funny types, no magic hidden methods. It’s just a plain old list of things. You can splice and play with this list as much as you want—what you see is what you’re getting. With Hiccup doing the layout and Reagent doing the logic and event processing, we end up with a fully functional React environment. A More Complicated Example All right, let’s tie this together a bit more with some components. One of the magical things about React (and Reagent) is that you compartmentalize your view and layout logic into modules, which you can then reuse throughout your application. Say we create a simple component that shows a button and some simple logic: ; widget.cljs (defn component [polite?] [:div [:p (str "Do not press the button" (when polite? ", please."))] [:input {:type "button" :value "PUSH ME" :on-click #(js/alert "What did I tell you?")}]]) Quick note on naming: Modules in Clojure are normally namespaced, so widget.cljs might be imported under the namespace widget. This means that the top level component function will be accessed as widget/component. I like to have only one top-level component per module, but this is a style preference—you might prefer to name your component function something like polite-component or widget-component. This simple component presents us with an optionally polite widget. (when polite? ", please.") evaluates to ", please." when polite? == true and to nil when it is false. Now let’s embed this within our app.cljs: (defn app [] [:div [:h1 "Welcome to my app"] [widget/component true]]) Here we embed our widget within our app component by calling it as the first item of a list—just like the HTML keywords! We can then pass any children or parameters to the component by providing them as other elements of the same list. Here we simply pass true, so in our widget polite? == true, and thus we get the polite version. If we were to evaluate our app function now, we would get the following: [:div [:h1 "Welcome to my app"] [widget/component true]] ; <- widget/component would look more like a ; function reference, but I have kept it ; clean for legibility. Note how widget/component has not been evaluated! (See the Functions section if you’re confused.) Components within your DOM tree are only evaluated (and thus converted into real React objects behind the scenes) if they have been updated, which keeps things nice and snappy and reduces the amount of complexity that you have to deal with at any point in time. More detail on this subject for those interested can be obtained in the Reagent docs. Lists All the Way Down Furthermore, note how the DOM is just a list of lists, and components are just functions that return lists of lists. Why is this so important as you learn ClojureScript? Because anything you can do to functions or lists, you can do to components. This is where you start to get compounding returns by using a Lisp dialect like ClojureScript: Your components and HTML elements become first-class objects that you can manipulate like any other normal data! Let me just say that again: Components and HTML elements are first-class supported objects within the Clojure language! That’s right, you heard me. It’s almost like Lisps were designed to process lists (hint: they were.) This includes things like: - Mapping over elements of a numbered list: (def words ["green" "eggs" "and" "ham"]) (defn li-shout [x] [:li (string/uppercase x)) (concat [:ol] (map li-shout words) ; becomes [:ol [:li "GREEN"] [:li "EGGS"] [:li "AND"] [:li "HAM"]] - Wrapping components: ; in widget.cljs (defn greeting-component [name] [:div [:p (str "Hiya " name "!")]]) ; ... (def shouty-greeting-component #(widget/greeting-component (string/uppercase %))) (defn app [] [:div [:h1 "My App"] [shouty-greeting-component "Luke"]]) ; <- will show Hiya LUKE! - Injecting attributes: (def default-btn-attrs {:type "button" :value "I am a button" :class "my-button-class"}) (defn two-button-component [] [:div [:input (assoc default-btn-attrs :on-click #(println "I do one thing"))] [:input (assoc default-btn-attrs :on-click #(println "I do a different thing"))]]) Dealing with plain old data types like lists and maps is dramatically simpler than anything resembling a class, and ends up being much more powerful in the long run! A Pattern Emerges Okay, let’s recap. What has our ClojureScript tutorial shown so far? - Everything is reduced down to the simplest functionality—elements are just lists, and components are just functions that return elements. - Because components and elements are first-class objects, we are able to write more with less. These two points fit snugly into the Clojure and functional programming ethos—code is data to be manipulated, and complexity is built up through connecting less complex parts. We present our program (our webpage in this example) as data (lists, functions, maps) and keep it that way until the very last moment when Reagent takes over and turns it into React code. This makes our code re-usable, and most importantly very easy to read and understand with very little magic. Getting Stylish Now we know how to make an application with some basic functionality, so let’s move on to how we can make it look good. There are a couple of ways to approach this, the most simple being with style sheets and referencing their classes in your components: .my-class { color: red; } [:div {:class "my-class"} "Hello, world!"] This will do exactly as you would expect, presenting us with a beautiful, red “Hello, world!” text. However, why go to all of this trouble colocating view and logic code into your components, but then separating out your styling into a style sheet—not only do you now have to look in two different places, but you’re dealing with two different languages too! Why not write our CSS as code in our components (see a theme here?). This will give us a bunch of advantages: - Everything that defines a component is in the same place. - Class names can be guaranteed unique through clever generation. - CSS can be dynamic, changing as our data changes. My personal favorite flavor of CSS-in-code is with Clojure Style Sheets (cljss). Embedded CSS looks like the below: ;; -- STYLES ------------------------------------------------------------ (defstyles component-style [] {:color "red" :width "100%"}) ;; -- VIEW -------------------------------------------------------------- (defn component [] [:div {:class (component-style)} "Hello, world!"]) defstyles creates a function which will generate a unique class name for us (which is great for anyone who imports our components.) There are many other things that cljss can do for you (composing styles, animations, element overrides, etc.) that I won’t go into detail here. I recommend that you check it out yourself! Assembling the Pieces of a ClojureScript App Lastly, there’s the glue required to stick all of this together. Fortunately, besides a project file and an index.html, boilerplate is at a minimum here. You need: - Your project definition file, project.clj. A staple of any Clojure project, this defines your dependencies—even directly from GitHub—and other build properties (similar to build.gradleor package.json.) - An index.htmlthat acts as a binding point for the Reagent application. - Some setup code for a dev environment and finally for starting up your Reagent application. You’ll find the full code example for this ClojureScript tutorial available on GitHub. So that’s it (for now). Hopefully, I have at least piqued your curiosity a small amount, whether that’s to check out a Lisp dialect (Clojure[Script] or otherwise) or even to try your hand at making your own Reagent application! I promise you that you won’t regret it. Join me in follow-up to this article, Getting Into a State, where I talk about state management using re-frame—say hello to Redux in ClojureScript! Understanding the basics Is React front-end or back-end? React is a front-end development framework for JavaScript. What is ClojureScript? ClojureScript is a compiler for Clojure that targets JavaScript. It emits JavaScript code which is compatible with the advanced compilation mode of the Google Closure optimizing compiler. It inherits most of the properties of Clojure, a dynamic programming language supporting interactive development. What is Lisp written in? Lisp is the name used for a group of languages that share common characteristics (such as Clojure, Common Lisp, Scheme etc.), so "Lisp" itself is not really written. (This is like asking "What are the ingredients for a cake?" Most cakes follow a similar theme, but will have different ingredients.) Is Lisp any good? Yes! Lisp prioritizes the principle of "code as data." This can be seen from the derivation of the name itself—LISt Processor. Everything in a Lisp dialect is data—even function calls are a list of arguments! Lisp is a fantastic style of programming language—there are many different flavors to suit any need. Is Lisp functional programming? Lisp dialects commonly invoke parts of functional and imperative programming languages. Clojure and ClojureScript are multiparadigm—they heavily lean on functional programming, and allow you to branch into imperative when it's needed. This allows you to experience the best of both worlds! What is the Google Closure Library? The Google Closure Library is a broad and well-established cross-browser library for JavaScript, containing a variety of tools for UI, DOM manipulation, server communication, testing, etc. It is intended for use with the Google Closure Compiler. What is the Google Closure Compiler? The Google Closure Compiler compiles JavaScript into "better JavaScript" by manipulating, optimizing, and minifying to ensure that it downloads and runs faster. Additionally, it runs a suite of checks on your code to minimize problems at runtime.
https://www.toptal.com/clojure/clojurescript-tutorial-react-front-end
CC-MAIN-2021-04
refinedweb
2,867
62.98
C# Interface - c# - c# tutorial - c# net What is the use of interface in. - It is used to achieve fully abstraction because it cannot have method body. - Its implementation must be provided by class or struct. - The class or struct which implements the interface, must provide the implementation of all the methods declared inside the interface. Interface C# interface example - Let's see the example of interface in C# which has draw() method. Its implementation is provided by two classes: Rectangle and Circle. using System; public interface Drawable { void draw(); } public class Rectangle : Drawable { public void draw() { Console.WriteLine("drawing rectangle..."); } } public class Circle : Drawable { public void draw() { Console.WriteLine("drawing circle..."); } } public class TestInterface { public static void Main() { Drawable d; d = new Rectangle(); d.draw(); d = new Circle(); d.draw(); } } click below button to copy the code. By - c# tutorial - team C# examples - Output : drawing rectangle... drawing circle… Note: Interface methods are public and abstract by default. You cannot explicitly use public and abstract keywords for an interface method. learn c# tutorial - Abstract vs Interface Csharp in c# Example using System; public interface Drawable { public abstract void draw();//Compile Time Error }
https://www.wikitechy.com/tutorials/csharp/csharp-interface
CC-MAIN-2019-43
refinedweb
192
50.53
Control microscope through client server program. Project description camacq Python project to control microscope through client-server program. Install Install the camacq package. Python version 3.6+ is supported. # Check python version. python --version # Install package. pip install camacq # Test that program is callable and show help. camacq -h Run camacq Configure camacq uses a yaml configuration file, config.yml, for configuring almost all settings in the app. The configuration file is found in the configuration directory. The default configuration directory is located in the home directory and called .camacq. The location of the configuration directory can be overridden when starting camacq. camacq --config /my_custom_config_dir When camacq is started it checks the configuration directory for the configuration file, and if none is found creates a default configuration file. See below for an example of how to configure the leica api and a simple automation, in the configuration yaml file. leica: host: localhost port: 8895 imaging_dir: '/imaging_dir' automations: - name: start trigger: - type: event id: camacq_start_event action: - type: command id: start_imaging API To interact with a microscope camacq needs to connect to an API from a microscope vendor, which in turn will control the microscope. Currently camacq can connect to the Computer Aided Microscopy (CAM) interface of Leica Microsystems' microscopes that have that feature activated. The design of camacq is built to be able to easily extend to APIs of other microscope vendors in the future. We welcome pull requests for this and other improvements. The API interface should be contained within a separate Python library, that instantiates a client object which camacq can use. leica: host: localhost port: 8895 imaging_dir: '/imaging_dir' Automations To tell the microscope what to do, camacq uses automations. Automations are blocks of yaml consisting of triggers, optional conditions and actions. A trigger is the notification of an event in camacq, eg a new image is saved. An action is what camacq should do when the trigger triggers, eg go to the next well. A condition is a criteria that has to be true to allow the action to execute, when a trigger has triggered. As events happen, camacq checks the configured automations to see if any automation trigger matches the event. If there is a match, it also checks for possible conditions and if they are true. If both trigger and conditions matches and resolves to true, the corresponding action(s) will be executed. For each automation block, it is possible to have multiple triggers, multiple conditions and multiple actions. Eg we can configure an automation with two triggers and two actions. If any of the triggers matches an event, both actions will be executed, in sequence. automations: name: image_next_well trigger: - type: event id: camacq_start_event - type: event id: well_event data: well_img_ok: true action: - type: sample id: set_sample data: plate_name: plate_1 well_x: 1 well_y: > {{ trigger.event.well_y + 1 }} - type: command id: start_imaging Trigger Let us look more closely at the trigger section of the above automation. trigger: - type: event id: camacq_start_event - type: event id: well_event data: well_img_ok: true This section now holds a sequence of two trigger items, where each has a type and an id. The second item also has a data key. The type key tells camacq what type of trigger it should configure. Currently only triggers of type event are available. See the documentation for all available event ids. The id key sets the trigger id which will be the first part of the matching criteria for the trigger. The second part is optional and is the value of the data key. This key can hold key-value pairs with event data that should match the attributes of the event for the trigger to trigger. So for the second item we want the event to have id well_event and to have an attribute called well_img_ok which should return True, for the event to trigger our trigger. Action Looking at the action section of our example automation, we see that it also has two items. And exactly as for the triggers, each action has a type and an id, and can optionally specify a data key. Actions can have different types, eg sample or command. You will find all of the action types in the documentation. For an action, the data key sets the keyword arguments that should be provided to the action handler function that executes the action. action: - type: sample id: set_sample data: plate_name: plate_1 well_x: 1 well_y: > {{ trigger.event.well_y + 1 }} - type: command id: start_imaging In our example we want to do two things, first set a well, and then start the imaging. To not have to define this automation for each well we want to image, automations allow for dynamic rendering of the value of a data key, via use of the Jinja2 template language. You can recognize this part by the curly brackets. See the template section below for further details. Template Using templates in automations allows us to build powerful and flexible pieces of automation configuration code to control the microscope. Besides having all the standard Jinja2 features, we also have the trigger event and the full sample state data available as variables when the template is rendered. Eg if a well event triggered the automation we can use trigger.event.container inside the template and have access to all the attributes of the well container that triggered the event. Useful sample attributes are also directly available on the trigger.event eg trigger.event.well_x. well_y: > {% if trigger.event.container is defined %} {{ trigger.event.well_y + 1 }} {% else %} 1 {% endif %} If we need access to some sample state that isn't part of the trigger, we can use samples directly in the template. Via this variable the whole sample state data is accessible from inside a template. See below for the sample attribute structure. Note that only condition and action values in key-value pairs support rendering a template. Templates are not supported in the keys of key-value pairs and not in trigger sections. Condition A condition can be used to check the current sample state and only execute the action if some criteria is met. Say eg we want to make sure that channel 3 of well 1:1 of plate 1 is green and that gain is set to 800. condition: type: AND conditions: - condition: > {% if samples.leica.data['{"name": "channel", "plate_name": "plate_1", "well_x": 1, "well_y": 1, "channel_id": 3}'].values['channel_name'] == 'green' %} true {% endif %} - condition: > {% if samples.leica.data['{"name": "channel", "plate_name": "plate_1", "well_x": 1, "well_y": 1, "channel_id": 3}'].values['gain'] == 800 %} true {% endif %} The trigger event data is also available in the condition template as a variable. Below example will evaluate to true if the well that triggered the event has either 1 or 2 as x coordinate. condition: type: OR conditions: - condition: > {% if trigger.event.well_x == 1 %} true {% endif %} - condition: > {% if trigger.event.well_x == 2 %} true {% endif %} Currently each condition must be a template that renders to the string true if the condition criteria is met. Sample The sample state should represent the sample with a representation that is specific to each implemented microscope api using the ImageContainer api of camacq. An image container has a name, a dictionary of images and a dictionary of values as attributes. The container also fires a specific event on container change. There are two special cases of the image container. The first is the main sample container of each microscope api, eg the leica container. The main container has an extra attribute data which is a dictionary with all the containers of the sample. The second special case is the image in the dictionary of images of an image container. The image is also a container and has only itself in the images dictionary and a path attribute with the path of the image. Eg for the leica sample there are plate, well, field, z_slice, channel and image containers under the main leica sample container. All implemented sample states are available as a variable samples in templates in automations. The leica sample is available as samples.leica. See below for the leica sample state attribute structure in camacq. The words in all capital letters are example values. Each image container has a name, which is either of plate, well, field, z_slice, channel or image. The different leica containers have different leica specific attributes that aren't all shown below. samples: leica: name: leica images: PATH: name: image path: PATH plate_name: PLATE_NAME well_x: WELL_X well_y: WELL_Y field_x: FIELD_X field_y: FIELD_Y z_slice_id: Z_SLICE_ID channel_id: CHANNEL_ID images: PATH: self values: VALUE_KEY: VALUE values: VALUE_KEY: VALUE data: CONTAINER_ID: name: plate/well/field/z_slice/channel/image images: PATH: name: image path: PATH plate_name: PLATE_NAME well_x: WELL_X well_y: WELL_Y field_x: FIELD_X field_y: FIELD_Y z_slice_id: Z_SLICE_ID channel_id: CHANNEL_ID images: PATH: self values: VALUE_KEY: VALUE values: VALUE_KEY: VALUE Plugins To extend the functionality of camacq and to make it possible to do automated feedback microscopy, camacq supports plugins. A plugin is a module or a package in camacq that provides code for a specific task. It can eg be an image analysis script. See the documentation for all default available plugins. To install a custom plugin, create a Python package with a setup.py module that implements the entry_points interface with key "camacq.plugins". setup( ... entry_points={"camacq.plugins": "plugin_a = package_a.plugin_a"}, ... ) See the packaging docs for details. camacq will automatically load installed modules or packages that implement this entry_point. Add a setup_module coroutine function in the module or package. This function will be awaited with center and config as arguments. async def setup_module(center, config): """Set up the plugin package.""" Each plugin must have its own configuration section at the root of the config. example_plugin: ... Development Install the packages needed for development. pip install -r requirements_dev.txt Use the Makefile to run common development tasks. make Release See the release instructions. Credits A lot of the inspiration for the architecture of camacq comes from another open-source Python automation app: Home Assistant. This is also the source for the automations interface in camacq. Project details Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
https://pypi.org/project/camacq/
CC-MAIN-2020-16
refinedweb
1,689
56.66
This post will look at two numerical integration methods, the trapezoid rule and Romberg’s algorithm, and memoization. This post is a continuation of ideas from the recent posts on Lobatto integration and memoization. Although the trapezoid rule is not typically very accurate, it can be in special instances, and Romberg combined it with extrapolation to create a very accurate method. Trapezoid rule The trapezoid is the simplest numerical integration method. The only thing that could be simpler is Riemann sums. By replacing rectangles of Riemann sums with trapezoids, you can make the approximation error an order of magnitude smaller. The trapezoid rule is crude, and hardly recommended for practical use, with two exceptions. It can be remarkably efficient for periodic functions and for analytic functions that decay double exponentially. The trapezoid rule works so well in these cases that it’s common to transform a general function so that it has one of these forms so the trapezoid rule can be applied. To be clear, the trapezoid rule for a given step size h may not be very accurate. But for periodic and double exponential functions the error decreases exponentially as h decreases. Here’s an implementation of the trapezoid rule that follows the derivation directly. def trapezoid1(f, a, b, n): integral = 0 h = (b-a)/n for i in range(n): integral += 0.5*h*(f(a + i*h) + f(a + (i+1)*h)) return integral This code approximates the integral of f(x) over [a, b] by adding up the areas of n trapezoids. Although we want to keep things simple, a slight change would make this code twice as efficient. def trapezoid2(f, a, b, n): integral = 0.5*( f(a) + f(b) ) h = (b-a)/n for i in range(1, n): integral += f(a + i*h) return h*integral Now we’re not evaluating f twice at every interior point. Estimating error Suppose you’ve used the trapezoid rule once, then you decide to use it again with half as large a step size in order to compare the results. If the results are the same within your tolerance, then presumably you have your result. Someone could create a function where this comparison would be misleading, where the two results agree but both are way off. But this is unlikely to happen in practice. As Einstein said, God is subtle but he is not malicious. If you cut your step size h in half, you double your number of integration points. So if you evaluated your integrand at n points the first time, you’ll evaluate it at 2n points the second time. But half of these points are duplicates. It would be more efficient to save the function evaluations from the first integration and reuse them in the second integration, only evaluating your function at the n new integration points. It would be most efficient to write your code to directly save previous results, but using memoization would be easier and still more efficient than redundantly evaluating your integrand. We’ll illustrate this with Python code. Now let’s integrate exp(cos(x)) over [0, π] with 4 and then 8 steps. from numpy import exp, cos, pi print( trapezoid2(f, 0, pi, 4) ) print( trapezoid2(f, 0, pi, 8) ) This prints 3.97746388 3.97746326 So this suggests we’ve already found our integral to six decimal places. Why so fast? Because we’re integrating a periodic function. If we repeat our experiment with exp(x) we see that we don’t even get one decimal place agreement. The code print( trapezoid2(exp, 0, pi, 4 ) ) print( trapezoid2(exp, 0, pi, 8 ) ) prints 23.26 22.42 Eliminating redundancy The function trapezoid2 eliminated some redundancy, but we still have redundant function evaluations when we call this function twice as we do above. When we call trapezoid2 with n = 4, we do 5 function evaluations. When we call it again with n = 8 we do 9 function evaluations, 4 of which we’ve done before. As we did in the Lobatto quadrature example, we will have our integrand function sleep for 10 seconds to make the function calls obvious, and we will add memoization to have Python to cache function evaluations for us. from time import sleep, time from functools import lru_cache @lru_cache() def f(x): sleep(10) return exp(cos(x)) t0 = time() trapezoid2(f, 0, pi, 4) t1 = time() print(t1 - t0) trapezoid2(f, 0, pi, 8) t2 = time() print(t2 - t1) This shows that the first integration takes 50 seconds and the second requires 40 seconds. The first integration requires 5 function evaluations and the second requires 9, but the latter is faster because it only requires 4 new function evaluations. Romberg integration In the examples above, we doubled the number of integration intervals and compared results in order to estimate our numerical integration error. A natural next step would be to double the number of intervals again. Maybe by comparing three integrations we can see a pattern and project what the error would be if we did more integrations. Werner Romberg took this a step further. Rather than doing a few integrations and eye-balling the results, he formalized the inference using Richardson extrapolation to project where the integrations are going. Specifically, his method applies the trapezoid rule at 2m points for increasing values of m. The method stops when either the maximum value of m has been reached or the difference between successive integral estimates is within tolerance. When Romberg’s method is appropriate, it converges very quickly and there is no need for m to be large. To illustrate Romberg’s method, let’s go back to the example of integrating exp(x) over [0, π]. If we were to use the trapezoid rule repeatedly, we would get these results. Steps Results 1 37.920111 2 26.516336 4 23.267285 8 22.424495 16 22.211780 32 22.158473 This doesn’t look promising. We don’t appear to have even the first decimal correct. But Romberg’s method applies Richardson extrapolation to the data above to produce a very accurate result. from scipy.integrate import romberg r = romberg(exp, 0, pi, divmax = 5) print("exact: ", exp(pi) - 1) print("romberg: ", r) This produces exact: 22.1406926327792 romberg: 22.1406926327867 showing that although none of the trapezoid rule estimates are good to more than 3 significant figures, the extrapolated estimate is good 12 figures, almost to 13 figures. If you pass the argument show=True to romberg you can see the inner workings of the integration, including a report that the integrand was evaluated 33 times, i.e. 1 + 2m times when m is given by divmax. It seems mysterious how Richardson extrapolation could take the integral estimates above, good to three figures, and produce an estimate good to twelve figures. But if we plot the error in each estimate on a log scale it becomes more apparent what’s going on. The errors follow nearly a straight line, and so the extrapolated error is “nearly” negative infinity. That is, since the log errors nearly follow a straight line going down, polynomial extrapolation produces a value whose log error is very large and negative. 6 thoughts on “Trapezoid rule and Romberg integration” Minor typo: <> Although it does almost create a periodic sentence :) Grrr, can’t use angle brackets. “It can be remarkably efficient for periodic functions and for periodic functions and for analytic functions that decay double exponentially.” Thanks. You have to HTML escape angle brackets: < and >. And by the way, this comes up often: you can insert code too with formatting too, but you need to put <pre> tags around it. Grrr, can’t use angle brackets, I always forget. “It can be remarkably efficient for periodic functions and for periodic functions and for analytic functions that decay double exponentially.” There are some nice generalizations of Romberg integration. Romberg integration assumes that the error is of the form a0*h^2+a1*h^4+… Modified Romberg integration allows different exponents and there are variants that try to detect the exponents. Such methods can deal with endpoint singularities in the integrand. See for example (Kahaner 1972) You might like to also do a post on the Shanks transformation, which is based on the same idea as Richardson extrapolation, applied to series: try to model the error term, then remove it using several adjacent values. The Leibnitz formula for pi is an excellent test case for the Shanks transformation.
https://www.johndcook.com/blog/2020/02/18/trapezoid-romberg/
CC-MAIN-2021-31
refinedweb
1,423
54.52
24/05/2011 at 17:02, xxxxxxxx wrote: Am I right that you can't use a button in the Execute Method of a tag plugin to do things like print. Or open a dialog message box? I get illegal crossover errors when trying to do that. In C++ I use the Message method to make button calls like this: Bool MyTag::Message(GeListNode *node, LONG type, void *data) { switch (type) { case MSG_DESCRIPTION_COMMAND: // MSG_DESCRIPTION_COMMAND is send when button is clicked { DescriptionCommand *dc = (DescriptionCommand* )data; // data contains the description ID of the button LONG button = dc->id[0].id; // get the ID of the button switch (button) // check for different button IDs { case BUTTON1: GePrint("Button1 was pushed"); break; case BUTTON2: GePrint("Button2 was pushed"); break; } } } return TRUE; } Am I supposed to do it that way in python too? I don't think I saw any tags with buttons examples like this in the SDK. Are there any examples of doing this with python? -ScottA On 24/05/2011 at 22:00, xxxxxxxx wrote: Yes , it is possible. Don't have the time now but in the afternoon (GMT+1) i can exactly tell you how. It was something like: def Message(op, data, type) : if not data: return id = data[0]['id'][0] if id = MY_BUTTON_ID: """ Stuff here """ Maybe you can figure it out yourself with that sample. Cheers, Niklas On 25/05/2011 at 01:06, xxxxxxxx wrote: I get illegal crossover errors when trying to do that. I get illegal crossover errors when trying to do that. Which function triggers that exception? On 25/05/2011 at 07:35, xxxxxxxx wrote: I think I was just using something simple like: if tag[1006]:gui.MessageDialog("Hello"). Or something similar to that. But when I tried to get that same error happen again today. I can't make it happen. When the button code wasn't working in the execute method. I tried a bunch of things, so lord knows what I did to trigger that error. That's when I stopped messing around and looked up how I executed buttons in tags using C++. And when I saw that I was doing it successfully inside of the Message method. I realized that I was probably putting my button code in the wrong place. But now I need to figure out how to convert my C++ syntax to python. Right now I'm trying this: def Message(self, id, data, type ) : if not data: return id = data[0]['id'][0] if id == CLICK_ME: print "Button Pushed" return True But I'm getting the error: "int" object is unsubscriptable. Traceback(most recent call last). It looks like Rui and I are having the same problem. On 25/05/2011 at 09:37, xxxxxxxx wrote: I was now able to look it up, I used this. def GetMessageID(data) : try: return data["id"][0].id except: return None But I don't have the time to test it if its really working, sorry. Cheers On 25/05/2011 at 10:00, xxxxxxxx wrote: Thanks for the help nux. But I don't really understand the "try /except" thing very well yet. I guess I need to see a very simple working example of a button used on a tag. Because I'm just not getting it. On 25/05/2011 at 11:59, xxxxxxxx wrote: Well, it's like try and catch. If anything goes wrong, there will be returned None instead an Error is raised. I.e. if data is None, it's unsubscriptable. Or the data is different than the data when a button is clicked, that it may raise an error too. On 25/05/2011 at 12:41, xxxxxxxx wrote: I think I'm getting closer def Message(self, tag, type, data) : if type<>18: return True button = data[c4d.CLICK_ME][0].id if button == c4d.CLICK_ME: print("Button was Pushed"); c4d.EventAdd() return True At this point. At least I get a result when I click the button. But it returns this error: keyError: 1006 #1006 is the numerical ID for my button so that's working -In C++. A description function is used to get the ID of a gizmo. -Then that is assigned to a variable. -Then that variable is used to point to the gizmo like this: LONG button = dc->id[0].id; I have converted everything to python except for the description function that C++ uses. Maybe that's the missing piece to the puzzle? On 26/05/2011 at 05:29, xxxxxxxx wrote: I just don't understand what your problem is. What are you doin with type != 18 ? And what's not working for you ? The function works as it should. It returns the current ID of the clicked element in the AM. On 27/05/2011 at 13:59, xxxxxxxx wrote: Here is an example of calling a button with python: def GetMessageID(data) : #This custom method is used to get the id of your buttons if data is None: return try: return data["id"][0].id except: return class myTag(plugins.TagData) : #The tag class def Init(self, tag) : # Set the default values for the tag's GUI elements return True def Message(self, op, type, data) : doc = op.GetDocument() id = GetMessageID(data) #calls to the custom "GetMessageID()" method if not id: return True #Error handling if id == c4d.CLICK_ONE: #If the button named CLICK_ONE in your .res file is pressed #Do Something print "Button1 was Clicked" if id == c4d.CLICK_TWO: #If the button named CLICK_TWO in your .res file is pressed #Do Something print "Button2 was Clicked" return True def Execute(self, tag, doc, op, bt, priority, flags) : #Put your code stuff in here return 0 Thanks for the help Niklas. On 27/05/2011 at 14:23, xxxxxxxx wrote: Np Did you see the example I've posted in Rui's thread ? Btw, why do you use 1-space indentation ? The Python standart is 4 spaces. Cheers, Niklas On 27/05/2011 at 17:19, xxxxxxxx wrote: Yes. I saw it. It helped me figure out what I was doing wrong. I use single spacing because I hate python's indentation rules. Actually. I more than hate it. But the word I really feel about it I can't say here or I'll get banned. It's a lot easier for me to keep track of the indentation if I stay as close to the left margin as I can. Rather than pushing everything four spaces out from the left margin. I know it's bad form. But it helps me keep track of the empty spaces easier. It also cuts down on how much swearing I do at my computer. On 28/05/2011 at 00:55, xxxxxxxx wrote: Haha xD Hm, I actually like it. Because you can also just press Tab once and you've got 4 spaces in most editors. (Can be set in the preferences) And it's a lot more overviewable. -Niklas
https://plugincafe.maxon.net/topic/5724/5770_buttons-on-tag-plugins
CC-MAIN-2021-39
refinedweb
1,173
74.69
Deprecated. - NAME - DEPRECATED - SYNOPSIS - DESCRIPTION - IMPORT ARGUMENTS - METHODS - ACCESSORS - SUBCLASSING - UTILITIES - SOURCE - MAINTAINERS - AUTHORS NAME Test::Stream::HashBase - Base class for classes that use a hashref of a hash. DEPRECATED This distribution is deprecated in favor of Test2, Test2::Suite, and Test2::Workflow. See Test::Stream::Manual::ToTest2 for a conversion guide. SYNOPSIS A class: package My::Class; use strict; use warnings; use Test::Stream::HashBase accessors => ::Stream::HashBase accessors => ['bat']; sub init { my $self = shift; # We get the constants from the base class for free. $self->{+FOO} ||= 'SubFoo'; $self->{+BAT} || = 'bat'; $self->SUPER::init(); } use it: package main; use strict; use warnings; use My::Class; my $one = My::Class->new(foo => 'MyFoo', bar => 'MyBar'); # Accessors! my $foo = $one->foo; # 'MyFoo' my $bar = $one->bar; # 'MyBar' my $baz = $one->baz; # Defaulted to: 'baz' # Setters! $one->set_foo('A Foo'); $one->set_bar('A Bar'); $one->set_baz('A Baz'); # Clear! $one->clear_foo; $one->clear_bar; $one->clear_baz; $one->{+FOO} = 'xxx'; DESCRIPTION inheritence is also supported. IMPORT ARGUMENTS - accessors => [...] This is how you define your accessors. See the ACCESSORS section below. - base => $class *** DEPRECATED *** Just use base 'Parent::Class';before loading HashBase. This is how you subclass a Test::Stream::Hashbase class. This will give you all the constants of the parent(s). - into => $class This is a way to apply HashBase to another class. package My::Thing; sub import { my $caller = caller; Test::Stream::HashBase->import(@_, into => $class); ... } METHODS PROVIDED BY HASH BASE HOOKS - $self->init() This gives you the chance to set some default values to your fields. The only argument is $selfwith its indexes already set from the constructor. ACCESSORS To generate accessors you list them when using the module: use Test::Stream::HashBase accessors => [qw/foo/]; This will generate the following subs in your namespace: - foo() Getter, used to get the value of the foofield. - set_foo() Setter, used to set the value of the foofield. - clear_foo() Clearer, used to completely remove the 'foo' key from the object hash. - FOO() Constant, returs. SUBCLASSING You can subclass an existing HashBase class. use Test::Stream::HashBase base => 'Another::HashBase::Class', accessors => [qw/foo bar baz/]; The base class is added to @ISA for you, and all constants from base classes are added to subclasses automatically. UTILITIES hashbase has a handful of class methods that can be used to generate accessors. These methods ARE NOT exported, and are not attached to objects created with hashbase. - $sub = Test::Stream::HashBase->gen_accessor($field) This generates a coderef that acts as an accessor for the specified field. - $sub = Test::Stream::HashBase->gen_getter($field) This generates a coderef that acts as a getter for the specified field. - $sub = Test::Stream::HashBase->get_setter($field) This generates a coderef that acts as a setter for the specified field. These all work in the same way, except that getters only get, setters always set, and accessors can get and/or set. my $sub = Test::Stream::HashBase->gen_accessor('foo'); my $foo = $obj->$sub(); $obj->$sub('value'); You can also add the sub to your class as a named method: *foo = Test::Stream::HashBase->gen_accessor('foo'); SOURCE The source code repository for Test::Stream can be found at. MAINTAINERS AUTHORS This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See
https://web-stage.metacpan.org/pod/Test::Stream::HashBase
CC-MAIN-2021-31
refinedweb
548
56.55
@k0ste, see "Note: Packages in the AUR assume that the base-devel group is installed, i.e. they do not list the group's members as dependencies explicitly." Search Criteria Package Details: package-query 1.8-2 Dependencies (2) - pacman>=5.0 (pacman-git) - yajl>=2.0 Required by (4) Sources (1) Latest Comments f2404 commented on 2016-03-27 10:45 @k0ste, see k0ste commented on 2016-03-27 08:54 @maintainer add 'pkg-config' to makedepends. f2404 commented on 2016-03-21 11:04 @josephgbr, done. Sorry, my first time :) rafaelff commented on 2016-03-21 10:30 @f2404: please update .SRCINFO as well. f2404 commented on 2016-03-21 10:26 @uberGeek, done. bigoten commented on 2016-03-20 21:21 @f2404, @josephgbr: Thank you both. Your suggestions worked out. I did have two curl versions installed, no idea why. All I needed to do was to remove two curl-related files in /usr/local/bin (curl, curl-config). Then compiling package-query and yaourt was uneventful. Thanks a lot! rafaelff commented on 2016-03-20 20:24 @bigoten: You might have more than one version installed e.g. one inside ~/bin. Please run 'which curl' and then run 'pacman -Qo <path>' (where path is the path of the curl executable obtained from 'which'). This last command should tell you which package is providing curl you are using to get 'curl --version', if you installed via Arch Linux's pacman. See my scenario, for example: $ which curl /usr/bin/curl $ LC_ALL=C pacman -Qo /usr/bin/curl # FYI: LC_ALL=C = don't use translation /usr/bin/curl is owned by curl 7.47.1-2 uberGeek commented on 2016-03-20 19:36 When you have time, please add 'aarch64' to arch(). Thank you! f2404 commented on 2016-03-20 06:28 In my case, `curl --version` and `pacman -Qi curl` are showing the same version: 7.47.1. I'm thinking maybe your issue is due to that other curl, versioned 7.28.1. You can find the binary location by running `which curl`. After that, you could try removing that curl, and reinstalling the official version: `pacman -S curl`. You can also check the libcurl (/usr/lib/libcurl.so.4) version by running `strings /usr/lib/libcurl.so.4 | grep 7.` - it should be saying "CLIENT libcurl 7.47.1". bigoten commented on 2016-03-20 00:50 I have the regular versions installed (not git): - openssl 1.0.2.g-3 - About the curl package I find contradicting info, not sure why: "curl -- version" indicates 7.28.1, but "pacman -S curl" indicates 7.47.1-2 is already installed. rafaelff commented on 2016-03-19 21:17 Did you compile curl and openssl packages on your own, or installed an alternative version of them like -git? bigoten commented on 2016-03-19 19:54 I am having problems compiling package-query 1.8-1 on my system. Following the advice of other users on this page on how to proceed after pacman was upgraded to version 5, I removed package-query and yaourt: > pacman -Rdd package-query yaourt then I updated the system via pacman: > pacman -Syu then I downloaded package-query from this page, unpacked it, and tried to compile it: > makepkg -sri The compilation always ends with the same error: > ... mv -f .deps/package-query.Tpo .deps/package-query.Po /bin/sh ../libtool --tag=CC --mode=link gcc -D_GNU_SOURCE -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z -Wl,relro -o package-query aur.o alpm-query.o util.o color.o package-query.o -lyajl -lalpm /usr/bin/ld: aur.o: undefined reference to symbol 'curl_free@@CURL_OPENSSL_4' /usr/lib/libcurl.so.4: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Makefile:425: recipe for target 'package-query' failed make[2]: *** [package-query] Error 1 make[2]: Leaving directory '/home/bigoten/Downloads/package-query/src/package-query-1.8/src' Makefile:428: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/bigoten/Downloads/package-query/src/package-query-1.8' Makefile:360: recipe for target 'all' failed make: *** [all] Error 2 ==> ERROR: A failure occurred in build(). Aborting... I have searched everywhere about this error (the "undefined reference to symbol 'curl_free@@CURL_OPENSSL_4'" and the "/usr/lib/libcurl.so.4: error adding symbols: DSO missing from command line" messages), to no avail. Could anyone please let me know what I am missing? gyscos commented on 2016-03-10 06:04 Could you add 'aarch64' to the available architectures? Thanks! rafaelff commented on 2016-03-07 06:28 @jasonrizke: package "pkg-config" is part of the group "base-devel", which is assumed to be installed (). jasonritzke commented on 2016-03-07 01:50 Is there a new build dependency on pkg-config? I couldn't makepkg without it, and it was not required previously. If somebody else can confirm my symptom (cannot makepkg w/o pkg-config installed) then it should probably be added to builddeps. Skunnyk commented on 2016-03-02 23:18 Yup, yaourt 1.8 is now out, please update :) hamelg commented on 2016-03-01 19:27 I've just upgraded to 1.8. Now, yaourt complains about unrecognized option '--csep' at the end of each upgrade : :: Processing package changes... (1/1) upgrading openssh [##############################] 100% warning: /etc/ssh/sshd_config installed as /etc/ssh/sshd_config.pacnew warning: /etc/ssh/ssh_config installed as /etc/ssh/ssh_config.pacnew ==> Searching for original config files to save package-query: unrecognized option '--csep' Query alpm database and/or AUR Usage: package-query [options] [targets ...] More information: package-query --help 4javier commented on 2016-03-01 18:39 It fixes the problem with RPC v5 for -S option, but not for -w switch javier@archbox ~ $ yaourt -Sw budgie-desktop error: target not found: budgie-desktop javier@archbox ~ $ yaourt -S budgie-desktop ==> Downloading budgie-desktop PKGBUILD from AUR... ... .. Skunnyk commented on 2016-02-29 20:43 Released package-query 1.8 : it fix the compatibility with aur rpc v5, add new features and fix tons of bugs : yaourt 1.7 is (or should be) compatible with package-query 1.8. A new version of yaourt will follow in a few days :) lord_rel commented on 2016-02-29 18:30 package-query 1.8 released today gonciarz commented on 2016-02-29 13:02 @gourdcaptain: confirmed. I switched to package-query-git as a temporary solution gourdcaptain commented on 2016-02-29 07:11 As of a few hours ago, package-query does not seem to be working in terms of querying the package list. Package-query-git does work. rafaelff commented on 2016-02-07 08:32 @ahioros: did you try rebuilding yaourt too, after pacman 5.0 installed? ahioros commented on 2016-02-07 02:50 @josephgbr i follow you trying upgrade and i have this message: /usr/lib/yaourt/util.sh: line 166: package-query: not found /usr/lib/yaourt/util.sh: line 166: package-query: not found % pacman -Qs package-query local/package-query 1.7-2 Query ALPM and AUR update #archlinux irc channel topic: Welcome to Arch Linux World Domination, Inc. <+> Be kind to the people who are helping you. Be kind to the people you are trying to help. <+> pacman 5.0 in [core]! <+> old package-query versions are incompatible with pacman 5.0, update it or remove it along with yaourt rafaelff commented on 2016-02-06 01:35 Basically, it is required to: 1- remove package-query - if you have a package that requires it, remove too (to reinstall later). 2- run system update, which will update pacman to 5.0.0 (sudo pacman -Syu) 3- with pacman 5.0.0 installed, rebuild package-query and install, along with other helpers you want, e.g. pacupg, yaourt, etc. done kerberizer commented on 2016-02-05 22:25 @valentin.brasov, obviously you need to also update (or, rather, uninstall and rebuild after pacman is updated) pacdep as well... valentin.brasov commented on 2016-02-05 22:12 Hi again, Trying on another system, I run into a problem: So firstly I run successfully: # pacman -Rdd package-query yaourt Then when I do: # pacman -Syu I get: error: failed to prepare transaction (could not satisfy dependencies) :: pacdep: requires pacman<4.3 Then I checked what pacman version I have: # pacman --version Ad it prints: Pacman v4.2.1 - libalpm v9.0.1 Please help. ondoho commented on 2016-02-05 13:15 __"You can symlink, rebuild (package-query), and remove the symlink. Still, I'd probably rebuild a second time -- just to be sure."__ this is what i just did, and now all works. from what i can see (i hope i'm not missing anything) there can't be any harm in it. kerberizer commented on 2016-02-04 22:13 @el_Salmon: Pretty sure you get the same message as @accessgranted, namely "WARNING: A package has already been built, installing existing package..." Do not use "makepkg -si". Use "makepkg -sif" instead. "-f" stands for "force", i.e. build a new package even if there is already an existing one in the output directory. It also may be a good practice as extra precaution to clean the "src" directory in advance with "-C", so finally the command would become "makepkg -Cifs". Also, as other people have noted elsewhere, you don't really need to rebuild yaourt (but probably should uninstall and reinstall it anyway, unless you want to break your package dependencies). el_Salmon commented on 2016-02-04 20:57 Removing and installing package-query and yaourt like in [1] doesn't work for me. I get the same error always: $yaourt -Syu package-query: error while loading shared libraries: libalpm.so.9: cannot open shared object file: No such file or directory [1] kerberizer commented on 2016-02-04 00:00 @asafk: That's what I had in mind with "in a pinch". Still, I'd probably rebuild a second time -- just to be sure. ;) And to be honest, I also think anyone should be able to rebuild at least package-query without any helper tool. Don't get lazy, people! @all: Also, be careful what you do and pay attention to any warnings or suspicious messages. Take for example @accessgranted's problem: he/she hadn't noticed the message "WARNING: A package has already been built, installing existing package..." So, instead of rebuilding the package, accessgranted just reinstalled their old one. No surprise that the missing library problem persisted. Linux is not really that tough, but it does require some effort. Obviously, you're not afraid of that effort, so do the things the right way. This is what really makes you stand out of the Windows crowd. ;) asafk commented on 2016-02-03 23:47 You can symlink, rebuild, and remove the symlink. That's what I did and it works just peachy. kerberizer commented on 2016-02-03 22:48 I'm sorry to have to say this, but symlinking to libraries with a different soname, even just with respect to the version (the number after the .so extension), is a _bad_ idea. While it can probably be used in a pinch to just run a thing or two needed for a proper rebuild, one should _never_ use it as a substitution to that rebuild. There _is_ a reason why the soname gets bumped: it doesn't get bumped that often actually. Bumping means incompatibility and the problem is that it may look like everything's working OK, but then, just when you've already forgotten what you did with that symlink, strange errors begin to occur. And then everybody wastes precious time debugging those errors until you remember at last about that symlink. TL;DR: Don't symlink different version shared libraries. Rebuild! wass commented on 2016-02-03 19:14 @asem Yes, it works without symlink. I think, you suggested the best way to resolve the problem. Anyway, @YauheniM is right too, so both approaches are good. Thank you guys! asem commented on 2016-02-03 00:03 @YauheniM No need to symlink , just download and build package-query manually using makepkg -si and the error is gone YauheniM commented on 2016-02-02 23:29 panaut0lordv commented on 2016-02-02 23:23 Hello Everybody, Just run: yaourt -S package-query and then: yaourt -Syu UPDATE: yaourt -Syu package-query works fine Cheers, Michal accessgranted commented on 2016-02-02 22:26 Hi, glad to be able to be part of the community. This is my first post. I'm afraid I have the same problem as Valentin.Brasov: [access@arch ~]$ sudo pacman -Syu [sudo] password for access: :: Synchronizing package databases... core is up to date extra 1767.1 KiB 643K/s 00:07 [######################] 100% community 3.3 MiB 839K/s 00:15 [######################] 100% multilib is up to date archlinuxfr is up to date :: Starting full system upgrade... warning: firefox: ignoring package upgrade (44.0-1 => 44.0-2) there is nothing to do [access@arch ~]$ sudo pacman -Rdd package-query yaourt [sudo] password for access: Packages (2) package-query-1.7-2 yaourt-1.7-1 Total Removed Size: 0.80 MiB :: Do you want to remove these packages? [Y/n] y :: Processing package changes... (1/2) removing package-query [######################] 100% (2/2) removing yaourt [######################] 100% [access@arch ~]$ curl -O % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 822 0 822 0 0 2320 0 --:--:-- --:--:-- --:--:-- 2315 [access@arch ~]$ tar -xvzf package-query.tar.gz package-query/ package-query/.SRCINFO package-query/PKGBUILD [access@arch ~]$ cd package-query [access@arch package-query]$ makepkg -si ==> WARNING: A package has already been built, installing existing package... ==> Installing package package-query with pacman -U... resolving dependencies... looking for conflicting packages... Packages (1) package-query-1.7-2 Total Installed Size: 0.08 MiB :: Proceed with installation? [Y/n] y (1/1) checking keys in keyring [######################] 100% (1/1) checking package integrity [######################] 100% (1/1) loading package files [######################] 100% (1/1) checking for file conflicts [######################] 100% :: Processing package changes... (1/1) installing package-query [######################] 100% [access@arch package-query]$ cd .. [access@arch ~]$ curl -O % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 952 0 952 0 0 2945 0 --:--:-- --:--:-- --:--:-- 2938 [access@arch ~]$ tar -xvzf yaourt.tar.gz yaourt/ yaourt/.SRCINFO yaourt/PKGBUILD [access@arch ~]$ cd yaourt [access@arch yaourt]$ makepkg -si ==> WARNING: A package has already been built, installing existing package... ==> Installing package yaourt with pacman -U... resolving dependencies... looking for conflicting packages... Packages (1) yaourt-1.7-1 Total Installed Size: 0.72 MiB :: Proceed with installation? [Y/n] y (1/1) checking keys in keyring [######################] 100% (1/1) checking package integrity [######################] 100% (1/1) loading package files [######################] 100% (1/1) checking for file conflicts [######################] 100% :: Processing package changes... (1/1) installing yaourt [######################] 100% Optional dependencies for yaourt aurvote: vote for favorite packages from AUR customizepkg: automatically modify PKGBUILD during install/upgrade rsync: retrieve PKGBUILD from official repositories [access@arch yaourt]$ cd .. [access@arch ~]$ yaourt stockfish package-query: error while loading shared libraries: libalpm.so.9: cannot open shared object file: No such file or directory [access@arch ~]$ Thanks thibdb13 commented on 2016-02-02 20:27 I did as clep/cauna said/wrote and it works without any problem. Just don't forget if pacman is not yet 5.0.0 to make a "pacman -Syu" after removing package-query and yaourt and before installing them again. davidsmit commented on 2016-02-02 20:14 Like bouhappy said: download & rebuild of only package-query (and not yaourt) solved the issue. valentin.brasov commented on 2016-02-02 20:12 I followed cleps's comments and it worked. Then I updated the whole system from yaourt-gui and this has updated pacman from 4.2.1-4 to 5.0.0-1. After that trying to do stuff in yaourt-gui (like option 1. Sync DB) yields: package-query: error while loading shared libraries: libalpm.so.9: cannot open shared object file: No such file or directory package-query: error while loading shared libraries: libalpm.so.9: cannot open shared object file: No such file or directory Please help. clep commented on 2016-02-02 10:11 Hey guys, works for me also like cauna and josephgbr. cauna commented on 2016-02-02 07:11 I almost did the same with josephgbr. 1) pacman already is 5.0.0 2) sudo -Rdd package-query yaourt 3) wget the tarballs from aur or you can click on "Download snapshot" 4) tar xzf the tarballs 5) cd into the folder and mkpkg respectively 6) sudo pacman -U package-query*.pkg.tar.xz and sudo pacman -U yaourt*.pkg.tar.xz respectively This solves everything. gaelic commented on 2016-02-02 06:33 @hazey: Ran into the same problem. A 'makepkg -f' didn't do the trick. I removed the everything from the directory except the PKGBUILD and ran makepkg again. Voila, its linked against .10. I guess makepkg -f just compiles again, but the configure step is skipped? bouhappy commented on 2016-02-02 05:47 Only package-query depends on libalpm. Yaourt itself does not (but it calls package-query which does depend on libalpm) so you should not (normally) need to update yaourt, but only package-query. After pacman update to 5, just download the snapshot above and makepkg & install your new package-query with pacman -U. Then re-run yaourt (which should now work) for full --aur update. The above is tested on my 2 machines -- note that I use testing repository on both, and also I see no further dependency issues, it maybe the reason why you also needed to update yaourt. hazey commented on 2016-02-02 03:23 Upgrading pacman to 5.0.0, pacman -Rsn package-query yaourt, and reinstalling package-query and yaourt (including via pulling the plain pkgbuild via wget and downloading the snapshot) and makepkg -sri'ing them did not seem to make any difference for me (still received the library error on .9), ran through the comments and tried the variations but unsure why didn't seem to take. Ended up installing package-query-git for now which worked without issue /edit After running the upgrade on 2 additional computers/servers did not have issues as above, only difference was when ran the upgrade on the first computer (per above) I upgraded package-query BEFORE pacman, not sure why caused such a fuss but removing package-query/yaourt, upgrading pacman, then reinstalling package-query/yaourt on the other computers seemed to work without issue. Odd as still couldn't get the first computer to work with package-query after numerous rebuilds (only package-query-git), ended up copying the built package-query-1.7-2-x86_64.pkg.tar.xz from one of the other computers which worked. tancrackers commented on 2016-02-01 21:30 I can confirm that josephgbr's method worked for me. rafaelff commented on 2016-02-01 19:25 works for me: 1- upgrade pacman to 5.0.0 2- remove package-query and yaourt 3- rebuild and install package-query and yaourt ps.: no [archlinuxfr] repository set Joel commented on 2016-02-01 19:24 Same as edtoml posted, didn't solve the libpalpm error. /edit: Following jakob steps did solve the issue. edtoml commented on 2016-02-01 19:00 Removing the existing package-query and yaourt, downloading the new PGKBUILDS and rebuilding and installing does NOT fix the problem here. jakob commented on 2016-02-01 11:53 In short (use plain file directly instead of git site) wget "" -O PKGBUILD makepkg -sri cooltrane commented on 2016-02-01 11:02 For those who have trouble ("libalpm.so.9:cannot open share object file" Error) I can confirm, that when following the steps : - getting the pkgbuild - makepkg -sri it works fine. Rhinoceros commented on 2016-02-01 11:01 Thank you Skunnyk for the quick update. flortsch commented on 2016-02-01 10:39 error while loading shared libraries: libalpm.so.9: cannot open shared object file: No such file or directory Also got the problem after updating package-query and yaourt. I simply uninstalled both packages and did a fresh install with the new pkgbuild and now it works just fine. f2404 commented on 2016-02-01 10:34 Guys, you need to update this package after updating pacman. Jamaal commented on 2016-02-01 10:30 Same problem with libalpm.so.9. @anatolyb That unfortunately doesn't work for me. anatolyb commented on 2016-02-01 10:24 2 z3ntu: download PKGBUILD from this page, build the package with `makepkg`, and install it with `pacman -U <package_name>.tar.xz` z3ntu commented on 2016-02-01 10:14 libalpm.so.9 cannot be opened. trulex commented on 2016-02-01 10:13 When I run 'yaourt somepackage' I get: package-query: error while loading shared libraries: libalpm.so.9: cannot open shared object file: No such file or directory Skunnyk commented on 2016-02-01 09:53 Quickly updated the pkgbuild for pacman 5.0 beardedlinuxgeek commented on 2016-02-01 09:44 Thanks for patching this quickly Rhinoceros commented on 2016-02-01 09:11 pacman 5.0.0-1 was pushed to core today. package-query 1.7-1 requires pacman<4.3, so it blocks `pacman -Syu`. Upstream [1] says that a recompiled package-query 1.7 seems to work with pacman 5.0.0. Should this package then have its dependencies changed? [1] Severus commented on 2016-02-01 09:10 @bitwave please recompile with new pacman, it works fine again bitwave commented on 2016-02-01 08:19 for me yaourt is completely broken... -.- tuxertech commented on 2016-02-01 07:23 package-query-git works just fine. FredBezies commented on 2016-02-01 06:13 Pacman 5.0 is in core now. Looks like package-query depends needs to be updated. Skunnyk commented on 2016-01-30 17:03 If you are using [testing] and have pacman 5.0, try to use package-query-git, and compile it again the new libalpm. Please do NOT do any link thing… Note: package-query should works with pacman 5.0 too, you need to change the depends line to remove <4.3 and recompile it. Scimmia commented on 2016-01-30 15:58 Wait for them to fix it. Symlinking between ABI versions is not OK. cbowman57 commented on 2016-01-30 15:49 Then by all means, offer a solution Scimmia. Scimmia commented on 2016-01-30 15:43 That is an absolutely horrible idea, cbowman57. cbowman57 commented on 2016-01-30 15:36 @fusion809 I'm sure there are, in the interim use the package-query-git then find libalpm.so.10.0.0 and create a link named libalpm.so.9. That will hold us over until they get it sorted out. As Scimmia has pointed out, this could cause problems. Use at your own risk, have a current backup, which I always do, in case something goes horribly wrong. fusion809 commented on 2016-01-30 06:05 Hey, any updates planned for this package to make it compatible with pacman 5.0.0? Atsuri commented on 2015-09-27 16:19 @sistematico This is not a bug, spaces in Unix have meaning! If your path includes directories with spaces in names use quotation marks "", for instance "/path/". As of now package-query compiles properly on x86_64 Arch with kernel 4.1.6-1 and base-devel fully installed. Reason for "out-of-date" flag? ozky commented on 2015-08-30 11:26 Where this coming it's out of date ? github page says 1.6.2 is newest version and this pkgbuild is 1.6.2 so it's impossible it's out of date. Somebody have not taked off that flagged out even it's updated. sistematico commented on 2015-06-07 06:25 Not working with directory that contain spaces. Example /home/lucas/Some Dir/package-query/ HisDudeness commented on 2015-04-30 08:22 AFAIK, out-of-date doesn't mean the link is down, just that the original developer has released a newer version which hasn't still been updated to Arch. Better, an Arch user has found that a newer version than the one in the AUR has come out, so has flagged the AUR package as "out-of-date". That will warn the package mantainer so that the package will be updated ASAP. neroburner commented on 2015-04-09 19:18 was able to install it flawlessly on armv6h (package was not down) lamphie commented on 2015-04-09 11:04 @krabat Sorry, I misunderstand the out-of-date flag, the link to this package is down (Not sure at the time I write this comment). The only way now, is by getting the git version. kerberizer commented on 2015-04-07 13:10 @krabat: Please be so kind to not edit your comments several times. This reposting with minor corrections generates a lot of unnecessary and even confusing e-mail notifications. pmattern commented on 2015-04-07 12:40 > Failed to connect to mir.archlinux.fr port 80: Connection refused indicates a server problem which seems to happen rather frequently on this server. It has nothing to do with the package being outdated. I can't see any other reason why it should be out-of-date either. Latest release is still 1.5, see. It has just been built flawlessly here. out-of-date. Latest release is still 1.5, see. pmattern commented on 2015-04-07 12:28 supposed to be out-of-date. Latest release is still 1.5, see. lamphie commented on 2015-04-06 09:36 @dape: As you can see the package `package-query' is out-of-date, that's why you get a time-out when downloading it. The solution of moormaster or balwierz works by getting the git version: It works for me. lamphie commented on 2015-04-06 09:33 @dape: As you can see the package `package-query' is out-of-date, that's why you get a time-out when downloading this package. The solution of balwierz or moormaster works by getting this time the git version. $cd /tmp curl tar -xzf package-query-git.tar.gz cd package-query-git makepkg -s It works for me. lamphie commented on 2015-04-06 09:31 @dape: As you can see the package `package-query' is out-of-date, that's why you get a time-out when downloading this package. The solution of balwierz or moormaster works by getting this time the git version. $cd /tmp wget tar -xzf package-query-git.tar.gz cd package-query-git makepkg -s It works for me. dape commented on 2015-04-06 05:39 -> Downloading package-query-1.5.tar.gz... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to mir.archlinux.fr port 80: Connection refused ==> ERROR: Failure while downloading package-query-1.5.tar.gz Aborting... Scimmia commented on 2015-03-24 20:59 @CPUnltd: you are responsible for rebuilding AUR packages after an soname bump. CPUnltd commented on 2015-03-24 18:55 just got this today: package-query: error while loading shared libraries: lialpm.so.8: cannot open shared object file: no such file or directory after updating my desktop. Doesn't affect pacman directly, only package-query. rafaelff commented on 2015-02-21 20:55 No, 'make' and 'fakeroot' are part of base-devel group, which it is recommended to be installed when installing packages from AUR. kerberizer commented on 2015-02-21 20:53 Re: The packages make and fakeroot should be added as build-dependencies. I'm afraid I have to repeat my comment from the yaourt package recently: do you guys ever read the manuals? A lot of unnecessary noise would be spared. Note: The group base-devel is assumed to be already installed when building with makepkg. Members of this group should not be included in makedepends array. simonp commented on 2015-02-21 20:49 The packages make and fakeroot should be added as build-dependencies. simonp commented on 2015-02-21 20:48 `make` is missing as a build dependency. moormaster commented on 2015-01-17 09:29 The mirror for the file seems to be down In the meantime I installed the aur package package-query-git This seems to work. :) TsundereC commented on 2015-01-17 09:19 Can anyone access mir.archlinux.fr ? I tried to download this package, but it always says "Connection Timeout"...... zesssez commented on 2015-01-13 19:36 Hi to all, i want to install package-query, but have problems in buid i think: arch: armv7h nexus7 I got package-query working before, i reinstalled system and now it's impossible to compile it. Build information: source code location : . prefix : /usr sysconfdir : /etc conf file : /etc/pacman.conf localstatedir : /var database dir : /var/lib/pacman/ compiler : gcc compiler flags : -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 package-query version : 1.5 using git version : no git ver : Variable information: root working directory : / aur base url : make all-recursive make[1]: Entering directory '/home/user/packagequery/src/package-query-1.5' Making all in src make[2]: Entering directory '/home/user/packagequery/src/package-query-1.5/src' gcc -DLOCALEDIR=\"/usr/share/locale\" -DCONFFILE=\"/etc/pacman.conf\" -DROOTDIR=\"/\" -DDBPATH=\"/var/lib/pacman/\" -DAUR_BASE_URL=\"\" -DHAVE_CONFIG_H -I. -I.. -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -MT aur.o -MD -MP -MF .deps/aur.Tpo -c -o aur.o aur.c In file included from /usr/include/alpm.h:35:0, from alpm-query.h:21, from aur.c:30: /usr/include/archive.h:1:1: error: expected identifier or ‘(’ before ‘.’ token ../../ca-certificates/extracted/cadir/AddTrust_Qualified_Certificates_Root.pem . . . #few error than this one all of them on /usr/include/archive.h . . #anf final error Makefile:426: recipe for target 'aur.o' failed make[2]: *** [aur.o] Error 1 make[2]: Leaving directory '/home/user/packagequery/src/package-query-1.5/src' Makefile:412: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/user/packagequery/src/package-query-1.5' Makefile:343: recipe for target 'all' failed make: *** [all] Error 2 ==> ERROR: A failure occurred in build(). Aborting... I create a swapfile to avoid mem issues, but no luck: [user@alarm etc]$ free -m total used free shared buff/cache available Mem: 972 392 423 0 156 563 Swap: 1023 0 1023 No change, the makepkg problem persist: i made some changes in makepkg following slipknot with no luck @tuxce Any ideas? Thanks. applebloom commented on 2015-01-08 05:16 sudo pacman -Rdd package-query sudo pacman -Sy pacman sudo pacman-db-upgrade cd /tmp wget -O - | tar xvz cd package-query makepkg -si ventieldopje commented on 2015-01-07 12:00 I didn't need the git version to fix the alpm problem, just rebuild using this PKGBUILD with makepkg has done the trick. Rebuilding is all that's required, probably because the libraries changed name or path. balwierz commented on 2015-01-07 10:32 I had problems with libalpm too, so I installed manually (download PKBUILD and makepkg -i) the git version: Now it seems all right. $ ldd /usr/bin/package-query | grep alpm libalpm.so.9 => /usr/lib/libalpm.so.9 balwierz commented on 2015-01-07 10:30 joko commented on 2015-01-07 07:39 Hello, everyone, I'd like to share my experience upgrading package-query while moving from pacman 4.1 to 4.2. My installed version of package-query requiring pacman<=4.2, thus I couldn't upgrade my system straightforwardly. So, I built package-query 1.5-2 manually with makepkg -si. yaourt -Syua updated properly pacman then, but it stopped working in the middle, because the libalpm.so.8 dependency issue that other users have already reported. At this point, I did pacman-db-upgrade and then rebuilt package-query 1.5-2 manually and finally my system was working as intended. rafaelff commented on 2015-01-05 19:14 Guys, please do not extend this discussion in this Comment list. Only issues related to package build/installation/bugs should take place in here. For other types of discussion, do it in aur-general mail list. rafaelff commented on 2015-01-05 19:02 Guys, please do not prolong this discussion in this Comment list. Only issues related to package build/installation/bugs should take place in here. For other types of discussion, do it in aur-general mail list. Scimmia commented on 2015-01-05 18:58 @kerberizer, there's a number of reasons. The first reason is philosophical, but the others are practical problems. 1. It encourages people to stay willfully ignorant of how the AUR work. AUR helpers are nice, but you should know what they're doing. Arch's only supported method of using the AUR is running makepkg directly, so it's vitally important that you know how to use it. 2. Since the repo is unofficial, the packages aren't rebuilt/moved at exactly the same time as the official package. This is really only a problem because of #1, as people who know how to use the AUR don't have a problem with it. 3. The repo is a mess. Have you ever looked at what is all there? If it gets put in at the top of pacman.conf, it can cause problems. If a user tries to install an AUR package that has an old version already build in the repo, it causes problems. Packages in the repo aren't always built in a clean chroot, so they cause problems. These packages aren't included in to-do lists, so they often miss changes in Arch, causing problems. Should I continue? kerberizer commented on 2015-01-05 16:25 @crossroads1112, you would've saved us both from needlessly spamming the comments if you had first read carefully my comment. I had said exactly the same you did. @Scimmia, could you please elaborate on why the archlinux.fr repo is "really pretty bad"? Why not notify the maintainers of the problems? And if it's that hopeless, well, let's make a new, better repo -- specifically for package-query and yaourt. @agent0, you could simplify the things a little bit and avoid some possible mistakes by using "makepkg -is". "-i" stands for install and will simply invoke "pacman -U" automatically (thus no way you could accidentally re-install a package from the cache). I typically use "-cifs" myself, which also cleans the directory afterwards and forces the build even if there is a previously build package. P.S. My personal opinion is that understanding how to solve such problems on your own will benefit most users (this is one of the reasons to use Arch, after all), but I also understand why some users feel frustration instead and would have preferred a more automagic-type approach. agent0 commented on 2015-01-05 03:24 @Scimmia, @josephgbr, I completely did all things again: remove package-query, yaourt, yaourt-gui. Then I downloaded package-query's PKGBUILD and did makepkg -s. Then installed via pacman -U. For now ldd /usr/bin/package-query | grep alpm shows libalpm.so.9 => /usr/lib/libalpm.so.9 (0x00007fba43511000). Maybe when I reinstalled packege-query it was installed from cache? Do not know. It was written if I want to reinstall package and I answered yes. And by the way, I did not removed yaourt that time. Maybe that was a problem. Anyway, for now problem is solved for me. Thank you! Scimmia commented on 2015-01-05 03:08 @agent0, how about using objdump -p instead of ldd, does it still point to libalpm.so.8? There's no way the system can link something at build time to a library that doesn't exist. rafaelff commented on 2015-01-05 03:05 agent0: looks good. Please make sure you installed the pkg.tar.xz you just built, and not an old build. agent0 commented on 2015-01-05 02:30 @josephgbr, I checked that my pacman version is 4.2.0-5, but to be clear, I reinstalled pacman itself via pacman. Then I makepkg -s for package-query. It's version is 1.5-2. Then I reinstall it. $ ldd /usr/bin/package-query | grep alpm libalpm.so.8 => not found What the hell? @Scimmia, already removed that symlink. I understand that it is bad thing, but how I then solve problem? Scimmia commented on 2015-01-05 01:47 Please don't consider using that repo, it's really pretty bad. @agent0, you did understand that you need to rebuild package-query *after* updating pacman itself, right? Remove that symlink you created, that's a very, very bad thing to do. matthias.lisin commented on 2015-01-05 01:27 consider using the unofficial (and unsigned) user repository "archlinuxfr": The repository provides yaourt and package-query. The packages were quickly updated after the new pacman version was added to the Core-repo. [archlinuxfr] Server = ( Wiki: ) rafaelff commented on 2015-01-05 00:36 agent0: if pacman 4.2.0-5 is installed & you say you rebuilt package-query & it still links to /usr/lib/libalpm.so.8; then it seems you missed something. Make sure pacman 4.2.0-5 is installed before rebuilding package-query. After reinstalling it, check if you get this output: $ ldd /usr/bin/package-query | grep alpm libalpm.so.9 => /usr/lib/libalpm.so.9 (0x00007fe9d4c66000) agent0 commented on 2015-01-05 00:28 @josephgbr, yes, I deleted package-query and yaourt and did makepkg -s. Then installed them with sudo pacman -U. And that did not solved problem. agent0 commented on 2015-01-05 00:26 wwgfd's advice to ln -s /usr/lib/libalpm.so.9 /usr/lib/libalpm.so.8 helped me. rafaelff commented on 2015-01-05 00:24 agent0: did you reinstall PACKAGE-QUERY or yaourt? You need to rebuild package-query and reinstall package-query agent0 commented on 2015-01-05 00:22 Did not helped me. I follewed ArthurBorsboom instruction and even I reinstalled yaourt manually, but I still have package-query: error while loading shared libraries: libalpm.so.8: cannot open shared object file: No such file or directory in yaourt output and it does not work! crossroads1112 commented on 2015-01-04 11:18 No, this is not a chicken-and-egg problem as it is still possible to install packages from the AUR without AUR Helpers. They are helpers after all. You needn't use a third party repo either. Just follow ArthurBorsboom's solution and install package-query manually and you're done. kerberizer commented on 2015-01-01 19:46 Guys, this is a classical chicken-and-egg problem and therefore there's no magical solution. package-query needs to be rebuilt because of a shared library version bump (by the pacman update), but if you try rebuilding it with yaourt, you'll inevitably fail, because yaourt itself *depends* on package-query. No clever tricks in the PKGBUILD can help to avoid this problem (some nasty hacks in fact may, but that's not the point). And this is why you have to rebuild package-query manually when such shared libs updates happen. Now, the only reasonable way to keep the automation working -- if you prefer it that way -- is to use precompiled packages from a repo. There is, in fact, such repo, which the yaourt developers maintain themselves. More information on how to set it up: wwgfd commented on 2015-01-01 18:27 FWIW simply sym-linking `/usr/lib/libalpm.so.9` to `/usr/lib/libalpm.so.8` worked for me (I know someone should slap me for that but hey...) Maybe the PKGBUILD script could be updated in some way to force compiling with the *new* version of libalpm ? Humble_Panda commented on 2014-12-30 10:47 The solution provided by ArthurBorsboom works fine. But there is a crucial mistake in his way. He writes: sudo pacman -U package-query-1.5-1-x86_64.pkg.tar.xz When it needs to be: sudo pacman -U package-query-1.5-2-x86_64.pkg.tar.xz Skunnyk commented on 2014-12-29 15:01 So recompile it manually ? :) It's just to say "hey, pkgrel bump, rebuild it". Yamakaky commented on 2014-12-29 14:49 ... That's a point ^^ Scimmia commented on 2014-12-29 14:48 That makes no sense. Your AUR helper isn't working, so how would bumping the pkgrel force a rebuild? Skunnyk commented on 2014-12-29 12:36 Yep ! Updated to 1.5-2 to force the rebuild Yamakaky commented on 2014-12-29 11:02 Please update to 1.5-2 to force the rebuild. ArthurBorsboom commented on 2014-12-29 09:31 For me the fix was indeed rebuilding package-query this way. sudo pacman -Rdd package-query wget tar -xzf package-query.tar.gz cd package-query makepkg -s sudo pacman -U package-query-1.5-1-x86_64.pkg.tar.xz Thanks tuxce commented on 2014-12-29 09:00 You need to rebuild package-query, see Scimmia's comment. ArthurBorsboom commented on 2014-12-29 08:05 package-query: error while loading shared libraries: libalpm.so.8: cannot open shared object file: No such file or directory tuxce commented on 2014-12-24 17:04 On AFUR, it still requires pacman 4.1 because 4.1 is still in core. leosw commented on 2014-12-24 15:44 Works fine. If testing repos, try that sudo pacman -Rns yaourt package-query sudo pacman -Suy # Will install pacman 4.2 wget tar -xzf package-query.tar.gz cd package-query makepkg -s sudo pacman -U package-query-1.5-1-x86_64.pkg.tar.xz # If you have archlinuxfr repo in /etc/pacman.conf, you can install back yaourt using pacman sudo pacman -S yaourt That's all P.S. Please update dependencies in AFUR (archlinux fr repo), it still require pacman 4.1 Scimmia commented on 2014-12-24 14:33 @wolletd, linking happens at build time. If you built it against 4.1, you'll need to rebuild against 4.2. wolletd commented on 2014-12-24 14:06 Version 1.5 builds but won't run due to missing libalpm.so.8. With pacman 4.2 there is libalpm.so.9. MayKiller commented on 2014-12-21 14:50 Temporary method for pacman 4.2 and package-query. edit PKGBUILD and change these lines: pkgrel=4 md5sums=('SKIP') download and extract cd package-query-1.4/src/ edit alpm-query.h and change this line: #define F_UNREQUIRED 9 repackage makepkg pacman -U package-query-1.4-4[TAB] EOF baboofei commented on 2014-12-20 23:47 Problem after doing what @blackout said... > until the next update I just removed the > pacman<4.2 > dependency manually otherwise updating will fail. Results in... sudo yaourt -Syua ... :: Synchronizing package databases... testing is up to date core is up to date extra is up to date community-testing is up to date community is up to date gnome-unstable is up to date multilib-testing is up to date multilib is up to date package-query: error while loading shared libraries: libalpm.so.8: cannot open shared object file: No such file or directory package-query: error while loading shared libraries: libalpm.so.8: cannot open shared object file: No such file or directory Package-query need to be updated for Pacman 4.2 blackout commented on 2014-12-19 15:47 until the next update I just removed the pacman<4.2 dependency manually otherwise updating will fail. sl1pkn07 commented on 2014-12-12 00:08 @tumbler try to change '-march=x86-64 -mtune=generic' to '-march=native' sl1pkn07 commented on 2014-12-12 00:04 build ok here :S tumbler commented on 2014-12-08 14:11 ok but ... i cannot knwo how to fix ... now i have all my packages update ... this is more important for now ... do you see anything be wrong? rafaelff commented on 2014-12-08 14:05 You didn't solve, you found a work around. Something is wrong with your own system, tumbler. Maybe in /etc/makepkg.conf, maybe in other files... tumbler commented on 2014-12-08 13:59 I have just solved compiling with clang instead of makepkg SpotlightKid commented on 2014-12-08 13:54 wget tar -xzf package-query.tar.gz cd package-query makepkg If that doesn't work for you, make sure you have all the prerequisites as detailed here:. If you still get an error, post your commands and the relevant output including the exact error meessage to the aur mailing list to get help. tumbler commented on 2014-12-08 09:01 @Spotlightkid I've tried using "yaourt-Syua" and answers error ... even downloading the "tarball" and compiling it with "makepkg" responds error. What should I do? SpotlightKid commented on 2014-12-07 17:54 @tumbler: how are you compiling/making the package? The preprocessor defines in your compilation commands seem all wrong. 'yaourt package-query' or 'makepkg' with the downloaded PKGBUILD works just fine for me. tumbler commented on 2014-12-07 16:49 make all-recursive make[1]: Entering directory '/home/tumbler/Downloads/package-query-1.4' Making all in src make[2]: Entering directory '/home/tumbler/Downloads/package-query-1.4/src' gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DCONFFILE=\"/usr/local/etc/pacman.conf\" -DROOTDIR=\"/\" -DDBPATH=\"/usr/local/var/lib/pacman/\" -DAUR_BASE_URL=\"\" -DHAVE_CONFIG_H -I. -I.. -D_GNU_SOURCE -g -O2 -MT aur.o -MD -MP -MF .deps/aur.Tpo -c -o aur.o aur.c aur.c: In function 'json_integer': aur.c:340:2: internal compiler error: in c_parser_declspecs, at c/c-parser.c:2170 else if (strcmp (pkg_json->current_key, AUR_LAST)==0) ^ Please submit a full bug report, with preprocessed source if appropriate. See <> for instructions. Makefile:426: recipe for target 'aur.o' failed make[2]: *** [aur.o] Error 1 make[2]: Leaving directory '/home/tumbler/Downloads/package-query-1.4/src' Makefile:412: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/tumbler/Downloads/package-query-1.4' Makefile:343: recipe for target 'all' failed make: *** [all] Error 2 tumbler commented on 2014-12-06 11:30 i can't update this paclage ... error in build ... try again? Almin commented on 2014-12-05 18:03 Yeah, thanks! Works now! Almin commented on 2014-12-05 14:47 Didn't detect that it's possible to compile on armv7h, I had to delete the comma (',') in arch=('i686' 'x86_64' 'mips64el' 'armv6h' 'armv7h', 'arm') between 'armv7h' and 'arm'. Jamalaka commented on 2014-12-05 13:42 "arm" compiles fine on my "Zyxel NSA" NAS. rustam commented on 2014-12-01 14:16 I second the request to add "arm"(for ARMv5 machines) to the list of architectures. Just tested it on a Marvel Kirkwood machine, works just fine. jellysheep commented on 2014-10-21 18:45 @ineiti, SpotlightKid: I would appreciate 'arm', too. Compiles fine on a WM8650 machine. niufox commented on 2014-10-18 00:16 arm arch use yaourt : 1.install package-query: pacman -S base-devel wget h tar zxvf package-query.tar.gz cd package-query makepkg -si 2.install yaourt cd .. wget tar zxvf yaourt.tar.gz cd yaourt makepkg -si cd .. SpotlightKid commented on 2014-09-04 13:42 @ineit: I second that request (using Arch on a Seagate Dockstar). ineiti commented on 2014-09-03 17:45 Can you add 'arm' to the PKGBUILD-arch variable, so that I can also install easily yaourt on my Dreamplug, please? sugatang.itlog commented on 2014-08-19 08:50 Thanks josephgbr. Success. rafaelff commented on 2014-08-19 08:41 @sugatang.itlog: This is expected, as the PKGBUILD is available in the source package file in the "Download tarball": sugatang.itlog commented on 2014-08-19 08:38 Hi, as of this writing, no PKGBUILD file included in. Just trying to install yaourt. Thanks. zanegrey commented on 2014-07-26 22:18 Would it be possible to get the arm version of this put here? rafaelff commented on 2014-06-23 11:30 @tuxce: please update. This PKGBUILD is out-of-date, in comparison with archlinuxfr.. kevashcraft commented on 2014-06-22 17:52 To build package while it's out of date, update the pkgver to 1.4 and add the md5sum of which is '045a49b5121b3d469b6546fc271d002a' to the PKGBUILD truh commented on 2014-06-08 13:47 Already tried reinstalling curl with pacman (I don't have yaourt installed). bidulock commented on 2014-06-08 12:21 yaourt -S curl ? truh commented on 2014-06-08 11:04 package-query: Build information: source code location : . prefix : /usr sysconfdir : /etc conf file : /etc/pacman.conf localstatedir : /var database dir : /var/lib/pacman/ compiler : gcc compiler flags : -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 package-query version : 1.2 using git version : no git ver : Variable information: root working directory : / aur base url : make all-recursive make[1]: Entering directory '/home/jakob/build/package-query/src/package-query-1.2' Making all in src make[2]: Entering directory '/home/jakob/build/package-query/src/package-query-1.2/src' /bin/sh ../libtool --tag=CC --mode=link gcc -D_GNU_SOURCE -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -L/opt/lampp/lib -lcurl --param=ssp-buffer-size=4 -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z -Wl,relro -o package-query aur.o alpm-query.o util.o color.o package-query.o -L/opt/lampp/lib /opt/lampp/lib/libcurl.so -L/opt/lampp /opt/lampp/lib/libldap.so /opt/lampp/lib/liblber.so -lresolv -lssl -lcrypto -lz -lrt -lyajl -lalpm -Wl,-rpath -Wl,/opt/lampp/lib -Wl,-rpath -Wl,/opt/lampp/lib /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/libalpm.so: undefined reference to `curl_easy_perform@CURL_OPENSSL_4' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/libalpm.so: undefined reference to `curl_easy_strerror@CURL_OPENSSL_4' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/libalpm.so: undefined reference to `curl_easy_getinfo@CURL_OPENSSL_4' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/libalpm.so: undefined reference to `curl_easy_cleanup@CURL_OPENSSL_4' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/libalpm.so: undefined reference to `curl_easy_init@CURL_OPENSSL_4' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/libalpm.so: undefined reference to `curl_easy_setopt@CURL_OPENSSL_4' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/libalpm.so: undefined reference to `curl_global_init@CURL_OPENSSL_4' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/libalpm.so: undefined reference to `curl_global_cleanup@CURL_OPENSSL_4' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/libalpm.so: undefined reference to `curl_easy_reset@CURL_OPENSSL_4' collect2: error: ld returned 1 exit status Makefile:381: recipe for target 'package-query' failed make[2]: *** [package-query] Error 1 make[2]: Leaving directory '/home/jakob/build/package-query/src/package-query-1.2/src' Makefile:384: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/jakob/build/package-query/src/package-query-1.2' Makefile:315: recipe for target 'all' failed make: *** [all] Error 2 ==> ERROR: A failure occurred in build(). Aborting... ######## Any ideas? ArcherGR commented on 2014-04-26 15:31 Trying to install the .pkg.tar.gz and getting "error: '/var/cache/pacman/pkg/package-query.tar.gz': invalid or corrupted package (PGP signature)" Tryed downloading the package, installing from the urls but to no avail NewWorld commented on 2014-04-24 15:12 URL of the tarball is offline. Scimmia commented on 2014-04-03 16:27 @theking2, builds fine here, even in a clean chroot. Do you have the entire base-devel group installed? theking2 commented on 2014-03-20 19:57 ==> Making package: package-query 0.5.1-1 (Thu 20 Mar 20:56:19 CET 2014) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> Retrieving sources... -> Found package-query-0.5.1.tar.gz ==> Validating source files with md5sums... package-query-0.5.1.tar.gz ... Passed ==> Extracting sources... -> Extracting package-query-0.5.1.tar.gz with bsdtar ==> Removing existing pkg/ directory... ==> Starting build()... configure.ac:12: error: required file './compile' not found configure.ac:12: 'automake --add-missing' can install 'compile' autoreconf: automake failed with exit status: 1 ==> ERROR: A failure occurred in build(). Aborting... leitecarvalho commented on 2014-02-26 23:08 What happened to the package? the only comes with PKGBUILD file. e8hffff commented on 2013-12-28 03:33 Fix a system problem with; /usr/bin/awk: Permission denied I deleted the gawk exec which was a double up of gawk-4.1.0. The made links for awk > gawk > gawk-4.1.0. I also set o+rx on the main gawk-4.1.0 file. e8hffff commented on 2013-12-27 03:27 Getting error; line 1279: /usr/bin/awk: Permission denied kaatisu84 commented on 2013-11-17 11:12 That worked perfectly, thank you so much! Renamed the dir to AUR and all is great. Cheers! Scimmia commented on 2013-11-17 07:10 Build in a dir without a space. kaatisu84 commented on 2013-11-17 06:55 Getting this error and I have been searching for hours for an answer - any suggestions? Making install in src make[1]: Entering directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2/src' make[2]: Entering directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2/src' /usr/bin/mkdir -p '/home/kaatisu84/AUR Packages/package-query/pkg/package-query/usr/bin' /bin/sh ../libtool --mode=install /usr/bin/install -c package-query '/home/kaatisu84/AUR Packages/package-query/pkg/package-query/usr/bin' libtool: install: /usr/bin/install -c package-query /home/kaatisu84/AUR Packages/package-query/pkg/package-query/usr/bin/package-query /usr/bin/install: target 'Packages/package-query/pkg/package-query/usr/bin/package-query' is not a directory Makefile:332: recipe for target 'install-binPROGRAMS' failed make[2]: *** [install-binPROGRAMS] Error 1 make[2]: Leaving directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2/src' Makefile:518: recipe for target 'install-am' failed make[1]: *** [install-am] Error 2 make[1]: Leaving directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2/src' Making install in doc make[1]: Entering directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2/doc' make[2]: Entering directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2/doc' make[2]: Nothing to be done for 'install-exec-am'. /usr/bin/mkdir -p '/home/kaatisu84/AUR Packages/package-query/pkg/package-query/usr/share/man/man8' /usr/bin/install -c -m 644 package-query.8 '/home/kaatisu84/AUR Packages/package-query/pkg/package-query/usr/share/man/man8' make[2]: Leaving directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2/doc' make[1]: Leaving directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2/doc' make[1]: Entering directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2' make[2]: Entering directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2' make[2]: Nothing to be done for 'install-exec-am'. make[2]: Nothing to be done for 'install-data-am'. make[2]: Leaving directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2' make[1]: Leaving directory '/home/kaatisu84/AUR Packages/package-query/src/package-query-1.2' Makefile:384: recipe for target 'install-recursive' failed make: *** [install-recursive] Error 1 ==> ERROR: A failure occurred in package(). Aborting... HolyTux commented on 2013-10-30 16:08 You can edit /etc/makepkg.conf and make your own way of downloading in the DLAGENT section, assume %o for OUTPUT FILE and %u for URL. HolyTux commented on 2013-10-30 15:41 you can edit /etc/makepkg.conf as root, in the DLAGENT section you can make your own way of downloading. use %o as the OUTPUT FILE abd %u as the URL. (Alireza) Omid commented on 2013-10-10 21:39 Due to our government filtering or something else, I get the error "curl: (35) Unknown SSL protocol error in connection to aur.archlinux.org:443" when I use "curl -O some-link". But "curl -1O some-link" works fine. Were can I alter the source of package-query so that it uses this form of the curl command? HateJacket commented on 2013-09-01 13:49 Maybe you're trying to build the package on an ntfs partition/disk? afaik, if you've got it setup as-per the wiki, you wont be able to execute any scripts there, better to move it to a local partition/disk :) enkahel commented on 2013-06-15 09:35 Getting this error on build, and I cannot figure why : ==> Making package: package-query 1.2-2 (Sat Jun 15 11:33:13 CEST 2013) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> Retrieving sources... -> Found package-query-1.2.tar.gz ==> Validating source files with md5sums... package-query-1.2.tar.gz ... Passed ==> Extracting sources... -> Extracting package-query-1.2.tar.gz with bsdtar ==> Removing existing pkg/ directory... ==> Starting build()... ~/builds/package-query/PKGBUILD: line 15: ./configure: Permission denied ==> ERROR: A failure occurred in build(). Aborting... Any ideas ? Anonymous comment on 2013-06-06 17:46 Ist still does not work for me. Output of "makepkg -L" can be found under Anonymous comment on 2013-04-10 09:16') Anonymous comment on 2013-04-09 19:23 @tuxce indeed, it was not the case at the time of my comment. Maybe a caching problem on my side. Sorry for the noise. rafaelff commented on 2013-04-09 16:15 @v1c3: Make sure '--with-aur-url.....' is still in same line as './configure'. @tuxce: I suggest that you keep the './configure' line less than 80 characteres Anonymous comment on 2013-04-09 16:07 I wasnt able to build the package. I got the following Error: /home/vice/src/package-query/PKGBUILD: line 15: --with-aur-url=: No such file or directory ==> ERROR: A failure occurred in build(). Aborting... rafaelff commented on 2013-04-09 15:09 @shivan: only difference I notice between your PKGBUILD and tuxce is the position of the md5sums, but even its hash is the same... tuxce commented on 2013-04-09 15:04 @shivan: the PKGBUILD you post has no difference with the one in AUR @Anderson: what's the problem with the sources ?!? @phillme: run "makepkg -L" and paste the package-query-1.2-2-x86_64-build.log (in pastebin, it's better to review a file there) Anonymous comment on 2013-04-09 14:27') Anderson commented on 2013-04-09 11:21 Please update sources - the tar.gz build fails, however the GIT version works Anonymous comment on 2013-04-06 18:12 Hi. For me compilation breaks after trying to find config.h . Any help is appreciated. Thanks in Advance # ~/builds/package-query $ makepkg -s ============================= package-query: Build information: source code location : . prefix : /usr sysconfdir : /etc conf file : /etc/pacman.conf localstatedir : /var database dir : /var/lib/pacman/ compiler : gcc compiler flags : -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 package-query version : 1.2 using git version : no git ver : Variable information: root working directory : / aur base url : make[1]: Entering directory `/home/caspar/builds/package-query/src/package-query-1.2' cd . && /bin/sh ./config.status config.h config.status: creating config.h config.status: config.h is unchanged make[1]: Leaving directory `/home/caspar/builds/package-query/src/package-query-1.2' make all-recursive make[1]: Entering directory `/home/caspar/builds/package-query/src/package-query-1.2' Making all in src make[2]: Entering directory `/home/caspar/builds/package-query/src/package-query-1.2/src' aur.o -MD -MP -MF .deps/aur.Tpo -c -o aur.o aur.c package-query.o -MD -MP -MF .deps/package-query.Tpo -c -o package-query.o package-query.c aur.c:19:20: fatal error: config.h: No such file or directory #include "config.h" ^ compilation terminated. make[2]: *** [aur.o] Error 1 make[2]: *** Waiting for unfinished jobs.... package-query.c:20:20: fatal error: config.h: No such file or directory #include <config.h> ^ compilation terminated. make[2]: *** [package-query.o] Error 1 make[2]: Leaving directory `/home/caspar/builds/package-query/src/package-query-1.2/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/caspar/builds/package-query/src/package-query-1.2' make: *** [all] Error 2 ==> ERROR: A failure occurred in build(). Aborting... ================================= rafaelff commented on 2013-04-06 15:22 @willianhotlz: When posting a log output, run makepkg with "LC_ALL=C" in front to make it english, as not everyone understands Brazilian Portuguese ;) Also, avoid building packages inside a path with blankspace (in your case, "Arch Linux"), as sometimes some PKGBUILD or Makefiles forget to treat it. I suggest moving "Arch Linux" to "ArchLinux" - simple, probably harmless. @tuxce: Can you please quote the target path of installation to avoid issues like this? "/usr/bin/install: target 'Linux/package-query/pkg/package-query/usr/bin/package-query' is not a directory" Anonymous comment on 2013-04-06 15:03 Error: Making install in src make[1]: Entrando no diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2/src' make[2]: Entrando no diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2/src' make[2]: Nada a ser feito para `install-data-am'. /usr/bin/mkdir -p '/home/willian/Documentos/Arch Linux/package-query/pkg/package-query/usr/bin' /bin/sh ../libtool --mode=install /usr/bin/install -c package-query '/home/willian/Documentos/Arch Linux/package-query/pkg/package-query/usr/bin' libtool: install: /usr/bin/install -c package-query /home/willian/Documentos/Arch Linux/package-query/pkg/package-query/usr/bin/package-query /usr/bin/install: target 'Linux/package-query/pkg/package-query/usr/bin/package-query' is not a directory make[2]: ** [install-binPROGRAMS] Erro 1 make[2]: Saindo do diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2/src' make[1]: ** [install-am] Erro 2 make[1]: Saindo do diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2/src' Making install in doc make[1]: Entrando no diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2/doc' make[2]: Entrando no diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2/doc' make[2]: Nada a ser feito para `install-exec-am'. /usr/bin/mkdir -p '/home/willian/Documentos/Arch Linux/package-query/pkg/package-query/usr/share/man/man8' /usr/bin/install -c -m 644 package-query.8 '/home/willian/Documentos/Arch Linux/package-query/pkg/package-query/usr/share/man/man8' make[2]: Saindo do diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2/doc' make[1]: Saindo do diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2/doc' make[1]: Entrando no diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2' make[2]: Entrando no diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2' make[2]: Nada a ser feito para `install-exec-am'. make[2]: Nada a ser feito para `install-data-am'. make[2]: Saindo do diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2' make[1]: Saindo do diretório `/home/willian/Documentos/Arch Linux/package-query/src/package-query-1.2' make: ** [install-recursive] Erro 1 ==> ERRO: Uma falha ocorreu em package(). eazar001 commented on 2013-04-05 23:03 @josephgbr, never mind actually package-query works perfectly here, the error i was mentioning pertains only to pacman -S yaourt. Sorry about that. eazar001 commented on 2013-04-05 23:03 @josephgbr, never mind actually package-query works perfectly here, the error i was mentioning pertains only to pacman -S yaourt. Sorry about that. eazar001 commented on 2013-04-05 23:00 @josephgbr, never mind actually package-query works perfectly here, the error i was mentioning pertains only to pacman -S yaourt. Sorry about that. eazar001 commented on 2013-04-05 22:56 @josephgbr: it says 'no such file or directory', probably because I forgot to mention that when it asks me to delete it, I say 'yes.' rafaelff commented on 2013-04-05 22:31 sudo rm /var/cache/pacman/pkg/package-query-1.2-2-i686.pkg.tar.xz and install it again. eazar001 commented on 2013-04-05 22:31 Following these instructions works, but on pacman -Syu I get: :: File /var/cache/pacman/pkg/package-query-1.2-2-i686.pkg.tar.xz is corrupted (invalid or corrupted package (PGP signature)). tombenko commented on 2013-04-05 20:19 TNX! joat commented on 2013-04-05 14:16 The following got yaourt working for me without having to reinstall yajl and yaourt: 1) pacman -Rdd package-query 2) pacman -Syu (this should install pacman 4.1) 3) Take care of /etc/pacman.conf.pacnew (and /etc/makepkg.conf.pacnew for those that have a custom makepkg.conf) 4) pacman -Su 5) Use makepkg to build and install package-query tuxce commented on 2013-04-05 13:54 To compile package-query 1.2, you need to have pacman 4.1, you cannot use package-query (from yaourt) to upgrade itself. One way to upgrade : yaourt -G package-query pacman -Rdd package-query pacman -Su cd package-query makepkg -i kar commented on 2013-04-05 13:13 I think you should uninstall yaourt, yajl and package-query. After that, you should firstly install yajl, than package-query and than yaourt. This was the way for me. And now, it works without problems with pacman 4.1 But maybe, there is a better way?! tombenko commented on 2013-04-05 13:01 yaourt -Sf package-query ==> Downloading package-query PKGBUILD from AUR... x PKGBUILD package-query 1.2-2 ( Unsupported package: Potentially dangerous ! ) ==> Edit PKGBUILD ? [Y/n] ("A" to abort) ==> ------------------------------------ ==> n ==> package-query dependencies: - pacman<4.2 (already installed) - curl (already installed) - yajl>=2.0 (already installed) - pacman>=4.1 (package found) ==> Continue building package-query ? [Y/n] ==> --------------------------------------- ==> ==> Building and installing package ==> Install or build missing dependencies for package-query: :: A következő csomagok telepítése javasolt elsőként: pacman :: Megszakítja a jelenlegi műveletet, :: és telepíti ezeket a csomagokat most? [I/n] y függőségek feloldása... belső ütközések keresése... hiba: nem sikerült előkészíteni a tranzakciót (nem sikerült kielégíteni a függőségeket) :: package-query: igényli a következőt: pacman<4.1 ==> Restart building package-query ? [y/N] ==> -------------------------------------- ==> tombenko commented on 2013-04-05 12:59 Little fun: I can't upgrade package-query by yaourt, because it needs pacman>=4.1, but later it depends on pacman<4.1. The same happens with makepkg... Therefore I can't even upgrade pacman, because it is package-querys dependency... --force drops the same... muon commented on 2013-04-05 12:32 Is there a reason the direct-link PKGBUILD is still for pkgver 1.1 while the tarball contains a PKGBUILD for pkgver 1.2? supersym commented on 2013-04-05 10:22 Fixed! I also had a time issue on this old machine so I couldn't try before that. But it worked great so thumbs up! :) kar commented on 2013-04-05 09:21 Ok, version 1.2 works fine! Thank you. supersym commented on 2013-04-05 09:09 Ok cause I am getting aura at least, with less hoops atm. Only manual wget on haskell-curl/pcre but with package-query it would complain curl-types header was missing. Curl new one isn't shipped with the headers though which 'll probably have to remove references from in the automate/macro tools louis058 commented on 2013-04-05 09:09 I am getting the same error rafaelff commented on 2013-04-05 08:57 @kar: Try again, with 1.2 kar commented on 2013-04-05 08:55 I can't build it. There are 2 mistakes. Here is the terminal outout. But it's (partly) in german. I hope it's ok. kar commented on 2013-04-05 08:55 I can't build it. There are 2 mistakes. Here is the terminal outout. But it's (partly) in german. I hope it's ok. kar commented on 2013-04-05 08:51 I can't build it. There are 2 mistakes. Here is the terminal outout. But it's (partly) in german. I hope it's ok. mssun commented on 2013-04-05 08:30 Thanks. Hope to see the update in AUR quickly. ptrxyz commented on 2013-04-05 08:29 @robertsms: fixed New URL: In a shell: mkdir tmpfolder cd tmpfolder wget -O PKGBUILD makepkg sudo pacman -U package-query-1.1-2-x86_64.pkg.tar.xz # this is for 64bit. adjust for x86. ptrxyz commented on 2013-04-05 08:26 @robertsms: hm, seems to be an encoding error by pastebin. Try to get it here: Or simply copy & paste it from the browser. mssun commented on 2013-04-05 08:20 @ptrxyz There is an error in the PKGBUILD. ==> ERROR: PKGBUILD contains CRLF characters and cannot be sourced. mssun commented on 2013-04-05 08:19 @ptrxyz There is an error in the PKGBUILD. ==> ERROR: PKGBUILD contains CRLF characters and cannot be sourced. mssun commented on 2013-04-05 08:14 Same trouble. Is there any people can give a temporary solution? Or just wait for the update? Thank you! ptrxyz commented on 2013-04-05 08:11 Anatolik's patch works for me too. As a workaround for all those out there waiting for this packed to be updated, I edited the PKGBUILD a little bit so it will automatically apply the patch: In a shell: mkdir tmpfolder cd tmpfolder wget -O PKGBUILD makepkg sudo pacman -U package-query-1.1-2-x86_64.pkg.tar.xz # this is for 64bit. adjust for x86. anatolik commented on 2013-04-05 04:08 pacman 4.1 has some API changes. Thankfully most changes just function renames. Here is the source diff I compiled package-query and it works fine. supersym commented on 2013-04-05 02:24 Still broken like an old record. This is a essential part of my workflow and others who require yaourt for their aur downloads... is there anything we can do? doesn't seem like this should be able, e.g. move it to official repos or whats the deal with that? student975 commented on 2013-04-04 23:08 pacman 4.1 is official now. tuxce commented on 2013-04-01 09:20 It's compatible with pacman 4.0.3 which is still in [core]. Install aur/package-query-git if you use testing/pacman (4.1) Anonymous comment on 2013-04-01 07:20 Incompatible with pacman since today hachre commented on 2013-03-13 07:54 @amstan: gcc is required by makepkg so this doesn't have to depend on it. amstan commented on 2013-03-10 01:43 I think it needs gcc as a dependency. WhiteHatHacker1 commented on 2012-12-20 22:22 I downloaded the tarball, extracted it to it's own folder, ran "makepkg -s", and got "==> ERROR: A failure occurred in package(). Aborting..." as the end result. I have tried re-extracting, re-downloading, and deleting everything and starting over but it just doesn't seem to work. Do you have any ideas? Thanks in advance (^_^). cuihao commented on 2012-11-04 00:40 cuihao@cuihao-arch ~ $ package-query -A test The URL[]=test returned error : 301 Anonymous comment on 2012-10-29 11:53 thanks. my pacman.conf got updated and I missed this update. Anonymous comment on 2012-10-29 11:53 thanks. my pacman.conf got updated and I missed this update. dgbaley27 commented on 2012-10-25 20:23 Or, alternatively, *you* need to sign the package after you've built it. dgbaley27 commented on 2012-10-25 20:22 You missed something. This is just a PKGBUILD, not a package, so it doesn't need to be signed. You need to relax your signing options in /etc/pacman.conf. Anonymous comment on 2012-10-25 19:19 could you please sign this package. trying to update this results in: "error: package-query: missing required signature error: failed to commit transaction (invalid or corrupted package (PGP signature)) Errors occurred, no packages were upgraded. " or did I miss something? ejstacey commented on 2012-10-24 10:02 Are you able to change the depends line from: depends=('pacman>=4.0' 'pacman<4.1' curl 'yajl>=2.0') to: depends=('pacman>=4.0' 'pacman<4.1' 'curl' 'yajl>=2.0') ? This gives us a uniform "everything in quotes" approach ;) jecxjo commented on 2012-10-22 21:48 Package works unmodified with 'armv6h' architecture. Please add to supported architectures line. Anonymous comment on 2012-08-15 03:11 I am getting the pacman needed error; openssl is installed. I had to remove package-install and yaourt to update a machine that hadn't been for awhile. Pacman installed is 4.0.3-3. I'm not understanding the comments regarding fixing this. tycho commented on 2012-05-30 08:38 Package works unmodified with 'armv7h' architecture. Please add to supported architectures line. Anonymous comment on 2012-05-06 17:10 This package and package-query-git work unmodified on mips64el architecture. Please, replace "arch=('i686' 'x86_64')" with "arch=('i686' 'x86_64' 'mips64el')". Anonymous comment on 2012-04-04 21:50 tuxce, Oh, I install openssl and that error stopped appearing. Thanks! Luck in developing! tuxce commented on 2012-04-03 20:53 From you config.log: > /usr/lib/libcurl.so.4: undefined reference to `SSL_CTX_set_srp_password' > /usr/lib/libcurl.so.4: undefined reference to `SSL_CTX_set_srp_username' Do you have an alternate openssl package ? Anonymous comment on 2012-04-03 14:33 I have such problem - error when configuring: "configure: error: pacman is needed to compile package-query". >pacman -Q pacman >pacman 4.0.2-1 config.log: Anonymous comment on 2012-03-15 19:52 tuxce commented on 2012-03-01 13:33 Those packages are not in package-query's dependencies list. rudy.matela commented on 2012-02-29 12:35 I couldn't find some of the dependencies of the package on aur or official repositories as of today (2012-02-29). lib32-libxrandr lib32-libxv (among others) tuxce commented on 2012-02-03 07:13 You have to remove it, install packman 4.x then rebuild it. ur6lad commented on 2012-02-03 06:29 Error 1. In file included from aur.c:31:0: alpm-query.h:55:25: error: unknown type name 'alpm_db_t' 2. In file included from aur.c:32:0: util.h:91:2: error: unknown type name 'alpm_handle_t' ur6lad commented on 2012-02-03 06:25 I can't update pacman to 4.0 because package-query requeries old pacman, I can't update package-query to 1.0.1 because new one requires pacman 4.0 % emphire commented on 2012-01-17 01:31 pacman 4.x is now out of testing and into core. student975 commented on 2012-01-16 21:26 I'm not in a hurry, and, I'm sure, the package has pacman 4.x branch. SirWuffleton commented on 2012-01-16 21:21 @student975: I had the same mess, I solved it by removing package-query and yaourt, upgrading pacman, then using makepkg to rebuild and install them manually. student975 commented on 2012-01-16 20:05 error: failed to prepare transaction (could not satisfy dependencies) :: Starting full system upgrade... :: package-query: requires pacman<3.6 tuxce commented on 2011-10-13 20:01 pacman 4.x is now in [testing], package-query will be updated once it reaches [core]. Meanwhile, you can use yaourt-git / package-query-git mityukov commented on 2011-09-19 19:22 Cannot upgrade this package via yaourt. Get "Permission denied" for the line, where ./configure command goes. Full log: dgbaley27 commented on 2011-09-09 00:07 Whoops, sorry for the spam. I had an extra "-" for -fstack-protector in CFLAGS. Move along, nothing to see here. dgbaley27 commented on 2011-09-09 00:00 One item of note is that I have another computer with a nearly identical package list and building was no problem. tuxce commented on 2011-09-08 18:11 Paste your config.log please. dgbaley27 commented on 2011-09-08 16:44 I can't build this latest version (0.9-1). checking whether the C compiler works... no configure: error: in `/tmp/yaourt-tmp-matt/aur-package-query/src/package-query-0.9': configure: error: C compiler cannot create executables See `config.log' for more details One thing I see in config.log is that gcc is being called with -V which is invalid. rwelin commented on 2011-09-08 14:39 After upgrading from package-query 0.8.1-1 to 0.9-1, yaourt wants to upgrade local packages saying there's a new release even though there's not. I now get this output when I do a full system upgrade with yaourt: ==> Package upgrade only (new release): local/batterystop 0.2-1 1 -> 1 local/nileup 1.0-1 1 -> 1 local/nilfan 1.0-2 2 -> 2 Maybe this is a problem with yaourt but I posted this here since it was package-query I upgraded. Anonymous comment on 2011-09-07 23:28 Want to release a new version so multiinfo and the user agent changes make it out to the masses? The AUR server would love you too. tuxce commented on 2011-09-01 13:56 It's back now. badboy commented on 2011-09-01 11:25 brings a "404 not found". Any other mirror? Jristz commented on 2011-08-18 04:05 Adverticement: Package-Query Not work nor compile w/ Pacman 4.0.0RC1 in This moment please use Pacman 3.5.x for using w/ Package-Query Anonymous comment on 2011-07-24 14:55 The dont open here Huulivoide commented on 2011-06-28 11:55 Doesent link to pthreads lib and so it won't build libtool: link: gcc -D_GNU_SOURCE -march=athlon64-sse3 -O2 -pipe -fuse-linker-plugin -Wl,--hash-style=gnu -Wl,--as-needed -o package-query aur.o alpm-query.o util.o color.o package-query.o -lcurl -lyajl -lalpm /usr/bin/ld.gold: aur.o: in function aur_request:aur.c(.text+0x528): error: undefined reference to 'pthread_create' /usr/bin/ld.gold: aur.o: in function aur_request:aur.c(.text+0x550): error: undefined reference to 'pthread_join' Anonymous comment on 2011-06-23 21:16 >> "fatal error: curl/types.h: No such file or directory" this bug is arleady corrected in GIT but still présent in the tar.gz waiting for a new package .... makepkg -si wait for error then edit PKGBUILD and comment "source=..." like this: #source=(http then remove the line #include <curl/types.h> in src/package-query-0.8/src/aur.c execute "makepkg -si" again. the message must be gone... WorMzy commented on 2011-06-23 20:46 Hope I'm not jumping the gun, but it's still broken here: Making all in src make[2]: Entering directory `/home/wormzy/package-query/src/package-query-0.8/src' gcc -DLOCALEDIR=\"/usr/share/locale\" -DCONFFILE=\"/etc/pacman.conf\" -DROOTDIR=\"/\" -DDBPATH=\"/var/lib/pacman/\" -DAUR_BASE_URL=\"\" -DHAVE_CONFIG_H -I. -I.. -D_GNU_SOURCE -march=x86-64 -mtune=generic -O2 -pipe -MT aur.o -MD -MP -MF .deps/aur.Tpo -c -o aur.o aur.c aur.c:27:24: fatal error: curl/types.h: No such file or directory compilation terminated. make[2]: *** [aur.o] Error 1 make[2]: Leaving directory `/home/wormzy/package-query/src/package-query-0.8/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/wormzy/package-query/src/package-query-0.8' make: *** [all] Error 2 ==> ERROR: A failure occurred in build(). Aborting... tuxce commented on 2011-06-23 18:59 Fixed, thanks. PerisH commented on 2011-06-23 15:54 Seems that the package don't build. The screen is: aur.c:27:24: error fatal: curl/types.h: No existe el fichero o el directorio compilación terminada. make[2]: *** [aur.o] Error 1 make[2]: *** Se espera a que terminen otras tareas.... mv -f .deps/alpm-query.Tpo .deps/alpm-query.Po mv -f .deps/util.Tpo .deps/util.Po make[2]: se sale del directorio `/home/perish/Descargas/package-query/src/package-query-0.8/src' make[1]: *** [all-recursive] Error 1 make[1]: se sale del directorio `/home/perish/Descargas/package-query/src/package-query-0.8' make: *** [all] Error 2 ==> ERROR: Se produjo un error en build(). Cancelando... Anonymous comment on 2011-05-16 09:11 hi! make: *** No rule to make tarhet 'query/pkg'. Stop why?? rafaelff commented on 2011-05-05 00:37 I had no problem building this in Arch 32-bits (did not try it in 64 bits). @learne Maybe reading this topic will help you somehow: tuxce commented on 2011-04-29 15:24 I don't know how you built it. Version "0.8" does not have this code and this PKGBUILD has pkgver=0.8 ! Anonymous comment on 2011-04-29 15:15 I cannot build package-query... Are you sure the package isn't broken ? Else, what's wrong ? aur.c:430:40: error: ‘yajl_status_insufficient_data’ undeclared (first use in this function) nickoe commented on 2011-04-29 09:48 Ninez: Just do as Hador says tuxce commented on 2011-04-28 15:29 What are you talking about? The package is not broken, and why should I add <2.99 ? (at least <3 would make sense) but for now, there is no reason to do it. Ninez commented on 2011-04-28 14:19 tuxce, you should really be fixing this package. the fix is insanely stupid simple to do. As Leniviy pointed out, it is easy. change **literally - four characters** in your PKGBUILD. and your done. :) basinilya commented on 2011-04-27 18:21 is it hard to add yajl<2.99 to dependencies? Hador commented on 2011-04-26 13:10 all you have to do is rebuild package-query to link against the new yajl version. dracorp commented on 2011-04-26 08:05 replace#depends#yajl#yajl1 Anonymous comment on 2011-04-26 04:13 package-query: error while loading shared libraries: libyajl.so.1: cannot open shared object file: No such file or directory if you usin yajl-2.0 Also that is my problem. Because of it, I cant use yaourt so I have removed yajl-2 and tried to build and install yajl1 from aur. My yaourt work fine. But, I think you must fix and update it. Sorry for my bad english. Jristz commented on 2011-04-26 03:30 package-query: error while loading shared libraries: libyajl.so.1: cannot open shared object file: No such file or directory if you usin yajl-2.0 tuxce commented on 2011-04-15 06:12 From what you pasted: ==> Making package: package-query 0.5.1-1 (Thu Apr 14 18:59:53 CDT 2011) package-query's version is 0.7-1 ! jecxjo commented on 2011-04-15 00:16 I have the same issue. Here's the output: andrewboktor commented on 2011-04-07 10:03 I have experienced a very strange thing, may be this is of interest to you. Here is what I did: wget tar xvf package-query.tar.gz cd package-query makepkg I got a build error, undefined reference to alpm_db_register_local (I lost the history, so the exact output is not there). I removed that folder and downloaded package-query-git, it built fine and installed fine. Now, package-query also builds fine. nebulon commented on 2011-03-26 09:36 quantumphaze commented on 2011-03-25 02:23 Last Updated: Thu, 24 Mar 2011 08:09:17 +0000 First Submitted: Wed, 24 Mar 2010 23:18:00 +0000 Happy Birthday! hcjl commented on 2011-03-24 12:28 see jorgicio's comment jorgicio commented on 2011-03-24 03:59 tuxce, pacman 3.5 is now on [core]. Please, upgrade the package. Thanks tuxce commented on 2011-03-22 22:12 Read the comment just before yours. Anonymous comment on 2011-03-22 20:42 Breaks upgrade of pacman to 3.5. ;) tuxce commented on 2011-03-17 13:35 Please don't flag it out of date until pacman 3.5 reaches [core] repo. KlavKalashj commented on 2011-03-17 12:20 Thank you, that works in combination with yaourt-git. tuxce commented on 2011-03-17 11:01 There is package-query-git for pacman 3.5 compatibility until it reaches [core]. KlavKalashj commented on 2011-03-16 22:21 Will this be updated to support the new pacman(3.5)? tuxce commented on 2011-03-11 09:44 Can you please use bsdson commented on 2011-03-11 03:58 *** glibc detected *** package-query: double free or corruption (fasttop): 0xad1006a0 *** ======= Backtrace: ========= /lib/libc.so.6(+0x6b6c1)[0xb76126c1] /lib/libc.so.6(+0x6cfdb)[0xb7613fdb] /lib/libc.so.6(+0x6ed51)[0xb7615d51] /lib/libc.so.6(realloc+0xe9)[0xb76172e9] /usr/lib/libcrypto.so.1.0.0(+0x41274)[0xb73fa274] [0x632e6b] ======= Memory map: ======== 08048000-08051000 r-xp 00000000 08:02 790159 /usr/bin/package-query 08051000-08052000 rw-p 00008000 08:02 790159 /usr/bin/package-query 08052000-08058000 rw-p 00000000 00:00 0 09692000-09825000 rw-p 00000000 00:00 0 [heap] ad100000-ad121000 rw-p 00000000 00:00 0 ad121000-ad200000 ---p 00000000 00:00 0 ad2a4000-ad2b5000 r-xp 00000000 08:02 3794 /lib/libresolv-2.13.so ad2b5000-ad2b6000 r--p 00010000 08:02 3794 /lib/libresolv-2.13.so ad2b6000-ad2b7000 rw-p 00011000 08:02 3794 /lib/libresolv-2.13.so ad2b7000-ad2b9000 rw-p 00000000 00:00 0 aead8000-aead9000 ---p 00000000 00:00 0 aead9000-af2d9000 rw-p 00000000 00:00 0 af2d9000-af2da000 ---p 00000000 00:00 0 af2da000-afada000 rw-p 00000000 00:00 0 b02db000-b02dc000 ---p 00000000 00:00 0 b02dc000-b0adc000 rw-p 00000000 00:00 0 b12dd000-b12de000 ---p 00000000 00:00 0 b12de000-b1ade000 rw-p 00000000 00:00 0 b2100000-b2121000 rw-p 00000000 00:00 0 b2121000-b2200000 ---p 00000000 00:00 0 b22a7000-b22c2000 r-xp 00000000 08:02 804838 /usr/lib/libgcc_s.so.1 b22c2000-b22c3000 rw-p 0001a000 08:02 804838 /usr/lib/libgcc_s.so.1 b22df000-b22e0000 ---p 00000000 00:00 0 b22e0000-b2ae0000 rw-p 00000000 00:00 0 b2ae0000-b2ae1000 ---p 00000000 00:00 0 b2ae1000-b32e1000 rw-p 00000000 00:00 0 b32e1000-b32e2000 ---p 00000000 00:00 0 b32e2000-b3ae2000 rw-p 00000000 00:00 0 b3ae2000-b3ae3000 ---p 00000000 00:00 0 b3ae3000-b42e3000 rw-p 00000000 00:00 0 b42e3000-b42e4000 ---p 00000000 00:00 0 b42e4000-b4ae4000 rw-p 00000000 00:00 0 b4ae4000-b4ae5000 ---p 00000000 00:00 0 b4ae5000-b52e5000 rw-p 00000000 00:00 0 b52e5000-b52e6000 ---p 00000000 00:00 0 b52e6000-b5ae6000 rw-p 00000000 00:00 0 b5ae6000-b5ae7000 ---p 00000000 00:00 0 b5ae7000-b62e7000 rw-p 00000000 00:00 0 b62e7000-b62e8000 ---p 00000000 00:00 0 b62e8000-b6ae8000 rw-p 00000000 00:00 0 b6ae8000-b6ae9000 ---p 00000000 00:00 0 b6ae9000-b72eb000 rw-p 00000000 00:00 0 b72eb000-b72fa000 r-xp 00000000 08:02 228 /lib/libbz2.so.1.0.6 b72fa000-b72fb000 rw-p 0000f000 08:02 228 /lib/libbz2.so.1.0.6 b72fb000-b731b000 r-xp 00000000 08:02 804020 /usr/lib/liblzma.so.5.0.1 b731b000-b731c000 rw-p 00020000 08:02 804020 /usr/lib/liblzma.so.5.0.1 b731c000-b731d000 rw-p 00000000 00:00 0 b731d000-b7343000 r-xp 00000000 08:02 797477 /usr/lib/libexpat.so.1.5.2 b7343000-b7345000 rw-p 00026000 08:02 797477 /usr/lib/libexpat.so.1.5.2 b7345000-b7349000 r-xp 00000000 08:02 201 /lib/libattr.so.1.1.0 b7349000-b734a000 rw-p 00003000 08:02 201 /lib/libattr.so.1.1.0 b734a000-b7350000 r-xp 00000000 08:02 12920 /lib/libacl.so.1.1.0 b7350000-b7351000 rw-p 00005000 08:02 12920 /lib/libacl.so.1.1.0 b7351000-b738f000 r-xp 00000000 08:02 797499 /usr/lib/libarchive.so.2.8.4 b738f000-b7390000 rw-p 0003d000 08:02 797499 /usr/lib/libarchive.so.2.8.4 b7390000-b7391000 rw-p 00000000 00:00 0 b7391000-b739e000 r-xp 00000000 08:02 802500 /usr/lib/libfetch.so b739e000-b739f000 rw-p 0000d000 08:02 802500 /usr/lib/libfetch.so b739f000-b73a0000 rw-p 00000000 00:00 0 b73a0000-b73b4000 r-xp 00000000 08:02 788249 /usr/lib/libz.so.1.2.5 b73b4000-b73b5000 rw-p 00013000 08:02 788249 /usr/lib/libz.so.1.2.5 b73b5000-b73b7000 r-xp 00000000 08:02 1343 /lib/libdl-2.13.so b73b7000-b73b8000 r--p 00001000 08:02 1343 /lib/libdl-2.13.so b73b8000-b73b9000 rw-p 00002000 08:02 1343 /lib/libdl-2.13.so b73b9000-b751c000 r-xp 00000000 08:02 790179 /usr/lib/libcrypto.so.1.0.0 b751c000-b7530000 rw-p 00162000 08:02 790179 /usr/lib/libcrypto.so.1.0.0 b7530000-b7533000 rw-p 00000000 00:00 0 b7533000-b7580000 r-xp 00000000 08:02 790180 /usr/lib/libssl.so.1.0.0 b7580000-b7584000 rw-p 0004d000 08:02 790180 /usr/lib/libssl.so.1.0.0 b7584000-b758b000 r-xp 00000000 08:02 11552 /lib/librt-2.13.so b758b000-b758c000 r--p 00006000 08:02 11552 /lib/librt-2.13.so b758c000-b758d000 rw-p 00007000 08:02 11552 /lib/librt-2.13.so b758d000-b75a2000 r-xp 00000000 08:02 1484 /lib/libpthread-2.13.so b75a2000-b75a3000 r--p 00014000 08:02 1484 /lib/libpthread-2.13.so b75a3000-b75a4000 rw-p 00015000 08:02 1484 /lib/libpthread-2.13.so b75a4000-b75a7000 rw-p 00000000 00:00 0 b75a7000-b76ec000 r-xp 00000000 08:02 1497 /lib/libc-2.13.so b76ec000-b76ed000 ---p 00145000 08:02 1497 /lib/libc-2.13.so b76ed000-b76ef000 r--p 00145000 08:02 1497 /lib/libc-2.13.so b76ef000-b76f0000 rw-p 00147000 08:02 1497 /lib/libc-2.13.so b76f0000-b76f3000 rw-p 00000000 00:00 0 b76f3000-b7714000 r-xp 00000000 08:02 797524 /usr/lib/libalpm.so.5.0.3 b7714000-b7715000 rw-p 00020000 08:02 797524 /usr/lib/libalpm.so.5.0.3 b7715000-b771b000 r-xp 00000000 08:02 823788 /usr/lib/libyajl.so.1.0.11 b771b000-b771c000 rw-p 00005000 08:02 823788 /usr/lib/libyajl.so.1.0.11 b771c000-b7769000 r-xp 00000000 08:02 789378 /usr/lib/libcurl.so.4.2.0 b7769000-b776b000 rw-p 0004c000 08:02 789378 /usr/lib/libcurl.so.4.2.0 b776e000-b7775000 rw-p 00000000 00:00 0 b7775000-b777e000 r-xp 00000000 08:02 11535 /lib/libnss_files-2.13.so b777e000-b777f000 r--p 00009000 08:02 11535 /lib/libnss_files-2.13.so b777f000-b7780000 rw-p 0000a000 08:02 11535 /lib/libnss_files-2.13.so b7780000-b7781000 rw-p 00000000 00:00 0 b7781000-b7785000 r-xp 00000000 08:02 11543 /lib/libnss_dns-2.13.so b7785000-b7786000 r--p 00004000 08:02 11543 /lib/libnss_dns-2.13.so b7786000-b7787000 rw-p 00005000 08:02 11543 /lib/libnss_dns-2.13.so b7787000-b7788000 rw-p 00000000 00:00 0 b7788000-b7789000 r-xp 00000000 00:00 0 [vdso] b7789000-b77a5000 r-xp 00000000 08:02 3559 /lib/ld-2.13.so b77a5000-b77a6000 r--p 0001b000 08:02 3559 /lib/ld-2.13.so b77a6000-b77a7000 rw-p 0001c000 08:02 3559 /lib/ld-2.13.so bfd75000-bfd96000 rw-p 00000000 00:00 0 [stack] /usr/lib/yaourt/basicfunctions.sh: line 12: 2194 Aborted package-query "${PKGQUERY_C_ARG[@]}" "$@" tuxce commented on 2011-01-27 21:32 @tezeriusz, at least read the comment before yours @FrozenCow, package-query doesn't need libstdc++5, (btw it's in C not C++) FrozenCow commented on 2011-01-27 00:38 For people getting the error while compiling: configure: error: C compiler cannot create executables Do: pacman -S libstdc++5 It is not in base-devel! This was not noted on the wiki page of yaourt. Will add it there too. tezeriusz commented on 2011-01-25 21:35 missing builddeps autoconf, automake and pkgconfig tuxce commented on 2010-12-10 09:16 pkg-config is part of base-devel. Please, read the warning. Anonymous comment on 2010-12-10 02:35 Please add dependency to pkg-config. autogen.sh generates malformed "configure" script without pkg-config (PKG_CHECK_MODULES macro in configure.ac is not expanded) dgbaley27 commented on 2010-12-05 14:33 Thanks pkg-query worked for me, but I don't think it's part of base-devel tuxce commented on 2010-12-02 13:56 @piezoelectric : pkg-config is part of base-devel, without it, I have the exact same error you have. dgbaley27 commented on 2010-12-02 02:57 yes, base-devel is fully installed tuxce commented on 2010-12-01 13:16 piezoelectric, Barone Rosso: did you install base-devel ? @zebulon, with 0.5.1 ? do you remember what you ran ? dgbaley27 commented on 2010-12-01 03:19 I keep getting this error on the same computer: > checking whether to link with libfetch... ./configure: line 11385: syntax error near unexpected token `LIBCURL,' > ./configure: line 11385: ` PKG_CHECK_MODULES(LIBCURL, libcurl)' > Aborting... and only on this one computer. I've tried doing things like reinstalling curl and libfetch. Has anyone dealt with this? zebulon commented on 2010-11-30 18:50 I just had this segfault: /usr/lib/yaourt/basicfunctions.sh: line 12: 5676 Erreur de segmentation package-query "${PKGQUERY_C_ARG[@]}" "$@" Unfortunately, I cannot reproduce it (it works well otherwise). Maybe a race condition or a problem with the threading? bred commented on 2010-11-30 05:54 checking for a BSD-compatible install... /bin/install -c I've this error: checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for gcc... gcc checking whether the C compiler works... no configure: error: in `/opt/packages/package-query/src/package-query-0.5.1': configure: error: C compiler cannot create executables See `config.log' for more details raw commented on 2010-11-29 22:30 if you get errors at compile-time, dont forget to install base-devel pacman -S base-devel raw commented on 2010-11-29 22:24 Missing build dependencies: automake, autoconf, pkg-config, libtool... [root@us-1 package-query]# raw commented on 2010-11-29 22:15 Missing build dependencies: automake, autoconf tuxce commented on 2010-11-29 19:59 you have to install ca-certificates or recompile package-query with --with-aur-url= (by default, it's https) Anonymous comment on 2010-11-29 19:36 0.5-1 package, no problem Anonymous comment on 2010-11-29 19:35 curl error: Peer certificate cannot be authenticated with known CA certificates tuxce commented on 2010-11-28 22:14 @umityakup, what's the error message ? tuxce commented on 2010-11-28 22:12 What's the error message ? silvik commented on 2010-11-28 22:06 that was fast tuxce! everything works fine for me now, with 0.5.1, no segfaults. thank you Anonymous comment on 2010-11-28 21:24 0.5.1-1 curl error continues. 0.5-1 package, no problem tuxce commented on 2010-11-28 18:09 Really sorry, 0.5.1 fix the segfault. silvik commented on 2010-11-28 15:52 on 64bits, when trying to install a package with yaourt I get this: looks like a problem with package-query Anonymous comment on 2010-11-27 12:04 /usr/lib/yaourt/basicfunctions.sh: line 12: 4946 Segmentation fault package-query "${PKGQUERY_C_ARG[@]}" "$@" Anonymous comment on 2010-11-27 09:29 Arch x86_64, multilib, no Proxy alorewotik commented on 2010-11-26 18:43 While updating: alorewotik commented on 2010-11-26 18:41 alorewotik commented on 2010-11-26 18:41 Anonymous comment on 2010-11-26 17:57 0.5-3 and 0.5-2 curl error packets in progress. 0.5-1 with no problem .. vnoel commented on 2010-11-26 15:59 works fine now :) archdria commented on 2010-11-26 15:46 Second update works, but the checksum should be: md5sums=('5dd7f4aa61b6e8bd9d8dcadd9a26c039') Thanks :) vnoel commented on 2010-11-26 14:09 Behind a proxy, I don't have such errors, it is just that aur is never connected to in the end! Anonymous comment on 2010-11-26 14:06 @ccc1: I don't think this a proxy related problem, because I'm direct connected to the internet here. PS. Sorry for the repetition in the posts, AUR is quite odd sometimes when deleting posts. ccc1 commented on 2010-11-26 13:33 @estevao: Same problem here. btw: i'm behind a proxy. Anonymous comment on 2010-11-26 13:23 This error too (it's random): Anonymous comment on 2010-11-26 13:20 Hi. I'm getting the following error on my machines (i686 and x86_64) after the upgrade to version 0.5-1: Thanks vnoel commented on 2010-11-26 12:50 Hi, doesn't work anymore behind a proxy! ender4 commented on 2010-11-21 02:12 I had actually already followed those instructions, and was still having trouble for wget, curl and package-query. I just tried all of these programs without explicitly disable IPv6 support (though it's disabled in the kernel), and they work. I honestly don't know why it didn't work before, or why it suddenly started working. tuxce commented on 2010-11-17 12:31 Ok I was wrong, curlrc is not parsed by libcurl. Since you have the same issue with other softs, I think disabling ipv6 () would be a better solution, no? ender4 commented on 2010-11-16 21:56 I tried adding "-4" to ~/.curlrc, that got the curl executable working, but not package-query. Does libcurl not read the ~/.curlrc, and if it does, why was I still having problems? tuxce commented on 2010-11-16 20:49 Install base-devel. Anonymous comment on 2010-11-16 19:59 I get this on one of my computers: checking whether to link with libfetch... ./configure: line 11385: syntax error near unexpected token `LIBCURL,' ./configure: line 11385: ` PKG_CHECK_MODULES(LIBCURL, libcurl)' I tried reinstalling libfetch but that's not the issue it seems. tuxce commented on 2010-11-15 22:19 how about adding "-4" in ~/.curlrc ? ender4 commented on 2010-11-15 16:46 package-query, (and therefore yoaurt) were not able to access AUR for me, giving a "unable to resolve hostname" error. After some investigation, I discovered that disabling IPv6 for curl in aur.c fixed the problem. The solution didn't surprise me, since I had to disable ipv6 to get konqueror to access any website, and I had to add the -4 option to wget to get that to work. I suspect the real problem is a little bit deeper, but the following patch is at least a temporary solution: Anonymous comment on 2010-11-09 17:35 worked! reinstalled the pacman, who created the file /usr/lib/libalpm.so Thanks tuxce commented on 2010-11-09 17:01 you should also have: libalpm.so (libc6,x86-64) => /usr/lib/libalpm.so $ pacman -Qo /usr/lib/libalpm.so /usr/lib/libalpm.so is owned by pacman 3.4.1-1 Anonymous comment on 2010-11-09 15:39 ldconfig -p | grep alpm libalpm.so.5 (libc6,x86_64) => /usr/lib/libalpm.so.5 ldd /usr/bin/pacman | grep alpm libalpm.so.5 => /usr/lib/libalpm.so.5 (0x00007f2aeb7f20000) ps: You are in a chroot ? => No tuxce commented on 2010-11-09 15:18 > configure:11275: gcc -o conftest -march=x86-64 -mtune=generic -O2 -pipe -Wl,--hash-style=gnu -Wl,--as-needed conftest.c -lalpm >&5 > /usr/bin/ld: cannot find -lalpm You are in a chroot env or something similar ? what's the output of: ldconfig -p | grep alpm ldd /usr/bin/pacman | grep alpm Anonymous comment on 2010-11-09 14:05 tuxce commented on 2010-11-06 12:09 Could you pastebin the config.log please ? Anonymous comment on 2010-11-05 16:11 Error: configure error: pacman is needed to compile package-query I have pacman 3.4.1 installed. baghera commented on 2010-10-31 21:07 No, check this Read the warning highlighted in pink. Anonymous comment on 2010-10-31 20:52 I too had the problem "Can't exec "aclocal"..." that was solved by installing base-devel. If 'base-devel' (just just automake?) is a required dependency, should it not be listed in the PKGBUILD's depends()? Anonymous comment on 2010-10-28 18:05 Thanks for the advice, package-query & yaourt updated and working well. I had base-devel installed but automake seemed to have gone missing for some reason. baghera commented on 2010-10-28 07:51 aclocal is included in automake, install it. BTW, you should consider installing the whole base-devel group, or you will face problems like this again. Anonymous comment on 2010-10-28 07:49 Hi, I am trying to update package-query and get the following error: Can't exec "aclocal": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326. autoreconf: failed to run aclocal: No such file or directory Aborting... baghera commented on 2010-10-27 07:11 0.4 works properly here. Did you update? mortzu commented on 2010-10-27 06:52 seems not to work with the default https of aur.archlinux.org baghera commented on 2010-06-27 09:53 gcc is part of base-devel group, installing that group is a requirement to build anything on arch. Almost every package would depend on gcc (or other pkg included in base-devel), that's why base-devel has been created. Long story short: gcc should not be listed as makedep. lifo2 commented on 2010-06-27 09:47 Missing build dependency gcc. Building without it installed produce a tar.gz containing only the man page ! baghera commented on 2010-06-26 15:05 @ menollo Adding || return 1 is no longer required since pacman 3.4.0, since pacman aborts automatically with any errors during packaging. || return 1 should be removed from every PKGBUILD since it's redundant. menollo commented on 2010-06-24 14:22 you should add || return 1 after the make command I tried to build it on a fresh install without gcc, it created an emtpy package instead of giving an error about gcc... Anonymous comment on 2010-06-19 20:51 tuxce, thanks. Well works. tuxce commented on 2010-06-19 00:04 libalpm.so.5 is part of pacman 3.4 You installed pacman from testing, builded package-query then downgraded pacman ... You just have to rebuild package-query Anonymous comment on 2010-06-18 23:08 after latest update package-query: package-query: error while loading shared libraries: libalpm.so.5: cannot open shared object file: No such file or directory Anonymous comment on 2010-06-18 11:00 this will require a rebuild with the new pacman 3.4.0 from testing alium commented on 2010-06-17 06:54 after update pacman 3.4.0: package-query: error while loading shared libraries: libalpm.so.4: cannot open shared object file: No such file or directory alium commented on 2010-06-17 06:37 after update pacman 3.4.0: package-query: error while loading shared libraries: libalpm.so.4: cannot open shared object file: No such file or directory tuxce commented on 2010-06-07 20:17 make and gcc are part of base-devel group. This group is assumed already installed when building from AUR. Anonymous comment on 2010-06-07 19:52 please add make and gcc as makedepends :) tuxce commented on 2010-06-02 11:00 The error message is not clear enough ? Anonymous comment on 2010-06-02 10:34 curl error: Couldn't connect to server tuxce commented on 2010-04-05 13:30 @Mahara, I don't understand, something wrong ? It's just a warning (an int instead of size_t in a function return) Anonymous comment on 2010-04-04 21:02 ==> Starting build()... gcc -Wall -march=x86-64 -mtune=generic -O2 -pipe -c -o aur.o aur.c aur.c: In function ‘aur_request’: aur.c:373: warning: call to ‘_curl_easy_setopt_err_write_callback’ declared with attribute warning: curl_easy_setopt expects a curl_write_callback argument for this option gcc -Wall -march=x86-64 -mtune=generic -O2 -pipe -c -o alpm-query.o alpm-query.c gcc -Wall -march=x86-64 -mtune=generic -O2 -pipe -c -o util.o util.c gcc -Wall -march=x86-64 -mtune=generic -O2 -pipe -c -o package-query.o package-query.c gcc -Wall *.o -o package-query -lalpm -lyajl -lcurl install -m 755 package-query /home/alex/Downloads/package-query/pkg/usr/bin/package-query tuxce commented on 2010-03-27 16:54 It's an error of gcc, not package-query, you updated gmp and not gcc. -> pacman -Syu bsdson commented on 2010-03-27 13:41 ==> Starting build()... gcc -Wall -march=i686 -mtune=generic -O2 -pipe -c -o aur.o aur.c /usr/lib/gcc/i686-pc-linux-gnu/4.4.3/cc1: error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory make: *** [aur.o] Error 1 ==> ERROR: Build Failed. Aborting... Error: Makepkg was unable to build package-query package.
https://aur.archlinux.org/packages/package-query/?ID=35915&detail=1&comments=all
CC-MAIN-2016-22
refinedweb
17,876
59.3
asdfsddf sefafasfdaf 2008-10-02 using eclipse 3.3 I installed pydev and configured it for jython. Code completion doesn't show me the jython javadocs though. i.e. if you were to look at this pic: I can see the green box but not the yellow box to it's right with the text. How do I import the javadocs? Fabio Zadrozny 2008-10-03 Actually, pydev gets most of it by reflection using a shell... but in the case of Jython: import StringIO print StringIO.StringIO.__doc__ None while in Python: import StringIO print StringIO.StringIO.__doc__ class StringIO([buffer]) When a StringIO object is created, it can be initialized to an existing string by passing the string to the constructor. If no string is given, the StringIO will start. So, it's not really a Pydev issue, but a Jython issue at this level... Cheers, Fabio asdfsddf sefafasfdaf 2008-10-06 I installed python 2.6 and the javadocs are working properly for that perspective- still working on jython docs. Now I have a jython project and a python project. For code completion, why are the icons for jython functions showing as a red square(builtin), but for python 2.6 the icon is a green circle(local/imported?)? I created the similar projects for both interpreters, and used the same line of code. dict = {"key1":"val1"} In python, the code completion for dict.keys completes to dict.keys(). In jython it completes to dict.keys, no brackets. Fabio Zadrozny 2008-10-13 That's because the introspection for jython is not as good as the instrospection in python... Also, when completing java classes, it tries to use the icons that JDT gives and be consistent with what you have in java. Cheers, Fabio
http://sourceforge.net/p/pydev/discussion/293649/thread/a9f6f248
CC-MAIN-2015-11
refinedweb
297
76.52
Tracing stack and heap overflow errors Warning This article is outdated. For the latest version of this article, see Tracking memory usage with Mbed OS. If you have ever seen the lights of dead on your development board, accompanied by an RTX error code: 0x00000001 or Operator new out of memory message on the serial port, you have hit a memory overflow bug. Memory management remains a difficult problem on microcontrollers. Not only is memory limited, but also microcontrollers do not have an MMU and therefore cannot move memory blocks around without changing addresses. This lack of virtual memory means you have to have fixed stack sizes, so you can run into a stack overflow error even when there is still RAM available. To monitor and debug memory overflow issues, mbed OS 5 provides runtime statistics for stack and heap usage. To make it easier to dynamically use these runtime statistics, Max Vilimpoc - embedded software lead at unu GmbH in Germany - released the mbed-memory-status library, which this blog post uses to analyse and debug both a stack overflow and a heap allocation error. In addition, this post shows how you use Max's library to track usage of the ISR stack, which the mbed OS 5 runtime statistics do not provide. Adding mbed-memory-status to your project If you're using the online compiler: - Right-click on your project. - Choose Import Library > From URL. - Under 'Source URL', enter: - Click Import. If you're using mbed CLI, run: $ mbed add Enabling runtime statistics Open or create the mbed_app.json file, and fill it with: { "macros": ["DEBUG_ISR_STACK_USAGE=1", "MBED_HEAP_STATS_ENABLED=1", "MBED_STACK_STATS_ENABLED=1"] } This enables stack, heap and ISR stack statistics. Note: If you're using the online compiler, remove the DEBUG_ISR_STACK_USAGE=1 macro. ISR statistics The ISR stack is not covered by the mbed OS runtime statistics but is an extension made by the mbed-memory-status library. Tracking works like this: - The library registers a function in the startup (*.S) script for the application. - This function fills the ISR stack with placeholder values ( 0xAFFEC7ED) but without affecting the stack pointer. - When requesting the available space on the ISR stack, the code inspects the memory reserved for the ISR stack and sees which part of the memory has not changed. To enable these statistics, you'll need to modify the startup script for your development board. This only works if you're compiling locally with GCC, not in the online compiler. Instructions are here. Note: This approach unfortunately does not track freed memory. Viewing memory regions Now that you have enabled runtime statistics, you can view the memory regions. This is useful because it gives you insight in the threads that are running, the stack sizes of these threads and the available heap memory. This is especially useful when debugging stack overflow errors because it shows the memory regions and thread IDs. To view the running threads and the heap and ISR stack sizes, add these lines to your main() function: #include "mbed_memory_status.h" int main() { print_all_thread_info(); print_heap_and_isr_stack_info(); For mbed-os-example-blinky compiled with GCC_ARM, running on a FRDM-K64F this results in the following output: stack ( start: 20002690 end: 200029B0 size: 00000320 used: 00000070 ) thread ( id: 200029F8 entry: 00002E8D ) stack ( start: 20000B7C end: 20001B7C size: 00001000 used: 00000098 ) thread ( id: 20002A38 entry: 000025F1 ) stack ( start: 20002DC8 end: 20002FC8 size: 00000200 used: 00000040 ) thread ( id: 2000301C entry: 00002639 ) heap ( start: 20003130 end: 2002F000 size: 0002BED0 used: 00000000 ) alloc ( ok: 00000000 fail: 00000000 ) isr_stack ( start: 2002F000 end: 20030000 size: 00001000 used: 00000400 ) You see three threads running, their memory regions and the amount of stack space used. To see what these threads are, you can inspect the .elf file (on a debug build) via: arm-none-eabi-nm mbed-os-example-blinky.elf Looking for entries with offset entry minus 1 (Why minus 1?): 00002e8c T osTimerThread 000025f0 T pre_main 00002638 T os_idle_demon Debugging a stack overflow error Now that you know which threads are running and the memory space that they are using, you can trigger a stack overflow error. The following program overflows the stack size of the main thread ( 0x1000 bytes on the K64F) after a second: #include "mbed.h" #include "mbed_memory_status.h" int main() { uint8_t big_arr[1024]; for (size_t ix = 0; ix < sizeof(big_arr); ix++) big_arr[ix] = ix; // fill the memory print_all_thread_info();)]); } } When you run this application, it first prints out the thread list and crashes immediately after. stack ( start: 20000B7C end: 20001B7C size: 00001000 used: 00000FFC ) thread ( id: 20002A38 entry: 00002575 ) RTX error code: 0x00000001, task ID: 0x20002A38 You can now look in the nm output to see which thread was responsible for crashing. This already helps pinpoint the problem, and by carefully placing print_all_thread_info() calls around your code, you can find out where the allocation fails quickly. Unfortunately, a debugger does not help much in this scenario because this causes a stack corruption. Even when you set a watchpoint at the end of the stack, or break in the error handling code, the stack is corrupt, and you cannot backtrace. Note: To prevent applications from continuing when stack corruption occurs, mbed OS 5 has a 'stack canary'. It's located in rt_System.c. Mitigating this problem To deal with this problem, you can either: - Move items from stack to the heap by replacing stack allocations with malloc. - Increase the size of the stack. The best way of dealing with this issue depends on your setup. When you want to increase the stack size, you can either change the default stack size for threads (via the OS_STKSIZE macro) or spin up a new thread with the required stack size. The first option affects all your threads and thus is less recommended, and the second option is more flexible but requires you to allocate an extra thread. You can run the example above in a new thread with a bigger stack size like this: #include "mbed.h" #include "mbed_memory_status.h" void fn_that_requires_big_stack() { uint8_t big_arr[1024]; for (size_t ix = 0; ix < sizeof(big_arr); ix++) big_arr[ix] = ix; // fill the array)]); } } int main() { Thread t(osPriorityNormal, 8 * 1024 /* 8K stack */); t.start(&fn_that_requires_big_stack); print_all_thread_info(); wait(osWaitForever); } When you run this application, you now see an extra thread with a stack size of 8K, of which 4.2K is used. stack ( start: 20002690 end: 200029B0 size: 00000320 used: 00000070 ) thread ( id: 200029F8 entry: 000031F1 ) stack ( start: 20000B74 end: 20001B74 size: 00001000 used: 00000104 ) thread ( id: 20002A38 entry: 00002815 ) stack ( start: 20003140 end: 20005140 size: 00002000 used: 00001070 ) thread ( id: 20002A78 entry: 00002515 ) stack ( start: 20002DC8 end: 20002FC8 size: 00000200 used: 00000040 ) thread ( id: 2000301C entry: 0000279D ) The third entry is the new thread. Debugging a heap allocation error When the heap is full, you either see malloc() fail, or you see the Operator new out of memory runtime error. You can use the same library to also track heap usage. This program fills up the heap using malloc() calls and then creates a new DigitalOut object, triggering the runtime error after a few seconds. #include "mbed.h" #include "mbed_memory_status.h" int main() { print_all_thread_info(); print_heap_and_isr_stack_info(); size_t malloc_size = 16 * 1024; while (true) { wait(0.2); // fill up the memory void* ptr = malloc(malloc_size); printf("Allocated %d bytes (success %d)\n", malloc_size, ptr != NULL); if (ptr == NULL) { malloc_size /= 2; print_heap_and_isr_stack_info(); } // and then allocate an object on the heap DigitalOut* led = new DigitalOut(LED1); } } By printing the heap information, you can quickly see how each operation affects the amount of free memory on the heap. Allocated 2048 bytes (success 1) heap ( start: 20003130 end: 2002F000 size: 0002BED0 used: 0002AC3C ) alloc ( ok: 0000001D fail: 00000003 ) Allocated 2048 bytes (success 0) heap ( start: 20003130 end: 2002F000 size: 0002BED0 used: 0002AC40 ) alloc ( ok: 0000001E fail: 00000004 ) Allocated 1024 bytes (success 0) heap ( start: 20003130 end: 2002F000 size: 0002BED0 used: 0002AC44 ) alloc ( ok: 0000001F fail: 00000005 ) ... snip ... Allocated 128 bytes (success 1) heap ( start: 20003130 end: 2002F000 size: 0002BED0 used: 0002ACD0 ) alloc ( ok: 00000023 fail: 00000007 ) Allocated 128 bytes (success 0) heap ( start: 20003130 end: 2002F000 size: 0002BED0 used: 0002ACD4 ) alloc ( ok: 00000024 fail: 00000008 ) Operator new out of memory After a while, the system cannot declare a new DigitalOut object on the heap anymore, and the program throws a runtime error. A quick way to debug these errors is by attaching a debugger to your application and setting breakpoints in the operator new and operator new[] functions of mbed_retarget.cpp. Debugging OOM errors on the heap in Visual Studio Code This log information can also help when you want to determine whether you're leaking memory anywhere. You can run the logger in a separate thread and periodically print the heap memory used. If you see this increase over time, you may want to see if you forgot to free some objects. Conclusion Memory issues remain one of the most annoying problems when developing for small microcontrollers, but with the addition of runtime statistics in mbed OS 5, it becomes easier to find these bugs. It's especially great to see the community using these statistics in new libraries to better analyze problems while running the application. - Jan Jongboom is Developer Evangelist IoT, and he has debugged far too many memory leaks. You need to log in to post a discussion Questions 4 years, 1 month ago 4 years, 4 months ago
https://os.mbed.com/blog/entry/Tracing-stack-and-heap-overflow-errors/
CC-MAIN-2021-31
refinedweb
1,557
58.21
(Prototype) Use iOS GPU in PyTorch¶ Introduction¶ This tutorial introduces the steps to run your models on iOS GPU. We’ll be using the mobilenetv2 model as an example. Since the mobile GPU features are currently in the prototype stage, you’ll need to build a custom pytorch binary from source. For the time being, only a limited number of operators are supported, and certain client side APIs are subject to change in the future versions. Model Preparation¶ Since GPUs consume weights in a different order, the first step we need to do is to convert our TorchScript model to a GPU compatible model. This step is also known as “prepacking”. To do that, we’ll build a custom pytorch binary from source that includes the Metal backend. Go ahead checkout the pytorch source code from github and run the command below cd PYTORCH_ROOT USE_PYTORCH_METAL=ON python setup.py install --cmake The command above will build a custom pytorch binary from master. The install argument simply tells setup.py to override the existing PyTorch on your desktop. Once the build finished, open another terminal to check the PyTorch version to see if the installation was successful. As the time of writing of this recipe, the version is 1.8.0a0+41237a4. You might be seeing different numbers depending on when you check out the code from master, but it should be greater than 1.7.0. import torch torch.__version__ #1.8.0a0+41237a4 The next step is going to be converting the mobilenetv2 torchscript model to a Metal compatible model. We’ll be leveraging the optimize_for_mobile API from the torch.utils module. As shown below import torch import torchvision from torch.utils.mobile_optimizer import optimize_for_mobile model = torchvision.models.mobilenet_v2(pretrained=True) scripted_model = torch.jit.script(model) optimized_model = optimize_for_mobile(scripted_model, backend='metal') print(torch.jit.export_opnames(optimized_model)) torch.jit.save(optimized_model, './mobilenetv2_metal.pt') Note that the torch.jit.export_opnames(optimized_model) is going to dump all the optimized operators from the optimized_mobile. If everything works well, you should be able to see the following ops being printed out from the console ['aten::adaptive_avg_pool2d', 'aten::add.Tensor', 'aten::addmm', 'aten::reshape', 'aten::size.int', 'metal::copy_to_host', 'metal_prepack::conv2d_run'] Those are all the ops we need to run the mobilenetv2 model on iOS GPU. Cool! Now that you have the mobilenetv2_metal.pt saved on your disk, let’s move on to the iOS part. Use C++ APIs¶ In this section, we’ll be using the HelloWorld example to demonstrate how to use the C++ APIs. The first thing we need to do is to build a custom LibTorch from Source. Make sure you have deleted the build folder from the previous step in PyTorch root directory. Then run the command below IOS_ARCH=arm64 USE_PYTORCH_METAL=1 ./scripts/build_ios.sh Note IOS_ARCH tells the script to build a arm64 version of Libtorch. This is because in PyTorch, Metal is only available for the iOS devices that support the Apple A9 chip or above. Once the build finished, follow the Build PyTorch iOS libraries from source section from the iOS tutorial to setup the XCode settings properly. Don’t forget to copy the ./mobilenetv2_metal.pt to your XCode project. Next we need to make some changes in TorchModule.mm // #import <Libtorch-Lite.h> // If it's built from source with xcode, comment out the line above // and use following headers #include <torch/csrc/jit/mobile/import.h> #include <torch/csrc/jit/mobile/module.h> #include <torch/script.h> - (NSArray<NSNumber*>*)predictImage:(void*)imageBuffer { torch::jit::GraphOptimizerEnabledGuard opguard(false); at::Tensor tensor = torch::from_blob(imageBuffer, {1, 3, 224, 224}, at::kFloat).metal(); auto outputTensor = _impl.forward({tensor}).toTensor().cpu(); ... } As you can see, we simply just call .metal() to move our input tensor from CPU to GPU, and then call .cpu() to move the result back. Internally, .metal() will copy the input data from the CPU buffer to a GPU buffer with a GPU compatible memory format. When .cpu() is invoked, the GPU command buffer will be flushed and synced. After forward finished, the final result will then be copied back from the GPU buffer back to a CPU buffer. The last step we have to do is to add the Accelerate.framework and the MetalShaderPerformance.framework to your xcode project. If everything works fine, you should be able to see the inference results on your phone. The result below was captured from an iPhone11 device - timber wolf, grey wolf, gray wolf, Canis lupus - malamute, malemute, Alaskan malamute - Eskimo dog, husky You may notice that the results are slighly different from the results we got from the CPU model as shown in the iOS tutorial. This is because by default Metal uses fp16 rather than fp32 to compute. The precision loss is expected. Conclusion¶ In this tutorial, we demonstrated how to convert a mobilenetv2 model to a GPU compatible model. We walked through a HelloWorld example to show how to use the C++ APIs to run models on iOS GPU. Please be aware of that GPU feature is still under development, new operators will continue to be added. APIs are subject to change in the future versions. Thanks for reading! As always, we welcome any feedback, so please create an issue here if you have any. Learn More¶ - The Mobilenetv2 from Torchvision - To learn more about how to use optimize_for_mobile, please refer to the Mobile Perf Recipe
https://pytorch.org/tutorials/prototype/ios_gpu_workflow.html
CC-MAIN-2021-31
refinedweb
900
58.69
Function generators¶ Many situations in ACQ4 ask the user to define a waveform that will be sent to an analog or digital channel on a DAQ device. For this purpose, ACQ4 uses a general-purpose function generator control accompanied by a plot displaying the output of the generator: Function generators have two modes of operation: - Simple mode allows the construction of waveforms by selecting one or more elements to add to the waveform and adjusting the parameters for each element. This mode is rather limited in its capabilities (currently, the output may be the sume of one or more square pulses or pulse trains), but is simple to use and generates a metadata structure that can be easily parsed by analysis software. - Advanced mode allows the user to enter a Python expression that will be evaluated to yield the waveform output. This mode is far more flexible in the types of waveform it can generate, but requires some minimal knowledge of the Python language. In some cases, it also presents a difficult analysis problem because a single waveform may be specified in many different ways. The result is that analysis software may be required to either parse complex Python statements or directly analyze the waveform to determine the stimulation parameters used. All function generators have the following controls: - Enable function is used to enable or disable the function generator output. In the context of the Task Runner, a disabled channel is simply ignored when configuring the DAQ to execute a task. - Display specifies whether the functions generated should be plotted. - Advanced determines whether the function generator is operating in advanced or simple mode. - ? can be pressed to display reference documentation related to the function generator. - ! can be pressed to display error information about the current function being generated. - Update causes the function generator output to be replotted. - Auto causes updates to be processed automatically when changes are made to the function. Simple mode¶ In simple mode, the generator displays a dropdown menu labeled Add Stimulus. Selecting an item from the list causes a new instance of that item to be added to the total waveform. Multiple items may be added to build up more complex waveforms. Each item is added with a unique name and may be renamed or removed by right-clicking on this name. Currently, only two item types are supported in simple mode: Pulse and Pulse train. Pulse adds a single square pulse to the waveform. It has four parameters that may be set to define the shape of the pulse: - start determines the time of the beginning of the pulse. - length determines the duration of the pulse. - amplitude determines the amplitude of the pulse from baseline. - sum determines the integral of the pulse amplitude over time. These four parameters overspecify the shape of the pulse. Thus, changing length or amplitude will also cause the sum to change. By default, changing the sum causes length to change accordingly. However, the sum parameter includes a sub-parameter affect that determines this behavior. Sub-parameters may be accessed by clicking the triangle or + icon adjacent to the parameter name. Pulse train adds a sequence of square pulses to the waveform. Its parameters are as follows: - start determines the time of the beginning of the first pulse. - length determines the duration of each pulse. - amplitude determines the amplitude of each pulse from baseline. - sum determines the integral of each pulse amplitude over time. - period determines the duration from the start of one pulse to the start of the next. - pulse_number determines the number of pulses in the train. The length, amplitude, and sum parameters have the same behavior as described above for Pulse. Waveform sequences¶ Function generators are also used to design sequences of waveforms with one or more parameters that vary for each point in the sequence. In simple mode, each of the paraneters that define a waveform element may be expanded to reveal a set of sequencing controls that determine whether and how a parameter should be handled in a sequence: Sequences may be specified either as a range or a list. If range is selected, then several parameters are shown which determine how the sequence is constructed: - start is the first value in the sequence. - stop is the last value in the sequence. - steps is the number of values in the sequence. - log spacing indicates whether the intervals between sequence values are linear or logarithmic. - randomize indicates whether the order of the sequence should be shuffled. Alternately, selecting list gives a simple text box in which a comma-separated list of values may be specified. The waveform is generated once for each value in the sequence and plotted in grey. For example, the figure above shows a pulse that sequences its amplitude logarithmically from 1 mV to 100 mV in 10 steps. The red plot line shows the function evaluated using the default parameters for all values (in this case, 100 mV), ignoring any sequence specifications. If multiple parameters are sequenced, then the function is generated once per combination of sequence values. In the context of the Task Runner sequencing system, each sequenced parameter creates a new entry in the sequence parameter list. When Test or Record Sequence is clicked there, the task is executed once for each combination of sequence values (grey plot lines). When Test Single or Record Single is clicked, the task is executed only once using the default values (red plot line). Advanced mode¶ Clicking the Advanced button causes the user interface to display a text box in which a python expression or statements may be written. If a waveform was already specified in simple mode, then clicking Advanced will automatically generate an equivalent function (but note that the translation does not work in the opposite direction; changes made in advanced mode will not carry over when switching back to simple mode). If a Python expression is supplied, it must evaluate to a NumPy array with the correct number of samples. Alternatively, multiple Python statements may be given, ending in a return statement that returns the output array. The values in the array must always be expressed as unscaled units (eg. amperes instead of nano- or picoamperes). This is done to avoid any ambiguity about the required scaling in different contexts. The environment for evaluating the function is defined as follows: Global variables nPtsand rateare defined indicating the required number of points and sample rate. ACQ4’s unit symbols are imported into the global namespace, allowing the code to be written unambiguously with more ‘naturally’ scaled values. NumPy is imported as ‘np’ in the global namespace. This provides a large collection of array and numerical functions. Several convenience functions are defined that simplify the construction of common waveform components: - **steps**(times, values, [base=0.0]) - **pulse**(times, widths, values, [base=0.0]) - **sineWave**(period, amplitude=1.0, phase=0.0, start=0.0, stop=None, base=0.0) - **squareWave**(period, amplitude=1.0, phase=0.0, duty=0.5, start=0.0, stop=None, base=0.0) - **sawWave**(period, amplitude=1.0, phase=0.0, start=0.0, stop=None, base=0.0) - **listWave**(period, values, phase=0.0, start=0.0, stop=None, base=0.0) More information about these functions is available by clicking the ? button at the bottom of the function generator. The Add Sequence Parameter button creates a new global variable which may be used in the function. In the example figure above, the Pulse_amplitude variable is automatically sequenced from 1 mV to 100 mV in 10 logarithmically-spaced steps. Specifying the sequence values to use works almost exactly the same as described above for simple mode. The only major difference is that the values entered for each parameter are also evaluated as python expressions. Example advanced mode functions¶ Square pulse waveform using the built-in pulse function: pulse(times=10*ms, widths=5*ms, values=-10*mV) The same square pulse waveform, done without the built-in pulse function: data = np.zeros(nPts) start = 10*ms * rate stop = start + 5*ms * rate data[start:stop] = -10*mV return data Load waveform from binary data file: np.fromfile('stim.dat', dtype=np.float32) Stored data format¶ Function generators create a standard metadata format that describes all of the parameters it uses when constructing the output waveform. Devices and modules that store data based on a function generator will usually store this metadata structure as well. The structure follows: - stimuli: A hierarchy of parameters describing each of the simple-mode components that constructed the complete waveform, including the names of the components, their configuration parameters, and any sequencing settings. - function: The python code that was used to generate the waveform. - params: The sequence parameters that were used with the Python function. - advancedMode: (bool) whether the function generator was being used in advanced mode.
http://acq4.org/documentation/userGuide/userInterface/functionGenerator.html
CC-MAIN-2019-13
refinedweb
1,473
55.34
In today’s Programming Praxis, our task is to enumerate all the non-palindrome prime numbers that are still prime when their digits are reversed. Let’s get started, shall we? Since we are to focus on maximum speed, the obvious choice is to use a library. import Data.Numbers.Primes I tried a couple different versions, and settled on a simple filter. This version can calculate all the emirps under one million in about 650 ms. One other version where the isPrime test was replaced by first putting all the primes in a Set and doing membership testing was a fraction faster (about 10 ms), but it is about twice as long and requires specifying the maximum up front, which is less convenient then the current infinite stream. I also tried to make it faster via parallelism, but I could only get it to go slower, so it looks like the benefits of doing everything in parallel don’t weigh up against the additional overhead. Or maybe I’m just not using the library right. emirps :: [Integer] emirps = [p | p <- primes, let rev = reverse (show p) , isPrime (read rev), show p /= rev] All that’s left is to print all the emirps under a million. main :: IO () main = print $ takeWhile (< 1000000) emirps As mentioned, just evaluating the list takes about 650 ms, which is about the same as the Scheme version. Tags: bonsai, code, emirps, Haskell, kata, praxis, primes, programming November 3, 2010 at 3:46 pm | Hi, You use the Data.Numbers.Primes package, but if you did your own prime numbers generation, would the bench be horrible ? ++ greg November 3, 2010 at 6:35 pm | That would depend on the algorithm used. Obviously a naive algorithm, like the one I used in the previous exercise, is going to be pretty slow. I tried using the basic wheel factorization method from (Data.Numbers.Primes also relies on wheel factorization, albeit a more complex version) and it calculates the whole list in about 1.5 seconds. That’s on a different computer than the original solution though, so the two aren’t directly comparable. Still, it’s not too far off and that’s with an algorithm that hasn’t exactly been optimized for speed (for instance, my primes function was simply 2 : filter isPrime [3,5..]). So the short answer is no, it wouldn’t be a whole lot worse. But why bother reinventing the wheel (factorization)? 🙂 November 3, 2010 at 9:54 pm | I was looking for comments/tips about an efficient implementation of the prime numbers generation, and you answered it well. And I agree, no need to reinvent the wheel 😀 (good one ;)) Thanks again Greg
https://bonsaicode.wordpress.com/2010/11/02/programming-praxis-emirps/
CC-MAIN-2017-30
refinedweb
450
68.7
Introduction to Applications Graphics Device Contexts Introduction to GDI Microsoft Windows is a graphics-oriented operating system. It uses shapes, pictures, lines, colors, and various types of options to convey the impression of physical objects. When we stare at a flat screen built in front of a monitor filled with insignificant wires, we believe that we are looking at physical buildings or real people. This is done through smart and effective representations that have made computer use nowadays become fun and useful. To support the ability to represent pictures and other visual features, Microsoft in the beginning provided a library called the Graphical Device Interface or GDI. To face the new requirements as computer use became more and more demanding, Microsoft upgraded the GDI to GDI+. GDI+ is the graphical library used in the .NET Framework. You use GDI to draw shapes and/or display pictures in your application. Introduction to Device Contexts To draw something, you need a platform on which to draw and one or a few tools to draw with. The most common platform on which to draw is probably a piece of paper. Besides such a platform, you may need a pen or a brush that would show the evolution of the drawing work on the platform. Since a pen can have or use only one color, depending on your goal, one pen may not be sufficient, in which case you would end up with quite a few of them. A device context is an ensemble of the platform you draw on and the tools you need to draw with. It also includes the dimensioning of the platform, the orientation and other variations of your drawing, the colors, and various other accessories that you can use to express your imagination. When using a computer, you certainly cannot position tools on the table or desktop to use as needed. To help with drawing on the Windows operating system, Microsoft created the Graphical Device Interface, abbreviated as GDI. It is a set of classes, functions, variables, and constants that group all or most of everything you need to draw on an application. GDI is provided as a library called Gdi.dll and is already installed on your computer. The GDI+ Library GDI+ is the system used to perform drawing and other related graphics operations for the Microsoft Windows family of operating systems. Its predecessor was the Graphical Device Interface (GDI), which has therefore been replaced, namely with the new operating systems such as Windows XP, Windows Server 2003, or Windows Vista. The + in GDI+ indicates that it provides a significant improvement to GDI. It adds new features that were not available in GDI and were therefore difficult to produce. GDI+ allows you to create device-independent applications without worrying about the hardware on which the application would run. GDI+ is inherently installed in Microsoft Windows XP, Windows Server 2003, drawings is called a graphic. In most cases, this object is not readily available when you need it: you must request it from the object on which you want to draw or you must create it. Both operations are highly easy. Getting a Graphic Object In GDI+, a graphic object is based on a class called Graphics. This class is defined in the System.Drawing namespace. Before drawing, you should obtain a graphic object. Fortunately, every Windows control, that is, every object based on the Control class, automatically inherits a method called CreateGraphics(), which gives you access to the graphic part of a control. The syntax of the Control.CreateGraphics() method is: public Graphics CreateGraphics(); As you can see, the CreateGraphics() method returns the Graphics object of the variable you call it from. Here is an example of getting the Graphics object of a form: private void button1_Click(object sender, EventArgs e) { Graphics graph = CreateGraphics(); } Another technique you can use to get the Graphics object of a control is to call the Graphics.FromHwnd() static method. Its syntax is: public static Graphics FromHwnd(IntPtr hwnd); Remember that this method is static. The argument passed to it must be a handle to the object whose Graphics object you want to access. Every Windows control has a handle called Handle. Here is an example of using it to get the Graphics part of a form: for different shapes. Each method used to draw something has a name that starts with Draw... Also, each method that is used to draw a known shape requires a Pen argument. Therefore, when drawing, your first decision will be based on the shape or type of figure you want to draw..
http://functionx.com/vcsharp/gdi/introduction.htm
CC-MAIN-2018-34
refinedweb
765
61.67
Python package for using the Urban Airship Reach API Project DescriptionRelease History Download Files About The Urbanairship uareach (formerly known as wallet) library is a Python library for using the Urban Airship Reach web service API. Version 0.1.0 is a beta release. Please visit Urban Airship Support with questions or comments. Running Tests To run tests, run: $ nosetests Usage To get started, simply import the library and set up a client: import uareach as ua client = ua.Reach('email', 'wallet_key') # Example: getting a pass my_pass = ua.get_pass(client, pass_id=12345) For more details on using the library, please see the full documentation, as well as the Urban Airship API Documentation. Download Files Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
https://pypi.org/project/uareach/
CC-MAIN-2017-43
refinedweb
133
64.1
Wikipedia:Miscellany for deletion From Wikipedia, the free encyclopedia Miscellany for deletion (MfD) is a place where Wikipedians decide what should be done with problematic pages in the namespaces outside the main namespace (also called the "article namespace") which aren't covered by other specialized deletion discussion areas. Items sent here are usually discussed for seven days; then they are either deleted by an administrator or kept, based on community consensus (determined using the discussion as a guideline). [edit] Introduction The only currently-used namespaces in which pages are eligible for deletion here are: - Portal: - MediaWiki: - Wikipedia: - This includes WikiProjects, although it is usually preferable to either mark the Project as historical or change it to a task force of the parent Project, unless the Project is entirely undesirable. - User: - When a page in the User or User talk namespaces seems worthy of deletion, please explain your concerns using either a personal note or by adding "{{subst:Uw-userpage}} ~~~~" to their talk page. While this step is not required, it does assume good faith and civility; often the user is simply unaware of the guidelines, and the page can either be fixed or speedily deleted using {{db-userreq}}. The same applies to personal userpages you want deleted; there is no need to list them here, simply tag them with {{db-userreq}}. - Also be aware of not biting new users -- sometimes using the {{subst:welcome}} template and a pointer to WP:UP would be best first. - the various Talk: namespaces - Userboxes, regardless of namespace. The undeletion of pages deleted after having been discussed here, and debating whether discussions here have been properly closed, is the purview of Wikipedia:Deletion review, which operates in accordance with our undeletion policy. [edit] Please familiarize yourself with the following policies - Wikipedia:Deletion policy — our deletion policy that describes how we delete things by consensus - Wikipedia:Guide to deletion — whose guidelines on discussion format and shorthands also apply here - Wikipedia:User page — our guidelines on user pages [edit] Prerequisites Please bear in mind that: - Nominating a Wikipedia policy or guideline page, or one of the deletion discussion areas (or their sub-pages), for deletion will probably be considered disruptive, and the ensuing discussions closed early. This is not a forum for modifying or revoking policy. - Nominating for deletion a proposed policy or guideline page that is still under discussion is generally frowned upon. If you oppose a proposal, discuss it on the policy page's discussion page. Consider being bold and improving the proposal. Modify the proposal so that it gains consensus. Also note that even if a policy fails to gain consensus, it is often useful to retain it as a historical record, for the benefit of future editors. - User pages about Wikipedia-related matters by established users usually do not qualify for deletion. - Normal editing that doesn't require the use of any administrator tools, such as merging the page into another page or renaming it, can often resolve problems. - If a page is in the wrong namespace (e.g. an article in Wikipedia namespace), simply move it and tag the redirect for speedy deletion using {{db-reason}} using the reason: Redirect left after a cross-namespace move - G6 Housekeeping and notify the author of the original article of the cross-namespace move. [edit] How to list pages for deletion Please check the aforementioned list of deletion discussion areas to check that you are in the right area. To list a page for deletion, follow this three-step process: (replace PageName with the name of the page, including its namespace, to be deleted) - While not required, it is generally considered civil to notify the good-faith creator and any main contributors of the miscellany that you are nominating. To find the main contributors, look in the page history or talk page of the page and/or use TDS' Article Contribution Counter or Wikipedia Page History Statistics. For your convenience, you may add {{subst:MFDWarning|PageName}} ~~~~ Notice of deletion discussion at [[Wikipedia:Miscellany for deletion/PageName]] PageNamewith the name of the nomination page you are proposing for deletion. - If the user has not edited in a while, consider sending the user an email to notify them about the MfD if the MfD concerns their user pages. - If you are nominating a Portal, please make a note of your nomination here and consider using the portal guidelines in your nomination. [edit] Active discussions - Pages currently being considered are indexed by the day on which they were first listed. Please place new listings at the top of the section for the current day. If no section for the current day is present, please start a new section. - [edit] 2009-07-06 [edit] User:Cloverfieldmoster/Matthew Li Also nominating User:Cloverfieldmoster/Sandbox:Prediction, User:Cloverfieldmoster/Prediction, and User:Cloverfieldmoster/Ascendency. Cloverfieldmoster has been creating articles apparently about himself (two were deleted earlier today) and inserting himself into film pages. Has also quietly tried to insert references to hoax future films into several articles since creating the username, and the other user subpages nominated are for those hoax films. User became very active today with fraudulent edits. -- TheRealFennShysa (talk) 23:31, 6 July 2009 (UTC) [edit] Tatari Oguz Effendi (disambiguation) A dab page with one entry, and an unusual name that looks unlikely to result in duplicate entries. Because of the glyphs on the chars, a redirect would be useful, but that exists already. I42 (talk) 19:46, 6 July 2009 (UTC) [edit] 2009-07-05 [edit] User:MCW07 Nominating userpage and talk page of an editor with clear WP:COI edits recently. Also, blatant advertising for an off-wiki commercial site - editor informed of WP:UP#NOT problem with link, but re-added anyway after prior removal. Duplicate content on both eserpage and talk page. -- MikeWazowski (talk) 03:59, 6 July 2009 (UTC) - Delete - speedy G11 if possible. → ROUX ₪ 04:44, 6 July 2009 (UTC) - Speedy delete G11. -t'shaélchat 06:34, 6 July 2009 (UTC) - There are some editor issues here. The user is a valued contributor. Links to promotional external sites are not OK, should be removed, and if reinserted, the user needs to be warned and blocked if he insists on repeating. The blunt hammer of deletion is not likely a good solution. --SmokeyJoe (talk) 09:06, 6 July 2009 (UTC) - Comment per the nomination statement by user:MikeWazowski MCW07 has been informed and these links have been removed, he then re-added them. -t'shaélchat 09:08, 6 July 2009 (UTC) - I know. There is a bigger problem than his user and talk page. The editor seems to believe that it is OK to link to blogspot.com sites. His userpage and talk page are only examples of the bigger problem, which is the user damaging mainspace with the addition of non reliable sources. User:MikeWazowski seems to have been correctly acting in reverting these edits. User:MCW07 needs to be warned, and blocked if he continues. --SmokeyJoe (talk) 09:28, 6 July 2009 (UTC) - Comment I guess I don't understand how blogspot.com links are any less valued than anything else, something I think was the original reason for my targeting, and was confirmed by the statements above. Preferential treatment over people with the money to pay for a yearly domain name is ludicrous. I offer something different than other websites do, especially those run by AOL and Gawker, for example. I've never spammed anywhere on this entire site, something that is ignored in favor of controlling my very own profile page. If you'll look back, every link I posted on a Wikipedia article was for something related to that article, i.e. a review for said film mentioned. As far as my user page, what exactly do I put there, a big picture of me hugging a Wikipedia logo or something (Oh wait, nope, that's probably illegal as well considering it has a logo in it)? I've donated to Wikipedia in the past thanks to the wonderful service provided, now I have to block harassing emails from its users. It's not a friendly place, sadly. And no, I received no warnings for anything. I just came one day to find out every article I had edited had been reverted. I then confronted the editor about never being warned before all of my work was deleted, simply to receive a response that "he was not required to warn me of anything, that's how it works here". MCW07 (talk) 22:11, 6 July 2009 (UTC) - Sorry about the lack of polite discussion. Unfortunately, there are people who make it their business to insert links to their sites wherever possible, for the benefit of the website, not for the benefit of wikipedia. The big red flag here is the character string "blog" in the url. As a rule, blog sites are not reliable or reputable websites. Of course, there can be exceptions. If the site or the author is independently notable (WP:WEB, WP:BIO), then a case can be made. If someone suggests that your links are not sufficiently reliable/reputable (as is now done), you can take it up at Wikipedia:Reliable sources/Noticeboard, and see if anyone there disagrees with you. --SmokeyJoe (talk) 23:58, 6 July 2009 (UTC) [edit] Wikipedia:Proposed mergers Either tag as inactive or delete. This page has a backlog stretching back to January 2008 and it's only getting larger and larger without anyone working on it. We already have {{Merge}} and other similar templates, which encourage merge discussions to take place on the talk page. This page is nothing but clutter, moving merge discussions away from their intended and logical place on the talk page. If someone sees a {{merge}}, they can either boldly merge themselves or discuss on the talk page, without this extra unnecessary step of listing it here and adding to a never-decreasing backlog. Ten Pound Hammer, his otters and a clue-bat • (Many otters • One bat • One hammer) 15:26, 5 July 2009 (UTC) - Oppose. There is cleanup activity going on, this page clearly states that it does not replace but merely supplement the standard merging process (optionally!), and it has parallels with e.g. the Wikipedia:Move requests page. No reason at all for it to go. --LjL (talk) 15:34, 5 July 2009 (UTC) - It's a redundant supplement. All it does is list a select few mergers which are currently up. This is probably 5% of them. Ten Pound Hammer, his otters and a clue-bat • (Many otters • One bat • One hammer) 15:43, 5 July 2009 (UTC) - Keep. It's not inactive, and the size of the backlog is a problem that won't go away by deleting the page. The page gets way too little attention, yes, but it's not inactive, and it's helpful in locating and keeping track of merger discussions. Without this page merger discussions would get even less eyes on them, and I don't know what anyone would benefit from this page being deleted. Jafeluv (talk) 20:29, 5 July 2009 (UTC) - Keep I know at least one person is actively working on this page, me. In march 2009 the backlog went all the way to 2007, it's come a long way since then. Little to no discussion actually goes on at this page anyways, all discussion takes place on the article's talk pages. This page is only a notice board, and an active one at that. Try checking the page history. --NickPenguin(contribs) 20:44, 5 July 2009 (UTC) - Keep - firstly, the backlog is not that bad - there are only eight outstanding requests from 2008 including only one very old one. Secondly, merges take some time to do correctly, to gauge consensus and then to ensure important details are neither misinterpreted nor lost during the actual rewriting to create the merged text. It's not as simple as simply pasting one article on top of another, and shouldn't be rushed through simply to deal with a backlog. Thirdly (and fairly self-evidently), a backlog should be addressed by responding to requests ratehr than deleting the noticeboard where the requests are listed. This would be akin to a call centre backlog being addressed by unplugging the phones. Fourth, there is slow but steady progress in addressing emrge requests, as previous editors have posted above. Fifth, the presence of merge requests not listed on this page is no reason to delete it - the page need not be a comprehensive list of every merge request in Wikipedia, but simply a worklist for those with copyediting skills and an understanding of merge policy, to help complete requests by other editors not be confident enough to do it themselves. If this sounds unfriendly its not meant to be - I just can't really see the argument for deleting a useful and routinely accessed noticeboard. Euryalus (talk) 23:33, 5 July 2009 (UTC) - Keep, poorly researched nomination. PM could use improvement, particularly greater participation, but retiring it is not appropriate. Flatscan (talk) 04:59, 6 July 2009 (UTC) - According to the page history, NickPenguin has been removing completed entries, greatly reducing the page size since late March 2009. - Discussions are linked from PM and occur on an article Talk page. - As mentioned above, PM is optional: it doesn't bog down obvious mergers with unnecessary procedure, but is available if additional input is needed. Similar to the complementary category/list interaction described by WP:CLN, PM is a manually-selected subset and has a brief description to assist list browsing. Flatscan (talk) 04:59, 6 July 2009 (UTC) - Keep. Worthy effort. Not inactive. Backlog is not overwhelming. Could use advertising. --SmokeyJoe (talk) 08:56, 6 July 2009 (UTC) - Comment There's actually only 50 merge requests on this page. Some are clearly more complicated than others, and most of the easy ones have been completed by now, but this has to be the smallest backlog on record. --NickPenguin(contribs) 18:01, 6 July 2009 (UTC) [edit] User:Washingtonlawyer This looks to me like an attempt to keep an article within wikipedia, about some non-notable subject. This kind of thing typically isn't allowed, I would be fine if an admin moved it to a subpage. — Dædαlus Contribs 03:07, 5 July 2009 (UTC) - Move to subpage. Looks like a newcomers first attempt at article creation. --SmokeyJoe (talk) 12:06, 5 July 2009 (UTC) - Keep does not appear to be spam, nor anything more than a short essay permitted in Userspace. Collect (talk) 13:41, 5 July 2009 (UTC) [edit] User talk:Thundermoomoo Wasn't sure if this qualified for speedy, so nominating it here. Not sure what to make of the page; it looks like a silly, non-encyclopedic article but in User talk namespace. This talk page is the user's only contributions. Not sure if it should just be deleted or moved to the user page. Carl Lindberg (talk) 14:57, 5 July 2009 (UTC) - Could this be a reasonable start to an article? Move the page to User:Thundermoomoo/Lim Ming Xiang Nigel. Welcome the newcomer. Advise the newcomer to read WP:BIO, WP:BLP and WP:COI. --SmokeyJoe (talk) 08:53, 6 July 2009 (UTC) [edit] 2009-07-04 [edit] 2009-07-03 [edit] User talk:210.50.30.37/Archive 1 Utterly pointless to maintain an archive of warnings given to a dynamic IP address, and a bad habit to start (although this appears to be a lone occurrence). The people who received these warnings three years ago are surely long gone by now and wouldn't find this page again if they knew it existed. -- bd2412 T 23:29, 3 July 2009 (UTC) - It is enough for the warnings to remain accessible in the talk page history. If there is no need for a visible archive, delete it. --SmokeyJoe (talk) 12:02, 5 July 2009 (UTC) - Delete and move the talk messages back to the main talk page User talk:210.50.30.37. There are not enough messages here for an archive anyways. meshach (talk) 15:39, 5 July 2009 (UTC) [edit] User:Mojo-hustla We talk a lot about db-spam at WT:CSD these days, and I'd like to get more feedback from MfD voters. My personal vote is to speedy-delete this as db-spam, with a nice note to the creator along the lines of "Your only two contributions so far to Wikipedia have been your user page and similar content in the deleted article Fly Security Services. This gives the impression that your only interest is promoting a particular company, but I could be wrong; maybe you'd like to edit other articles on Wikipedia. If so, please enjoy your stay, but first read WP:PROMO and WP:Your first article." - Dank (push to talk) 17:04, 3 July 2009 (UTC) - I agree that we should give these folks encouragement to stick around rather than giving them a hard shove out the door with a block for spam. –xenotalk 17:06, 3 July 2009 (UTC) - Agreed, Xeno. Is that roughly the message you'd like to see on their talk page? How do you feel about speedy-deleting this userpage? And btw, what do you think of the link to WP:PROMO (a section of WP:SPAM) rather than WP:COI? PROMO seems easier to read, more to the point, and more forgiving to me than COI, at least for newbies. - Dank (push to talk) 17:11, 3 July 2009 (UTC) - The only problem I see linking "PROMO" is that it's calling them a "spammer" which is a derogatory characterization. COI is a little less harsh in that regard. I think the page should be blanked, rather than deleted, they should also be pointed to WP:UP. –xenotalk 17:15, 3 July 2009 (UTC) - That's a great idea, we ought to be able to tailor a message for potential promotionalism on userpages and put it in a linked section of UP. I'll work on it this weekend. - Dank (push to talk) 17:44, 3 July 2009 (UTC) - How about WP:BFAQ#WHYWP:WHYNOT? It was a little sloppy, but I've tightened it up; it's more conversational and not as accusatory as COI or PROMO, I think. - Dank (push to talk) 16:33, 4 July 2009 (UTC) - Weak keep, but edit to remove excessive promotion, such aas the external link. External links are only OK for serious contributors. --SmokeyJoe (talk) 11:54, 5 July 2009 (UTC) - Keep as edited Does not now appear to violate any rules or policies. And I find no actual policy page which says users can not represent companies - only that they adhere scrupulously to COI policies. Collect (talk) 13:46, 5 July 2009 (UTC) - m:Role_account. I can't immediately find an en: page reference, but role/shared accounts are blocked on discovery. --SmokeyJoe (talk) 00:59, 6 July 2009 (UTC) - Wikipedia:U#Inappropriate usernames: "the suggestion that the account is operated by a group, project or collective rather than one individual" - Dank (push to talk) 01:40, 6 July 2009 (UTC) [edit] User:Dinakar.uppuluri Biography like. Rabbit67890 (talk) 07:45, 3 July 2009 (UTC) - Comment - have you tried discussing this with the user? I have nominated the mainspace page he created for speedy deletion per WP:CSD#A7, but perhaps it would be a good idea to discuss WP:USER with him regarding his userpage? → ROUX ₪ 08:08, 3 July 2009 (UTC) - Speedy delete WP:G11, users only edit and clearly an autobiographical piece.--Otterathome (talk) 18:20, 3 July 2009 (UTC) - Speedy keep per WP:BITE. There is nothing wrong with a user page being biography-like, so I don't even understand the nom. WP:CSD G11 does not apply, because the primary subject of the page is the person, not his company, as to which I am not even sure whether it really exists yet; the page implies that it may merely be his future plan. As to this being the user's only edit, well, he only registered his account within the last 24 hours or so. --Metropolitan90 (talk) 03:24, 4 July 2009 (UTC) - Keep per above. Kevin Rutherford (talk) 03:02, 5 July 2009 (UTC) - Keep. A relatively brief and acceptable userpage for an intending contributor. Almost, but not quite breaking too-promotional line. --SmokeyJoe (talk) 11:51, 5 July 2009 (UTC) - Keep Up for 7 minutes before MfD? No post to communicate first? Not violating guidelines (short c.v. is permitted). No reason to delete, many to keep. Collect (talk) 14:12, 5 July 2009 (UTC) [edit] 2009-07-02 [edit] User:Lilyhoh Lilyhoh (talk · contribs) is using Wikipedia as a webhost. The user has made hundreds of edits over the last six months to maintain this personal profile, but has made no other contributions to Wikipedia. Per WP:NOTWEBHOST, this is inappropriate use of Wikipedia's userpages. -- Peacock (talk) 14:09, 2 July 2009 (UTC) - Delete not even a web site, a to-do list. DGG (talk)` - Delete. Refer user to Wikipedia:Alternative outlets. Allow her to move the content offsite on request. --SmokeyJoe (talk) 11:47, 5 July 2009 (UTC) - Delete, Wikipedia is not a free webhost. Stifle (talk) 20:47, 6 July 2009 (UTC) [edit] 2009-07-01 [edit] 2009-06-30 [edit] User:Flnclan/wireless Encourages and condones an illegal activity, see Legality of piggybacking. Otterathome (talk) 21:31, 30 June 2009 (UTC) - Keep - Uh, no. It says their neighbour steals the connection. Doesn't seem like encouraging or condoning to me. As for the second, I see nothing encouraging or condoning about it. It's a mere statement of fact. Given the other MfD you put up, it might make more sense for you to go to WP:USERBOX and discuss there your issues with userboxes and propose guidelines. → ROUX ₪ 21:37, 30 June 2009 (UTC) - So would - be acceptable then?--Otterathome (talk) 21:39, 30 June 2009 (UTC) - I doubt anyone would use it, but I don't think it would violate any guidelines. Keep both (but userfy the 2nd) and urge nominator to take a look at former MFDs for userboxen. Mostly only divisive and inflammatory userboxes are deleted. –xenotalk 21:40, 30 June 2009 (UTC) - One of them is being used on over 50 pages.--Otterathome (talk) 21:42, 30 June 2009 (UTC) - I was talking about your hypothetical "This user commits credit card fraud" userbox. –xenotalk 21:43, 30 June 2009 (UTC) - I didn't know Wikipedia permitted users to brag about their crimes and encourage other users to do it too--Otterathome (talk) 21:51, 30 June 2009 (UTC) - Keep argument by analogy is flawed, userbox is harmless, nominator is advised to go do something more useful. Jclemens (talk) 22:21, 30 June 2009 (UTC) - Keep- I think that the wording should say: "This user is a wireless thief (or something like that)", but otherwise this is a harmless template. Kevin Rutherford (talk) 00:40, 1 July 2009 (UTC) - Keep I agree with Jclemens. -T'Shael,The Infernal Vulcan Overlord 16:01, 24 June 2009 (UTC 00:57, 1 July 2009 (UTC) - Keep as it stands, though I would be wary if it were used an an attack by elsewhere identifying the neighbour. Collect (talk) 01:02, 1 July 2009 (UTC) - Keep both. While these do say "steal", the intended sense appears to be misappropriation rather than theft, more in line with "This user steals his neighbor's parking space" than "This user steals his neighbor's blank checks". In the absence of actual misuse, it shouldn't be prohibited. — Gavia immer (talk) 23:31, 1 July 2009 (UTC) - Keep. I agree with Gavia immer, this is just a harmless userbox. Besides, some people don't neccesarily "steal" their neighbours wireless connection, but instead use it on their User Page humorously, or to make their page look more decorated. Dragpyre (talk) 17:15, 3 July 2009 (UTC) [edit] User:Regregex/User computer age 30 Not even sure if it's possible to contribute with a computer that is older than 30 years old. Only being used on User:Jnivekk. Otterathome (talk) 21:13, 30 June 2009 (UTC) - Keep I don't see how that userbox is hurting anyone, as it's not improper in anyway. I disagree with your rationale that having only one link to it is grounds for deletion. -T'Shael,The Vulcan Overlord 16:01, 24 June 2009 (UTC 21:17, 30 June 2009 (UTC) - Strong/speedy keep - no reason given for deletion. Many userboxen make factually loose claims such as "This user...uploads material directly to the Internet by using the awesome power of his mind." Why did you nominate this? It's not harmful in the least. –xenotalk 21:17, 30 June 2009 (UTC) - Speedy keep - If browsing via Lynx, one certainly could. Is there an actual reason why you think this should be deleted? → ROUX ₪ 21:18, 30 June 2009 (UTC) - Keep 30 years in octal is doable, 30 years in hexadecimal is impossible, 30 years in binary is undefined, and 30 years in decimal is improbable. Since when are we the userbox accuracy police? Jclemens (talk) 21:19, 30 June 2009 (UTC) - Nom note also note we already have these too which also serve the same purpose:--Otterathome (talk) 21:23, 30 June 2009 (UTC) - Speedy keep - No reason given for deletion. –Juliancolton | Talk 21:25, 30 June 2009 (UTC) - Speedy keep Nice userbox. Plus it promotes respect for old computers. Very Green. Good for the planet. Dr.K. logos 21:29, 30 June 2009 (UTC) - Question At the top of Wikipedia:Deletion policy, it says Redundant or otherwise useless templates template is being used on 1 user page. And on WP:UP#NOT there are many other reasons that apply. If none of these reasons are actually true then may I suggest they are removed?--Otterathome (talk) 21:48, 30 June 2009 (UTC) - That applies to templates in template space, not userboxes properly in userspace. And without pointing out what part of UP#NOT applies, I'm not sure what you're driving at. I would suggest you find a more useful activity, such as patrolling articlespace for BLP violations and such rather than worrying about harmless userboxen. –xenotalk 21:50, 30 June 2009 (UTC) - I must agree with xeno and second his suggestion. -T'Shael,The Vulcan Overlord 16:01, 24 June 2009 (UTC 21:53, 30 June 2009 (UTC) - I didn't know users had to do other activities before nominating things for deletion, could you point me to this guideline?--Otterathome (talk) 21:54, 30 June 2009 (UTC) - My point is that these nominations of harmless userboxen are counter-productive. –xenotalk 21:55, 30 June 2009 (UTC) - I am trying to clean up unused userboxes, so I can't see how it is counter-productive. That argument could be used in any deletion discussion if you don't agree with a certain page being deleted, so it's a WP:NOHARM argument.--Otterathome (talk) 18:19, 3 July 2009 (UTC) - Deletion doesn't space. Focus on cleaning up templatespace (i.e. per WP:UBM), not userspace. –xenotalk 18:23, 3 July 2009 (UTC) - They take up space on the page lists, userbox directories and contribution lists.--Otterathome (talk) 18:33, 3 July 2009 (UTC) - Who cares? → ROUX ₪ 21:38, 3 July 2009 (UTC) - Users browsing the userbox listings and anyone looking at page/contributions lists.--Otterathome (talk) 16:08, 4 July 2009 (UTC) - Keep as no actual reason for deletion is furnished. Collect (talk) 01:04, 1 July 2009 (UTC) - Keep- I think that we could also combine these templates and use a type that allows for the precise age of the computer to be punched in to gain the result. Kevin Rutherford (talk) 00:43, 2 July 2009 (UTC) [edit] User:King Sweaterhead/Userboxes/Female Superiority I have nominated this userbox for deletion because of the following concern: intended to be a gender double standard and dishonest opinion. If it is unacceptable to have a userbox stating male superiority, then it should be unacceptable to have a userbox stating female superiority. Gender double standards have been an issue to others and myself. Decimus Tedius Regio Zanarukando (talk) 02:31, 12 June 2009 (UTC) - I agree. I do not believe that there should be any userboxes on Wikipedia that would promote any kind of discrimination, including that against men. I think this userbox should be deleted. Jprulestheworld01 (talk) 18:56, 14 June 2009 (UTC) - This MfD nomination was incomplete (missing step 3). It is listed now. –BLACK FALCON (TALK) 16:44, 30 June 2009 (UTC) - I agree with the nominator - delete. Thryduulf (talk) 18:05, 30 June 2009 (UTC) - Speedy delete Wikipedia:CSD#G10.--Otterathome (talk) 21:11, 30 June 2009 (UTC) - Keep - I'm a male, and I'm not offended by this whatsoever. –Juliancolton | Talk 21:26, 30 June 2009 (UTC) - Keep I'm in the same boat as Julian. -T'Shael,The Vulcan Overlord 16:01, 24 June 2009 (UTC 22:21, 30 June 2009 (UTC) - Question: Was there a male superiority userbox/MFD? can someone link it? –xenotalk 23:25, 30 June 2009 (UTC) - Delete Perhaps this was meant in jest, but if taken literally it is basically offensive sexism. WP:USER makes it clear that Wikipedia pages are not for polemical statements. Perhaps most males feel very comfortable with their status and may not be offended but we can't assume that of everyone. Deciding it should be kept because it does not offend you personally sort of misses the point. Reverse the male and female roles in this userbox of its offensiveness becomes clear. Chillum 00:47, 1 July 2009 (UTC) - I am a bit surprised to see how this is going. If it was claiming men were superior to woman, or that whites were superior to blacks then I don't think it would be going the same way. There seems to be a double standard where sexism against men is considered harmless. Chillum 13:46, 2 July 2009 (UTC) - Keep Unless, of course, we would bar songs from "Annie Get Your Gun"? Collect (talk) 01:06, 1 July 2009 (UTC) - Keep. This a neutral statement of opinion. While the opinion itself is not neutral, allowing editors to state it benefits the encyclopedia by documenting their potential biases. — Gavia immer (talk) 23:27, 1 July 2009 (UTC) - Comment what about the transgenderers? Are they superior to both, inferior to both, or somewhere in the middle? MickMacNee (talk) 13:14, 2 July 2009 (UTC) - Delete My lack of offense to this doesn't make this inoffensive. There seems little upshot in keeping the box, with plenty of potential downsides. Matt Deres (talk) 17:13, 3 July 2009 (UTC) [edit] User:Pakalomattam/joel osteen Abandoned userspace draft; user has not edited this page in over a year and has not edited at all in over six months. Stifle (talk) 15:51, 30 June 2009 (UTC) - Keep - per no good reason given for deletion. –xenotalk 15:53, 30 June 2009 (UTC) - Uh... what part of the reason is bad? The page has been abandoned and is an external linkfarm. It's also being used as a free webhost. Stifle (talk) 15:56, 30 June 2009 (UTC) - Page appears to have been used as a sandbox for the mainspace article of the same name. What's to say the contributor won't return? NOINDEX seems to be a better way to deal with it if there are other concerns. –xenotalk 15:59, 30 June 2009 (UTC) - Merge anything worth keeping with the main Joel Osteen article then replace with {{userpage}}.--Otterathome (talk) 21:25, 30 June 2009 (UTC) - Blank. User can unblank if he wants to work some more on it. No point fussing with the unreliable NOINDEX for something that no one has a reason to look at. No need to delete, it doesn't hurt by exisitng in accessible history. --SmokeyJoe (talk) 09:43, 1 July 2009 (UTC) [edit] 2009-06-29 [edit] User:TruthbringerToronto/Publimedia International Multiple articles on Romanian magazines, originally created by Cristina.danilescu (talk · contribs) in November 2006 -- no, not a typo -- and moved into User:TruthbringerToronto's userspace, where they have remained completely untouched for the last 31 months. The pages are: As user space is not a permanent storage space for the unwanted, it's time to delete these. -- Calton | Talk 17:42, 29 June 2009 (UTC) - Just blank such pages. There is no need to advertise abandoned things, and then debate them. If they are abandoned, no one minds if you blank them. Blanking is far less confrontational to the user when he returns. If you don't delete them, you won't upset some completely unexpect use of them. Deletion offers no performance advantage over blanking. Delete these if you like, but necessarily with the proviso that the user can have them undeleted on request (making it more bother than it is worth). --SmokeyJoe (talk) 09:50, 1 July 2009 (UTC) [edit] User:JuiceTOtheMAXX/Sims Survivor: The Australian Outback Also User:JuiceTOtheMAXX/Sims Survivor: Africa, User:JuiceTOtheMAXX/Sims Survivor: Pulau Tiga, User:JuiceTOtheMAXX/Sims Survivor: Malaysia, User:JuiceTOtheMAXX/Sims Survivor: Marquesas, User:JuiceTOtheMAXX/Sims Survivor: Thailand, User:JuiceTOtheMAXX/Sims Survivor: The Amazon, User:JuiceTOtheMAXX/Sims Survivor: All-Stars, User:JuiceTOtheMAXX/Sims Survivor: Pearl Islands, User:JuiceTOtheMAXX/Sims Survivor: China and User:JuiceTOtheMAXX/Survivor: Micronesia Fanfic. The titles of these pages makes the intention obvious. More internet reality TV show nonsense. Wikipedia is not a free webhost. 245/247 of this user's edits are to the userspace. MER-C 10:46, 29 June 2009 (UTC) - Burn with fire, er delete. Many fine webhosting services are out there: Wikipedia is NOT one of them. --Calton | Talk 17:59, 29 June 2009 (UTC) - (Speedy) delete. --Dirk Beetstra T C 10:10, 1 July 2009 (UTC) - Does not look to me to be so obviously not suitable for development into mainspace content. --SmokeyJoe (talk) 01:20, 4 July 2009 (UTC) [edit] User:Hertfordshire1234/Prince Elliott [edit] User:Hertfordshire1234/Elliott Windsor, Earl of Hertforshire User Hertfordshire1234 (talk · contribs) (currently blocked for a week) and his sockpuppet Englandrules123 (talk · contribs) have input numerous hoax articles purporting to show that "Elliott Dashwood" or "Elliott Windsor" is a member of the British aristocracy. These user pages are more of his fantasies in preparation and have nothing to do with writing an encyclopedia. -- JohnCD (talk) 09:39, 29 June 2009 (UTC) - Delete if these are hoax articles in waiting. Totnesmartin (talk) 10:57, 29 June 2009 (UTC) - Delete per nom. — RHaworth (Talk | contribs) 23:12, 29 June 2009 (UTC) - Delete per nom. Had to go through a shed load of the hoax articles myself and these two pages are more of the same. FlowerpotmaN·(t) 00:33, 30 June 2009 (UTC) - Delete per nom.— Dædαlus Contribs 03:09, 5 July 2009 (UTC) [edit] User talk:SurvivorHarryPotter User talk page used solely for unrelated activity. Wikipedia is not a web hosting service. -- Kotiwalo (talk) 08:50, 29 June 2009 (UTC) - The page "User talk:SurvivorHarryPotter" is not using Wikipedia as a web hosting service. Facebook is the web hosting service for this Online Reality Game. The Wikipedia User talk page is being used document the experience of the Online Reality Game Survivor "Harry Potter.":. SurvivorHarryPotter (talk) 09:03, 29 June 2009 (UTC) - Wikipedia talk pages are not meant for unrelated activities. They are meant for communicating with other users about Wikipedia and improving it. Kotiwalo (talk) 09:12, 29 June 2009 (UTC) - Delete this is a scratchpad/tally page for some facebook game. Keep it in facebook, or if not there, some wiki farm. Totnesmartin (talk) 11:00, 29 June 2009 (UTC) - The user actually blanked the page already twice, but I reverted since the afd tag states that the page shouldn't be blanked. Thus I doubt anyone will oppose deletion. Kotiwalo (talk) 11:16, 29 June 2009 (UTC) - Wikipedia is not a bureaucracy, and I believe a page can be speedy deleted if the sole author blanks the page - but I don't know how much this conflicts with a deletion process. Totnesmartin (talk) 12:05, 29 June 2009 (UTC) - Delete. Actually, the user IS using Wikipedia as a webhosting service: he's trying to use it to host game stats. --Calton | Talk 17:56, 29 June 2009 (UTC) - Delete Wikipedia is not a webhost. -T'Shael,The Vulcan Overlord 16:01, 24 June 2009 (UTC 19:09, 29 June 2009 (UTC) [edit] User:Gongpao/F&S International Education Similar to Wikipedia:Miscellany for deletion/User:Synapse8/PrintGlobe Inc., this is a userpage created in October 2008, by a user who hasn't edited since then, so it is unlikely to ever be introduced into articlespace. Falls under Wikipedia is not a webhost. Ricky81682 (talk) 03:51, 29 June 2009 (UTC) - Redirect to user's userpage if it bothers you. No reason to delete. No Reason for MfD debates. We should assume that the user will return, and not bite people for inactivity. Maybe he will return if you ask him what he intends with the page? Maybe you could even welcome him. --SmokeyJoe (talk) 04:02, 29 June 2009 (UTC) - Keep Frankly deleting every page of a person absent as an editor for 8 months is not productive. Page violates no rules, hence no reason to delete. Collect (talk) 17:10, 29 June 2009 (UTC) - Keep- Who says that this isn't their sandbox? Kevin Rutherford (talk) 00:49, 2 July 2009 (UTC) - Keep Assume good faith, something the nominator seems to have forgotten. -- Ricky28618 (talk) 23:53, 2 July 2009 (UTC) [edit] 2009-06-28 [edit] Recent discussions [edit] 2009-06-27 [edit] Wikipedia:WikiProject User scripts/Scripts/Fix lowercase first letter problem Old bit of JavaScript that has been entirely replaced by {{lowercase title}}. —Remember the dot (talk) 03:51, 27 June 2009 (UTC) - Is actually used in 2 users monobooks.. Rich Farmbrough, 13:54, 27 June 2009 (UTC). - Having been replaced, the script is never activated. It can be deleted without trouble. —Remember the dot (talk) 17:37, 27 June 2009 (UTC) [edit] 2009-06-26 [edit] 2009-06-25 [edit] Closed discussions For archived Miscellany for deletion debates see the MfD Archives. [edit] 2009-06-28 - Wikipedia:Miscellany for deletion/Allsterecho talk redirects (speedy deleted) [edit] 2009-06-27 - Wikipedia:Miscellany for deletion/Wikipedia:WikiProject Citizendium Porting (keep) - Wikipedia:Miscellany_for_deletion/User:Xgsdev (speedy delete) - Wikipedia:Miscellany_for_deletion/User:Jethro_Loves_Shermerra (delete) [edit] 2009-06-26 - Wikipedia:Miscellany for deletion/User talk:ChristofferMunck (content blanked) [edit] 2009-06-25 - Wikipedia:Miscellany for deletion/User talk:Pkoulop (Speedy close)
http://ornacle.com/wiki/Wikipedia:MFD
crawl-002
refinedweb
6,494
62.17
Knowing that I will not be the only one posting on these features in the Java Tiger release here are some observations I made while running some tests. I created an example showing Generics, auto (un)boxing and the new for loop in one little program. I actually used the Netbeans IDE 4.0 to create it. At (my) first glance Netbeans looks like a very good IDE with a lot of features also present in Eclipse. public void runTest() { // Generics: only Integers allowed ArrayList<integer> col = new ArrayList<integer>(); // Math.random(); for (int i = 0; i<1000000;i++) { // autoboxing col.add(getRandom()); } int total = 0; Integer oldValue = null; boolean allTheSame = true; // new For loop for(Integer s : col) { // auto unboxing total += s; if ( oldValue != null && oldValue != s ) allTheSame = false; oldValue = s; } System.out.println(total); System.out.println("Were are all the same " + allTheSame); } // method always returning randomly generated 1 ;-) private int getRandom() { return (int)Math.ceil((Math.random() * 1)); } Prompted by “In addition, the enhanced for construct is a compiler ‘trick’ and can actually end up being slower when used for large collections.” quote in the Tiger feature list, I tried measuring some performance. Using the auto boxing feature to add the radomly generated 1’s to the collection I noticed that all objects are equal in the collection (using the == operator). If I use the “old” way col.add(new Integer(getRandom())) to add the radomly generated 1’s , I get all different objects (of course). This has of course quite an impact on the performance ( 511 ms vs 1132 ms ) If I now change my getRandom method so it returns a double and also change my ArrayList to a generic double implementation I get all different objects in both the old way and the new way (auto boxing). For completeness the same method in pre 1.5 code public void runTestOld() { ArrayList col = new ArrayList(); for (int i = 0; i< 1000000;i++) { col.add(new Integer(getRandom())); } int total = 0; Integer s =null; Integer oldValue = null; boolean allTheSame = true; for(Iterator i = col.iterator() ; i.hasNext();) { s = (Integer)i.next(); total += s.intValue(); if ( oldValue != null && oldValue != s ) allTheSame = false; oldValue = s; } System.out.println(total); System.out.println("Were are all the same " + allTheSame); } I actually did not measure any significant differences between the old way of looping with an Iterator and the new For loop (yet). Also check the new compiler flag -Xlint:unchecked . With that flag the compiler will tell you were you work unchecked C:TigerTestsrcGenericsTest.java:128: warning: [unchecked]unchecked call to add(E) as a member of the raw type java.util.ArrayList col.add(new Integer(getRandom())); 1 warning Personally I think generics, auto ( un) boxing and the new for loop will help Java Developers to write more concise and clearer Code. can we fix it, and how thanks
https://technology.amis.nl/2004/10/11/tiger-java-50-generics-auto-unboxing-and-new-for-loop/
CC-MAIN-2016-50
refinedweb
480
56.55
Hi everyone, i am trying to integrate a wind sensor into Pixhawks hard- and software. All the work is done within my masters thesis. Since now things worked good and I build a 5kg octokopter controlled by the pixhawk running arducopter on it. I already mounted the sensor on the copter and connected it to the serial 5 port. The sensor outputs the data as an RS232 signal which is converted via MAX3232 to 5V TTL level. So all the physical work is done and I have to do the software integration now. I spent a lot of work on changing the sf0x driver (also connected via serial port if you use it) from the pixhawk code base to my needs without success. What I wanted to do is reading the sensor data through the serial port and log it on the sd card. If it is possible I want to use the arducopter code base to be still able to connect to mission planner. The message from the sensor looks like this: <STX><ID>,11.111,22.222,33.333,44.444<ETX>CC<CR><LF> Is there anybody who has done something similar and can share some code or help me ??? I´m really looking forward to hearing fom you! Views: 6342 <![if !IE]>▶<![endif]> Reply to This <![if !IE]>▶<![endif]> Reply Hi James, that sounds good and is exactly what I want to do. Yes you are right it is quite difficult to find the best place for mounting the sensor. I did some cfd simulations on this and I can tell you that on the upper side of the copter there is the best place to position the sensor. Moreover you have to calculate the influence of the motion produced by the attitude control all the time. Thank you so far. Hope you get things done soon because I'm curious to have a look at your code. <![if !IE]>▶<![endif]> Reply I did not get a lot of time to spend on this but I did get my set up reading the serial data. Just to get you going while I fix up the logging - this code reads input at 115200 baud on serial port 4 in the format 11111,22222,33333,44444<LF> (4 comma separated unsigned integers of variable character length terminated by '\n') and updates the user variables, temp, xVal, yVal, zVal UserCode.pde: (you must also uncomment the appropriate USERHOOK_XXX defines in APM_Config.h) void check_sensor() { static char incoming[10]; static uint8_t index=0; static uint8_t value_index=0; uint8_t data; int16_t numc; numc = sensor_port->available(); // Number of bytes available in rx buffer for (int16_t i = 0; i < numc; i++) { // Process bytes received data = sensor_port->read(); // Read the next byte // hal.console->printf("%c",data); if(data==','){ // seperator incoming[index]='\0'; // Place null char to mark end of string switch(value_index++){ case 0: temp=strtol(incoming,NULL,10); break; case 1: xVal=strtol(incoming,NULL,10); break; case 2: yVal=strtol(incoming,NULL,10); break; } // Switch index=0; } else if(data=='\n') { // Look for newline char separately to determine the end of current data incoming[index]='\0'; // Place null to mark end of string zVal=strtol(incoming,NULL,10); // Convert string to float and assign to global sensor_value index=0; // Reset indexes for next line reading value_index=0; //hal.console->printf("Temp: %i, xVal: %i, yVal: %i, zVal: %i\n",temp, xVal, yVal,zVal); } else //continue accumulating bytes incoming[index++]=data; // Add next byte to string } } void userhook_init() { sensor_port->begin(115200,128, 0); //115200 baud, 128 byte input buffer, 0 byte output buffer sensor_port->set_flow_control(AP_HAL::UARTDriver::FLOW_CONTROL_DISABLE); //Disable flow control } void userhook_MediumLoop() { check_sensor(); //Check serial input at 10Hz } UserVariables.h: #define sensor_port hal.uartE uint16_t temp, xVal, yVal, zVal=0; <![if !IE]>▶<![endif]> Reply James, thank you VERY much so far! I'm going to test it on my copter immediately. I'll kepp you up to date. <![if !IE]>▶<![endif]> Reply Hi Marvin, You are welcome. I managed to get the logging sorted before I left work. I need to gather data tomorrow to calibrate the sensor. Hopefully we have a relatively wind free day so I can mount the sensor along with the Pixhawk + GPS on a vehicle to gather wind data across the speed/direction ranges I require.... I will post all the altered source files in the morning. <![if !IE]>▶<![endif]> Reply Hi Marvin, Attached are the altered files (from current master) including logging to dataflash (SENS,temp,xVal,yVal,zVal). Did you have any luck with the code to parse your input? Cheers, James <![if !IE]>▶<![endif]> Reply Hi James, great job thanks again!!! The last days a played around with your code and modified it for my needs. Finally I got it working quite good. The code below could be used to process serial data in form of: xxx,-111.11,+222.22,-333.33,x,xxx<LF> (where " x " is stuff which isn't needed) The data is read now from uartD (/dev/ttyS2) because uartE didn't work. The values are defined and parsed as floats and saved in the dataflash logs. Moreover I tried to display data in the real time plot in Mission Planner as well as saving them to the telemetry logs by modifying the sonar_alt log as mentioned here: Custom sensors and Real-Time logging And this is the final code I am using (today): UserCode.pde: // Write a sensors packet static void Log_Write_Sensor() { struct log_Sensor pkt = { LOG_PACKET_HEADER_INIT(LOG_SENSOR_MSG), xVal : xVal, yVal : yVal, zVal : zVal }; DataFlash.WriteBlock(&pkt, sizeof(pkt)); } void check_sensor() { static char incoming[100]; static uint8_t index = 0; static uint8_t value_index = 0; char data; int16_t numc; numc = sensor_port->available(); // Number of bytes available in rx buffer for (int16_t i = 0; i < numc; i++) // Process bytes received { data = sensor_port->read(); // Read the next byte // hal.console->printf("Incoming:"); for(int j = 0; j < 100; j++) { //hal.console->printf("%c", incoming[j]); } //hal.console->printf("\n"); if(data == ',') { // Value seperator incoming[index]='\0'; // Place null char to mark end of string for(int k = 0; k < (99 - index); k++) // write zeros after the sensor values in the buffer { incoming[index + 1 + k] = 0; } value_index++; switch(value_index) { case 2: xVal = atof(incoming); break; case 3: yVal = atof(incoming); break; case 4: zVal = atof(incoming); break; } // Switch index=0; } else if(data=='\n') // Look for newline char to mark end of current data { index = 0; // Reset indexes for next line reading value_index = 0; // hal.console->printf("xVal: %f, yVal: %f, zVal: %f\n", xVal, yVal, zVal); Log_Write_Sensor(); } else { incoming[index] = data; // Add next byte to string if(index == 99) { index = 0; } index++; } } } #ifdef USERHOOK_INIT void userhook_init() { sensor_port->begin(19200,128,0); sensor_port->set_flow_control(AP_HAL::UARTDriver::FLOW_CONTROL_DISABLE); //Disable flow control } #endif #ifdef USERHOOK_FASTLOOP void userhook_FastLoop() { // put your 100Hz code here check_sensor(); // Log_Write_Sensor() is called from check_sensor() sonar_alt = xVal * 1000; hal.console->printf("%f\n",xVal); hal.console->printf("%i\n",sonar_alt); } #endif #ifdef USERHOOK_50HZLOOP void userhook_50Hz() { // put your 50Hz code here } #endif #ifdef USERHOOK_MEDIUMLOOP void userhook_MediumLoop() { // 10 Hz Code // sonar_alt = xVal * 1000; // hal.console->printf("%f\n",xVal); // hal.console->printf("%i\n",sonar_alt); } #endif #ifdef USERHOOK_SLOWLOOP void userhook_SlowLoop() { // put your 3.3Hz code here } #endif #ifdef USERHOOK_SUPERSLOWLOOP void userhook_SuperSlowLoop() { // put your 1Hz code here } #endif UserVariables.h: #ifdef USERHOOK_VARIABLES #define sensor_port hal.uartD float xVal; float yVal; float zVal; #define LOG_SENSOR_MSG 0xF0 struct PACKED log_Sensor { LOG_PACKET_HEADER; float xVal; float yVal; float zVal; }; #endif // USERHOOK_VARIABLES And line 715-716 in Log.pde: { LOG_SENSOR_MSG, sizeof(log_Sensor), "SENS", "fff", "xVal,yVal,zVal" }, Moreover I uncommented the 10Hz- and the 100Hz-Loop as well as the UserVariables.h in APMConfig.h. So there are still some small issues but all in all I made a huge step forward! <![if !IE]>▶<![endif]> Reply Hi Marvin, Looks good. I am glad that you found my code useful. Just a couple of comments on your changes: The variable incoming[] only needs to hold enough characters for one field + a null, so from your spec above, -123.45 + null or 8 chars. You have allocated 100 bytes for this which seems an unnecessary waste. I see that you are detecting an overrun on incoming[] by wrapping back to a zero index when > 99. Although I believe you do not need quite so much space in your buffer, this is something I should also have done in my code. If for some reason the serial stream is not what we expect and has no ',' in the stream (i.e. different baud rate) then my code would over run the array and randomly write over memory assigned to other vars with potentially disastrous consequences... I have altered my code from: incoming[index++]=data; // Add next byte to string to: incoming[index++]=data; // Add next byte to string if(index==10)index=9; Also, you should not need to write all zeros to pad out the end of incoming[] after each time it is used as you fill it up sequentially from the start and mark the end with a null. A single null char is all that C/C++ needs to mark the end of a string. The atof() function never sees anything it is not supposed to. You are calling Log_Write_Sensor() from within check_sensor() which you have being called at 100Hz. When check_sensor() is called we have no idea where in the sensor_port byte stream we are. This is why we have to process it byte by byte and determine our position by aligning to <LF> chars. If you output the serial data received to the console and add a marker char every time you call check_sensor() you will see that it appears pretty randomly in the data. The point is, you do not necessarily have a complete data sentence present at the end of every call to check_sensor(). In your case where you are looking at a serial port at 19200 baud and expecting 34 bytes, the maximum throughput would be 34*8 (bits/byte) + 34 (stop bits)=306bits. 19200/306 or slightly more than 62 sentences/second. This is the absolute max and does not take into account how often the attached sensor actually transmits the data. Unless you are using an ultrasonic sensor, I can't imagine that your wind sensor has anything like an effective temporal resolution that could make use of 100Hz logging. check_sensor() needs to be called at least as often as required to keep up with the data and not over run the buffer - and there is no harm in calling it more frequently if you have the processing overhead. I would place this code in the slowest loop that gives you the logging frequency required. You obviously picked up that the format field of LOG_SENSOR_MSG needed altering from 'llll' to 'fff' - good spotting :) BTW - what sensor are you using? <![if !IE]>▶<![endif]> Reply Thank you very much James! It´s quite a long time ago since I joint this thread but now I´ll work further on my drone. I´m really sorry but at the moment I´m not allowed to tell any details about the sensor. Maybe you would like to have a look at my other thread? Uploading and Compiling ArduCopter V3.2 with Eclipse Greets Marvin <![if !IE]>▶<![endif]> Reply I´m in big trouble !!! Hi everyone, I added and changed the code like James told above. If I start the pixhawk there are only some bytes coming into the serial port. But these are not the bytes beeing sent from the sensor. There are only some random characters and special signs arriving in the console. (I´m using putty connected to the usb port of pixhawk at 38400 baud to display the console; I prited out "numc" and "data" from the UserCode.pde) But I´m sure that the sensor is configured at 19200 baud and sending data at 10Hz. I also tried the code posted above with an arduino and it worked very well without modification. So everthing is hooked up correctly and the sensor is working. TX and RX are correctly connected and the baudrate is the same on both ends. Moreover I tried to send a copy of the sensor data string from the arduino to the pixhawk port which gave the same corrupted input in pixhawk. It is like the data is not arriving the right way in the buffer or something like that. So I think there is a problem with the serial 4 (I also tried telemetry 2) -port on pixhawk. Is there a trick to unlock this ports for serial input ??? Do I have to change the initialisation of this ports somewhere else in the code ??? Is my code interfering with mavlink and do I have to disable/ enable mavlink on the used port? I REALLY dont know how to get things done because I know the code is able to work on an arduino and handling time of my master thesis is going out. I guess there are also other people out there having the same problem as I read in some threads, but nobody posted a solution. If someone could help here I think this thread would be the first step by step instruction for a pixhawk custom sensor integration and reading serial data into it. James how did you managed this problem? Thanks in advance !!! Greets Marvin <![if !IE]>▶<![endif]> Reply Marvin, What version of the Arducopter code are you using? In 3.2, both serial 4 and 5 have already been assigned other purposes, a 3rd telemetry port and a 2nd gps. You'll have to search through the code and repurpose whichever serial port you were planning to use. -Chris <![if !IE]>▶<![endif]> Reply Thank you Chris! I´m using ArduCopter 3.2. I found in ArduCopter > system.pde (l.106 - 110) and in ArduCopter > ArduCopter.pde the same (l. 15468 - 15472) #if GPS2_ENABLE if (hal.uartE != NULL) { hal.uartE->begin(38400, 256, 16); } #endif I´ll change this to my baudrate of 19200 so it will work if I enable GPS2. Do you think these modifications on ArduCopter are enough or do I have to change something on PX4 flight stack too? <![if !IE]>▶<![endif]> Reply <![if !IE]>▶<![endif]> Reply to Discussion
https://diydrones.com/forum/topics/pixhawk-custom-sensor-integration
CC-MAIN-2019-13
refinedweb
2,378
61.87
Namespace document alternative formats RDDL by Tim Bray and Jonathan Borden XHTML plus A new element <resource> with a bunch of ordinary attributes like "title" and "description" Two special attributes "nature" (namespace name or mime type) and "purpose". RDF in HTML as described by Tim Berners-Lee An XHTML processor ignores all embedded RDF An RDF processor processes all RDF within an XHTML document as though it were within an RDF document. An RDF processor ignores any XHTML within which any RDF is embedded. TAG held a RDDL challenge to request alternatives. Norm Walsh wrote a summary of the challenge. TAG considered results of challenge and commissioned a draft proposal: Minimal RDDL by Tim Bray and Jonathan Borden Uses <a> elements and two new attributes, rddl:nature and rddl:purpose. Can use other useful <a> attributes like "title" and "longdesc" Does not try to re-use the <a> "rel" and "rev" attributes. All the RDDL proposals are actually very similar and are mutually transformable via XSLT. Paul Cotton 4 of 5
http://www.w3.org/2003/Talks/techplen-tagissue8/slide4-0.html
CC-MAIN-2017-17
refinedweb
171
52.6
This page provides information to help you plan a Anthos Service Mesh upgrade. We recommend that you also review the Istio upgrade notes. About canary upgrades We recommend that you upgrade Anthos Service Mesh by first running a canary deployment of the new control plane. With a canary upgrade, asmcli installs a new revision of the control plane alongside the old control plane. Both the old and new control planes are labeled with a revision label, which serves as an identifier for the control planes. You then migrate workloads to the new control plane by setting the same revision label on your namespaces and performing a rolling restart. The restart re-injects the sidecar proxies in the Pods so that the proxies use the new control plane. With this approach, you can monitor the effect of the upgrade on a small percentage of your workloads. After testing your application, you can migrate all traffic to the new control plane or rollback to the old control plane. This approach is much safer than doing an in-place upgrade where the new control plane replaces the old control plane. For this initial preview, asmcli installs the istio-ingressgateway with a revision label by default. This allows you to do a canary upgrade of the istio-ingressgateway as well as the control plane. Customize the control plane If you customized the previous installation, you need the same customizations when you upgrade Anthos Service Mesh. If your current Anthos Service Mesh installation uses Anthos Service Mesh certificate authority (Mesh CA) as the certificate authority (CA) for issuing mutual TLS (mTLS) certificates, we recommend that you continue your current Anthos Service Mesh installation uses Istio CA (previously called "Citadel"), you can switch to Mesh CA when you upgrade, but you need to schedule downtime. During the upgrade, mTLS traffic is interrupted until all workloads are switched to using the new control plane with Mesh CA. Certificates from Mesh CA include the following data about your application's services: - The Google Cloud project ID - The GKE namespace - The GKE service account name Identifying your CA When you run asmcli install to upgrade, you specify the CA that asmcli should enable on the new control plane. Changing CAs causes downtime when your deploy workloads to the new control plane. If you can't schedule downtime, make sure to specify that same CA for the new control plane that the old control plane uses. If you aren't sure which CA is enabled on your mesh, run the following commands: Get a list of Pods from one of your namespaces: kubectl get pods -n NAMESPACE Replace POD_NAMEwith the name of one of your Pods in the following command: kubectl get pod POD_NAME -n NAMESPACE -o yaml | grep CA_ADDR -A 1 If Mesh CA is enabled on the namespace, your see the following output: - name: CA_ADDR value: meshca.googleapis.com:443.
https://cloud.google.com/service-mesh/v1.10/docs/unified-install/plan-upgrade
CC-MAIN-2021-49
refinedweb
482
54.76
This site uses strictly necessary cookies. More Information I'm making a 2d board-game-style game in Unity 5, and I have a prefab made up of a couple of sprites which represents a game piece. I want some text in my prefab that I can update as the game progresses. If i try to add text, it requires a canvas, but when I create a canvas, an extraordinarily enormous canvas is created, that looks to be at least 1000x times bigger than by camera area. If I try to place this canvas inside my prefab, my prefab is now made of an enormously huge canvas, and my tiny sprite images. This makes the prefab impossible to position, or calculate sizing or animate, or anything else I want to do. How can I add text to a prefab, and make the text contained within the size of my prefab spites? Here's what I have tried so far: if I set the canvas for the text to "Render Mode: World Space" I'm able to make it's rect tranform smaller. However, if I get it as small as my sprites, the text becomes an unreadably blurry mess. I guess this happens because my sprites are literally at least 1000x smaller than the canvas, so when I zoom in enough to even see the sprites, the text has been zoomed into oblivion. My sprites are so much smaller than the canvas, that if I am zoomed out to see the full canvas, my sprites are not even visible. I'm able to kind of make things work if I recreate my prefab using UI Images instead of sprites. This way, the UI Images, and the text are both UI elements contained in the enormous canvas, so the size disparity doesn't exist. However, I don't know what the pitfalls are going to be trying to build an entire game out of ui images instead of sprites. Do I get all the state capabilities of sprites? Answer by Pharan · Oct 04, 2015 at 01:00 AM Use the first method (World Space canvas), but scale down the Transform of the Canvas to around 0.01 on all axes. This will make it match the default 2D sprite scale of "100 pixels per unit". Then set the dimensions and sizes of your UI elements have a gameobject only rotate 180 degrees 3 Answers Fill Font Characters with White? 0 Answers using UnityEngine.UI; 'Not necessary' although I need to use 'Text' and '.text'. Also unable to drag-and-drop the Text from my canvas into the 'text' slot. 1 Answer Is it possible to make 2D Sprites in Unity,Is it possible to make 2D Sprites in Unity or is Blender more suitable? 2 Answers How to prevent jitter with movement over curved slopes 0 Answers EnterpriseSocial Q&A
https://answers.unity.com/questions/1075951/is-there-a-way-to-add-text-to-a-prefab-in-a-2d-gam.html
CC-MAIN-2021-21
refinedweb
479
77.27
Capacity Planning Testing for SharePoint 2007 Dario Mratovich Consultant Microsoft OFC309 Session Objectives and Takeaways • Learn how to determine the real throughput requirements for a farm • Understand how to do capacity planning testing on your SharePoint farm • NOT a primer on how to use VSTT 2008 • Learn some of the different ways in which you can increase capacity in your farm Agenda • Know the goal of your testing • Know what to measure • Determine the throughput requirements for your farm • Create the test environment • Create the tests and custom tools • Run tests and analyze results Know the Goal of Your Testing Determine what you want the end result to be – what are you hoping to prove? While this seems like a simple concept, many people that are doing testing for the first time have a difficult time being very specific in answering this question. Know the Goal of Your Testing • Measuring RPS • Most common • Measuring specific operations • Impact on or impact by normal ops • Measuring how much / how fast content can be indexed • Measuring performance of individual pages: • TTLB for pages with custom code • Clients over latent networks • Typically one of two categories: • Capacity planning verification – yes this will work! • Proof of concept – how much can I do? Know the Goal of Your TestingExample of not doing capacity planning • England and Wales 1901 Census website • Launched in January 2002 • 30 million hits per day • Servers and application couldn’t keep up with demand • Took 8 months to redevelop, redeploy and test Know What to Measure Knowing the goal of your testing will make it easier for you to decide which metrics to captureand what thresholds you need to meet for each metric when running your tests. Know What to Measure • RPS – most tests are based on how many requests you can service. Requests Per Second is the best number for a test like that. RPS can be used for measuring how many pages are delivered as well as things like how many searches are executed. Know What to Measure • Page Time – also known as Time To Last Byte (TTLB), this tells you how long it takes to deliver a page back to the client. Often you will use this value in conjunction with RPS; for example, our farm needs to deliver 100 RPS and pages should load within 5 seconds. Know What to Measure • Crawl Time – for measuring crawl performance, measure • Overall time the crawl takes, • Corpus size, and • Number of documents being indexed per second • Document indexing rate is a little more complicated: • Office Server Search Indexer Catalogs – Documents Filtered gives you the total number of documents that have been indexed per content source • Office Server Search Gatherer Projects – Document Add Rate gives you the number of items indexed per second per content source • Office Server Search Gatherer – Documents Filtered Rate gives you the overall number of items being indexed per second Determine the Throughput Requirements for Your Farm The rest of this section will focus on testing for farm throughput, or RPS, since it is the most common scenario by a wide margin. Determining the RPS needed to support your farm can be a complicated process. Determine the Throughput Requirements for Your Farm • Rule #1: Number of users means nothing! • Rule #2: Number of users means nothing!! • Rule #3: Number of users means nothing!!! • I can support 100,000 users on a single server farm running on my laptop if they each average 1 request every 12 hours • 100k requests over 12 hours is 2 RPS Determine the Throughput Requirements for Your Farm • First determine number of RPS needed • Use historical data if possible (IIS logs and Log Parser, Web Trends, etc.) • Otherwise, start with number of users • Divide users by usage profile • What percent are Light (20), typical (36), heavy (60), or extreme (120) • Multiply number users by number ops per usage profile • Factor in peak concurrency Determine the Throughput Requirements for Your Farm • Contoso has 80k employees; up to 40k may be at work during any 8 hour window • 80k users, 40k active, concurrency 5% to 10% at peak • 10% light, 70% typical, 15% heavy, 5% extreme • (10% light x 40k) x 20 RPH = 80,000 RPH • (70% typical x 40k) x 36 RPH = 1,008,000 RPH • (15% heavy x 40k) x 60 RPH = 360,000 RPH • (5% extreme x 40k) x 120 RPH = 240,000 RPH • 1,688,000 / 3600 (seconds per hour) = 469 RPS • 469 x 10% peak = 46.9 RPS required Determine the Throughput Requirements for Your Farm • Now you know RPS required, but what should those requests be doing? • This determines your test mix • Again, look to any historical info you can get if possible • Otherwise, as in most cases, start making educated guesses • Start with test mixes in Planning for Software Boundaries documents on TechNet demo Introducing Visual Studio Team Test: Building a simple Web Test Create the Test Environment Once you’ve decided what your test goals are, you need to design the environment and tests that are going to be used to execute your tests. This includes not only the SharePoint environment, but also the operational environment. Create the Test EnvironmentSchematic Test Tools Infrastructure SharePoint Environment Create the Test EnvironmentConfiguring Test Servers • VSTT Controller • VSTT Agent(s) • Use a separate SQL Server for VSTT results • Turn off anti-virus software on load test controller and agents • Make sure all network settings are configured correctly, names are resolvable, etc. • Watch out for bottlenecks on your agents and controller Create the Test EnvironmentPlan your infrastructure • Active Directory • Forest and Domain • Users • Do you have enough DCs for the authentication load • Monitor the lsass.exe on DCs • DNS • Load Balancing • Remember, names are only resolved once • A test agent will route all requests for a namespace to the same IP address once it’s initially resolved Create the Test EnvironmentConfigure SharePoint • Stop the WSS timer and Admin services, as well as profile imports and crawls (unless testing these) • Enable BLOB and/or output cache, if appropriate • All pages should be published; nothing checked-out • Make sure navigation is realistic • Make sure you test a wide sample of pages • Stop anti-virus software (unless you are measuring performance when using SharePoint integrated AV) • Write scenarios will change the content database • Restore from backup after a test run that includes writes Create the Test EnvironmentOther SharePoint Tasks • How many users are you going to have, and in what roles? • How are you going to populate those SharePoint roles with AD users and groups? • Do you need • Audiences? • Profile imports? • Search content sources? • To import profiles and crawl content prior to running your tests? How long will it take? Create the Test EnvironmentPreparing Test Data • Make sure you have adequate sample data • A very common stumbling block • Have enough content for a reasonable search corpus • Uploading the same document many times – sometimes hundreds or thousands of times – with different names each time CAN HURT YOU • You will probably need tools to populate sample data • • You almost always end up writing additional tools for other data population tasks Create the Tests and Custom Tools The next step is to create the actual tests that are going to be run. Often times tests are data driven, meaning test parameters are read from a database or CSV file rather than a static value so that the entire test site is hit over the course of a test. That may mean that additional custom tools are developed and used to capture all of the unique sites, pages, lists, and items in the site so that they can be plugged into your tests. Web Tests Best Practices • After recording a test change hardcoded values (URLs, parameters, etc.) to pull from data source • Always have validation rules (error.aspx is 200) • Use multiple users and user roles • The system behaves differently per user role • Avoid using farm admin (it does not benefit caching) • Model client apps such as RSS, Outlook, OneNote Web Tests Best Practices • Parse Dependent Requests – Yes or No? • Rarely, analyze the percentage of first-time users • When set to True, your bottleneck is most likely going to be WFE disk • Internal MS properties analysis tell us 30% of total requests are for resources (JavaScript, CSS, etc.) • You can model this in a separate web test • Always test your web test • Does it work for all URLs? • Does it work with all users? Load Test Best Practices • Validate your test mix; a bad mix can make the results unreasonably fast or slow • Start in a well known system state • Restore a backup before each run • Be sure to update stats and defrag indexes • Perform an iisreset • Define a warmup period for the test; the first request after iisreset does a lot of things • Think times – Yes or No? • Virtually impossible to model correctly • If you do you’ll need to have higher user load to generate high RPS. It can stress the agents Sample Tests and Data Population • • Published by PG based in internal tool • Sample tests cover many basic SharePoint operations • Use as a reference to build new tests • Data population tool defines hierarchical data in XML format • Nest the tag in the same way as the product OM • SPSite->SPWeb->SPList->SPListItem • Sites->Webs->Lists->ListItems) Other Tools You May Need • Script to create users in Active Directory • CSV files or database containing data for webs, lists, libraries, list items and documents for use in webtests • Tool to upload sample corpus into the site • sptdatapop tools • May also be able to use your upload document webtest • Tool to create webs, lists, libraries, list items, etc. • sptdatapop tools • Tool to create My Sites • May be able to use the sptdatapop tools • Tool to create a list of users and passwords to run tests demo Add a WebTest, Run a Load Test Run Tests and Analyze Results Your tests have been created, now you are running your tests. What are some of the bottlenecks you can look for? What are ways you can scale your farm up further? Questions to Ask Yourself • Where is the bottleneck? • There will ALWAYS one • And is it where I expect it to be? • Can performance be improved? How? • Are there spikes in throughput? Are there any strange patterns? • Are there many errors? • Unexpected resources getting downloaded? • Any Load Balancing Issues? Investigation Techniques • Ensure correct configuration (HW, SharePoint Settings, Load Balancer, etc.) • Divide and conquer • Run a simple litmus scenario (e.g. homepage) • Isolate workloads / operations / pages • Reduce farm topology • Read vs. Read-Write scenarios Investigating with VSTT • Use Tables view to: • Find error rate of individual transactions • TTLB per operation • Look for any suspicious responses • Use Graph view to: • Look for RPS and TTLB Patterns • Analyze perf counters and Correlate behaviors Analyzing Performance Counters • Which machine/s cause the bottleneck? • CPU / Memory / Disk IO / Network • Then you can zoom in according to machine role • Start with the VSTT default counter sets • Add SharePoint / Search / Excel specific ones Patterns and BehavioursWhat we expect to see • The SQL Private Bytes behaviour is normal • WFE memory is stable • We expect this level of spikiness in CPU Patterns and BehavioursIdentifying problems • WFE CPU went down across all machines • SQL CPU went up • SQL Lock Wait Time went up • Hence the bottleneck is in SQL demo Reviewing Test Results Typical Data Related Problems • Large lists • Lots of Web parts importing non-cached data from various places • Cross-list queries and CBQ Web parts • Too deep site structures • Too many sites in a site collection • Too many site collections in a Content DB • Too many ACLs • Unrealistic org structure showing on MySite Scaling PointsOnce you understand your capacity requirements, consider: • Pages with custom code – should the code be rewritten? • Are my objects within recommended guidelines? • Number web applications, site collections, sites collections per content database, etc. • Number of items in lists and libraries, etc. • Database optimizations • Additional data files? • Additional SQL Servers? • Disks: RAID options, partition alignment • DAT304 – Considerations for Large-Scale SharePoint Deployments on Microsoft SQL Server Scaling Points (continued)Once you understand your capacity requirements, consider: • Should load be split up by function into multiple farms? • Is the farm running 64-bit? • YES!!! • Should virtualization be used? • What does the host look like? • What does the guest look like? • Is caching used? • Output cache? • Blob cache? • Object cache? • Is the object cache being monitored and sizing accordingly? • Is per-item security being overused? Scaling Points (continued)Once you understand your capacity requirements, consider: • How big are pages? • Fiddler is your friend! • Is SSL being used? • If so are sticky sessions used so that requests don’t re-negotiate on each page? • Is there enough network bandwidth to support the traffic? • Do you have two VLANs for your farm? • One for the page traffic and a second backend channel for your servers to talk to each other and SQL? • Is the communication actually occurring on the appropriate VLAN? • Do you have a dedicated WFE that is used for indexing? Required Slide Speakers, please list the Breakout Sessions, TLC Interactive Theaters and Labs that are related to your session. Any queries, please check with your Track Owner. Related Content Breakout Sessions DAT304 – Considerations for Large-Scale SharePoint Deployments on Microsoft SQL Server OFC301 – 10 Steps to a Successful SharePoint Deployment Whiteboard Sessions WTB301 – SharePoint Architecture Panel Discussion with Joel, Eric and Zlatan Required Slide 10 pairs of MP3 sunglasses to be won Complete a session evaluation and enter to win! Required Slide Speakers, TechEd 2009 is not producing a DVD. Please announce that attendees can access session recordings from Tech-Ed website. These will only be available after the event. Resources Tech·Ed Africa 2009 sessions will be made available for download the week after the event from: • International Content & Community • • Microsoft Certification & Training Resources • • Resources for IT Professionals • Resources for Developers Required Slide.
https://www.slideserve.com/fisk/capacity-planning-testing-for-sharepoint-2007-powerpoint-ppt-presentation
CC-MAIN-2020-40
refinedweb
2,315
52.83
Proposed features/Tag structures Key structures There are basicially three different types of ways that a simple key can be extended with. Parameters A parameter defines a special part of the key to be set. For example name:fr=* sets the french name for something. The parameter by itself usually has no meaning. 'fr' by itself only says that something is 'french', but not what (of course there could be a key called 'fr' that means something, but thats another story). Another way to look at it: You don't set a value for 'fr' but for 'name'. 'fr' just describes in more detail what kind of 'name' we want to set. Structure Keys can also be divided into substructures. For example the 'addr'-namespace contains several subkeys ('street','housenumber',..) that are also valid on their own (you could also just tag street=Goethestraße, but are structured under 'addr' to keep them more organized. Another way to look at it: You set a value for 'street' that is part of an 'addr' (address). Properties Keys sometimes need to be structured to define properties for tags. For example if you defined a cycleway beside the street with cycleway=right you can define it's width with cycleway.width=*. 'width' might be a valid key without 'cycleway' in front of it, but will have a different meaning. width=* for example would define the width of the street it is put on, while cycleway.width=* would define the width of the cycleway that runs beside the street. Another way to look at it: You set a value for 'width', that might or might not be a valid tag on its own, but depends on the preceding tags to have the right meaning (set the width for the cycleway not the street). Value structures Sometimes multiple values for the same key are given by dividing the values with ';' (semicolon).
http://wiki.openstreetmap.org/wiki/Proposed_features/Tag_structures
CC-MAIN-2017-17
refinedweb
315
71.24
Comment Re:Teach the controversy (Score 1) 672 Aliens built the Pyramids Teach The Controversy Also, babies really come from STORKS not sex. Teach the controversy!!!! Aliens built the Pyramids Teach The Controversy Also, babies really come from STORKS not sex. Teach the controversy!!!! And btw... About this line > The website will be a therapist -- telling you only what you want to hear this was a surprising comment to me. If that was your experience with a therapist, please don't assume that all therapists would have such a useless strategy! Good well-trained and empathetic therapists do challenge assumptions and help move you towards useful and new perspectives not merely ego stroking. Everyone if possible should shop around for therapists and find someone that is a good fit, and that includes getting the right amount of insightfulness and independence of thought, with rapport but also without fear of speaking truthfully in your presence. The popular belief these days is that everyone is allowed to a have 'democratic' opinion on any subject regardless if they have any clue as to what they are talking about These links may also be enlightening: Most tales about YHWH aren't painting a picture of a nice guy. It's not that unreasonable to even half-seriously suggest that YHWH was an alien; too many of his actions and orders are pretty inhuman by anyone's measure, but fit a heartless robot just fine. Yeah, because when you do things right, people won't be sure you've done anything at all. See This is just a part of the evangelical fundamentalist echo chamber. This is just a part of the evangelical fundamentalist echo chamber. I am not sure what the "extensible type system" means It means that you can add methods or properties to a class without subclassing it. This feature is one of the very few things that I actually like about Objective C. It also means that Gosu supports custom type loaders that dynamically inject types into the language so you can use them as native objects in Gosu. For example, custom type loaders add Gosu types for objects from XML schemas (XSDs) and from remote WS-I compliant web services (SOAP). Later versions of the Gosu community release will include more APIs and documentation about creating your own custom type loaders. Modules of code containing type loaders can create entire namespaces of new types. This means that a type loader can import external objects and let Gosu code manipulate them as native objects. There are two custom type loaders that included in Gosu: (1) Gosu XML typeloader. This type loader supports the native Gosu APIs for XML. For more information, see "Gosu and XML". (2) Gosu SOAP typeloader. This type loader supports the native Gosu APIs for SOAP. The first Gosu community release does not yet include these add-on typeloaders that support these APIs due to in-progress changes in bundling add-on typeloaders. The Gosu documentation describes the XML and web services APIs right now so you can become familiar with these upcoming APIs. For more information But I really like my semicolons (as much as lispers like their parenthesis) Good news then!!! Because you CAN use your semicolons in Gosu! They are optional, although not the standard Gosu coding style. New languages for the JVM are cool and all, but still no syntax fixes the problems inherent in the JVM. Mainly, the lack of generics. Actually there are several improvements to the Gosu generics system that workaround JVM limitations. In Java, when you use generics, the true type like MyClass is erased and it just becomes MyClass at run time. This called type erasure. In Gosu, if you do the same thing, assuming MyClass is a Gosu type, the run time type is really MyClass. This is called reified generics. (Note however that if the type is a Java type to start out with, like java.util.ArrayList, then the generic version ArrayList in Gosu follows the type erasure route as you'd imagine.) But if you are playing in the Gosu world with Gosu types (for example, a Gosu class ), the language adds code that really does preserve generics even though the JVM doesn't natively think that way. "But it IS a piece of Gosu!" Don't worry: the language will probably be cancelled before it has a chance to really get going. Anyway, that was my first thought too, then I wondered if it was an invitation to Oracle's lawyers...? regarding the "chance to really get going", Gosu is already used by multi-billion dollar companies around the world already, for a bunch of years. See a list of companies here: It's just that the language now available to a wider audience who want it, not just Guidewire Software customers. "could of used a screenshot or two of the historical operating systems." What the fuck does "could of" mean? Native speakers know that he really meant "it could have", which in verbal English becomes "coulda" or "could've", the latter of which sounds like what he typed. There's no need to be mean about it. And certainly no need to score the parent post as "Score: 3 Insightful".... I can see it now... the ships land at the UN and... Alien: Greetings. We come in peace. UN: Where do you come from? Alien: A distant galaxy nearly 10 billion light years away. UN: Why are you here? Alien: To escape religious persecution! Most of our galaxy are ZYZYZYYZ-ists and we dont' feel safe to practice the Tarvu religion. We came to be baptized on the planet of our many-tentacled prophet. Praise Tarvu! It's so easy to join! Suppose you buy an expensive piece of industrial equipment. Once you get it home, you open the box and an EULA falls out. It says you didn't buy the device, you licensed the ability to use it. It says you may not sell the device, or return it for a refund, it is yours now once and for all time. Further, you agree that you can't sue for any injury that happens, even if such an injury is a result of a defect in manufacturing. How would that be any different? How would that be at all legal, based on existing contract law? i'm not a lawyer, but i've been told that you can't sign away your rights to sue for negligence or dangerous products and things like that. so even if someone convinces you to sign, that clause isn't enforceable in the US, or so I've been told. for example, if you rent a parachute and it turns out that they stuffed your parachute with old rags and not a parachute by acident, your survivors can still sue even if you've signed a thing waving your rights. if someone else knows more about the details about how this is handled in different jurisdictions, please speak up... What would an XKCDsort look like? I dunno what it would look like, but when they run the sound algorithm on it, it would sound like some awesome song from Guitar Hero. At least they didn't call it, iMagic. Yet. It is prophesied! Or prophesized! Or prophephizizzle! Or whatever that word is! Someday I'll link back to this post and say we warned you all!!!! All warranty and guarantee clauses become null and void upon payment of invoice.
https://slashdot.org/users2.pl?uid=666868&view=userhomepage&startdate=2013
CC-MAIN-2017-30
refinedweb
1,254
72.56
). 4. Support for Pandas versions 0.19.2 – 0.20.1 Version 1.1 of the Data Import Tool now supports 0.19.2 and 0.20.1 versions of the Pandas library. 5. Column Name Selection If duplicate column names exist in the data file, Pandas automatically mangles them to create unique column names. This mangling can be buggy at times, especially if there is whitespace around the column names. The Data Import Tool corrects this behavior to give a consistent user experience. Until the last release, this was being done under the hood by the Tool. With this release, we changed the Tool’s behavior to explicitly point out what columns are being renamed and how. 6. Template Discovery With this release, we updated how a Template file is chosen for a given input file. If multiple template files are discovered to be relevant, we choose the latest. We also sped up loading data from files if a relevant Template is used. For those of you new to the Data Import Tool, a Template file contains all of the commands you executed on the raw data using the Data Import Tool. A Template file is created when a DataFrame is successfully imported into the IPython console in the Canopy Editor. Further, a unique Template file is created for every data file. Using Template files, you can save your progress and when you later reload the data file into the Tool, the Tool will automatically discover and load the right Template for you, letting you start off from where you left things. 7. Increased Cell Copy and Data Loading Speeds Copying cells has been sped up significantly. We also sped up loading data from large files (>70MB in size). Using the Data Import Tool in Practice: a Machine Learning Use Case In theory, we could look at the various machine learning models that can be used to solve our problems and jump right to training and testing the models. However, in reality, a large amount of time is invested in the data cleaning and data preparation process. More often than not, real-life data cannot be simply fed to a machine learning model directly; there could be missing values, the data might need further processing to remove unnecessary details and join columns to generate a clean and concise dataset. That’s where the Data Import Tool comes in. The Pandas library made the process of data cleaning and processing has gotten easier and now, the Data Import Tool makes it A LOT easier. By letting you visually clean your dataset, be it removing, converting or joining columns, the Data Import Tool will allow you to visually operate on the data frame and look at the outcome of the operations. Not only that, the Data Import Tool is stateful, meaning that every command can be reverted and changes can be undone. To give you a real world example, let’s look at the training and test datasets from the Occupancy detection dataset. The dataset contains 8 columns of data, the first column contains index values, the second column contains DateTime values and the rest contain numerical values. As soon as you try loading the dataset, you might get an error. This is because the dataset contains a row containing column headers for 7 columns. But, the rest of the dataset contains 8 columns of data, which includes the index column. Because of this, we will have to skip the first row of data, which can be done from the Edit Command pane of the ReadData command. After we set `Number of rows to skip` to `1` and click `Refresh Data`, we should see the DataFrame we expect from the raw data. You might notice that the Data Import tool automatically converted the second column of data into a `DateTime` column. The DIT infers the type of data in a column and automatically performs the necessary conversions. Similarly, the last column was converted into a Boolean column because it represents the Occupancy, with values 0/1. As we can see from the raw data, the first column in the data contains Index values.. We can access the `SetIndex` command from the right-click menu item on the `ID` column. Alongside automatic conversions, the DIT generates the relevant Python/Pandas code, which can be saved from the `Save -> Save Code` sub menu item. The complete code generated when we loaded the training data set can be seen below: # -*- coding: utf-8 -*- import pandas as pd # Pandas version check from pkg_resources import parse_version if parse_version(pd.__version__) != parse_version('0.19.2'): raise RuntimeError('Invalid pandas version') from catalyst.pandas.convert import to_bool, to_datetime from catalyst.pandas.headers import get_stripped_columns # Read Data from datatest.txt filename = 'occupancy_data/datatest.txt' data_frame = pd.read_table( filename, delimiter=',', encoding='utf-8', skiprows=1, keep_default_na=False, na_values=['NA', 'N/A', 'nan', 'NaN', 'NULL', ''], comment=None, header=None, thousands=None, skipinitialspace=True, mangle_dupe_cols=True, quotechar='"', index_col=False ) # Ensure stripping of columns data_frame = get_stripped_columns(data_frame) # Type conversion for the following columns: 1, 7 for column in ['7']: valid_bools = {0: False, 1: True, 'true': True, 'f': False, 't': True, 'false': False} data_frame[column] = to_bool(data_frame[column], valid_bools) for column in ['1']: data_frame[column] = to_datetime(data_frame[column]) As you can see, the generated script shows how the training data can be loaded into a DataFrame using Pandas, how the relevant columns can be converted to Bool and DateTime type and how a column can be set as the Index of the DataFrame. We can trivially modify this script to perform the same operations on the other datasets by replacing the filename. Finally, not only does the Data Import Tool generate and autosave a Python/Pandas script for each of the commands applied, it also saves them into a nifty Template file. The Template file aids in reproducibility and speeds up the analysis process. Once you successfully modify the training data, every subsequent time you load the training data using the Data Import Tool, it will automatically apply the commands/operations you previously ran. Not only that, we know that the training and test datasets are similar and we need to perform the same data cleaning operations on both files. Once we cleaned the training dataset using the Data Import Tool, if we load the test dataset, it will intelligently understand that we are loading a file similar to the training dataset and will automatically perform the same operations that we performed on the training data. The datasets are available at – We encourage you to update the latest version of the Data Import Tool in Canopy’s Package Manager (search for the “catalyst” package) to make the most of the updates. For a complete list of changes, please refer to the Release Notes for the Version 1.1 of the Tool here. Refer to the Enthought Knowledge Base for Known Issues with the Tool. Finally, if you would like to provide us feedback regarding the Data Import Tool, write to us at canopy.support@enthought.com. Additional resources: Related blogs: - Using the Canopy Data Import Tool to Speed Cleaning and Transformation of Data & New Release Features - Loading Data Into a Pandas DataFrame: The Hard Way, and The Easy Way - Handling Missing Values in Pandas DataFrames: the Hard Way, and the Easy Way - Enthought Announces Canopy 2.1: A Major Milestone Release for the Python Analysis Environment and Package Distribution (June 2017) Watch a 2-minute demo video to see how the Canopy Data Import Tool works: See the Webinar “Fast Forward Through Data Analysis Dirty Work” for examples of how the Canopy Data Import Tool accelerates data munging:
http://blog.enthought.com/enthought-canopy/data-import-tool/whats-new-canopy-data-import-tool-version-1-1/
CC-MAIN-2020-10
refinedweb
1,274
50.57
Often, all the code for a single application is written in the same source language. This is usually a high-level language such as C or C++. That code is then compiled to ARM assembly code. However, in some situations you might want to make function calls from C/C++ code to assembly code. For example: To call an assembly function from C or C++: In the assembly source, declare the code as a global function using .globl and .type: .globl myadd .p2align 2 .type myadd,%function myadd: // Function "myadd" entry point. .fnstart add r0, r0, r1 // Function arguments are in R0 and R1. Add together and put the result in R0. bx lr // Return by branching to the address in the link register. .fnend armclang requires that you explicitly specify the types of exported symbols using the .type directive. If the .type directive is not specified in the above example, the linker outputs warnings of the form: Warning: L6437W: Relocation #RELA:1 in test.o(.text) with respect to myadd... Warning: L6318W: test.o(.text) contains branch to a non-code symbol myadd. In C code, declare the external function using extern: #include <stdio.h> extern int myadd(int a, int b); int main() { int a = 4; int b = 5; printf("Adding %d and %d results in %d\n", a, b, myadd(a, b)); return (0); } In C++ code, use extern "C": extern "C" int myadd(int a, int b); Ensure that your assembly code complies with the Procedure Call Standard for the ARM Architecture (AAPCS). The AAPCS describes a contract between caller functions and callee functions. For example, for integer or pointer types, it specifies that: For more information, see the Procedure Call Standard for the ARM Architecture (AAPCS). Compile both source files: armclang --target=arm-arm-none-eabi -march=armv8-a main.c myadd.s
http://infocenter.arm.com/help/topic/com.arm.doc.100748_0607_00_en/lmi1470147220260.html
CC-MAIN-2019-18
refinedweb
308
64.71
Re: Permission Errors - From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT]) - Date: Wed, 26 Oct 2005 01:53:48 GMT Hi Russ, Really glad that you've got things working again. Some further comments below: As for the "\TempConvert3" path in IIS manager, it indicate the physical path of the virtual directory. For those virtual directories whose path is just under the default inetpub\wwwroot, the path is like: "\XXXsubpathname" If the physical path of the virtual dir is not under wwwroot, it'll need to be specified as full path like; "d:\webfolder\myapp" So when we move a webproject to a new server (creating the new virtual directory for it on the new server), we need to make sure the path is also updated to the new physical location on the new server. Anyway thanks again for your posting. Always welcome when you meet any problem. Steven Cheng Microsoft Online Support Get Secure! (This posting is provided "AS IS", with no warranties, and confers no rights.) -------------------- | NNTP-Posting-Date: Tue, 25 Oct 2005 16:33:53 -0500 | From: Russ <russk2@xxxxxxxxxxx> | Newsgroups: microsoft.public.dotnet.general | Subject: Re: Permission Errors | Date: Tue, 25 Oct 2005 17:34:07 -0400 | Message-ID: <570tl1d16p5l17frun69f5jhi7fob67sn> <pu6ql19l5bfep5uv3sk6qvq0fl9rjekcio@xxxxxxx> <zUPL#xX2FHA.3220@xxxxxxxxxxxxxxxxxxxxx> <nctsl1hbtpgt7qrjqe7pgejslcvfgtj4rq@xxxxxxx> | X-Newsreader: Forte Agent 3.0/32.763 | MIME-Version: 1.0 | Content-Type: text/plain; charset=us-ascii | Content-Transfer-Encoding: 7bit | Lines: 415 | NNTP-Posting-Host: 68.37.155.53 | X-Trace: sv3-LqLh1Gv0FhKollbANUwXP+jOcniU/lYmpor8sgSono4gZiurKYb7YfWana1LnJVv+5Kgruh7 /E5qL8l!EIEIdaRQ2sat71zPr5A50eQFF00y2MFhVwR8mLWu4/b+D0kp/PlSyu3zI5rcBnci2+zt pSD7sMlL!Z0iYV6KU |!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POST ED!not-for-mail | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.general:52823 | X-Tomcat-NG: microsoft.public.dotnet.general | | Ok, I built the TempConvert3 sample web service on the XP work | station. It works fine. | | I then compared the files with the same files of my web service that | does not work. I could not find anything that looks suspicious. Of | course I have added a lot of code and additional files in my web | service. I especially looked at global.asax.h and found no | differences except in the name of the namespace. | | ... well I have it all working now! After I wrote the above, I looked | at IIS manager and noticed a difference in the local path. For the | TempConvert3 web it showed the path as "\TempConvert3", but for my | service the path was "C:\PssDev\PayrollEntryService". I then deleted | PayrollEntryService from IIS, and then cleaned/built the project in | Visual Studio again. When it deployed, I looked in IIS again and the | path was now "\PayrollEntryService". And my web service now works on | the XP machine - hooray! | | Next I looked at the 2003 server and saw that the local path was | similarly wrong. I deleted it from IIS and then rebuilt the service | setup project, and then deployed it on the server. The local path was | now right and the service runs on the server now. | | Finally I tested the original problem - the problem that the service | could not open files on the server when the service was running on the | XP work station. All seems ok now as long as I impersonate a user on | the XP workstation when running on that machine, and impersonate a | user on the server when running on that machine. | | I sure don't know how things got so screwed up, but I surely | appreciate all the time you have taken to help me Steven. I think I | can finally get back to working on the project again now. | | Thanks again, Russ | | On Tue, 25 Oct 2005 14:27:04 -0400, Russ <russk2@xxxxxxxxxxx> wrote: | | >Steven, responses interspersed: | > | >>Hi Russ, | >> | >>Thanks for your response. As you said that | >>============ | >> The web service project exists on the | >>local workstation, not the server. | >>============ | >>do you mean the webservice project's files and assemblies are on the | >>workstation machine and shared to remote boxes? I'm not quite sure on this | >>since you deployed the webservice to your new windows 2003 server, you | >>should also copy the files and assemblies there, didn't you? | > | >The web service was my first ASP.NET project. When I started the | >project, visual studio automatically selected my work station as the | >place where the project files would reside. I could build and host | >the web service on the W2K work station with no problem. But once the | >project was built and debugged I had to deploy it to the W2K server | >for further testing with the ASP.NET client. So I built a deployment | >project and that worked fine. | > | >The problem now is that the web service will not run, whether it is | >hosted on the XP work station, or on the new 2003 server. I always | >get the error message: | > | >> Parser Error Message: Could not load type | >> 'PayrollEntryService.Global'. | > | >Am I correct in assuming that this problem has nothing to do with the | >server, when I am trying to run or debug it on the work station? | > | >Also, keep in mind that it was working on the work station at one | >time. Then I removed the W2K server from service and set up the new | >2003 server. I don't see any reason why that should have caused the | >web service to stop working on the work station. | > | > | >>Also, for domain controller, generally we do not recommend hosting asp.net | >>application on DC since DC has some restrictions such as not have local | >>accounts,..... | > | >This is not a problem for the usage that I need. And anyway the web | >service was working fine on the W2K domain server. | > | > | >> Anyway, if you can start from create and run a simple | >>asp.net webservice on your new windows 2003 server so as to makesure the | >>asp.net framework and IIS works correctly. Then, we can continue to focus | >>on your specific project. | > | >Ok, I understand. I will actually do that on the work station first. | > | >I will do it today and let you know what I find out. | > | >Thanks, Russ | > | >> | >>Please let me know if you have any questions. | >> | >>Thanks, | >> | >>Steven Cheng | >>Microsoft Online Support | >> | >>Get Secure! | >>(This posting is provided "AS IS", with no warranties, and confers no | >>rights.) | >> | >> | >> | >>-------------------- | >>| NNTP-Posting-Date: Mon, 24 Oct 2005 12:59:22 -0500 | >>| From: Russ <russk2@xxxxxxxxxxx> | >>| Newsgroups: microsoft.public.dotnet.general | >>| Subject: Re: Permission Errors | >>| Date: Mon, 24 Oct 2005 13:59:18 -0400 | >>| Message-ID: <pu6ql19l5bfep5uv3sk6qvq0fl9rjekcio> | >>| X-Newsreader: Forte Agent 3.0/32.763 | >>| MIME-Version: 1.0 | >>| Content-Type: text/plain; charset=us-ascii | >>| Content-Transfer-Encoding: 7bit | >>| Lines: 401 | >>| NNTP-Posting-Host: 68.37.155.53 | >>| X-Trace: | >>sv3-mnWgmMZzSDgLc0dibOaGmDNtZP69cTDQlc3dngXWYcw4k0qJXOfG1sWSf3HLLJNh3hCvTz mI | >>e3Bucmc!CRFb1C/9kkVDy0wpDnOrXPLBGWeNLui/9utwvtcS9YNztk63oX2WPMPyWnCufQJZB7 kt | >>G589JJzw!ujIEjHcT | >>| li | >>ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gig an | >>ews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.PO ST | >>ED!not-for-mail | >>| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.general:52690 | >>| X-Tomcat-NG: microsoft.public.dotnet.general | >>| | >>| Steven, thanks for your reply. The web service project exists on the | >>| local workstation, not the server. It was working when I had the old | >>| server running, both when running the web service on the local | >>| workstation and when deployed to the W2K server. | >>| | >>| Now it works on neither - and as far as I know I did not change | >>| anything at the workstation. As well as I can understand, the server | >>| should not have any effect on starting the project on the work | >>| station. Once the service is running on the workstation, then it | >>| needs the server in order to locate some data files, but the project | >>| should still start, even if the server was shut down. Right??? | >>| | >>| And all I did was to set up a new server and remove the old one. | >>| Incidentally, if I copy the service to the new server and try to run | >>| it there, I get the same error. It seems that something has changed | >>| in one of the project files, but I still don't have a clue what to | >>| look for. | >>| | >>| One last thing. The old server was a domain server and I set up the | >>| new one to be a domain server with the same domain name. After the | >>| 2003 server was up, I removed the workstation from the domain, making | >>| it a workgroup computer, and then joined the domain again, to be sure | >>| it was registered correctly with the new server. Later in my testing | >>| I started up the old server and sure enough the web service would run | >>| on it (but still not on the work station). Then I demoted the old W2K | >>| server down to a workgroup computer, and then joined it to the new | >>| domain. At that point the web service no longer works on the W2K | >>| server either! | >>| | >>| Please try to make some sense of this for me - I haven't a clue! | >>| | >>| Thanks, Russ | >>| | >>| On Mon, 24 Oct 2005 04:39:22 GMT, stcheng@xxxxxxxxxxxxxxxxxxxx (Steven | >>| Cheng[MSFT]) wrote: | >>| | >>| >Hi Russ, | >>| > | >>| >As for the new problem you mentioned, it is likely caused by some | >>| >deployment setting. | >>| >The "XXXX.Global " is a class , and generally each ASP.NET application | >>| >will have one(or using the default if we don't explicitly provide one). | >>| >When using VS.NET IDE to create the asp.net project, it'll | >>automatically | >>| >add such a global class. However, the error message you met is not | >>| >specific to the global class, it indicate that your asp.net | >>| >application(webservice) can not find the certain class (assembly) it | >>| >requires.(generally global class is the first class which need to be | >>loaded | >>| >into runtime...). | >>| > | >>| >So on your new 2003 server, go to your webservice(PayrollEntryService)'s | >>| >application dir, and check the private "bin" sub dir to see whether all | >>the | >>| >webservice's assemblies are in the "bin" dir. | >>| > | >>| >If the assemblies are all existing, then make sure your application's | >>| >physical dir is located in a public place (not a user specific one , for | >>| >example under document settings\username......) so that the ASP.NET | >>process | >>| >identity can successfully access them. | >>| > | >>| >Also, above all , you need to makesure a normal asp.net | >>| >application(webservice) can run correctly (hosted in IIS). If there're | >>| >anything unclear, please feel free to post here. | >>| > | >>| >Thanks, | >>| >Steven Cheng | >>| >Microsoft Online Support | >>| > | >>| >Get Secure! | >>| >(This posting is provided "AS IS", with no warranties, and confers no | >>| >rights.) | >>| > | >>| > | >>| > | >>| > | >>| >-------------------- | >>| >| NNTP-Posting-Date: Fri, 21 Oct 2005 14:22:25 -0500 | >>| >| From: Russ <russk2@xxxxxxxxxxx> | >>| >| Newsgroups: microsoft.public.dotnet.general | >>| >| Subject: Re: Permission Errors | >>| >| Date: Fri, 21 Oct 2005 15:22:06 -0400 | >>| >| Message-ID: <nceil1lnvdn4sguv8ofl6tn60r29r3bs0> | >>| >| X-Newsreader: Forte Agent 3.0/32.763 | >>| >| MIME-Version: 1.0 | >>| >| Content-Type: text/plain; charset=us-ascii | >>| >| Content-Transfer-Encoding: 7bit | >>| >| Lines: 253 | >>| >| NNTP-Posting-Host: 68.37.155.53 | >>| >| X-Trace: | >>| | >>>sv3-nXJenZUWWBgFZCR9vAHhVQLHt3Ar8sodPe/9DYkFMD06e5++XOLGolXHkMgGuBK9UwTQG 3M | >>J | >>| | >>>uOW6yvi!Oh4nJ9x+wxOR0neSTmsAJJ2RUlucT5voq4zjyjd5/cH6Ik6BJ4XkBaGpD25dXcsAP mo | >>o | >>| >ArLXAoie!/vUojs8-o nl | >>i | >>| | >>>ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gi ga | >>n | >>| | >>>ews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.P OS | >>T | >>| >ED!not-for-mail | >>| >| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.general:52567 | >>| >| X-Tomcat-NG: microsoft.public.dotnet.general | >>| >| | >>| >| Sj | >>4 | >>| >x | >>| >| | >>| | >>> 26 | >>I | >>| >P | >>| >| >8Kdp9Ub8!SFDYpnTFEED02.phx.gbl!tornado.fastwebnet.it!tiscal i! | >>n | >>| >e | >>| >| | >>| | >>>>wsfeed1.ip.tiscali.net!proxad.net!216.239.36.134.MISMATCH!postnews.googl e. | >>c | >>| >o | >>| >| | >>| | >>>>m!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local 01 | . - References: - Permission Errors - From: Russ - RE: Permission Errors - From: Steven Cheng[MSFT] - Re: Permission Errors - From: Steven Cheng[MSFT] - Re: Permission Errors - From: Russ - Re: Permission Errors - From: Steven Cheng[MSFT] - Re: Permission Errors - From: Russ - Re: Permission Errors - From: Russ - Prev by Date: File Locking - Next by Date: What special for .net project in Software Development Life Cycle? - Previous by thread: Re: Permission Errors - Next by thread: How to handle hover + mouse down on a control ? - Index(es):
http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.general/2005-10/msg00791.html
crawl-002
refinedweb
2,003
57.77
Odoo Help Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps: CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc. How to generate values when click a button? Hello, Im trying to create a button with method when you click on it would create a new row with default values in the tree view maybe there is any examples that i could have a look? I already got the button just strugling with the function. Any examples and help would be appreaciated Thank you, If you simply want to create a record for any table (on API v7) you only need to call the create method and supply the required fields. For example, if you are on the view for sale orders and for some season you need to create a product, you could use following code: product_obj = self.pool.get('product.product') product_id = product_obj.create(cr, uid, {'name': 'My product'}) In this case, product only needs a name to be supplied in the function, but any other object needs to have a dictionary of required fields to be supplied. Of course this can also be used in a loop if you want to generate multiple entries. Something like so: product_obj = self.pool.get('product.product') names_list = ['item1', 'item2', 'item3'] for name in names_list: product_id = product_obj.create(cr, uid, {'name': name}) This is under the assumption that you use the ORM on Odoo v7. If you use the new API, creation is only slightly different. Try this : You add this In py: _columns = { 'id_no' : fields.char('id no', size=64), } _defaults = { 'id_no': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'sequence_code'), } def add(self, cr, uid, ids, context): vals = {} vals['id_no'] = 'Pre'+ids[0] self.create(cr, SUPERUSER_ID, vals, context) return True In view: <record> ---------- <field name="id_no"/> <button name="add" colspan="1" string="Add" type="object" /> </record> <record id="seq_unique_id" model="ir.sequence.type"> <field name="name">my_sequence</field> <field name="code">sequence_code</field> </record> <record id="seq_unique_id2" model="ir.sequence"> <field name="name">my_sequence</field> <field name="code">sequence_code</field> <field name="prefix">prefix</field> <field name="padding">3</field> </record> If you're looking for an example, there is one at page "Accounting/Configuration/Periods/Fiscal Years" when you create new fiscal year, there is two buttons "Create Monthly Periods" and "Create 3 Months Periods" with exactly same behavior as you're truing to implement. So you can take look and you'll get idea how to continue. About This Community Odoo Training Center Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now Why not using the Add Item link? Make the tree view not readonly? I mean yes add a link is a good example, but what im trying to do is generate lots of date when you click a button with predefined default values. Check the create_period method in odoo/odoo/addons/account/account.py. It is called from a button in view_account_fiscalyear_form view (odoo/addons/account/account_view.xml) And if you create without passing any value, it will use all default values. Ivan thanks very good example!
https://www.odoo.com/forum/help-1/question/how-to-generate-values-when-click-a-button-76323
CC-MAIN-2018-17
refinedweb
538
55.44
Fast communication of large arrays MPI for Python offers very convenient and flexible routines for sending and receiving general Python objects. Unfortunately, this flexibility comes with a cost in performance. In practice, what happens under the hood is that Python objects are converted to byte streams (pickled) when sending and back to Python objects (unpickled) when receiving. These conversions may add a serious overhead to communication. Good news is that MPI for Python offers alternative routines for sending and receiving contiguous memory buffers (such as NumPy arrays) with very little overhead. To distinguish between the two types of routines, the names of the flexible, all-purpose routines are all in lower case whereas the names of the fast, contiguous memory specific routines always start with an upper case letter. When using one of the upper case methods, the underlying MPI implementation can simply copy memory blocks without any conversions. If the amount of data to be communicated is large, this will give an enormous performance improvement. It is therefore always advisable to use only the upper case methods (apart from maybe some simple initialisation). Send/receive NumPy arrays Sending and receiving a NumPy array efficiently is very straightforward. Since MPI for Python knows NumPy arrays, it can automatically take care of most of the details. To send, one basically just needs to use the upper case method Send() giving the NumPy array and destination rank as arguments: Send(data, dest) To receive, one needs to first prepare a NumPy array to receive the data to and then use the upper case method Recv() giving the array and source rank as arguments: data = numpy.empty(shape, dtype) Recv(data, source) Note the difference between the upper/lower case methods on the receive side! Upper case Recv() does not return the data, but instead copies it to an existing array. Example: from mpi4py import MPI import numpy comm = MPI.COMM_WORLD rank = comm.Get_rank() data = numpy.empty(100, dtype=float) if rank == 0: data[:] = numpy.arange(100, dtype=float) comm.Send(data, dest=1) elif rank == 1: comm.Recv(data, source=0) Combined send and receive MPI supports also of sending one message and receiving another with a single call. This reduces the risk of deadlocks in many common situations. For example, when doing a simple message exchange (i.e. two processes send and receive a message to/from each other) one needs to be careful to have one process first receive and the other send and then vice versa to avoid a deadlock. With a combined send and receive, both processes can simply call a single MPI call and be done with it. The combined routine Sendrecv() is similar to the separate Send() and Recv() routines. It basically just combines the two and the arguments reflect this: buffer = numpy.empty(data.shape, dtype=data.dtype) Sendrecv(data, dest=tgt, recvbuf=buffer, source=src) The destination ( tgt) and source ( src) ranks can be the same or they can be different. If no destination or source is desired (e.g. on boundaries) one can use MPI.PROC_NULL to indicate no communication. Just like with the upper case receive, the receive buffer ( buffer) needs to exist before the call and be sufficiently large to hold all the data to be received. data = numpy.arange(10, dtype=float) * (rank + 1) buffer = numpy.empty(10, float) if rank == 0: tgt, src = 1, 1 elif rank == 1: tgt, src = 0, 0 comm.Sendrecv(data, dest=tgt, recvbuf=buffer, source=src) Communicate any contiguous array MPI datatypes MPI has a number of predefined datatypes to represent data, e.g. MPI.INT for an integer and MPI.DOUBLE for a floating point number (in Python float is double precision). If needed, one can also define custom datatypes, which can be handy e.g. to use non-contiguous data buffers. MPI has e.g. the following pre-defined datatypes available: - MPI.INT for an integer ( int) - MPI.DOUBLE for a floating point number ( float) - MPI.CHAR for a single character ( str) - MPI.COMPLEX for a complex number ( complex) Manual definition of a memory buffer When communicating a Python object (lower case methods) or a NumPy array (upper case methods), the datatype does not need to be specified. Objects are serialised into byte streams and the datatype of a NumPy array is automatically detected. If you have another type of contiguous array (i.e. an object referring to a contiguous memory space containing multiple elements of a single datatype), you have to do it manually instead. The data buffer argument for the upper case methods is actually expected to yield three pieces of information: - location in memory - number of elements - datatype of the elements These can be automatically obtained from a NumPy array, but now we need to define them manually as a list of three items: [buffer, count, datatype]. For example, assuming data contains an array of 100 integers, we could send it like this: comm.Send([data, 100, MPI.INT], dest=tgt) If one is working with simple contiguous arrays, the number of elements in an array can also be inferred from the byte size of the buffer ( data) and the byte size of the datatype. Thus, for such cases one can optionally also use a shorter syntax: [buffer, datatype]. Since the number of elements is usually trivially known, it is a good idea to simply stick with the 3-element syntax. An example of sending and receiving a manually defined memory buffer (using a NumPy array for the buffer just for simplicity): from mpi4py import MPI import numpy comm = MPI.COMM_WORLD rank = comm.Get_rank() data = numpy.empty(100, dtype=float) if rank == 0: data[:] = numpy.arange(100, dtype=float) comm.Send([data, 100, MPI.DOUBLE], dest=1) elif rank == 1: comm.Recv([data, 100, MPI.DOUBLE], source=0) © CC-BY-NC-SA 4.0 by CSC - IT Center for Science Ltd.
https://www.futurelearn.com/courses/python-in-hpc/0/steps/65144
CC-MAIN-2020-05
refinedweb
982
57.16
Difference between revisions of "Random shuffle" From HaskellWiki Revision as of 22:52, 13 December 2016 Contents The problem Shuffling a list, i.e. creating a random permutation, is not easy to do correctly. Each permutation should have the same probability. Packages There are ready made packages available from Hack] Other implemenations Purely functional - Using Data.Map, O(n * log n) import System.Random import Data.Map fisherYatesStep :: RandomGen g => (Map Int a, g) -> (Int, a) -> (Map Int a, g) fisherYatesStep (m, gen) (i, x) = ((insert j x . insert i (m ! j)) m, gen') where (j, gen') = randomR (0, i) gen fisherYates :: RandomGen g => g -> [a] -> ([a], g) fisherYates gen [] = ([], gen) fisherYates gen l = toElems $ foldl fisherYatesStep (initial (head l) gen) (numerate (tail l)) where toElems (x, y) = (elems x, y) numerate = zip [1..] initial x gen = (singleton 0 x, gen)"]
http://wiki.haskell.org/index.php?title=Random_shuffle&diff=prev&oldid=61319
CC-MAIN-2021-04
refinedweb
141
57.77
This action might not be possible to undo. Are you sure you want to continue? November 2006) Department of the Treasury Internal Revenue Service 8288 U.S. Withholding Tax Return for Dispositions by Foreign Persons of U.S. Real Property Interests OMB No. 1545-0902 Complete Part I or Part II. Also complete and attach Copies A and B of Form(s) 8288-A. (Attach additional sheets if you need more space.) Part I 1 To Be Completed by the Buyer or Other Transferee Required To Withhold Under Section 1445(a) Identifying number Name of buyer or other transferee responsible for withholding (see page 6) Street address, apt. or suite no., or rural route. Do not use a P.O. box. City or town, state, and ZIP code Phone number (optional) ( ) 2 Description and location of property acquired 3 6 Date of transfer Check applicable box. 4 Number of Forms 8288-A attached 5 7 Amount realized on the transfer Amount withheld a Withholding is at 10% b Withholding is of a reduced amount Part II 1 To Be Completed by an Entity Subject to the Provisions of Section 1445(e) Identifying number Name of entity or fiduciary responsible for withholding (see instructions) Street address, apt. or suite no., or rural route. Do not use a P.O. box. City or town, state, and ZIP code Phone number (optional) ( ) 2 Description of U.S. real property interest transferred or distributed 3 5 Date of transfer Complete all items that apply. a Amount subject to withholding at 35% b Amount subject to withholding at 10% c Amount subject to withholding at reduced rate d Large trust election to withhold at distribution 4 6 Number of Forms 8288-A attached Total amount withheld withholding agent, partner, fiduciary, or corporate officer Preparer’s signature Firm’s name (or yours if self-employed) and address Date Title (if applicable) Check if selfemployed EIN ZIP code Cat. No. 62260A Form Date Preparer’s SSN or PTIN For Privacy Act and Paperwork Reduction Act Notice, see the instructions. 8288 (Rev. 11-2006) Form 8288 (Rev. 11-2006) Page 2 Section references are to the Internal Revenue Code unless otherwise noted. Amount To Withhold Generally, you must withhold 10% of the amount realized on the disposition by the transferor (see Definitions on page 3). See Entities Subject to Section 1445(e) on page 5 for information about when withholding at 35% is required. Also see Withholding certificate issued by the IRS on page 4 for information about applying for reduction or elimination of withholding. Joint transferors. If one or more foreign persons and one or more U.S. persons jointly transfer a U.S. real property interest, you must determine the amount subject to withholding in the following manner. 1. Allocate the amount realized from the transfer among the transferors based on their capital contribution to the property. For this purpose, a husband and wife are treated as having contributed 50% each. 2. Withhold on the total amount allocated to foreign transferors. 3. Credit the amount withheld among the foreign transferors as they mutually agree. The transferors must request that the withholding be credited as agreed upon by the 10th day after the date of transfer. If no agreement is reached, credit the withholding by evenly dividing it among the foreign transferors. Where To File If you are filing in 2006, send Form 8288 with the amount withheld, and Copies A and B of Form(s) 8288-A to Internal Revenue Service, Philadelphia, PA 19255. If you are filing after 2006, send Form 8288 with the amount withheld, and copies A and B of Form(s) 8288-A to the Ogden Service Center, P.O. Box 409101, Ogden, UT 84409. General Instructions Purpose of Form A withholding obligation under section 1445 is generally imposed on the buyer or other transferee (withholding agent) when a U.S. real property interest is acquired from a foreign person. The withholding obligation also applies to foreign and domestic corporations, qualified investment entities, and the fiduciary of certain trusts and estates. This withholding serves to collect U.S. tax that may be owed by the foreign person. Use this form to report and transmit the amount withheld. You are not required to TIP withhold if any of the on Exceptions (which begin page 3) apply. Forms 8288-A Must Be Attached Anyone who completes Form 8288. After receipt of Form 8288 and Form(s) 8288-A, the IRS will stamp Copy B of Form 8288-A to show receipt of the withholding and will forward the stamped copy to the foreign person subject to withholding at the address shown on Form 8288-A. You are not required to furnish a copy of Form 8288 or 8288-A directly to the transferor. To receive credit for the withheld amount, the transferor generally must attach the stamped Copy B of Form 8288-A to a U.S. income tax return (for example, Form 1040NR or 1120-F) or application for early refund filed with the IRS. You are required to include the taxpayer identification numbers (TIN) of the transferor CAUTION and transferee on Forms 8288 and 8288-A. on Forms 8288 and 8288-A including the transferor’s TIN., and b. The alien or corporation did not own more than 5% of that stock at any time during the 1-year period ending on the date of the distribution. Use Form 1042, Annual Withholding Tax Return for U.S. Source Income of Foreign Persons, and Form 1042-S, Foreign Person’s U.S. Source Income Subject to Withholding, to report and pay over the withheld amounts. When To File after the 20th day after the date of transfer. Installment payments. You must withhold the full amount at the time of the first installment payment. If you cannot because the payment does not involve sufficient cash or other liquid assets, you may obtain a withholding certificate from the IRS. See the instructions for Form 8288-B, Application for Withholding Certificate for Dispositions by Foreign Persons of U.S. Real Property Interests, for more information. Penalties Under section 6651, penalties apply for failure to file Form 8288 when due and for failure to pay the withholding when due. In addition, if you are required to but do not withhold tax under section 1445, the tax, including interest, may be collected from you. Under section 7202, you may be subject to a penalty of up to $10,000 for willful failure to collect and pay over the tax. Corporate officers or other responsible persons may be subject to a penalty under section 6672 equal to the amount that should have been withheld and paid over to the IRS. Form 8288 (Rev. 11-2006) Page 3). Withholding agent. For purposes of this return, this means the buyer or other transferee who acquires a U.S. real property interest from a foreign person. Foreign person. A nonresident alien individual, a foreign corporation that does not have a valid election under section 897(i) to be treated as a domestic corporation, a foreign partnership, a foreign trust, or a foreign estate. A resident alien individual is not a foreign person. U.S. real property interest.: 1. An interest in a domestically controlled qualified investment entity. 2. An interest in a corporation that has disposed of all its U.S. real property interests in transactions in which the full amount of any gain was recognized as provided in section 897(c)(1)(B). 3. An interest in certain publicly traded corporations, partnerships, and trusts. See Regulations sections 1.897-1 and -2 for more information. Also see Transferred property that is not a U.S. real property interest on page 4. Qualified investment entity. A qualified investment entity is: ● A real estate investment trust (REIT), and ● A regulated investment company (RIC) that is a U.S. real property holding corporation. For more information, see Pub. 515. Domestically controlled qualified investment entity. A qualified investment entity is domestically controlled if at all times during the testing period less than 50% in value of its stock was held, directly or indirectly, by foreign persons. The testing period is the shorter of (a) the 5-year period ending on the date of the disposition (or distribution), or (b) the period during which the entity was in existence. You are not required to withhold if any of the following applies. 1. Purchase of residence for $300,000 or less. One or more individuals acquire U.S. real property for use as a residence and the amount realized (sales price) is not more than $300,000.. 2. Transferor not a foreign person. You receive a certification of nonforeign status from the transferor, signed under penalties of perjury, stating that the transferor is not a foreign person and containing the transferor’s name, address, and identification number (social security number (SSN) or employer identification number (EIN)). If you receive a certification, the withholding tax cannot be collected from you unless you knew that the certification was false or you received a notice from your agent or the transferor’s agent, including sections 897 and 1445.. If, after the date of transfer, you receive a notice from your agent or the transferor’s agent that the certification of nonforeign status is false, you do not have to withhold on consideration paid before you received the notice. However, you must withhold the full 10% of the amount realized from any consideration that remains to be paid, if possible. You must do this by withholding and paying over the entire amount of each successive payment of consideration until the full 10% has been withheld and Form 8288 (Rev. 11-2006) Page 4 paid to the IRS. These amounts must be reported and transmitted to the IRS by the 20th day following the date of each payment. 3. Transferred property that is not a U.S. real property interest. You acquire an interest in property that is not a U.S. real property interest (defined on page 3). that an interest in a corporation is not a U.S. real property interest is false, see Late notice of false certification on page 3. Generally, no withholding is required on the acquisition of an interest in a foreign corporation. However, withholding may be required if the foreign corporation has made the election under section 897(i) to be treated as a domestic corporation. 4. Transferor’s nonrecognition of gain or loss. You may receive a notice from the transferor signed under penalties of perjury stating that the transferor is not required to recognize gain or loss on the transfer because of a nonrecognition provision of the Internal Revenue Code (see Temporary Regulations section 1.897-6T(a)(2)) or a provision in a U.S. tax treaty. You may rely on the transferor’s notice the Director, Philadelphia Service Center, P.O. Box 21086, FIRPTA Unit, Philadelphia, PA 19114-0586. If you are filing after 2006, you must send a copy of the notice of nonrecognition to the Ogden Service Center, P.O. Box 409101, Ogden, UT 84409. See Regulations section 1.1445-2(d)(2) for more information on the transferor’s notice of nonrecognition. Note. A notice of nonrecognition cannot be used for the exclusion from income under section 121, like-kind exchanges that do not qualify for nonrecognition treatment in their entirety, and deferred like-kind exchanges that have not been completed when it is time to file Form 8288. In these cases, a withholding certificate issued by the IRS, as described next, must be obtained. 5.: a. Reduced withholding is appropriate because the 10% or 35% amount exceeds the transferor’s maximum tax liability, b. The transferor is exempt from U.S. tax or nonrecognition provisions apply, or. You can find Rev. Proc. 2000-35 on page 211 of Internal Revenue Bulletin 2000-35 at. on page 2 for more information. 6. No consideration paid. The amount realized by the transferor is zero (for example, the property is transferred as a gift and the recipient does not assume any liabilities or furnish any other consideration to the transferor). 7. Options to acquire U.S. real property interests. An amount is realized by the grantor on the grant or lapse of an option to acquire a U.S. real property interest. However, withholding is required on the sale, exchange, or exercise of an option. 8. Property acquired by a governmental unit. The property is acquired by the United States, a U.S. state or possession or political subdivision, or the District of Columbia. For rules that apply to foreclosures, see Regulations section 1.1445-2(d)(3). 9. Applicable wash sale transaction. A distribution from a domestically controlled qualified investment entity is treated as a distribution of a U.S. real property interest only because an interest in the entity was disposed of in an applicable wash sale transaction. See section 897(h)(5). Liability of Agents If the transferee or other withholding agent has received (a) a transferor’s certification of nonforeign status or (b) a corporation’s statement that an interest is not a U.S. real property interest, and the transferee’s or transferor’s agent knows that the document is false, the agent must provide notice to the transferee or other withholding agent. If the notice is not provided, the agent will be liable for the tax that should have been withheld, but only to the extent of the agent’s compensation from the transaction. If you are the transferee or withholding agent and you receive a notice of false certification or statement from your agent or the transferor’s agent, you must withhold tax as if you had not received a certification or statement. But see Late notice of false certification on page 3. The terms “transferor’s agent” and “transferee’s agent” mean any person who represents the transferor or transferee in any negotiation with another person (or another person’s agent) relating to the transaction or in settling the transaction. For purposes of section 1445(e), a transferor’s or transferee’s agent is any person who represents or advises an entity, a holder of an interest in an entity, or a fiduciary with respect to the planning, arrangement, or completion of a transaction described in sections 1445(e)(1) through (4). A person is not treated as an agent if the person only performs one or more of the following acts in connection with the transaction: 1. Receiving and disbursing any part of the consideration. 2. Recording any document. 3. Typing, copying, and other clerical tasks. 4. Obtaining title insurance reports and reports concerning the condition of the property. 5. Transmitting documents between the parties. 6. Functioning exclusively in his or her capacity as a representative of a condominium association or cooperative housing corporation. This exemption includes the board of directors, the committee, or other governing body. Form 8288 (Rev. 11-2006) Page 5 Entities Subject to Section 1445% of the gain it recognizes on the distribution of a U.S. real property interest to its shareholders. Certain domestic corporations are required to withhold tax on distributions to foreign shareholders. No withholding is required on the transfer of an interest in a domestic corporation if any class of stock of the corporation is regularly traded on an established securities market. Also, no withholding is required on the transfer of an interest in a publicly traded partnership or trust. No withholding will be required with respect to an interest holder if the entity or fiduciary receives a certification of nonforeign status from the interest holder. An entity or fiduciary may also use other means to determine that an interest holder is not a foreign person, but if it does so and it is later determined that the interest holder is a foreign person, the withholding may be collected from the entity or fiduciary. withhold 35% 35% of the amount attributable to the foreign beneficiary’s proportionate share of the current balance of the trust’s section 1445(e)(1) account. This election does not apply to any qualified investment entity or to any publicly traded trust. Special rules apply to large trusts that make recurring sales of growing crops and timber. A trust’s section 1445(e)(1) account is the total net gain realized by the trust on all section 1445(e)(1) transactions after the date of the election, minus the total of all distributions made by the trust after the date of the election from such total net gain. See Regulations section 1.1445-5(c)(3) for more information. Section 1445(e)(5) Transactions The transferee of a partnership interest must withhold 10% of the amount realized on the disposition by a foreign partner of an interest in a domestic or foreign partnership in which at least 50% of the value of the gross assets consists of U.S. real property interests and at least 90% of the value of the gross assets consists of U.S. real property interests plus any cash or cash equivalents. However, no withholding is required under section 1445(e)(5) for dispositions of interests in other partnerships, trusts, or estates until the effective date of a Treasury Decision under section 897(g). No withholding is required if, no earlier than 30 days before the transfer, the transferee receives a statement signed by a general partner under penalties of perjury that at least 50% of the value of the gross assets of the partnership does not consist of U.S. real property interests or that at least 90% of the value of the gross assets does not consist of U.S. real property interests plus cash or cash equivalents. The transferee may rely on the statement unless the transferee knows it is false or the transferee receives a false statement notice pursuant to Regulations section 1.1445-4. Section 1445(e)(2) Transactions A foreign corporation that distributes a U.S. real property interest must generally withhold 35% of the gain recognized by the corporation. No withholding or reduced withholding is required if the corporation receives a withholding certificate from the IRS. Section 1445(e)(6) Transactions A qualified investment entity must withhold 35% of a distribution to a nonresident alien or a foreign corporation that is treated as gain realized from the sale or exchange of a U.S. real property interest. No withholding under section 1445 is required on a distribution to a nonresident alien or foreign corporation if the distribution is on stock regularly traded on a securities market in the United States and the alien or corporation did not own more than 5% of that stock at any time during the 1-year period ending on the date of distribution. Section 1445(e)(1) Transactions Partnerships. A domestic partnership that is not publicly traded must withhold tax under section 1446 on effectively connected income allocated to its foreign partners and must file Form 8804, Annual Return for Partnership Withholding Tax (Section 1446), and Form 8805, Foreign Partner’s Information Statement of Section 1446 Withholding Tax. later), is not a qualified investment entity, and is not publicly traded. The fiduciary must Section 1445(e)(3) Transactions Generally, a domestic corporation that distributes any property to a foreign person that holds an interest in the corporation must withhold 10% of the fair market value of the property distributed if: 1. The foreign person’s interest in the corporation is a U.S. real property interest under section 897, and 2. The property is distributed in redemption of stock under section 302, in liquidation of the corporation under sections 331 through 341, or with respect to stock under section 301 that is not made out of the earnings and profits of the corporation. No withholding or reduced withholding is required if the corporation receives a withholding certificate from the IRS. Specific Instructions Complete only Part I or Part II. CAUTION Section 1445(e)(4) Transactions No withholding is required under section 1445(e)(4), relating to certain taxable distributions by domestic or foreign partnerships, trusts, and estates, until the effective date of a Treasury Decision under section 897(e)(2)(B)(ii) and (g). Form 8288 (Rev. 11-2006) Page 6. Lines CAUTION a social security number, this is an IRS individual taxpayer identification number (ITIN). If the individual does not already have an ITIN, he or she must apply for one by attaching the completed Form 8288 to a completed Form W-7, Application for IRS Individual Taxpayer Identification Number, and forwarding the package to the IRS at the address given in the Form W-7 instructions. Lines 2. Enter the location and a description of the property, including any substantial improvements (for example, “12-unit apartment building”). In the case of interests in a corporation that constitute a U.S. real property interest, enter the class or type and amount of the interest (for example, “10,000 shares Class A Preferred Stock XYZ Corporation”). Lines 4. Copies A and B of each Form 8288-A should be counted as one form. Part II, line 3. If you are a qualified investment entity, domestic trust or estate, or you make the large trust election, enter the date of distribution. Privacy Act and Paperwork Reduction Act Notice. We ask for the information on this form to carry out the Internal Revenue laws of the United States. Section 1445 generally imposes a withholding obligation on the buyer or other transferee (withholding agent) when a U.S. real property interest is acquired from a foreign person. Section 1445 also imposes a withholding obligation on certain foreign and domestic corporations, qualified investment entities, and the fiduciary of certain trusts and estates. This form is used to report and transmit the amount withheld. You are required to provide this information. Section 6109 requires you to provide your taxpayer identification number. We need this information to ensure that you are complying with the Internal Revenue laws and to allow us to figure and collect the right amount of tax. Failure to provide this information in a timely manner, or providing false information, may subject you to penalties. Routine uses of this information include giving it to the Department of Justice for civil and criminal litigation, and to cities, states, and the District of Columbia for use in the administration of 8288 Recordkeeping Learning about the law or the form 5 hr., 15 min. Form 8288-A 2 hr., 52 min. 5 hr., 8 min. 30 min. Preparing and sending the form to the IRS 6 hr., 38 min. 34 min. If you have comments concerning the accuracy of these time estimates or suggestions for making these forms simpler, we would be happy to hear from you. You can write to the Internal Revenue Service, Tax Products Coordinating Committee, SE:W:CAR:MP:T:T:SP, 1111 Constitution Ave. NW, IR-6406, Washington, DC 20224. Do not send the forms to this address..
https://www.scribd.com/document/373295/f8288
CC-MAIN-2016-40
refinedweb
3,845
54.52
Hello I an new to C++ and am making my first program from scratch that has a useful solution after a while debugging I notice a problem with a displayed item and so I change the the code and a new error comes up... ------ Build started: Project: A_Message, Configuration: Debug Win32 ------ name.cpp g:\vs2010projects\a_message\a_message\name.cpp(28): error C2065: 'x' : undeclared identifier ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== My code is like this and I just can't quite fix it... #include "stdafx.h" #include "iostream" int printing(); int naming() { using namespace std; cout << "Enter your name:" << endl; int x; cin >> x; #ifndef USER_NAME #define USER_NAME x #endif printing(); return 0; } int printing() { using namespace std; cout << "Hello,"<< USER_NAME << endl; return 0; } All the other code is fine just the #define USER_NAME x is a problem and the error is in Printing() when it tries to find x or something, as I said I'm new to this so any help is appreciated. Im using visual studio express 2010 on windows XP professional SP3 Thanks, Bobbysmile (FIles as atachments)
https://www.daniweb.com/programming/software-development/threads/374870/undeclared-identifier-x-probably-something-easy-to-fix
CC-MAIN-2018-34
refinedweb
187
52.87
#include <wx/process.h> The objects of this class are used in conjunction with the wxExecute() function. When a wxProcess object is passed to wxExecute(), its OnTerminate() virtual method is called when the process terminates. This allows the program to be (asynchronously) notified about the process termination and also retrieve its exit status which is unavailable from wxExecute() in the case of asynchronous execution.. wxProcess also supports IO redirection of the child process. For this, you have to call its Redirect() method before passing it to wxExecute(). If the child process was launched successfully, GetInputStream(), GetOutputStream() and GetErrorStream() can then be used to retrieve the streams corresponding to the child process standard output, input and error output respectively.. Constructs a process object. id is only used in the case you want to use wxWidgets events. It identifies this object, or another window that will receive the event. If the parent parameter is different from NULL, it will receive a wxEVT_END_PROCESS notification event (you should insert EVT_END_PROCESS macro in the event table of the parent to handle it) with the given id. Creates an object without any associated parent (and hence no id neither) but allows to specify the flags which can have the value of wxPROCESS_DEFAULT or wxPROCESS_REDIRECT. Specifying the former value has no particular effect while using the latter one is equivalent to calling Redirect().). Normally, a wxProcess object is deleted by its parent when it receives the notification about the process termination. However, it might happen that the parent object is destroyed before the external process is terminated (e.g. a window from which this external process was launched is closed by the user) and in this case it should not delete the wxProcess object, but should call Detach() instead. After the wxProcess object is detached from its parent, no notification events will be sent to the parent and the object will delete itself upon reception of the process termination notification. to write. wxSIGNONE, wxSIGKILL and wxSIGTERM have the same meaning under both Unix and Windows but all the other signals are equivalent to wxSIGTERM under Windows. The flags parameter can be wxKILL_NOCHILDREN (the default), or wxKILL_CHILDREN, in which case the child processes of this process will be killed too. Note that under Unix, for wxKILL_CHILDREN to work you should have created the process passing wxEXEC_MAKE_GROUP_LEADER. Returns the element of wxKillError enum. This static method replaces the standard popen() function: it launches the process specified by the cmd parameter and returns the wxProcess object which can be used to retrieve the streams connected to the standard input, output and error output of the child process. If the process couldn't be launched, NULL is returned. Turns on redirection. wxExecute() will try to open a couple of pipes to catch the subprocess stdio. The caught input stream is returned by GetOutputStream() as a non-seekable stream. The caught output stream is returned by GetInputStream() as a non-seekable stream. Sets the priority of the process, between 0 (lowest) and 100 (highest). It can only be set before the process is created. The following symbolic constants can be used in addition to raw values in 0..100 range:
https://docs.wxwidgets.org/3.0/classwx_process.html
CC-MAIN-2019-09
refinedweb
528
53.21
Sorry for the long time without reply, had some connection issues... On 5/28/06, Tobias Bocanegra <tobias.bocanegra@day.com> wrote: > > hi, > > Both will have an owner property, a list of subjects with reading rights > and > > another list of subjects with writing rights. > wouldn't it make more sense to have a general list of rights? i mean, > there are more actions than just read and write (currently: read, > write, remove). > > > Is it a right way to directly inherit from nt:folder or should i use > another > > namespace ? > i would create a mix:accessControlled mixin nodetype that has to > neccesairy properties or childnodes. so you can add the mixin to > whatever node you want. > you still can define the nt:privilegedFile like this: > > [nt:privilegedFile] > nt:file, mix:accessControlled Didn't check out the mixin node type at this time, It's now done with mixin node type. Thx for the advice > ? > > the checking is done in the access manager. take a look at the > SimpleAccessManager. it is initialized for every session that holds > the jaas subject. i would not add a special accesscontrol into the > default handler. ? > I would like, if you are interested in my work, to commit these change to > > jackrabbit as soon as it is functional. > there are some discussions of how to add ACLs into JSR283 (jcr 2.0). > as soon we have some consensus of how this should be modeled, we will > start to implement it into jackrabbit. and of course any sound help is > I've seen that the RFC3253 as been implemented in the webdav server, so i > > can later add the real rights showing in the propfind. > as i said, it would be cool, if the webdav acl and the repository acl > work with the same mechanisms. > > regards, toby > -- > -----------------------------------------< tobias.bocanegra@day.com >--- > Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel > T +41 61 226 98 98, F +41 61 226 98 97 > -----------------------------------------------< >--- > -- Muniak julien
http://mail-archives.apache.org/mod_mbox/jackrabbit-dev/200606.mbox/%3C63f34a630606150307j6a54dd18je130d384ae576d32@mail.gmail.com%3E
CC-MAIN-2017-17
refinedweb
327
65.01
Sales Have Ended Sales Have Ended About this event To join Jennifer's next class, click here!. Organizer Home Yoga Organizer of Free 60-Minute Virtual Online Vinyasa Yoga with Jenn Dodgson -- IE While our initial app was designed to deliver yoga to its consumers with convenience and digital accessibility in mind, the intention to take it to the next level didn’t form until pandemic struck the globe. We truly believe that everyone deserves access to health, wellness and peace of mind, and that is what inspired us to create a platform that can make this a possibility in spite of a world being forced to close its doors. MixPose equips you with the technology to participate in online virtual livestream yoga classes from anywhere in the world, and from the comfort of your own homes. MixPose delivers the option to join free yoga classes with your friends and receive feedback and assistance from expert instructors. Join a public class with other yogis and immerse yourself in the experience of a real-life yoga session. For those who prefer anonymity, we also offer a privatized feature that ensures you will only be visible to your instructor so that you are still able to benefit from interactive feedback. We firmly believe that health and wellness should be accessible to everyone, which is why we offer a multitude of free yoga classes at no cost to you!
https://www.eventbrite.com/e/free-60-minute-virtual-online-vinyasa-yoga-with-jenn-dodgson-ie-tickets-152312690357?aff=erelexpmlt
CC-MAIN-2021-25
refinedweb
236
50.5
From: Robert Ramey (ramey_at_[hidden]) Date: 2007-06-28 11:46:14 I would recommend re-organizing the code slightly as below. ***TcpEndpoint.h*** ... // remove archive headers as they are not an attribute of the class TcpEndpint class TcpEndpoint : public I_Endpoint { ... }; #include <boost/serialization/export.hpp> BOOST_CLASS_EXPORT_GUID(RCF::TcpEndpoint, "RCF::TcpEndpoint") > ------------------------------------------------------ > ***a.cpp*** > ... > #include "./TcpEndpoint.hpp" > ... > ------------------------------------------------------ > ***b.cpp*** > ... > #include "./TcpEndpoint.hpp" > ... > > ------------------------------------------------------ > ***c.cpp*** > ... > #include "./TcpEndpoint.hpp" > ... > "A.h" > #include <boost/serialization/export.hpp> > class A : public Base {}; > BOOST_CLASS_EXPORT_GUID(A, "A") > .... "main.cpp" #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> #inlcude "A.h" #inlcude "B.h" #inlcude "C.h" > int main() {...} This should do it. To summarize. EXPORT should be considered an attribute of the class so it can/should be in the class header. #include <...archive.hpp> is not an attribute of the class so it should NOT be in the class header. It is used to emit code for each EXPORT ed type for each archive used. So the combination of and exported type and and archive should be in one and only one module. If you want to encapsulate the serialization code - e.g. you're making a library of all the code for all the types, make a module: a.cpp #include <boost/serialization/text_oarchive.hpp> #include <boost/serialization/text_iarchive.hpp> ...// other archive types here. #include "a.hpp" // includes EXPORT template<class Archive> void a:serialize(Archive ar, const unsigned int version){ ar & ..; .... } Now you'll have the serialization code generated for type a and related to its export key. Note that the code will be generated regardless of whether its called or not. SOOOO I would recommend that you organize your application as a library of modules. One module for each non-trivial type you use. The then link your main module against the library. This will get you what you want, produce the smallest usable executables, and minimize compile and link time. Good Luck
http://lists.boost.org/Archives/boost/2007/06/124018.php
crawl-001
refinedweb
322
61.63
Build a team technical challenge website with replit.web Code competitions and hackathons are a fun way to expand your programming skills, get exposed to new ideas, and work together to solve difficult problems. The time-limited, competitive nature of these competitions provides an additional challenge. In this tutorial, we'll use the replit.web framework to build a leaderboard website for an online technical challenge in the vein of Advent of Code or Hackasat. We'll focus on the generic aspects of the site, such as teams, challenges and scores, so once we're done, you can use the site for your own competition. By the end of this tutorial, you'll be able to: - Use Replit's Flask-based web framework to rapidly develop authenticated web applications with persistent storage. - Use WTForms to create sophisticated web forms. - Use custom function decorators to handle multiple user roles. Getting started To get started, sign into Replit or create an account if you haven't already. Once logged in, create a Python repl. Our competition website will have the following functionality: - Users can sign in with their Replit accounts and either create a team or join an existing team. To join an existing team, a team password will be required. - Once they're in a team, users will be able to view challenges and submit challenge solutions. To keep things simple, we will validate challenge solutions by requiring users to submit a unique code per challenge. - A designated group of admin users will have the ability to add and remove challenges, start and end the competition, and clear the database for a new competition. Let's start off our competition application with the following module imports in main.py: from flask import Flask, render_template, flash, redirect, url_for, request from replit import db, web Here we're importing a number of Flask features we'll need. We could just use import flask to import everything, but we'll be using most of these functions often enough that having to prepend them with flask. would quickly become tiresome. We're also importing Replit's db and web modules, which will give us data persistence and user authentication. Now let's create our app and initialize its database. Add the following code just below the import statements in main.py: app = Flask(__name__) # Secret key app.config['SECRET_KEY'] = "YOUR-SECRET-KEY-HERE" # Database setup db_init() users = web.UserStore() ADMINS = ["YOUR-REPLIT-USERNAME-HERE"] Here we initialize our application, our general and user databases, and our list of admins. Make sure to replace the string in ADMINS with your Replit username before proceeding. Also replace the secret key with a long, random string. You can generate one in your repl's Python console with the following two lines of code: import random, string ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(20)) You'll notice that db_init() is undefined. As this is going to be a fairly large codebase, we're going to put it in a separate file. Create the file db_init.py in your repl's files tab: Add the following code to this file: from replit import db def db_init(): if "teams" not in db.keys(): db["teams"] = {} if "challenges" not in db.keys(): db["challenges"] = {} if "competition_started" not in db.keys(): db["competition_started"] = False Replit's Database can be thought of and used as one big Python dictionary that we can access with db. Any values we store in db will persist between repl restarts. To import this file in main.py, we can use an import statement in much the same way as we would for a module. Add this line in main.py, below your other imports: from db_init import db_init We've also defined a secondary database users in main.py. While db only contains what we put into it, users is a UserStore that will automatically have the names of users who sign into our application added as keys, so we can easily store and retrieve information about them. Now let's create some test content and run our app. Add the following code, and then run your repl. # Routes own Replit username on the greeting message. Creating user roles Function decorators like @web.authenticated, which prevent a function from executing unless certain conditions are met, are very useful for web applications like this one, in which we want to restrict certain pages based on who's attempting to view them. @web.authenticated restricts users based on authentication -- who a user is. We can now create our own decorators to restrict users based on authorization -- what a user is allowed to do. For this site, we're concerned about three things: - Is the user in a team? Users who aren't need to be able to create or join a team, and users who are need to be able to submit challenge solutions. - Is the user an admin? Users who are need to be able to create challenges, and perform other administrative tasks. For the sake of fairness, they should not be allowed to join teams themselves. - Is the competition running? If not, we don't want non-admin users to be able to view challenge pages or attempt to submit solutions. First, we'll create two helper functions to answer these questions. Add the following code to main.py, just below your ADMINS list: # Helper functions def is_admin(username): return username in ADMINS def in_team(username): if "team" in users[username].keys(): return users[username]["team"] The is_admin() function will return True if the provided user is an admin, or False otherwise. The function in_team() will return the name of the team the user is in, or None if they aren't in a team. Now we can create our authorization function decorators. Add the following import function to the top of main.py: from functools import wraps Then add this code below our helper functions: # Authorization decorators def admin_only(f): @wraps(f) def decorated_function(*args, **kwargs): if not is_admin(web.auth.name): flash("Permission denied.", "warning") return redirect(url_for("index")) return f(*args, **kwargs) return decorated_function This code may look a bit strange if you haven't written your own decorators before. Here's how it works: admin_only is the name of our decorator. You can think of decorators as functions which take other functions as arguments. (The code coming up is example code for the purpose. We also need to define a decorator for the opposite case, where we need to ensure that the current user is not an admin. Add the following code just below the # Authorization decorators code you added above: def not_admin_only(f): @wraps(f) def decorated_function(*args, **kwargs): if is_admin(web.auth.name): flash("Admins can't do that.", "warning") return redirect(url_for("index")) return f(*args, **kwargs) return decorated_function We will do much the same thing for team_only and not_team_only: def team_only(f): @wraps(f) def decorated_function(*args, **kwargs): if not in_team(web.auth.name): flash("Join a team first!", "warning") return redirect(url_for("index")) return f(*args, **kwargs) return decorated_function def not_team_only(f): @wraps(f) def decorated_function(*args, **kwargs): if in_team(web.auth.name): flash("You've already joined a team!", "warning") return redirect(url_for("index")) return f(*args, **kwargs) return decorated_function Finally, we need to add a decorator to check whether our competition is running. This is mainly for challenge description pages, so we'll add an exception for non-admin users: def competition_running(f): @wraps(f) def decorated_function(*args, **kwargs): if not (is_admin(web.auth.name) or db["competition_started"]): flash("The competition has not started yet.") return redirect(url_for("index")) return f(*args, **kwargs) return decorated_function Now that we've added our authorization controls, it's time to give them something to authorize. In the next sections, we'll define all of our app's functionality and build its front-end. Building forms The bulk of interactivity in our application will be enabled through forms. Users will be able to create and join teams, as well as submit challenge solutions. When we work with web forms, there's a lot to consider, including: - Which users should be able to submit which forms (authorization)? - What validation do we want on different fields? For example, length requirements, or ensuring a given value is an integer rather than a string. - How do we give feedback on data that doesn't pass our validations? - Security concerns around user input, such as SQL injection, cross-site scripting and cross-site request forgery. While the first one won't be relevant to our app, the second two are. We could build all of this ourselves using Flask's request.form as a basis, but fortunately someone else has already done the hard work and built the WTForms library, as well as Flask WTF, which integrates WTForms with Flask. We'll be using both of these to construct our application's various forms. To keep our codebase navigable, we'll put all our form code in a separate file, like we did with our database initialization code. Create forms.py in your repl's files tab now: We'll start this file off with some imports: from replit import db from flask_wtf import FlaskForm from wtforms import StringField, TextAreaField, SubmitField, PasswordField, SelectField, IntegerField, ValidationError from wtforms.validators import InputRequired, NumberRange, Length Here we import our Replit database, which we'll need for uniqueness validations, as well as everything we'll be using from WTForms and Flask WTF. Before we get started with our forms, it's worth thinking about how we're going to lay out the data structures they'll be used to create and modify. In db_init.py, we've defined two dictionaries -- "challenges" and "teams". Each of these will contain a dictionary for each challenge or team, keyed by an ID. Our data structure will look something like this: { "challenges": { "ID": { "name": "NAME", "description": "DESCRIPTION", "points": 10, "code": "CHALLENGE SOLUTION CODE" } }, "teams": { "ID": { "name": "NAME", "team_leader": "LEADER NAME", "team_members": ["LEADER NAME", "ADDITIONAL MEMBER"], "score": 0, "password": "TEAM PASSWORD", "challenges_solved": ["CHALLENGE ID", "ANOTHER CHALLENGE ID"] } } } The ID value for both our challenges and teams will be the challenge or team start creating our forms. With Flask WTF, we model each form as a class inheriting from FlaskForm. These classes take in the value of Flask's request.form and apply validations to the fields therein. We'll create our TeamCreateField first, with the following code: class TeamCreateForm(FlaskForm): name = StringField( "Team name", validators=[ InputRequired(), Length(3) ] ) password = PasswordField( "Team password", validators=[ InputRequired(), Length(8) ] ) submit = SubmitField("Create team") def validate_name(form, field): if name_to_id(field.data) in db["teams"].keys(): raise ValidationError("Team name already taken.") When users create teams, they'll specify a team name and team password. In our WTForms field specifications above, we've defined minimum lengths for both of these fields, ensured that the team password is entered in a password field, and written a custom validator to reject new teams with IDs that match existing teams. Because we're validating on ID rather than name, users won't be able to create teams with the same name but different capitalization (e.g. "Codeslingers" and "codeslingers"). Every field in all of our forms includes the InputRequired validator, which will ensure that users do not submit blank values. This validator can be left out for optional fields. Our ChallengeCreateForm is similar to TeamCreateForm, and can be added below it: class ChallengeCreateForm(FlaskForm): name = StringField( "Challenge name", validators=[ InputRequired(), Length(3) ] ) description = TextAreaField( "Challenge description", validators=[InputRequired()] ) points = IntegerField( "Challenge points", validators=[ InputRequired(), NumberRange(1) ] ) code = StringField("Challenge code", validators=[ InputRequired(), Length(8) ] ) submit = SubmitField("Create challenge") def validate_name(form, field): if name_to_id(field.data) in db["challenges"].keys(): raise ValidationError("Challenge name already used.") Here we've used the TextAreaField to give a bit more space for our users to write challenge descriptions, and IntegerField to specify the number of points a challenge is worth. We're also requiring that challenges be worth at least 1 point, using the NumberRange validator. Next up is our TeamJoinForm: class TeamJoinForm(FlaskForm): name = SelectField( "Team to join", choices= [ (team_id, team["name"]) for team_id, team in db["teams"].items() ], validators=[InputRequired()] ) password = PasswordField( "Team password", validators=[InputRequired()] ) submit = SubmitField("Join team") In this form, we're creating a drop-down box with the names of existing teams. The list comprehension in choices constructs a tuple for each team, consisting of the team's ID and name. This way, we can use the ID to identify teams on the backend while displaying the name to the user. Our last form is ChallengeSolveForm, which users will use to submit challenge solutions. Add it to the bottom of forms.py: class ChallengeSolveForm(FlaskForm): code = StringField("Challenge code", validators=[ InputRequired(), ] ) submit = SubmitField("Submit solution code") As we'll be including this form on the individual challenge pages, we don't need to ask the user to specify which challenge they're solving. Finally, we'll need to import our forms and helper function into main.py so we can use them in the rest of our app. Add the following line to the import statements in main.py: from forms import TeamCreateForm, TeamJoinForm, ChallengeCreateForm, ChallengeSolveForm, name_to_id Now that we have our form logic, we need to integrate them into both the front-end and back-end of the application. We'll deal with the back-end first. Building back-end functionality Back-end functionality is the heart of our application. Below, we'll define our application's routes and build the logic for creating and joining teams, as well as creating and solving challenges. Team functionality Let's start with teams. We'll define the following routes and functions in main.py, below our index() function: # Teams @app.route("/team-create", methods=["GET", "POST"]) @web.authenticated @not_admin_only @not_team_only def team_create(): pass @app.route("/team-join", methods=['GET', 'POST']) @web.authenticated @not_admin_only @not_team_only def team_join(): pass @app.route("/team/<team_id>") def team(team_id): pass The /team-create and /team-join routes will use their respective forms. Users already in teams and admins will not be permitted to create or join teams. The /team/<team_id> page will be an informational page, showing the team's name, score, and which challenges they've solved. We're using part of the URL as a parameter here, so, for example, /team/codeslingers will take us to the team page for that team. We won't require authentication for this page. Because we'll be dealing with passwords, we're going to store them as one-way encrypted hashes. This will prevent anyone with access to our repl's database from easily seeing all team passwords. We'll use Flask's Bcrypt extension for this, which you can install by searching for "flask-bcrypt" in the Packages tab on the Replit IDE sidebar. While Replit usually automatically installs packages based on our import statements, this one must be manually installed, as its package name is slightly different on Pypi and on disk. Once it's installed, we import it with the following additional line at the top of main.py: from flask_bcrypt import Bcrypt Then we initialize a Bcrypt object for our app by adding the following line just below app = Flask(__name__): bcrypt = Bcrypt(app) Now let's add some code to our team_create function: @app.route("/team-create", methods=["GET", "POST"]) @web.authenticated @not_admin_only @not_team_only def team_create(): form = TeamCreateForm(request.form) if request.method == "POST" and form.validate(): team_name = form.name.data team_id = name_to_id(team_name) hashed_password = bcrypt.generate_password_hash(form.password.data).decode("utf-8") team_leader = web.auth.name # Construct team dictionary db["teams"][team_id] = { "name": team_name, "password": hashed_password, "leader": team_leader, "members": [team_leader], "score": 0, "challenges_solved": [] } # Set user team users.current["team"] = team_id flash("Team created!") return redirect(url_for('team', team_id=team_id)) return render_template("team-create.html", form = form, **context()) First, we create an instance of TeamCreateForm using the values in request.form. We then check whether the current request is an HTTP team's ID using the helper function from forms.py, hash our team password, and then define our team's dictionary. After that, we set the current user's team in our user database and redirect the user to their new team's page. We use users.current as an alias for users[web.auth.name]. At the bottom of the function, we render our team-create page and tell it which form to use. This will happen regardless of whether the initiating request was a GET or a POST. We'll create the template and define the context function when we build the front-end. Now we can add the code for joining a team, in the team_join function: @app.route("/team-join", methods=['GET', 'POST']) @web.authenticated @not_admin_only @not_team_only def team_join(): form = TeamJoinForm(request.form) if request.method == "POST" and form.validate(): team_id = form.name.data team_name = db["teams"][team_id]["name"] if bcrypt.check_password_hash( db["teams"][team_id]["password"], form.password.data ): db["teams"][team_id]["members"].append(web.auth.name) users.current["team"] = team_id flash(f"You joined {team_name}!") return redirect(url_for('team', team_id=team_id)) else: flash(f"Wrong password for {team_name}!") return redirect(url_for("index")) return render_template("team-join.html", form = form, **context()) If our form validates, we check the provided team password, and if it's correct, we add the current user to the team and send them to the team page. If it's incorrect, we redirect them to the home page. Finally, we can define our /team/<team_id> route, by adding this code to the team() function: @app.route("/team/<team_id>") def team(team_id): return render_template("team.html", team_id = team_id, **context()) Admin functionality We're going to let admin users add challenges to the front-end so that we can keep our code generic and re-use it for multiple competitions, if we wish. We'll add the other admin functionality we need at the same time. We'll start with the challenge creation route. Add this code below your team routes: # Admin functions @app.route("/admin/challenge-create", methods=["GET", "POST"]) @web.authenticated @admin_only def admin_challenge_create(): form = ChallengeCreateForm(request.form) if request.method == "POST" and form.validate(): challenge_name = form.name.data challenge_id = name_to_id(challenge_name) hashed_code = bcrypt.generate_password_hash(form.code.data).decode("utf-8") # Construct challenge dictionary db["challenges"][challenge_id] = { "name": challenge_name, "description": form.description.data, "points": int(form.points.data), "code": hashed_code } flash("Challenge created!") return redirect(url_for('challenge', challenge_id=challenge_id)) return render_template("admin/challenge-create.html", form = form, **context()) This code is almost identical to our team creation functionality. While hashing challenge codes may not be strictly necessary, it will prevent any users with access to our repl from cheating by viewing the database. Challenge removal is a bit simpler: @app.route("/admin/challenge-remove/<challenge_id>") @web.authenticated @admin_only def admin_remove_challenge(challenge_id): # Remove challenge from team solutions for _, team in db["teams"].items(): if challenge_id in team["challenges_solved"]: team["challenges_solved"].remove(challenge_id) team["score"] -= db["challenges"][challenge_id]["points"] # Delete challenge dictionary del db["challenges"][challenge_id] flash("Challenge removed!") return redirect(url_for('index')) We'll allow admins to start and stop the competition with two routes that toggle a value in our database: @app.route("/admin/competition-start") @web.authenticated @admin_only def admin_start_competition(): db["competition_started"] = True flash("Competition started!") return redirect(url_for('index')) @app.route("/admin/competition-stop") @web.authenticated @admin_only @competition_running def admin_end_competition(): db["competition_started"] = False flash("Competition ended!") return redirect(url_for('index')) Finally, we'll define an admin route that deletes and reinitializes the application's general and user databases. This will be useful for running multiple competitions on the same app, and for debugging! @app.route('/admin/db-flush') @web.authenticated @admin_only def flush_db(): del db["challenges"] del db["teams"] del db["competition_started"] for _, user in users.items(): user["team"] = None db_init() return redirect(url_for("index")) If we add any additional keys or values to either of our databases, we will need to remember to delete them in this function. Challenge functionality Finally, we need to add functionality that will allow users to solve challenges and score points. Add the following code below your admin routes: # Challenge functionality @app.route("/challenge/<challenge_id>", methods=["GET", "POST"]) @web.authenticated @competition_running def challenge(challenge_id): form = ChallengeSolveForm(request.form) if request.method == "POST" and form.validate(): if bcrypt.check_password_hash( db["challenges"][challenge_id]["code"], form.code.data ): db["teams"][users.current["team"]]["challenges_solved"].append(challenge_id) db["teams"][users.current["team"]]["score"] += db["challenges"][challenge_id]["points"] flash("Challenge solved!") else: flash("Wrong challenge code!") return render_template("challenge.html", form = form, challenge_id = challenge_id, **context()) This function is very similar to team_join(). The main difference is that we will be hosting this form on the challenge description page, so we can fetch the challenge_id from the URL rather than asking the user which challenge they're submitting a code for in the form. Building the web application front-end We have a fully functional application back-end, but without some front-end pages, our users will have to join teams and submit challenge solutions using curl. So let's create an interface for our back-end using HTML and Jinja, Flask's powerful front-end templating language. Creating the HTML templates First, we'll need the following HTML files in a new directory called templates: templates/ |__ admin/ | |__ challenge-create.html |__ _macros.html |__ challenge.html |__ index.html |__ layout.html |__ leaderboard.html |__ team-create.html |__ team-join.html |__ team.html Once you've created these files, let's populate them, starting with templates/layout.html: <!DOCTYPE html> <html> <head> <title>Challenge Leaderboard</title> </head> <body> {% with messages = get_flashed_messages() %} {% if messages %} <ul class=flashes> {% for message in messages %} <li>{{ message }}</li> {% endfor %} </ul> {% endif %} {% endwith %} {% if name != None %} <p>Logged in as {{ username }}</p> {% endif %} <ul> <li><a href="/">View challenges</a></li> <li><a href="/leaderboard">View leaderboard</a></li> <li><a href="/team-create">Create team</a></li> <li><a href="/team-join">Join team</a></li> </ul> {% block body %}{% endblock %} </body> </html> We'll use this file as the base of all our pages, so we don't need to repeat the same HTML. It contains features we want on every page, such as flashed messages, an indication of who's currently logged in, and a global navigation menu. give all our form fields their own error-handling, provided by WTForms. Let's define our home page now, with a list of challenges. Add the following code to templates/index.html: {% extends "layout.html" %} {% block body %} <h1>Challenges</h1> <ul> {% for id, challenge in challenges.items()|sort(attribute='1.points') %} <li> <a href="/challenge/{{ id }}">{{ challenge.name }}</a> ({{ challenge.points }} points) {% if admin %} | <a href="/admin/challenge-remove/{{ id }}">DELETE</a> {% endif %} <li> {% endfor %} {% if admin %} <li><a href="/admin/challenge-create">NEW CHALLENGE...</a></li> {% endif %} </ul> {% if admin %} <h1>Admin functions</h1> <ul> {% if competition_running %} <li><a href="/admin/competition-stop">End competition</a></li> {% else %} <li><a href="/admin/competition-start">Start competition</a></li> {% endif %} <li><a href="/admin/db-flush">Flush database</a></li> </ul> {% endif %} {% endblock %} Here, {% extends "layout.html" %} tells our templating engine to use layout.html as a base template, and {% block body %} ... {% endblock %} defines the code to place inside layout.html's body block. The following line will sort challenges in ascending order of points: {% for id, challenge in challenges.items()|sort(attribute='1.points') %} In addition, we use {% if admin %} blocks to include links to admin functionality that will only display when an admin is logged in. Next we define our team pages: templates/team-create.html {% extends "layout.html" %} {% block body %} {% from "_macros.html" import render_field %} <h1>Create team</h1> <form action="/team-create" method="post" enctype="multipart/form-data"> {{ render_field(form.name) }} {{ render_field(form.password) }} {{ form.csrf_token }} {{ form.submit }} </form> {% endblock %} templates/team-join.html {% extends "layout.html" %} {% block body %} {% from "_macros.html" import render_field %} <h1>Join team</h1> <form action="/team-join" method="post"> {{ render_field(form.name) }} {{ render_field(form.password) }} {{ form.csrf_token }} {{ form.submit }} </form> {% endblock %} templates/team.html {% extends "layout.html" %} {% block body %} <h1>{{ teams[team_id].name }}</h1> <h2>Team members</h2> <ul> {% for user in teams[team_id].members %} <li>{{ user }}</li> {% endfor %} </ul> <h2>Challenges solved</h2> <ul> {% for id in teams[team_id].challenges_solved %} <li> <a href="/challenge/"{{ id }}>{{ challenges[id].name }}</a> <li> {% endfor %} </ul> {% endblock %} You'll notice that we've imported our render_function macro on these pages and used it to show our various form fields. Each form also has a hidden field specified by {{ form.csrf_token }}. This is a security feature WTForms provides to prevent cross-site request forgery vulnerabilities. Now we can create our challenge page: templates/challenge.html {% extends "layout.html" %} {% block body %} {% from "_macros.html" import render_field %} <h1>{{ challenges[challenge_id].name }}</h1> <p>{{ challenges[challenge_id].description }}</p> <p><b>Points: {{ challenges[challenge_id].points }}</b></p> {% if user_team != None and challenge_id not in teams[user_team]["challenges_solved"] %} <form action="/challenge/{{challenge_id}}" method="post"> {{ render_field(form.code) }} {{ form.csrf_token }} {{ form.submit }} </form> {% endif %} {% endblock %} Then our challenge creation page (inside the templates/admin directory): templates/admin/challenge-create.html {% extends "layout.html" %} {% block body %} {% from "_macros.html" import render_field %} <h1>Create challenge</h1> <form action="/admin/challenge-create" method="post" enctype="multipart/form-data"> {{ render_field(form.name) }} {{ render_field(form.description) }} {{ render_field(form.points) }} {{ render_field(form.code) }} {{ form.csrf_token }} {{ form.submit }} </form> {% endblock %} We've referred to a lot of different variables in our front-end templates. Flask's Jinja templating framework allows us to pass the variables we need into render_template(), as we did when building the application backend. Most pages needed a form, and some pages, such as challenge and team, needed a challenge or team ID. In addition, we unpack the return value of a function named context to all of our rendered pages. Define this function now with our other helper functions in main.py, just below in_team: def context(): return { "username": web.auth.name, "user_team": in_team(web.auth.name), "admin": is_admin(web.auth.name), "teams": db["teams"], "challenges": db["challenges"], "competition_running": db["competition_started"] } This will give every page most of the application's state. If we find we need another piece of state later, we can add it to the context helper function, and it will be available to all our pages. Importantly, we're using a function rather than a static dictionary so that we can get the most up-to-date application state every time we serve a page. Before we move on, we should change our app's home page from the initial demo version we made at the beginning of this tutorial to a proper page. Find the index() function and replace it with this code: @app.route("/") def index(): return render_template("index.html", **context()) You'll notice we've removed the @web.authenticated decorator. This will allow unauthenticated users to get a glimpse of our site before being asked to log in. replit.web will prompt them to log in as soon as they attempt to access an authenticated page. Building the leaderboard We've left out a key part of our application: the leaderboard showing which team is winning! Let's add the leaderboard frontend now, with the following HTML and Jinja code in templates/leaderboard.html: {% extends "layout.html" %} {% block body %} <h1>Leaderboard</h1> <ul> {% for id, team in teams.items()|sort(attribute='1.score', reverse=True) %} <li {% if id == user_team %}style="font-weight: bold"{% endif %}> <a href="/team/{{ id }}">{{ team.name }}</a>: {{ team.score }} points <li> {% endfor %} </ul> {% endblock %} Similar to the list of challenges on our home page, we use Jinja's sort filter to order the teams from highest to lowest score. {% for id, team in teams.items()|sort(attribute='1.score', reverse=True) %} We also use an if block to show the name of the current user's team in bold. Finally, we can add one last route to main.py, just above the line web.run(app): @app.route("/leaderboard") def leaderboard(): return render_template("leaderboard.html", **context()) We're leaving this one unauthenticated as well, so that spectators can see how the competition's going. Using the app We're done! Run your repl now to see your app in action. As your user account will be a site admin, you may need to enlist a couple of friends to test out all the app's functionality. For best results, open your repl's web page in a new tab. If you run into unexplained errors, you may need to clear your browser cookies, or flush the database. Where next? We've built a CRUD application with a fair amount of functionality, but there's still room for improvement. Some things you might want to add include: - CSS styling. - More admin functionality, such as adjusting scores, banning users and teams, and setting team size limitations. - File upload, for challenge files and/or team avatars. - Time-limited competitions, with a countdown. - Badges/achievements for things like being the first team to solve a given challenge. - A place for teams to submit challenge solution write-ups. And of course, you can also use your site to host a competition right now. You can find code for this tutorial here:
https://docs.replit.com/tutorials/technical-challenge-site
CC-MAIN-2022-27
refinedweb
4,881
50.12
Code covered by the BSD License 4.25 by Chad Greene 24 Feb 2012 (Updated 03 May 2012) Convert units of pressure, length, time, force, mass, accel., temp, speed, frequency, area, & more! This file was selected as MATLAB Central Pick of the Week | Watch this File Intuitive functions for conversion of acceleration, angle, area, computing, force, frequency, energy, length, mass, power, pressure, speed, temperature, time, or volume. All converters in this bundle take the form from2to(). EXAMPLE: Convert 700 kilopascals to pounds per square inch: kPa2psi(700) ans = 101.5264 Supported units and their abbreviations: ACCELERATION: centimeters per second squared (cmps2) Earth gravities (G) feet per second squared (ftps2) galileos (Gal) microgalileos (uGal) milligalileos (mGal) meters per second squared (mps2) millimeters per second squared (mmps2) nanometers per second squared (nmps2) ANGLE: degrees (deg) radians (rad) AREA: acres (acre) hectares (ha) square centimeters (cm2) square feet (ft2) square inches (in2) square kilometers (km2) square meters (m2) square miles (mi2) square millimeters (mm2) square yards (yd2) COMPUTING: bits (bit) bytes (B) exabytes (EB) gigabytes (GB) kilobytes (KB) megabytes (MB) petabytes (PB) terabytes (TB) ENERGY AND WORK: British thermal units (Btu) calories (cal) electron volts (eV) ergs (erg) foot-pounds (ftlb) joules (J) kilocalories or nutritional calories (kcal) kilojoules (kJ) kilowatt-hours (kWh) newton-meters (Nm) FORCE: dynes (dyn) kilopounds (kip) kilonewtons (kN) pounds (lbf) newtons (N) ounces-force (ozf) FREQUENCY: gigahertz (GHz) hertz (Hz) kilohertz (kHz) megahertz (MHz) radians per second (radps) revolutions per minute (rpm) terahertz (THz) LENGTH: angstroms (A) astronomical units (au) centimeters (cm) decimeters (dm) feet (ft) inches (in) kilometers (km) light years (ly) meters (m) micrometers or microns (um) miles (mi) millimeters (mm) nautical miles (nautmi) nanometers (nm) picometers (pm) yards (yd) MASS: atomic mass units (amu) grams (g) kilograms (kg) pounds-mass (lbm) microgram (ug) milligrams (mg) slugs (slug) POWER: boiler horsepower (hpb) British thermal units per hour (Btuph) electrical horsepower (hpe) gigawatts (GW) kilowatts (kW) mechanical horsepower (hp) megawatts (MW) terawatts (TW) watts (W) PRESSURE: standard atmospheres (atm) bar (bar) dynes per square centimeter (dynpcm2) feet of water column at 4°C (ftH2O) hectopascals (hPa) inches of water column at 4°C (inH2O) megapascals (MPa) kilopascals (kPa) millibar (mbar) millimeters of mercury at 0°C (mmHg) pascals (Pa) pounds per square inch (psi) torr (Torr) SPEED: feet per second (ftps) kilometers per hour (kmph) knots (knot) mach number at STP (mach) miles per hour (mph) meters per second (mps) TEMPERATURE: celsius (C) fahrenheit (F) kelvin (K) rankine (R) TIME: days (day) hours (hr) microseconds (us) minutes (min) milliseconds (ms) nanoseconds (ns) seconds (s) years (yr) VOLUME: centiliters (cl) cubic centimeters (cc or cm3) cubic feet (ft3) cubic inches (in3) cubic kilometers (km3) cubic meters (m3) cubic miles (mi3) cubic yards (yd3) liters (l) milliliters (ml) US liquid gallons (gal) US liquid ounces (oz) US liquid quarts (qt) Convert units, organize your code, and a year from now when you look over your old scripts, instantly recognize what units are associated with variables, before and after conversion. Other converters are available (acknowledged below), but the functions in this bundle were designed to be simpler, more comprehensive, and more intuitive. Please alert me if you find any errors. Unit Conversion, Units Conversion Toolbox, Velocity Conversion Toolbox, and Temperature Conversion Toolbox inspired this file. This file inspired Water Sound Speed Calculator, Sea Water Freezing Temperature Calculator, and Compressibility Factor Calculator. Chad, Yes, I see your point about simplicity. For your functions, you use very meaningful names, and they are unlikely to clash with other functions in the future, so it's probably not an issue. Packages will be nice if there may be function name clashes. If someone else happens to create a function called "m2mm" (just an example), then it may shadow your function or vice versa. By putting yours in a package, it would be safe because people would always call with your package name and then the function name. The other benefit I see with packages is the ease of discoverability of your functions. If I type "convert." and TAB, it will show all of your conversion functions. Otherwise, all of your functions are at the same level as all other MATLAB functions, so tab completion may be not as helpful. For example, if I type "m2" and then TAB, I see a bunch of yours along with a couple of MATLAB functions. But again, you chose very explicit function names, so I think people can just start typing the conversion and will be able to find your functions. Jiro: Thanks for the suggestion. Packaging these functions is certainly an option for those who wish to pursue it, but what would be gained by doubling the length of the function names? There's a wonderful simplicity to function names like km2mi, num2str, mean, plot, etc., as opposed to convert.km2mi, convert.num2str, compute.mean, or create.plot. I am always looking for ways to make improvements, but in my view, the simplest solution is to tuck these functions away in a folder of their own, add a path to that folder in your startup.m file, and never have to look at them again. Regarding the comments on putting functions into folders or creating a single "convert" function, you can put them in a package which is essentially putting them in a folder that starts with a "+". This creates a nice clean namespace for your functions. You can create a folder "+convert", and put all the functions inside there. Then make sure that the folder containing "+convert" is on the path. When you call, you call it using convert.km2mi(3) Erich, You have a keen eye! For my work, 0.000004% error is acceptable, but I realize that's not the case for everyone. I fixed the conversions between inches and multiples of meters, as you suggested. If any others catch your eye let me know. Thanks for the feedback. Feel free to email me directly, it's chad at chadagreene dot com. ;) Hi Ched, I am myself following Edward Tufte recommendations very closely, but his advices solely concern the visual display of information, not programming. I can however get your point. Hi Jean-Yves, You may be looking for something along these lines:. I wanted to write functions that are very clear, and your suggested form "convert(L2, 'miles', 'mm')" is not clear to me. I would have a hard time remembering whether L2 is being converted to miles from mm or from miles to mm. I'm a big fan of Edward Tufte, who says that good design shouldn't require mnemonics. mm2mi(L2) or mi2mm(L2) are immediately understandable to me. If clutter in your home folder is a problem, consider putting these files in a folder of their own. Add the path to that folder in your startup.m file as described above, and you'll never have to see these 1100+ functions again. Hi Chad, Have you considered merging ALL the numerous functions in one, that you could call with two flags, one for the source unit, one for the target units. Like for instance >> L1 = convert(L2, 'miles', 'mm'); Because honestly right now, the 200 functions are relatively inelegant and generate a lot of clutter in the MATLAB path. Works as advertised. Jan, you're right! Previously, I thought I had to use 6.68*1e-22. Then a few days ago I realized 6.68e-22 also works and it's much prettier. Makes sense that it's more computationally efficient, too. Consider my ways changed. Thanks for the tip! The explicit multiplication with the exponent in e.g. "A*6.684587122671*1e-22" is less efficient than including the exponent directly: "A*6.684587122671e-22" To help reduce clutter, I placed these functions in a folder of their own called 'functions'. Then I created a startup.m file in my home folder, with the line: addpath('C:\myfilepath\Documents\MATLAB\functions') This tells Matlab to look for the functions in that folder. edited description text Added acceleration converters, clarified documentation, added occasional commentary. Now, with angstroms! Added many more length converter functions in this update. More to come soon! Added conversions for time, frequency, and speed. Still plenty more to come. Massive addition to the bundle. Added mass conversions, mostly. Force (or weight) conversions now included. Pressure conversions: bar, mbar, psi, hPa, Pa, kPa, MPa, ftH2O, inH2O, mmHg, Torr, atm, dynpcm2. Computing: bits and bytes. Area: acre, ha, cm2, ft2, in2, km2, m2, mi2, mm2, yd2. Acceleration and gravity: Gal, mGal, uGal, nmps2, mps2, cmps2, G, ftps2, mmps2. Note that in this release, nms2 has become nmps2 for consistency with naming convention. Turned up the volume in this release. cl, cc, ml, cm3, ft3, in3, km3, m3, mi3, gal, l, oz, qt, yd3. A lot of energy went into making this update: Btu, cal, kcal, eV, erg, ftlb, Nm, J, kJ, kWh. The most powerful version to date! W, hp, hpe, hpb, kW, MW, GW, TW, Btuph. Most powerful version to date! Now with hp, Btuph, W, kW, MW, GW, TW, hpe, and hpb! Edited description text. Now with more significant digits. Thanks for the suggestions Erich.
http://www.mathworks.com/matlabcentral/fileexchange/35258-unit-converters
CC-MAIN-2014-15
refinedweb
1,530
63.29
Introduction When you log into Spotify, browse through your Discover Weekly playlist, and play a track, you’re interacting with some of our fleet of around 12,000 servers. Spotify has historically opted to run our core infrastructure on our own private fleet of physical servers (aka machines) rather than leveraging a public cloud such as Amazon Web Services (AWS). Our fleet consists of a minimal set of hardware configurations and is housed in four datacenters around the world. While we heavily utilise Helios for container-based continuous integration and deployment (CI/CD) each machine typically has a single role – i.e. most machines run a single instance of a microservice. At Spotify we believe in every team having ‘operational responsibility’. The people who build a microservice deploy the microservice, and manage the machines it’s deployed to. As you might imagine allowing hundreds of engineers to reliably manage thousands of machines is a complicated proposition. In this post we will recount the history of Spotify’s machine management infrastructure. We’ll provide some detail on the technical implementations, and how those implementations affected the productivity and happiness of our engineers. 2012 and Earlier – Prehistory When Spotify was a smaller company it was feasible to have a traditional, centralised operations team. The team was constantly busy fighting fires and handling every operations task under the sun. Nonetheless this was a clever operations team – a team who didn’t want to manage a rapidly growing fleet of machines by hand. One of the first tools built to manage machines at Spotify was the venerable ServerDb. ServerDb tracks details like a machine’s hardware specification, its location, hostname, network interfaces, and a unique hardware name. Each machine also has a ‘ServerDb state’, for example ‘in use’, ‘broken’, or ‘installing’. It was originally a simple SQL database and a set of scripts. Machines were installed using the Fully Automated Installer (FAI) and often managed using moob , which provides serial console access and power controls. Our heavily used DNS zone data was hand curated and required a manual push to take effect. All machines were (and still are) managed by Puppet once their base operating system (OS) was installed. Various parts of the stack were replaced over the years. FAI was replaced with Cobbler and debian-installer . Later, debian-installer was replaced with our own Duck . While many steps of the provisioning process were automated, these steps could be error prone and required human supervision. This could make provisioning 20 new machines an unpredictable and time-consuming task. Engineers requested new capacity by creating an issue in a JIRA project, and it could take weeks or even months for requests to be fulfilled. Late 2013 – The IO Tribe Spotify has always liked Agile teams (or squads, in Spotify parlance). In late 2013 the operations team became part of the newly formed Infrastructure and Operations (IO) organisation. New squads were formed around specific problem spaces within operations. Our squad took ownership of provisioning and managing Spotify’s machines. From the beginning we envisioned a completely self service machine management service, but the squad was swamped with busy work. We were inundated with requests for new machines, and constantly playing catchup on machine ingestion – the process of recording newly racked machines in ServerDb. We decided to start small and cobble together some minimal viable products (MVPs) to automate the major pain points in order to claim back time to work on bigger things. We began the effort on three fronts. DNS Pushes DNS pushes were one of our earliest wins. Initially the operations team had to hand-edit zone files, commit them to revision control, then run a script on our DNS master to compile and deploy the new zone data. We incrementally automated this process over time. First we built a tool to automatically generate most of our zone data from ServerDb. We then added integration tests and peer review that gave us high confidence in the quality of our changes. Soon thereafter we bit the bullet and automated the push. Cron jobs were created to automatically trigger the above process. Finally we tied up the loose ends, such as automatic creation of zones for new ServerDb subdomains. Machine Ingestion By the time our squad took ownership ServerDb had become a RESTful web service backed by PostgreSQL. It recorded hundreds of machines by parsing CSV files hand-collated by our datacenter team. These files contained data such as rack locations and MAC addresses that were easy for a technician to misread. We also assigned each server a static unique identifier in the form of a woman’s name – a shrinking namespace with thousands of servers. Our goal was to completely automate ingestion such that no human intervention was required after a machine was racked. We started by switching our network boot infrastructure from Cobbler to iPXE , which can make boot decisions based on a machine’s ServerDb state. ‘In use’ machines boot into their production OS. Machines in state ‘installing’ and machines unknown to ServerDb network boot into a tiny Duck-generated Linux environment we call the pxeimage, where they run a series of scripts to install or ingest them, respectively. In order to perform ingestions without human interaction we abandoned our woman’s name based machine naming scheme in favour of using the machines’ unique and programmatically discoverable serial numbers. Unknown machines run a reconnaissance script that determines their serial number, hardware type, network interfaces, etc and automatically registers them with ServerDb. Provisioning Requests At some point in prehistory a kind soul had written ‘provgun’ – the Provisioning Gun. Provgun was a script that read a JIRA ‘provisioning request’ issue and shelled out to the commands necessary to fulfill that request. A provisioning request specifies a location, role, hardware specification, and number of machines. For example “install 10 High IO machines in London with the fancydb role”. Provgun would find available machines in ServerDb, allocate them hostnames, and request they be installed via ServerDb. ServerDb used Celery tasks to shell out to ipmitool , instructing target machines to network boot into the pxeimage. After installing and rebooting into the new OS Puppet would apply further configuration based on the machine’s role. One of the first questions we asked was “can we put provgun in a cron loop?” like our DNS pushes. Unfortunately provgun was very optimistic, and did not know whether the commands it run had actually worked. We feared that naively looping over all open provisioning requests and firing off installs would increase rather than reduce busy work. Our solution was provcannon – the Provisioning Cannon. provcannon was a Python reimplementation of provgun that monitored each installation to ensure success. This monitoring allowed us to retry failed installs with exponential backoff, and to select replacements for consistently uninstallable machines. We configured provcannon to iterate over all outstanding provisioning requests twice daily. Impact By focusing our efforts on automating DNS changes, machine ingestion, and provisioning requests we reduced the turnaround time for getting capacity to Spotify engineers from weeks to hours. DNS updates went from something that made most of us very nervous to a process we hardly thought about anymore. Equally important was that our squad was freed from boring and error prone work to focus on further improving the turnaround time and experience for our fellow engineers. Mid 2014 – Breathing Room A few months after deploying our initial stopgaps things were calmer in the squad. Longtime Spotify engineers were pleased with the faster turnaround times for new machines, but newcomers used to AWS and similar platforms were less happy waiting a few hours. Parts of our infrastructure were unreliable, and we’d only automated installations. Power-cycling malfunctioning machines and ‘recycling’ superfluous ones back to the available pool still required us to read a JIRA issue and run a script. We decided it was time to execute on our grand goal – a self service web portal and API for Spotify engineers to manage machines on demand. Neep Starting at the bottom of the stack we first built a service – Neep – to broker jobs like installing, recycling, and power cycling machines. Neep runs in each datacenter on special machines patched into the out of band management network. Due to operational pains with Celery we built Neep as a light REST API around RQ – a simple Redis based job queue. We chose Pyramid as our blessed web framework for pragmatic reasons; we’d inherited ServerDb as a Pyramid service and wanted a minimal set of technologies. { "status": "finished", "result": null, "params": { }, "target": "hardwarename=C0MPUT3", "requester": "negz", "action": "install", "ended_at": "2015-07-31 17:45:53", "created_at": "2015-07-31 17:36:31", "id": "13fd7feb-69d7-4a25-821d-9520518a31d6", "user": "negz" } An example Neep job. Much of provcannon’s logic was reusable in Neep jobs that manage installation and recycling of machines. These jobs are effectively the same from Neep’s perspective. Neep simply sets the machine’s ServerDb state to ‘installing’ or ‘recycling’ to request the pxeimage either install a new OS or sanitize an old one and triggers a network boot. In order to remove the complication of shelling out we replaced calls to ipmitool with OpenStack’s pyghmi IPMI library. Sid Initially we put Neep through its paces by adapting provcannon to trigger Neep jobs. Once we’d worked out a few bugs in our new stack it was time to tie it all together, and Sid was born. Sid is the primary interface for engineers to request and manage machines at Spotify today. It’s another Pyramid REST service that ties together machine inventory data from ServerDb, role ownership data from Spotify’s internal microservice database, and machine management jobs in Neep to allow squads at Spotify to manage their services’ capacity. It expands on the parts of provcannon’s logic that find and allocate the most appropriate machines to fulfill a provisioning request. Sid’s charming Lingon UI was a breeze to build on top of its API, and has supplanted JIRA as the provisioning request interface. Impact Sid and Neep have not been the only improvements in the modern machine management stack at Spotify. DNS zone data generation has been rebuilt. We apply regularly auto-generated OS snapshots at install time rather than performing time consuming Puppet runs. The culmination of these improvements is that requests to provision or recycle capacity are fulfilled in minutes, not hours. Other squads have built tooling around Sid’s API to automatically manage their machine fleet. As the face of the provisioning stack at Spotify Sid is one of the most praised services in IO. Sid has fulfilled 3,500 provisioning requests to date. It has issued 28,000 Neep jobs to install, recycle, or power cycle machines with a 94% success rate. Not bad considering the inherent unreliability of individual machines in a datacenter. Mid 2015 – The State of the Art In 2015 Spotify decided to start migrating away from our own physical machines in favour of Google’s Cloud Platform (GCP). This paradigm shift challenged us to envision a way for many teams of engineers to manage a lot of cloud compute capacity without stepping on each others’ toes. Spotify Pool Manager In an effort to avoid the ‘not invented here’ trap our squad assessed Google’s capacity management offerings. We wanted a tool that could enforce Spotify’s opinions and patterns in order to provide engineers with an easy and obvious path to get compute capacity. We felt the Developer Console was powerful, but too flexible. It would be difficult to guide engineers towards our preferred settings. Deployment Manager was also powerful, and could enforce our opinions, but in a trial our engineers found it difficult to use. After providing feedback to Google we began building Spotify Pool Manager. SPM is a relatively light layer that frames Google’s powerful Compute Engine APIs in Spotify terms and provides sensible defaults. Engineers simply specify how many instances of what role they want and where. SPM ensures that number of instances will exist, using Google’s instance groups behind the scenes. Pools can be grown or shrunk at will. SPM is a stateless Pyramid service, relying primarily on Sid and the Google Cloud Platform to do the heavy lifting. While Sid has a standalone web interface we’re tightly integrating SPM with Spotify’s internal microservice management dashboard. Physical Pools Spotify won’t be rid of physical machines in the immediate future, so we’ve built pool support into Sid’s backend. While Sid’s provisioning request model has served us well, it can encourage too much attachment to individual machines. Having engineers manage their physical machine capacity similarly to Google’s instance groups will introduce them to paradigms like automatic replacement of failed machines and randomised hostnames as we transition to GCP. Sid’s pool support allows SPM to manage both Google Compute instances and physical machines, with the same user experience regardless of backend. Summary In the last few years Spotify’s machine management infrastructure has been a great example of the merits of iterative development. As a small squad of Site Reliability and Backend Engineers we’ve been able to significantly improve the productivity of our colleagues by building just enough automation to free ourselves to iterate. We’ve reduced the turnaround time for new machines from weeks to minutes, and drastically reduced the amount of support interactions required to manage machines at Spot Machines at Spotify 评论 抢沙发
http://www.shellsec.com/news/10331.html
CC-MAIN-2016-50
refinedweb
2,248
53
simple request to help request to help how to write the program for the following details in java Employee Information System An organization maintains the following data about each employee. Employee Class Fields: int Employee ID String Name request for java source code request for java source code I need source code for graphical password using cued-click points enabled with sound signature in java and oracle 9i as soon as possible... Plz send to my mail Simple Form in Java Simple Form in Java This is a simple program of java awt package which constructs a look like a form by using various java component. In this section, you will learn how request this program request this program if three text box value in my program i want to check the three input boxes values and display greatest two values How to send HTTP request in java? How to send HTTP request in java? How to send HTTP request in java REQUEST - Java Beginners code for a simple java program which performs basic arithmetic operation addition,subtraction,multiplication,division........ code for a simple java program which performs basic arithmetic operation addition,subtraction,multiplication,division........ code for a simple java program which performs basic arithmetic operation addition,subtraction Request Object In JSP Request Object In JSP  ... Request object. This object retrieves values whatever client passes to the server by an HTTP request. Let if you submit the html form with some data to be send request header and response - Java Beginners request header and response count the hits of a user on a site Simple Java Projects Simple Java Projects Hi, I am beginner in Java and trying to find Simple Java Projects to learn the different concepts on Java. Can anyone tell me where to get it? Thanks request dispatcher - Java Interview Questions request dispatcher what is the getrequestdispatcher... RequestDispatcher getRequestDispatcher(java.lang.String uri) Returns a request dispatcher..."); disp.include(request, response); ServletRequest to return a request Java Program Java Program A Simple program of JSP to Display message, with steps to execute that program Hi Friend, Follow these steps: 1)Go...:'hello.jsp' <%@page language="java"%> <%String st="Hello World"; %> simple ajax Request and Response code... simple ajax Request and Response code... var request=null; if (window.XMLHttpRequest) { request = new XMLHttpRequest(); } else if (window.ActiveXObject) { request = new ActiveXObject("Microsoft.XMLHTTP"); } if(request simple calculator - Java Beginners simple calculator how can i create a simple calculator using java codes? Hi Friend, Please visit the following link: Thanks Access Request and Response Access Request and Response  ... the request and response object in struts 2 application. To access the request... action class. Accessing the request and response object, you need a struts.xml Simple java applet Simple java applet Create a Java applet to display your address on the screen. Use different colors for background and text Please visit the following link: Applet Examples How to run a simple jsp page in tomcat??? How to run a simple jsp page in tomcat??? i am trying to run a simple jsp page in tomcat,i am having web.xml also in WEB-INF folder... an internal error () that prevented it from fulfilling this request. exception Request for codes - JSP-Servlet Request for codes Sir , I am an engineering student i am interested in learning JAVA also i need some example code for creating Registration form codes for creating web based application using JSP sir plz send me which java spring simple application java spring simple application hai I have design a simple application in this I always found class not found exception. I am sendig code as follows please resolve this and send me.my directory structure is as follows Project simple code - Java Beginners simple code to input a number and check wether it is prime or not and print its position in prime nuber series. Hi friend, Code to help in solving the problem : import java.io.*; class PrimeNumber { public Problem in request object Problem in request object I have created a form where I have file..." style="height:500px;"> <%@ page language="java" %> <%@ page import...=UTF-8" language="java" %> <%@ page import="java.io.File" %> <%@ page Simple Java Desktop Upload application Simple Java Desktop Upload application I try do simple example for upload applicationtake file from c:\ put to d:\ :) PLEASE HELP Simple Java Question - Java Beginners Simple Java Question [color=#0040BF] Dear All, I have a huge text file with name animal.txt, I have the following sample data: >id1 lion >id2 horse cat >id3 mouse tiger I need to save the contents How servlet Handles Multiple Request - Java Beginners How servlet Handles Multiple Request In servlet life cycle,consider two requests are waiting for service(). I know all request will be assigned to thread, which request gets excecuted first. 1 Java Servlet : Http Request Headers Java Servlet : Http Request Headers In this tutorial, you will learn how to Http Request Headers works in java servlet. Http Request Headers : HTTP Request Header is a request line text that a HTTP client(eg. web browser)sends Simple Java Programs Simple Java Programs In this section we will discuss about the Java programs... problem while compiling your Java program. Java class, object and methods... learner can learn how to write first program in Java. Java Constructor JSP Simple Examples JSP Simple Examples Index 1. Creating... in a java. In jsp we can declare it inside the declaration directive or a scriptlet directive. String Length In java How JSP Forwards a request How JSP Forwards a request In this section you will study how jsp forwards a request. The <jsp:forward> forwards the request information from one resource Simple Program Very Urgent.. - JSP-Servlet Simple Program Very Urgent.. Respected Sir/Madam, I am R.Ragavendran.. Thanks for your superb reply. I find a simple problem which i have tried my... does not support HTTP Request") return } var url="getuser.jsp" url=url+"?emp like... to the directory ("C:\vinod" in this example) where your program is saved. Java JSP Simple Examples ; Using Protected Access in JSP In java there are three types... to another page. Request...;. Request Java Script Program Java Script Program <%-- Document : index Created... () that prevented it from fulfilling this request. exception... are available in the Sun Java System Application Server 9.1 logs. Sun Java System a Java program a Java program Write a Java program to print even numbers from 2 to 1024? Write a Java program to print ? My Name is Mirza? 100 times? Write a Java program to print Fibonacci Series? Write a Java program to reverse a number Write a java program to do matrix addition operation On two given matrices java program java program Write a java program to find the number of Positive numbers in m* n matrix java program java program hi friends how to make a java program for getting non prime odd numbers in a given series Request Headers In EL in scripting. To access the request headers we need a simple trick, by using...Request Headers In EL Whenever an http client sends a request Advertisements If you enjoyed this post then why not add us on Google+? Add us to your Circles
http://roseindia.net/tutorialhelp/comment/95032
CC-MAIN-2015-22
refinedweb
1,204
54.83
Missing Opportunities for Polymorphism From WikiContent Revision as of 18:59, 5 July 2009 next() { /* find and item and "take" it */ } public boolean isEmpty() { return cart.isEmpty(); } } Let's say our webshop offers items that can be downloaded and items that need to be shipped. Let's build another object that supports these operations: public class Shipping { public boolean ship(Item item, GroundAddress address) { ... } public boolean ship(Item item, EMailAddress address { ... } } When a client has completed checkout we need to ship the goods: while (!cart.isEmpty()) { Item item = cart.next();. Another solution would be create two classes that both extend Item. Lets call these DownloadableItem and GroundItem. Now let's write some code. I'll promote Item to be an interface that supports a single method, ship. To ship the contents of the cart, we will call item.ship(shipper). Classes DownloadableItem and GroundItem will both implement ship. public class DownloadableItem implements Item { public boolean ship(Shipping shipper) { shipper.ship(this, customer.getEmailAddress()); } } public class GroundItem implements Item { public boolean ship(Shipping shipper) { shipper.ship(this, customer.getGroundAddress()); } } Each item knows if it can be downloaded or if ground shipment is required. There is no need to reconstruct lost context. This information has been captured at the time of order. In this example, DownloadableItem and Ground
http://commons.oreilly.com/wiki/index.php?title=Missing_Opportunities_for_Polymorphism&diff=24605&oldid=24602
CC-MAIN-2014-52
refinedweb
216
60.41
Penalty for Writing Off Invalid Business Expenses Small-business owners are always looking to benefit from tax deductions to lower their tax bill. However, if you push the limits too far and the IRS catches you, you could face substantial civil and even criminal penalties. Knowing the punishment that awaits for invalid business expenses is one more incentive to make sure your taxes are done right. Interest If the IRS disallows your deductions for invalid business expenses, your tax liability increases. Since payment of your taxes was already due, the IRS will add interest that has accrued since your filing due date. For example, assume the IRS disallowed $50,000 of deductions, which resulted in you owing an extra $13,000. If the deduction was disallowed six months after your filing deadline, you would be charged six months of interest on the $13,000. Late Fees When your tax liability increases, it means that you didn't pay in full by the filing deadline, so the IRS also adds late fees to your tax bill. If you don't pay the late fees within 21 calendar days (10 business days if you owe more than $100,000), the IRS starts charging you interest on the amount of the penalties. However, if you pay within the time limit, no additional interest accrues on the penalties. Substantial Understatement or Negligence Penalties If you substantially understate your tax liability, the IRS imposes a 20 percent penalty. For your individual tax return, an understatement is substantial if it exceeds the larger of 10 percent of the correct tax or $5,000. If you have incorporated your business and the error is on the corporate return, the understatement is substantial if it exceeds the lesser of 10 percent of the tax liability shown on your return (or if greater, $10,000), or $10,000,000. A 20 percent penalty also applies if you are negligent in filing your tax return. Examples of negligence include if you don't keep records of your expenses or don't exercise reasonable effort in preparing your tax return. Criminal and Civil Charges for Fraud If you are found to have fraudulently filed your taxes, you face a 75 percent penalty on the underpayment, instead of the 20 percent for mere negligence. In addition, you could face criminal charges for tax evasion and tax fraud. Tax evasion is a felony and carries a penalty of up to $250,000 in additional fines (plus the cost of prosecution) or up to 5 years in prison. Tax evasion occurs when "any person ... willfully attempts in any manner to evade or defeat any tax." Tax fraud is defined as someone who "willfully makes and subscribes any return, statement, or other document, which contains or is verified by a written declaration that it is made under the penalties of perjury, and which he does not believe to be true and correct as to every material matter." Tax fraud carries a penalty of $250,000 and up to 3 years in prison. References - Internal Revenue Service: Related Statutes and Penalties - General Fraud - Internal Revenue Service: Avoiding Penalties and the Tax Gap - Interal Revenue Code: Sections 6601, 6662, 6663, 6694, 7201, 7206 Photo Credits - Jupiterimages/Photos.com/Getty Images
https://smallbusiness.chron.com/penalty-writing-off-invalid-business-expenses-42966.html
CC-MAIN-2020-29
refinedweb
543
56.79
Hello, I would like to kill a specific session of Salome that was launched without the gui. I see the script killSalomeWithPort.py. However, I would like to have several sessions of salome running, and kill a specific one. This would require me to launch Salome with a specific port, so that I can kill it specifically later, I think. Is there the ability to launch salome to run on a specific port, so that I can kill it later, without killing other sessions that are running? I am trying to run an geometric optimization routine, and trying to run multiple sessions to speed things up. Thanks Hello Chaz I launch "runSalome --help" and see several options relating to ports. I haven't checked yet but "--ns-port-log=<ns_port_log_file> Print Naming Service Port into a user file." option seems suitable for your issue. I think with use of this option you can learn on what port a SALOME session of interest is running and thus to kill it as you need. St.Michael This works very well. Thanks! The command seems to require the absolute directory, and will not work with just a file name. This works: currentDirectory=os.getcwd() # get the string to the current directoryos.system('/home/username/salome/appli_V6_4_0/./runAppli -t --ns-port-log='+currentDirectory+'/salomePort.txt -u buildSalomeGeometry.py') # launch salome the port is written to the file in the current directory salomePort.txt. If the script is run again in the same directory with a salome session already open, the file will be overwritten, not appended. Therefore, multiple concurrent salome sessions need to be written with multiple kill filenames, or with the files stored in different directories. Later, to kill the specific salome session, read the port number to portToKill and: os.system('/home/username/salome/appli_V6_4_0/bin/salome/./killSalomeWithPort.py '+portToKill) # kill selectively by port While attempting to run several automated salome / openfoam simulations where salome is killed by the port number, Salome is crashing. I get errors such as: *** Abort *** an exception was raised, but no catch was found.*** Abort *** an exception was raised, but no catch was found.*** Abort *** an exception was raised, but no catch was found.*** Abort *** an exception was raised, but no catch was found.*** glibc detected *** SALOME_Container: double free or corruption (!prev): 0x0000000000ffc040 ****** glibc detected *** SALOME_Container: malloc(): memory corruption: 0x00007f5ae4000087 *** This seems to only happen when more than one simulation is running. It does not occur as soon as the second simulation runs. It crashes some time into the simulation after salome has opened and closed many times. Any thoughts as to what this error is? Hi Chaz, I'm also working in some optimisation problems and I have some issue with these ports and their avaibility.the solution that I found in this forum is to add this command at the end of my python script and normally it should works with parallel sessions: import osfrom killSalomeWithPort import killMyPortkillMyPort(os.getenv('NSPORT')) Best regardAchraf Soussi Thank you, that looks like a more elegant way of killing salome sessions. I will try it. Legal Information
http://www.salome-platform.org/forum/forum_10/645560298
CC-MAIN-2016-44
refinedweb
518
57.06
Repos for Git integration Note Support for arbitrary files in Databricks Repos is now in Public Preview. For details, see Work with non-notebook files in a Databricks repo and Import Python and R modules. To support best practices for data science and engineering code development, Databricks Repos provides repository-level integration with Git providers. You can develop code in a Databricks notebook and sync it with a remote Git repository. Databricks Repos lets you use Git functionality such as cloning a remote repo, managing branches, pushing and pulling changes, and visually comparing differences upon commit. Databricks Repos also provides an API that you can integrate with your CI/CD pipeline. For example, you can programmatically update a Databricks repo so that it always has the most recent code version. Databricks Repos provides security features such as allow lists to control access to Git repositories and detection of clear text secrets in source code. When audit logging is enabled, audit events are logged when you interact with a Databricks repo. For example, an audit event is logged when you create, update, or delete a Databricks repo, when you list all Databricks repos associated with a workspace, and when you sync changes between your Databricks repo and the Git remote. For more information about best practices for code development using Databricks repos, see Best practices for integrating repos with CI/CD workflows. Requirements Databricks supports these Git providers: - GitHub - Bitbucket - GitLab - Azure DevOps The Git server must be accessible from Databricks. Databricks does not support private Git servers, such as Git servers behind a VPN. Support for arbitrary files in Databricks Repos is available in Databricks Runtime 8.4 and above. Configure your Git integration with Databricks Click Settings in your Databricks workspace and select User Settings from the menu. On the User Settings page, go to the Git Integration tab. Follow the instructions for integration with GitHub, Bitbucket Cloud, GitLab, or Azure DevOps. For Azure DevOps, Git integration does not support Azure Active Directory tokens. You must use an Azure DevOps personal access token. If your organization has SAML SSO enabled in GitHub, ensure that you have authorized your personal access token for SSO. Enable support for arbitrary files in Databricks Repos In addition to syncing notebooks with a remote Git repository, Files in Repos lets you sync any type of file, such as .py files, data files in .csv or .json format, or .yaml configuration files. You can import and read these files within a Databricks repo. You can also view and edit plain text files in the UI. If support for this feature is not enabled, you will still see non-notebook files in your repo, but you will not be able to work with them. Requirements To work with non-notebook files in Databricks Repos, you must be running Databricks Runtime 8.4 or above. Enable Files in Repos An admin can enable this feature as follows: - Go to the Admin Console. - Click the Workspace Settings tab. - In the Advanced section, click the Files in Repos toggle. - Click Confirm. - Refresh your browser. The first time you access a repo after Files in Repos is enabled, a dialog appears indicating that you must perform a pull operation to sync non-notebook files in the repo. Select Agree and Pull to sync files. If there are any merge conflicts, another dialog appears giving you the option of discarding your conflicting changes or pushing your changes to a new branch. Clone a remote Git repository You can clone a remote Git repository and work on your notebooks or files in Databricks. You can create notebooks, edit notebooks and other files, and sync with the remote repository. You can also create new branches for your development work. For some tasks you must work in your Git provider, such as creating a PR, resolving conflicts, merging or deleting branches, or rebasing a branch. Click Repos in the sidebar. Click Add Repo. In the Add Repo dialog, click Clone remote Git repo and enter the repository URL. Select your Git provider from the drop-down menu, optionally change the name to use for the Databricks repo, and click Create. The contents of the remote repository are cloned to the Databricks repo. Work with notebooks in a Databricks repo To create a new notebook or folder in a repo, click the down arrow next to the repo name, and select Create > Notebook or Create > Folder from the menu. To move an notebook or folder in your workspace into a repo, navigate to the notebook or folder and select Move from the drop-down menu: In the dialog, select the repo to which you want to move the object: You can import a SQL or Python file as a single-cell Databricks notebook. - Add the comment line -- Databricks notebook sourceat the top of a SQL file. - Add the comment line # Databricks notebook sourceat the top of a Python file. Work with non-notebook files in a Databricks repo This section covers how to add files to a repo and view and edit files. Create a new file The most common way to create a file in a repo is to clone a Git repository. You can also create a new file directly from the Databricks repo. Click the down arrow next to the repo name, and select Create > File from the menu. Upload a file To upload a file from your local system, click the down arrow next to the repo name, and select Upload File(s). You can drag files into the dialog or click browse to select files. Edit a file To edit a file in a repo, click the filename in the Repos browser. The file opens and you can edit it. Changes are saved automatically. Access files in a repo programmatically You can programmatically read small data files in a repo, such as .csv or .json files, directly from a notebook. You cannot programmatically create or edit files from a notebook. import pandas as pd df = pd.read_csv("./data/winequality-red.csv") df You can use Spark to access files in a repo. Spark requires absolute file paths for file data. The absolute file path for a file in a repo is file:/Workspace/Repos/<user_folder>/<repo_name>/file. The example below shows the use of {os.getcwd()} to get the full path. import os spark.read.format("csv").load(f"file:{os.getcwd()}/my_data.csv") Work with Python and R modules Import Python and R modules The current working directory of your repo and notebook are automatically added to the Python path. When you work in the repo root, you can import modules from the root directory and all subdirectories. To import modules from another repo, you must add that repo to sys.path. For example: import sys sys.path.append("/Workspace/Repos/<user-name>/<repo-name>") # to use a relative path import sys import os sys.path.append(os.path.abspath('..')) You import functions from a module in a repo just as you would from a module saved as a cluster library or notebook-scoped library: from sample import power power.powerOfTwo(3) source("sample.R") power.powerOfTwo(3) Sync with a remote Git repository To sync with Git, use the Git dialog. The Git dialog lets you pull changes from your remote Git repository and push and commit changes. You can also change the branch you are working on or create a new branch. Important Git operations that pull in upstream changes clear the notebook state. For more information, see Incoming changes clear the notebook state. Open the Git dialog You can access the Git dialog from a notebook or from the repos browser. From a notebook, click the button at the top left of the notebook that identifies the current Git branch. From the repos browser, click the button to the right of the repo name: You can also click the down arrow next to the repo name, and select Git… from the menu. Pull changes from the remote Git repository To pull changes from the remote Git repository, click in the Git dialog. Notebooks and other files are updated automatically to the latest version in your remote repository. A message appears if there are merge conflicts. Databricks recommends that you resolve the merge conflict using your Git provider interface. Commit and push changes to the remote Git repository When you have added new notebooks or files, or made changes to existing notebooks or files, the Git dialog highlights the changes. Add a required Summary of the changes, and click Commit & Push to push these changes to the remote Git repository. If you don’t have permission to commit to the default branch, such as main, create a new branch and use your Git provider interface to create a pull request (PR) to merge it into the default branch. Note - Results are not included with a notebook commit. All results are cleared before the commit is made. - If there are merge conflicts, Databricks recommends that you create a new branch, commit and push your changes to that branch, work in that branch, and resolve the merge conflict using your Git provider interface. Control access to Databricks Repos Manage permissions When you create a repo, you have Can Manage permission. This lets you perform Git operations or modify the remote repository. You can clone public remote repositories without Git credentials (personal access token and username). To modify a public remote repository, or to clone or modify a private remote repository, you must have a Git provider username and personal access token with read and write permissions for the remote repository. Use allow lists An admin can limit which remote repos users can commit and push to. - Go to the Admin Console. - Click the Workspace Settings tab. - In the Advanced section, click the Enable Repos Git URL Allow List toggle. - Click Confirm. - In the field next to Repos Git URL Allow List: Empty list, enter a comma-separated list of URL prefixes. - Click Save. Users can only commit and push to Git repositories that start with one of the URL prefixes you specify. The default setting is “Empty list”, which disables access to all repositories. To allow access to all repositories, disable Enable Repos Git URL Allow List. Note - The list you save overwrites the existing set of saved URL prefixes. - It may take about 15 minutes for changes to take effect. Repos API The Repos API update endpoint allows you to update a repo to the latest version of a specific Git branch or to a tag. This enables you to update the repo before you run a job against a notebook in the repo. For details, see Repos API 2.0. Best practices for integrating repos with CI/CD workflows This section includes best practices for integrating Databricks repos with your CI/CD workflow. The following figure shows an overview of the steps. Admin workflow Repos have user-level folders and non-user top level folders. User-level folders are automatically created when users first clone a remote repository. You can think of repos in user folders as “local checkouts” that are individual for each user and where users make changes to their code. Set up top-level repo folders Admins can create non-user top level folders. The most common use case for these top level folders is to create Dev, Staging, and Production folders that contain repos for the appropriate versions or branches for development, staging, and production. For example, if your company uses the Main branch for production, the Production folder would contain repos configured to be at the Main branch. Typically permissions on these top-level folders are read-only for all non-admin users within the workspace. Set up Git automation to update repos on merge To ensure that repos are always at the latest version, you can set up Git automation to call the Repos API. In your Git provider, set up automation that, after every successful merge of a PR into the Main branch, calls the Repos API endpoint on the appropriate repo in the Production folder to bring that repo to the latest version. For example, on GitHub this can be achieved with GitHub Actions. User workflow To start a workflow, clone your remote repository into a user folder. A best practice is to create a new feature branch, or select a previously created branch, for your work, instead of directly committing and pushing changes to the main branch. You can make changes, commit, and push changes in that branch. When you are ready to merge your code, create a pull request and follow the review and merge processes in Git. Production job workflow You can point jobs directly to notebooks in repos. When a job kicks off a run, it uses the current version of the code in the repo. If the automation is setup as described in Admin workflow, every successful merge calls the Repos API to update the repo. As a result, jobs that are configured to run code from a repo always use the latest version available when the job run was created. Migration tips If you are using %run commands to make Python or R functions defined in a notebook available to another notebook, or are installing custom .whl files on a cluster, consider including those custom modules in a Databricks repo. In this way, you can keep your notebooks and other code modules in sync, ensuring that your notebook always uses the correct version. Migrate from %run commands %run commands let you include one notebook within another and are often used to make supporting Python or R code available to a notebook. In this example, a notebook named power.py includes the code below. # This code is in a notebook named "power.py". def n_to_mth(n,m): print(n, "to the", m, "th power is", n**m) You can then make functions defined in power.py available to a different notebook with a %run command: # This notebook uses a %run command to access the code in "power.py". %run ./power n_to_mth(3, 4) Using Files in Repos, you can directly import the module that contains the Python code and run the function. from Power import n_to_mth n_to_mth(3, 4) Migrate from installing custom Python .whl files You can install custom .whl files onto a cluster and then import them into a notebook attached to that cluster. For code that is frequently updated, this process is cumbersome and error-prone. Files in Repos lets you keep these Python files in the same repo with the notebooks that use the code, ensuring that your notebook always uses the correct version. For more information about packaging Python projects, see this tutorial. Limitations and FAQ In this section: - Incoming changes clear the notebook state - What happens if a job starts running on a notebook while a Git operation is in progress? - How can I run non-Databricks notebook files in a repo? For example, a .pyfile? - Can I create top-level folders that are not user folders? - Does Repos support GPG signing of commits? - How and where are the Github tokens stored in Databricks? Who would have access from Databricks? - Does Repos support on-premise or self-hosted Git servers? - Does Repos support Git submodules? - Does Repos support SSH? - Does Repos support .gitignorefiles? - Can I pull the latest version of a repository from Git before running a job without relying on an external orchestration tool? - Can I pull in .ipynbfiles? - Are there limits on the size of a repo or the number of files? - Does Repos support branch merging? - Are the contents of Databricks repos encrypted? - Can I delete a branch from a Databricks repo? - Where is Databricks repo content stored? - How can I disable Repos in my workspace? - Files in Repos limitations Incoming changes clear the notebook state Git operations that alter the notebook source code result in the loss of the notebook state, including cell results, comments, revision history, and widgets. For example, Git pull can change the source code of a notebook. In this case, Databricks repos must overwrite the existing notebook to import the changes. Git commit and push or creating a new branch do not affect the notebook source code, so the notebook state is preserved in these operations. What happens if a job starts running on a notebook while a Git operation is in progress? At any point while a Git operation is in progress, some notebooks in the Repo may have been updated while others have not. This can cause unpredictable behavior. For example, suppose notebook A calls notebook Z using a %run command. If a job running during a Git operation starts the most recent version of notebook A, but notebook Z has not yet been updated, the %run command in notebook A might start the older version of notebook Z. During the Git operation, the notebook states are not predictable and the job might fail or run notebook A and notebook Z from different commits. How can I run non-Databricks notebook files in a repo? For example, a .py file? You can use any of the following: - Bundle and deploy as a library on the cluster. - Pip install the Git repository directly. This requires a credential in secrets manager. - Use %runwith inline code in a notebook. - Use a custom container image. See Customize containers with Databricks Container Services. Can I create top-level folders that are not user folders? Yes, admins can create top-level folders to a single depth. Repos does not support additional folder levels. How and where are the Github tokens stored in Databricks? Who would have access from Databricks? - The authentication tokens are stored in the Databricks control plane, and a Databricks employee can only gain access through a temporary credential that is audited. - Databricks logs the creation and deletion of these tokens, but not their usage. Databricks has logging that tracks Git operations that could be used to audit the usage of the tokens by the Databricks application. - Github enterprise audits token usage. Other Git services may also have Git server auditing. Does Repos support Git submodules? No. You can clone a repo that contains Git submodules, but the submodule is not cloned. Does Repos support SSH? No, only HTTPS. Does Repos support .gitignore files? Yes. If you add a file to your repo and do not want it to be tracked by Git, create a .gitignore file or use one cloned from your remote repository and add the filename, including the extension. .gitignore works only for files that are not already tracked by Git. If you add a file that is already tracked by Git to a .gitignore file, the file is still tracked by Git. Can I pull the latest version of a repository from Git before running a job without relying on an external orchestration tool? No. Typically you can integrate this as a pre-commit on the Git server so that every push to a branch (main/prod) updates the Production repo. Can I pull in .ipynb files? Yes. The file renders in .json format, not notebook format. Are there limits on the size of a repo or the number of files? Databricks does not enforce a limit on the size of a repo. Working branches are limited to 200MB. Individual files are limited to 10MB. Databricks recommends that the total number of notebooks and files in a repo not exceed 1000. You may receive an error message if these limits are exceeded. You may also receive a timeout error on the initial clone of the repo, but the operation might complete in the background. Does Repos support branch merging? No. Databricks recommends that you create a pull request and merge through your Git provider. Are the contents of Databricks repos encrypted? The contents of repos are encrypted by Databricks using a platform-managed key. Encryption using Customer-managed keys for managed services is not supported. Can I delete a branch from a Databricks repo? No. To delete a branch, you must work in your Git provider. Where is Databricks repo content stored? The contents of a repo are temporarily cloned onto disk in the control plane. Databricks notebook files are stored in the control plane database just like notebooks in the main workspace. Non-notebook files may be stored on disk for up to 30 days. How can I disable Repos in my workspace? Follow these steps to disable Repos for Git in your workspace. - Go to the Admin Console. - Click the Workspace Settings tab. - In the Advanced section, click the Repos toggle. - Click Confirm. - Refresh your browser. Files in Repos limitations - Native file reads are supported in Python and R notebooks. Native file reads are not supported in Scala notebooks, but you can use Scala notebooks with DBFS as you do today. - The diff view in the Git dialog is not available for files. - Only text encoded files are rendered in the UI. To view files in Databricks, the files must not be larger than 10 MB. - You cannot create or edit a file from your notebook. Troubleshooting Error message: Invalid credentials Try the following: Confirm that the settings in the Git integration tab (User Settings > Git Integration) are correct. - You must enter both your Git provider username and token. Legacy Git integrations did not require a username, so you may need to add a username to work with repos. Confirm that you have selected the correct Git provider in the Add Repo dialog. Ensure your personal access token or app password has the correct repo access. If SSO is enabled on your Git provider, authorize your tokens for SSO. Test your token with command line Git. Both of these options should work: git clone https://<username>:<personal-access-token>@github.com/<org>/<repo-name>.git git clone -c http.sslVerify=false -c http.extraHeader='Authorization: Bearer <personal-access-token>' Error message: Secure connection could not be established because of SSL problems <link>: Secure connection to <link> could not be established because of SSL problems This error occurs if your Git server is not accessible from Databricks. Private Git servers are not supported. Timeout errors Expensive operations such as cloning a large repo or checking out a large branch may hit timeout errors, but the operation might complete in the background. You can also try again later if the workspace was under heavy load at the time. 404 errors If you get a 404 error when you try to open a non-notebook file, try waiting a few minutes and then trying again. There is a delay of a few minutes between when the workspace is enabled and when the webapp picks up the configuration flag. resource not found errors after pulling non-notebook files into a Databricks repo This error can occur if you are not using Databricks Runtime 8.4 or above. A cluster running Databricks Runtime 8.4 or above is required to work with non-notebook files in a repo.
https://docs.databricks.com/repos.html
CC-MAIN-2021-43
refinedweb
3,847
65.22
Sending email is a very common task in any web application for many purposes. In daily development we need to add some mail functionality to our project to send email to the customer or another in our web site. Introduction Sending email is a very common task in any web application for many purposes. In daily development we need to add some mail functionality to our project to send email to the customer or another in our web site. Using the code For sending mail from ASP.NET MVC we use the "System.Net.Mail" namespace. Let's see how to do this. Step 1: Create a new Model Class in the model folder. The following is the code for the new Model. Step 2: Create a new SendMailerController in the Controller folder. The following is the code for the design of the new Controller. SendMailerController.cs In the code above we have the following 4 fields: When the user clicks the "Send" button, the mail will be sent to the specified mail address that you provide in the "To" TextBox. That’s it. Press F5 to run your code. Understanding the Code In MVC, we can post our data in one of two ways. 1. Strongly typed 2. Ajax using jQuery In the preceding example, we used the strongly typed solution, why? Because we have FileUploader. This fileupload needs an object HttpPostedFileBase, that gives you the FileName,Content Length, Content type properties of your selected files. For posting attached file data from a View to a Controller, we need the following simple 3 steps. Step 1: In every web based app we define a <form> tag, here we also define a <form> tag in razor style. As you have seen in the preceding line of code, here it is: Step 2: Define fileupload control In the code above: that uses a [httppost] action method. In this method, we have a parameter of our MailModel object and HttpPostedFileBase object. Here remember one thing always. In Step 2 you defined a fileupload control, here is the property name=”fileUploader”. So when you define an object of HttpPostedFileBase object variable, both names should be the same. In the code above name=”fileiploader” and in the ActionMethod HttpPostedFileBase fileUploader. Now we create a MailMessage object. So we add our data into specified properties. For sending mail we need a SMTP Server, so in ASP.Net we have the SmtpClient class, using that class object we set its properties for the SMTP settings. This is the SMTP Host address of Gmail, if you want to use any other SMTP host service then please add a different SMTP host protocol, for example for Hotmail it is smtp.live.com. In Smtp.Port=587, 587 is the port for Gmail, so for any other service port you need to change the port correspondingly. View All View All
https://www.c-sharpcorner.com/uploadfile/sourabh_mishra1/sending-an-e-mail-with-attachment-using-asp-net-mvc/
CC-MAIN-2022-27
refinedweb
481
73.98
z3c.testsetup 0.8.4 Easier test setup for Zope 3 projects and other Python packages. z3c.testsetup: easy test setup for zope 3 and python projects Setting up tests for Zope 3 projects sometimes tends to be cumbersome. You often have to prepare complex things like test layers, setup functions, teardown functions and much more. Often these steps have to be done again and again. z3c.testsetup jumps in here, to support much flatter test setups. The package supports normal Python unit tests and doctests. Doctests and test modules are found throughout a whole package and registered with sensible, modifiable defaults. This saves a lot of manual work! See README.txt and the other .txt files in the src/z3c/testsetup directory for API documentation. (Or further down this page when reading this on pypi). Contents - z3c.testsetup: easy test setup for zope 3 and python projects - Detailed documentation - Initial notes - Basic Example - Registering the tests: register_all_tests() - Available markers for configuring the tests - How to upgrade from z3c.testsetup < 0.3 - Changelog for z3c.testsetup - 0.8.4 (2015-05-27) - 0.8.3 (2010-09-15) - 0.8.2 (2010-07-30) - 0.8.1 (2010-07-25) - 0.8 (2010-07-24) - 0.7 (2010-05-17) - 0.6.1 (2009-11-19) - 0.6 (2009-11-19) - 0.5.1 (2009-10-22) - 0.5 (2009-09-23) - 0.4 (2009-06-11) - 0.3 (2009-02-23) - 0.2.2 (2008-02-29) - 0.2.1 (2008-02-18) - 0.2 (2008-02-17) - 0.1 (2008-02-15) - Download Detailed documentation The package works in two steps: - It looks for testfiles in a given package. - It registers the tests according to your specifications. Initial notes - Between version 0.2 and 0.3 of z3c.testsetup a new set of testfile markers was introduced. If you are still using Test-Layer: unit or similar, please read the README.txt in the source directory carefully to learn how to switch to the new names. (Or see further down this page when reading it on pypi). - Zope integration note: if you want zope integration or functional tests, you have to make sure, that the zope.app.testing and zope.component packages are available during test runs. z3c.testsetup does not depend on it to make it usable for plain python packages. If you want zope integration/functional tests, this is almost always already the case, so you don’t need to care about this. - If you download the source code, you can look at the examples used for testing and at text files that test technical aspects of z3c.testsetup. This can be handy when you want detailed knowledge about specific features. Basic Example Before we can find, register and execute tests, we first have to write them down. z3c.testsetup includes examples used for testing (you can find them all in the tests/ subdirectory if you’ve downloaded the source code): >>> import os >>> import z3c.testsetup >>> pkgpath = os.path.dirname(z3c.testsetup.__file__) >>> cavepath = os.path.join(pkgpath, 'tests', 'othercave') Registering doctests In this example directory, there is a simple doctest doctest01.txt (please ignore the pipes on the left): >>> print_file(os.path.join(cavepath, 'doctest01.txt')) | A doctest | ========= | | :doctest: | | This is a simple doctest. | | >>> 1+1 | 2 | Important to note: the doctest is marked by a special marker that tells the testsetup machinery that the file contains doctest examples that should be registered during test runs: :doctest: Without this marker, a testfile won’t be registered during tests! This is the only difference compared to ‘normal’ doctests when you use z3c.testsetup. If you want to disable a test, just turn :doctest: into :nodoctest: (or something else) and the file will be ignored. Note How to disable markers or make them invisible All markers can be written as restructured text comments (two leading dots followed by whitespace) like this:.. :doctest: and will still work. This way you can make the markers disappear from autogenerated docs etc. Running the tests Now that we have a doctest available, we can write a testsetup routine that collects all tests, registers them and passes them to the testrunner: >>> print(open(os.path.join(cavepath, 'simplesetup01.py')).read()) import z3c.testsetup test_suite = z3c.testsetup.register_all_tests( 'z3c.testsetup.tests.othercave', allow_teardown=True) This is all we need in simple cases. We use register_all_tests(<dotted_pkg_name>) to tell the setup machinery, where to look for test files. The allow_teardown parameter tells, that we allow tearing down functional tests, so that they don’t have to be run in an isolated subprocess. Note that also files in subpackages will be found, registered and executed when they are marked approriately. Let’s start the testrunner and see what it gives: >>> import sys >>> sys.argv = [sys.argv[0],] >>> defaults = [ ... '--path', cavepath, ... '--tests-pattern', '^simplesetup01$', ... ] >>> from z3c.testsetup import testrunner >>> testrunner.run(defaults) Running zope...testrunner.layer.UnitTests tests: Set up zope...testrunner.layer.UnitTests in 0.000 seconds. Custom setUp for <DocTest doctest05.txt from ...doctest05.txt:0 (2 examples)> Custom tearDown for <DocTest doctest05.txt from ...doctest05.txt:0 (2 examples)> Ran 4 tests with 0 failures and 0 errors in N.NNN seconds. Running z3c...layer.DefaultZCMLLayer [...ftesting.zcml] tests: Tear down zope...testrunner.layer.UnitTests in N.NNN seconds. Set up z3c...layer.DefaultZCMLLayer [...ftesting.zcml] in N.NNN seconds. Ran 3 tests with 0 failures and 0 errors in N.NNN seconds. Running z3c...layer.DefaultZCMLLayer [...ftesting2.zcml] tests: Tear down z3c...DefaultZCMLLayer [...ftesting.zcml] in N.NNN seconds. Set up z3c...layer.DefaultZCMLLayer [...ftesting2.zcml] in N.NNN seconds. Ran 1 tests with 0 failures and 0 errors in N.NNN seconds. Running z3c.testsetup.tests.othercave.testing.FunctionalLayer1 tests: Tear down z3c...DefaultZCMLLayer [...ftesting2.zcml] in N.NNN seconds. Set up z3c....othercave.testing.FunctionalLayer1 in N.NNN seconds. Ran 1 tests with 0 failures and 0 errors in N.NNN seconds. Running z3c.testsetup.tests.othercave.testing.UnitLayer2 tests: Tear down z3c...othercave.testing.FunctionalLayer1 in N.NNN seconds. Set up z3c.testsetup.tests.othercave.testing.UnitLayer1 in N.NNN seconds. Set up z3c.testsetup.tests.othercave.testing.UnitLayer2 in N.NNN seconds. Running testSetUp of UnitLayer1 Running testSetUp of UnitLayer2 Running testTearDown of UnitLayer2 Running testTearDown of UnitLayer1 Ran 1 tests with 0 failures and 0 errors in N.NNN seconds. Tearing down left over layers: Tear down z3c...othercave.testing.UnitLayer2 in N.NNN seconds. Tear down z3c...othercave.testing.UnitLayer1 in N.NNN seconds. Total: 10 tests, 0 failures, 0 errors in N.NNN seconds. False As we can see, there were regular unittests as well as functional tests run. Some of the unittests used their own layer (UnitLayer1). Layers are shown in the output. In this example, the functional tests use different ZCML-files for configuration which results in separate test layers. Finding doctests in Python modules The doctest file described above was a pure .txt file. By default z3c.testsetup looks for doctests in files with filename extension .txt, .rst and .py. This means, that also doctests in Python modules are found just fine as in the following example: >>> print_file(os.path.join(cavepath, 'doctest08.py')) | """ | Doctests in a Python module | =========================== | | We can place doctests also in Python modules. | | :doctest: | | Here the Cave class is defined:: | | >>> from z3c.testsetup.tests.othercave.doctest08 import Cave | >>> Cave | <class 'z3c.testsetup...doctest08.Cave'> | | """ | | | class Cave(object): | """A Cave. | | A cave has a number:: | | >>> hasattr(Cave, 'number') | True | | """ | number = None | | def __init__(self, number): | """Create a Cave. | | We have to give a number if we create a cave:: | | >>> c = Cave(12) | >>> c.number | 12 | | """ | self.number = number | Here we placed the marker string :doctest: into the docstring of the module. Without it, the module would not have been considered a testfile. Note that you have to import the entities (classes, functions, etc.) from the very same file if you want to use them. Registering regular python unittests z3c.testsetup provides also (limited) support for regular unittest deployments as usually written in Python. An example file looks like this: >>> print_file(os.path.join(cavepath, 'pythontest1.py')) | """ | Tests with real TestCase objects. | | :unittest: | | """ | import unittest | | | class TestTest(unittest.TestCase): | | def setUp(self): | pass | | def testFoo(self): | self.assertEqual(2, 1+1) | The module contains a marker :unittest: in its module docstring instead of the :doctest: marker used in the other examples above. This means that the file is registered as a regular unittest. (It is also the replacement for the formely used :Test-Layer: python marker.) If you use unittests instead of doctests, then you are mainly on your own with setting up and tearing down tests. All this should be done by the test cases themselves. The only advantage of using z3c.testsetup here is, that those tests are found and run automatically when they provide the marker. Registering the tests: register_all_tests() The register_all_tests function mentioned above accepts a bunch of keyword parameters: register_all_tests(pkg_or_dotted_name [, extensions] [, encoding] [, checker] [, globs] [, optionflags] [, setup] [, teardown] [, zcml_config] [, layer_name] [, layer]) where all but the first parameter are keyword paramters and all but the package parameter are optional. While the extensions parameter determines the set of testfiles to be found, the other paramters tell how to setup single tests. The last five parameters are only fallbacks, that should better be configured in doctest files themselves via marker strings. extensions: a list of filename extensions to be considered during doctest search. Default value for doctests is ['.txt', '.rst', '.py']. Python tests are not touched by this (they have to be regular Python modules with ‘.py’ extension). If we want to register .foo files, we can do so: >>> import z3c.testsetup >>>. encoding: the encoding of testfiles. ‘utf-8’ by default. Setting this to None means using the default value. We’ve hidden one doctest file, that contains umlauts. If we set the encoding to ascii, we will get some UnicodeDecodeError. We cannot easily show that here, as this parameter is not supported for Python 2.4 and all examples in here have to work for each supported Python version. Note encoding parameter is not supported for Python 2.4. You can pass the encoding parameter, but it will be ignored when building test suites. For Python >= 2.5 the result would look like this: normalizer for Define this checker in your testrunner .py file and add a checker=mychecker option to the register_all_tests() call. Since version 0.5 checkers are applied to both regular and functional doctests (pre-0.5: only functional ones). globs: A dictionary of things that should be available immediately (without imports) during tests. Default is an empty dict, which might be populated by appropriate layers (see below). ZCML layers for example get you the getRootFolder method automatically. This parameter is a fallback which can be overriden by testfile markers specifying a certain layer (see below). The globs parameter applies only to doctests, not to plain python unittests. optionflags: Optionflags influence the behaviour of the testrunner. They are logically or’d so that you can add them arithmetically. See for details. setup: A callable that takes a test argument and is executed before every single doctest. The default function does nothing. This parameter is a fallback which can be overriden by testfile markers specifying a certain layer (see below). Specifying setup functions in a layer is also the recommended way. teardown: The equivalent to setup. The default function runs zope.testing.cleanup.cleanUp() unless overriden by a layer. Specifying teardown functions in a layer is also the recommended way. allow_teardown: A boolean whether teardown of zcml layers is allowed (added in 0.5). In rare corner cases (like programmatically slapping an interface on a class), a full safe teardown of the zope component architecture is impossible. Zope.testing has a default setting for allow_teardown of False, which means it uses the safe default of running every zcml layer in a separate process, which ensures full teardown. The drawback is that profiling and coverage tools cannot combine the profile/coverage data from separate processes. z3c.testsetup has a default of False (since 0.5.1, True in 0.5). If you want correct coverage/profiling output and your tests allow it, you’ll have to set allow_teardown=False in your register_all_tests() call. or a docfile specifies its own layer/ZCML config (see below). This is a fallback parameter. Use of docfile specific layer markers is recommended. layer_name: You can name your layer, to distinguish different setups of functional doctests. The layer name can be an arbitrary string. This parameter has no effect, if also a layer parameter is given or a docfile specifies its own layer/ZCML config (see below). This is a fallback parameter. Use of per-doctest-file specific layer markers is recommended.. This is a fallback parameter and has no effect for docfiles specifying their own layer or ZCML config. Note For more elaborate setups, you can use so-called TestGetters and TestCollectors. They are explained in testgetter.txt in the source code (so you’ll need to look there if you want to use it). Available markers for configuring the tests We already saw the :doctest: marker above. Other markers detected by z3c.testsetup are: :unittest: A replacement for :doctest:, marking a Python module as containing unittests to run. (Replaces old Test-Layer: python marker.) :setup: <dotted.name.of.function> Execute the given setup function before running doctests in this file. :teardown: <dotted.name.of.function> Execute the given teardown function after running doctests in this file. :layer: <dotted.name.of.layer.def> Use the given layer definition for tests in this file. If the layer given is derived from zope.testing.functional.ZCMLLayer, the test is registered using zope.app.testing.functional.FunctionalDocFileSuite. :zcml-layer: <ZCML_filename> Use the given ZCML file and run tests in this file on a ZCML layer. Tests are registered using doctest.DocFileSuite. :functional-zcml-layer: <ZCML_filename> Use the given ZCML file and run tests in this file registered with zope.app.testing.functional.FunctionalDocFileSuite. Markers are case-insensitive. See further below for explanations of the respective markers. Setting up a self-defined layer: :layer: Starting with z3c.testsetup 0.3 there is reasonable support for setting up layers per testfile. This way you can easily create setup-functions that are only run before/after certain sets tests. Overall, use of layers is the recommended way from now on. We can tell z3c.testsetup to use a certain layer using the :layer: marker as in the following example (see tests/othercave/doctest02.txt): A doctests with layer ===================== <BLANKLINE> :doctest: :layer: z3c.testsetup.tests.othercave.testing.UnitLayer2 <BLANKLINE> >>> 1+1 2 The :doctest: marker was used here as well, because without it the file would not have been detected as a registerable doctest file (we want developers to be explicit about that). The :layer: <DOTTED_NAME_OF_LAYER_DEF> marker then tells, where the testsetup machinery can find the layer definition. It is given in dotted name notation and points to a layer you defined yourself. How does the layer definition look like? It is defined as regualr Python code: >>> print(open(os.path.join(cavepath, 'testing.py')).read()) import os ... class UnitLayer1(object): """This represents a layer. A layer is a way to have common setup and teardown that happens once for a whole group of tests. <BLANKLINE> It must be an object with a `setUp` and a `tearDown` method, which are run once before or after all the tests applied to a layer respectively. <BLANKLINE> Optionally you can additionally define `testSetUp` and `testTearDown` methods, which are run before and after each single test. <BLANKLINE> This class is not instantiated. Therefore we use classmethods. """ <BLANKLINE> @classmethod def setUp(self): """This gets run once for the whole test run, or at most once per TestSuite that depends on the layer. (The latter can happen if multiple suites depend on the layer and the testrunner decides to tear down the layer after first suite finishes.) """ <BLANKLINE> @classmethod def tearDown(self): """This gets run once for the whole test run, or at most once per TestSuite that depends on the layer, after all tests in the suite have finished. """ <BLANKLINE> @classmethod def testSetUp(self): """This method is run before each single test in the current layer. It is optional. """ print(" Running testSetUp of UnitLayer1") <BLANKLINE> @classmethod def testTearDown(self): """This method is run before each single test in the current layer. It is optional. """ print(" Running testTearDown of UnitLayer1") <BLANKLINE> class UnitLayer2(UnitLayer1): """This Layer inherits ``UnitLayer1``. <BLANKLINE> This way we define nested setups. During test runs the testrunner will first call the setup methods of ``UnitTest1`` and then those of this class. Handling of teardown-methods will happen the other way round. """ <BLANKLINE> @classmethod def setUp(self): pass <BLANKLINE> @classmethod def testSetUp(self): print(" Running testSetUp of UnitLayer2") <BLANKLINE> @classmethod def testTearDown(self): print(" Running testTearDown of UnitLayer2") In a layer you can do all the special stuff that is needed to run a certain group of tests properly. Our setup here is special in that we defined a nested one: UnitLayer2 inherits UnitLayer1 so that during test runs the appropriate setup and teardown methods are called (see testrunner output above). More about test layers can be found at the documentation of testrunner layers API. Specifying a ZCML file: :zcml-layer: When it comes to integration tests which use zope’s component architecture, we need to specify a ZCML file which configures the test environment for us. We can do that using the :zcml-layer: <ZCML-file-name> marker. It expects a ZCML filename as argument and sets up a ZCML-layered testsuite for us. An example setup might look like so (see tests/othercave/doctest03.txt): A doctest with a ZCML-layer =========================== :doctest: :zcml-layer: ftesting.zcml >>> 1+1 2 Note Requires zope.app.testing If you use :zcml-layer, the zope.app.testing package must be available when running the tests and during test setup. This package is not fetched by default by z3c.testsetup. Here we say that the the local file ftesting.zcml should be used as ZCML configuration. As we can see in the above output of testruner, this file is indeed read during test runs and used by a ZCML layer called DefaultZCMLLayer. This layer is in fact only a zope.app.testing.functional.ZCMLLayer. The ZCML file is looked up in the same directory as the doctest file. (You can use relative paths like ../ftesting.zcml just fine, btw). When using the :zcml-layer: marker, the concerned tests are set up via special methods and functions from zope.app.testing. This way you get ‘functional’ or ‘integration’ tests out of the box: in the beginning an empty ZODB db is setup, getRootFolder, sync and other functions are pulled into the test namespace and several things more. If you want a plain setup instead then use your own layer definition using :layer: and remove the :zcml-layer: marker. Setting up a functional ZCML layer: :functional-zcml-layer: Sometimes we want tests to be registered using the FunctionalDocFileSuite function from zope.app.testing.functional (other tests are set up using doctest.DocFileSuite). This function pulls in even more functions into globs, like http (a HTTPCaller instance), wraps your setUp and tearDown methods into ZODB-setups and several things more. See the definition in. This setup needs also a ZCML configuration file, which can be specified via: :functional-zcml-layer: <ZCML-file-name> If a functional ZCML layer is specified in a testfile this way, it will override any simple :zcml-layer: or :layer: definition. An example setup might look like this (see tests/othercave/doctest04.txt): >>> print_file(os.path.join(cavepath, 'doctest04.txt')) | A functional doctest with ZCML-layer | ==================================== | | :doctest: | :functional-zcml-layer: ftesting.zcml | | We didn't define a real environment in ftesting.zcml, but in | functional tests certain often needed functions should be available | automatically:: | | >>> getRootFolder() | <zope...folder.Folder object at 0x...> | The placeholder between zope and folder was used because the location of the Folder class changed recently. This way we cover setups with old packages as well as recent ones. Note Requires zope.app.testing If you use :zcml-layer, the zope.app.testing package must be available when running the tests and during test setup. This package is not fetched by default by z3c.testsetup. Specifying test setup/teardown methods: :setup: and :teardown: We can specify a setUp(test) and tearDown(test) method for the examples in a doctest file, which will be executed once for the whole doctest file. This can be done using: :setup: <dotted.name.of.callable> :teardown: <dotted.name.of.callable> The callables denoted by the dotted names must accept a test parameter which will be the whole test suite of examples in the current doctest file. setup/teardown can be used to set up (and remove) a temporary directory, to monkeypatch a mailer, etcetera. An example can be found in doctest05.txt: >>> print_file(os.path.join(cavepath, 'doctest05.txt')) | A doctest with custom setup/teardown functions | ============================================== | | :doctest: | :setup: z3c.testsetup.tests.othercave.testing.setUp | :teardown: z3c.testsetup.tests.othercave.testing.tearDown | | >>> 1+1 | 2 | | We make use of a function registered during custom setup:: | | >>> myfunc(2) | 4 | The setup/teardown functions denoted in the example look like this: >>> print(open(os.path.join(cavepath, 'testing.py'), 'r').read()) import os ... def setUp(test): print(" Custom setUp for %s" % test) # We register a function that will be available during tests. test.globs['myfunc'] = lambda x: 2*x <BLANKLINE> def tearDown(test): print(" Custom tearDown for %s" % test) del test.globs['myfunc'] # unregister function ... As we can see, there is a function myfunc pulled into the namespace of the doctest. We could, however, do arbitrary other things here, set up a relational test database or whatever. How to upgrade from z3c.testsetup < 0.3 With the 0.3 release of z3c.testsetup the set of valid marker strings changed, introducing support for file-dependent setups, layers, etc. Deprecated :Test-Layer: marker If you still mark your testfiles with the :Test-Layer: marker, update your testfiles as follows: :Test-Layer: unit Change to: :doctest: :Test-Layer: python Change to: :unittest: :Test-Layer: functional Change to: :functional-zcml-layer: <ZCML-FILE> The ZCML file must explicitly be given. If you used custom setups passed to register_all_tests, consider declaring those setup/teardown functions in the appropriate doctest files using :setup: and :teardown:. You might also get better structured test suites when using the new layer markers :layer:, :zcml-layer: and functional-zcml-layer:. Deprectated parameters for register_all_tests() The following register_all_tests-parameters are deprecated, starting with z3c.testsetup 0.3: filter_func and related (ufilter_func, pfilter_func, etc.) All testtype specific parameters Support for testfile specific parameters (uextensions, fextensions, etc.) is running out and its use deprecated. Changelog for z3c.testsetup 0.8.4 (2015-05-27) - Added util.got_working_zope_app_testing() to determine whether we have not only zope.app.testing installed, but it is also in a usable state. - Make the package compatible with Python3. Please note that at the time of writing, there is no working zope.app.testing available for Python 3.x. While z3c.testsetup can cope with that, some functionality (from zope.app.testing.functional) will not be available during tests. That depends on tests in your project. - Support for Python 3.3, Python 3.4, and PyPy2. - As part of the “go-python3” project, internal tests have been reorganized. From now on we will test things in Python code, not in doctests any more. Existing doctests will be transformed into Sphinx docs. - Fix keyword parsing of methods: accept methods that accept no keyword parameters. - Close files properly when looking for marker strings. - Cope with unforeseeable file encodings. We do now expect utf-8 but will not break otherwise. 0.8.3 (2010-09-15) - Fixed tests on windows related to testrunner problems with multiple layers run in subprocesses. - Fixed some tests on windows, mostly because of path separator issues 0.8.2 (2010-07-30) - Fixed tests not to fail when some buildbot takes minutes to run the tests. - Fix tests to work also under Python 2.7. 0.8.1 (2010-07-25) - The encoding parameter is ignored under Python 2.4. This was already true for the 0.8 release, but now we silently ignore it instead of raising exceptions. For Python >= 2.5 nothing changed. 0.8 (2010-07-24) - Use standard lib doctest instead of zope.testing.doctest. - z3c.testsetup now looks in zope.testrunner for testrunner first (which was ripped out of zope.testing). Using testrunner from zope.testing is still supported. See bottom of testrunner.txt in sources for details. - Fix tests to stay compatible with more recent zope testrunners. This should us keep compatible with ZTK 1.0a2. 0.7 (2010-05-17) - Fix NameError bug in the warning message in case zope.app.testing is not availble when trying to run a functional doc test. This error presented itself as a highly cryptic ImportError when actually running tests. 0.6.1 (2009-11-19) - Test files that we attempt to read but that do not exist raise an error instead of passing silently. - Internal refactoring: regex caching. 0.6 (2009-11-19) - Python unittest modules with an import error now result in a visible warning. Previously, such problems would be hidden. Also the python testrunner could not report them as broken as we did not pass those test files to the testrunner. - Fixed regex for detecting the old “:test-layer: python” marker: it did not work when prefixed with restructuredtext’s “..” comment marker. 0.5.1 (2009-10-22) - Reverted allow_teardown default back to False to prevent confusion. 0.5 (2009-09-23) Bug fixes - Checkers are now applied to non-functional doctests too. Thanks to Jonathan Ballet for patches. - Normal UnitTest layers are now registered correctly. - :layer: now detects functional ZCML layers. If the defined layer is derived from zope.testing.functional.ZCMLLayer, then the test is set up with the same kind of testcase as :functional-zcml-layer:. - Reordered and cleaned up the documentation. Feature changes - By default, functional layer tests now use the allow_teardown=True option of the ZCMLLayer. This prevents the zcml layer from running in a subprocess which throws off profiling and thus code coverage tools. Running it in a subprocess is only normally needed when you do things like adding an interface to a class after the fact in your code. You can overrid it in the register_all_tests() call by setting allow_teardown=False. 0.4 (2009-06-11) Bug fixes - Made z3c.testsetup selftests work with zope.testing >= 3.7.3. Thanks to Jonathan Ballet for pointing to that problem. - Ignore *nix hidden test files (i.e. such starting with a dot in filename) by default. Thanks to Jonathan Ballet for patch. - ZCML files registered via the default layer are now separated from each other, even if they own the same filename. Therefore you can now register a default layer with an ftesting.zcml in one subpackage while having another ftesting.zcml in another package. This was not handled correctly before. Many thanks go to Jonathan Ballet who contributed a patch. Feature Changes - Added z3c.testsetup.testrunner that provides wrappers for zope.testing.testrunner``s ``run() and run_internal() functions. Using it, one can make sure that running testrunners inside tests will work regardless of which version of zope.testing is used during testruns. 0.3 (2009-02-23) Bug fixes - Updated doctest examples to reflect new zope.testing behaviour. - z3c.testsetup really shouldn’t require zope.app.testing any more. If you use it in an environment without this package, then you cannot register functional tests, which is determined when loading register_all_tests from z3c.testsetup. - Broken modules are ignored while scanning for tests. - Modules are not loaded anymore if their source code does not provide a suitable marker string. For this to work, the default checker method isTestModule now expects a martian.scan.ModuleInfo as argument and not a real module. Module infos can be easily created by using module_info_from_dotted_name and module_info_from_package from the martian.scan package. Feature Changes New set of testfile markers: :doctest: marks a testfile as a doctest. :unittest: marks a testfile as a regular unittest. :layer: dotted.name.to.layer.def applies the given layer definition to the tests in the doctest file. :zcml-layer: filename.zcml sets up a ZCML layer with the given filename and applies this layer to the doctests in the doctest file. :functional-zcml-layer: filename.zcml sets up a ZCML layer with the given filename and applies this layer to the doctests in the doctest file. Furthermore the tests are set up as functional doc tests. :setup: dotted.name.to.setup.function applies the setUp function denoted by the dotted name to the tests in the doctest file. :teardown: dotted.name.to.teardown.function applies the tearDown function denoted by the dotted name to the tests in the doctests file. See the examples in tests/othercave and README.txt to learn more about using these new directives. The old :test-layer: marker is still supported but it is deprecated now and will vanish at least with the 0.5 version of z3c.testsetup.. 0.1 (2008-02-15) Feature changes - Initial Release - Author: Zope Foundation and Contributors - Keywords: zope3 zope tests unittest doctest testsetup - License: ZPL 2.1 - Categories - Development Status :: 3 - Alpha - Environment :: Web Environment - Framework :: Zope3 - - Package Index Owner: ulif, ccomb, reinout, jw, mgedmin - DOAP record: z3c.testsetup-0.8.4.xml
https://pypi.python.org/pypi/z3c.testsetup
CC-MAIN-2017-34
refinedweb
4,928
60.41
CSC/ECE 517 Fall 2012/ch2a 2w13 sm Introduction. Stubs in different phases of testing Unit Testing In developing a huge software if we are following top down approach of development there may be some functionality which may not have been implemented. This can be overcome by implementing all the required functions. However, then we would be testing a huge chunk of code without actually testing it. This will lead to bugs and lot of time will be wasted on debugging. Consider the following example: Suppose we want to evaluate an expression factorial(x)/( sin(x) + tan(x) ). Assuming that we don't have library support available for calculating factorial,sin and tan of the given input we would have to write those functions. Using stubs we can write functions which would return appropriate values. Thus, assuming that factorial(x) is implemented then we can write stubs for sin and cos functions returning floating point values. We can than verify if our main function gives expected results for those values. This shows us that our main function, factorial are working correct without actually implementing sin and cos functions code: int main() { float y=factorial(x) / (sin(x) + tan(x) ); return 0; } int factorial(x) { //implmentation of factorial } float sin(int x) { return 0.5; } float cos(int x) { return 0.3; } Functional Testing The idea of stub remains the same in different forms of testing. In unit testing we are dealing with working inside a module and hence we overwrite the dependent implementations by stub. This allows us to test the calling code without the actual implementation. In functional testing we will replace other modules or collaborators of a class. The client class might be interested in some service from some other class ( collaborator class ). However, again instead of implementing the actual class we will have a stub implementation. In ruby the mocha gem provides support for functional test using stubbing. This helps in avoiding overlapping test cases. We can see the use of stubs in functional testing using mocha in ruby in the programming languages section. Integration Testing know that any errors discovered when combining units are likely related to the interface between units. This method reduces the number of possibilities to a far simpler level of analysis.. Regression Testingfix, did not introduce new faults. One of the main reasons for regression testing is to determine whether a change in one part of the software affects other parts of the software.. In Regression testing the use of test stubs is minimized as most of the system is already implemented and the main goal of the regression test is to see if there are any bugs that might have been ‘regressed’ from the previous stages of integrations. Ideally there will not be unimplemented modules by the time a system is tested for regression. However, in case of mutually exclusive modules of a system, a test stub for one of them can be used to test the regression of the other. Stubs in software development Agile Development Methodology such a development system, it recognizes that testing is not a separate phase, but an integral part of software development, along with coding.. Specification by example, also known as acceptance test-driven development, is used to capture examples of desired and undesired behavior and guide coding. In the agile testing toolkit, a stub is a piece of code that behaves in a predefined way, in order to simplify the testing process. Here are the kind of simplifications that a stub can bring: - If the code under test never returns the same value (usage of a timestamp or of a random value), a stub can be used to fix the root of the undeterminism. - If the code depends on some other class that has complex behavior that you don’t want to take into account in this test, using a stub for this other class can simplify its behavior and clarify the intent of the test - If the code depends on some other code that is not yet written or released, it is possible to start building the rest of the code before the dependency is actually finished. Rapid Application Development Rapid Application Development or RAD is a style of programming that focuses on having tools that allow a program to be created quickly. This is particularly useful for graphically based programs as it is easy to create a frontend which can then be used for testing the backend code. It. In such a development scenario it becomes increasingly important to be able to write tests and successfully test the software the is being developed so that a complete product is developed in quick time. Test stubs ensure that the testing of code is not stalled in case other modules are still being developed. A programmer can immediately use test stubs and test their code and move on the the next module once its completed. Examples of Stubs Java In Java, the basic technique is to implement the stub collaborators as concrete classes which only exhibit the small part of the overall behaviour of the collaborator which is needed by the class under test. As an example consider the case where a service implementation is under test. The implementation has a collaborator: public class SimpleService implements Service { private Collaborator collaborator; public void setCollaborator(Collaborator collaborator) { this.collaborator = collaborator; } // part of Service interface public boolean isActive() { return collaborator.isActive(); } } We could have a stub collaborator for testing as defined below: public class StubCollaboratorAdapter implements Collaborator { public boolean isActive() { return false; } } Now, a test case can be written as something like this: public void testActiveWhenCollaboratorIsActive() throws Exception { Service service = new SimpleService(); service.setCollaborator(new StubCollaboratorAdapter() { public boolean isActive() { return true; } }); assertTrue(service.isActive()); } Ruby While writing stubs, one. Below is an example of the Mocha framework that can be used to build stubs in Ruby: class Document def print # doesn't matter -- we are stubbing it out end end class View attr :document def initialize(document) @document = document end def print() if document.print puts "Excellent!" true else puts "Not Great." false end end end Test code can be written as follows:. IDE support for Stubs Eclipse Eclipse provides support to create test stub methods to test the methods developed during development. We can create the junit test case on a java class. We can then select the methods in the class which we would like to test. This will automatically create test stubs to test those methods. In the figure below we are testing methods of ArrayList class RubyMine The most basic way to create test templates in RubyMine is to use the regular procedure of creating files in the project. This means is both available for both plain Ruby projets,, ir rspec-rails is activated, the usual generators are hidden, and the list of generators includes only those specific for RSpec. Visual Studio Visual Studio is a fine IDE that provides good support for automatically generating stubs for methods. Generate Method Stub is an IntelliSense Automatic Code Generation feature that provides an easy way to have Visual Studio create a new method declaration at the time you are writing a method call. Visual Studio infers the declaration from the call. Some programming styles, such as test-driven development, suggest that you should consume before you define. That way, it is easier to figure out the form of the API that you are developing. You can use IntelliSense to program in that style. Using the Generate Method Stub operation, you avoid defining everything before you consume it. The Generate Method Stub IntelliSense operation can also increase productivity because you do not need to move from the calling code, your present focus, to the defining code, a separate focus, in order to generate a new method. You can instead write a method call, and then invoke the Generate Method Stub operation without dividing your attention. Conclusion We need tests that “run fast, and help us localize problems.” This can be hard to accomplish when your code accesses a database, hits another server, is time-dependent, etc. By substituting custom objects such as stubs for some of your module's dependencies, you can thoroughly test your code, increase your coverage, and still run in less than a second. You can even simulate rare scenarios like database failures and test your error handling code. One cannot rely on the traditional approach and wait for the entire system to be developed before subjecting it to various tests. With the increase in the demand for faster and more accurate software, stubs provide a great mechanism for testing. In general, Stubs greatly increase the speed of running unit tests and provide a means of testing code independently. References - Test Stubs and Mocks - Test Stubs on wikipedia - Test Stub support in RubyMine - Advantages of Stubs - Stubs and Testing - Mocks aren't Stubs - Testing techniques - -
http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2012/ch2a_2w13_sm
CC-MAIN-2017-17
refinedweb
1,482
51.07
This is the fifth part of the "Deploying Django Application on AWS with Terraform" guide. You can check out the previous steps here: - Part 1: Minimal Working Setup - Part 2: Connecting PostgreSQL RDS - Part 3: GitLab CI/CD - Part 4: Namecheap Domain + SSL In this step, we are going to: - Add a Celery + SQS setup for local development. - Create a periodic task using Celery Beat. - Add create an SQS instance on AWS. - Deploy worker and beat ECS services on AWS. About Celery and SQS As docs says: Celery is a simple, flexible, and reliable distributed system to process vast amounts of messages, while providing operations with the tools required to maintain such a system. It’s a task queue with focus on real-time processing, while also supporting task scheduling. So, you can run your long-running, CPU-bound, IO-bound tasks in separate docker containers. Your web server can schedule some tasks, and Celery will pick and execute them. Web server and Celery communicate via some backend. It could be Redis or RabbitMQ. But we use AWS as a cloud provider. So, we can use the SQS backend. Celery docs says: If you already integrate tightly with AWS, and are familiar with SQS, it presents a great option as a broker. It is extremely scalable and completely managed, and manages task delegation similarly to RabbitMQ. You can check more info about SQS here. Local development setup Running SQS locally SQS is a managed solution by AWS. And we could create a separate SQS instance for development purposes. But I want to run all things locally to be able to work without the Internet connection. Also, it's a good practice to run unit and integration tests without Internet access. To run SQS locally, we will use softwaremill/elasticmq-native Docker image. Go to the django-aws-backend folder and add a new service to docker-compose.yml in your Django project: ... services: ... sqs: image: "softwaremill/elasticmq-native:latest" ports: - "9324:9324" - "9325:9325" Run docker-compose up -d to run the SQS container. Then check in your browser to see the SQS management panel. Also, check URL to ensure that SQS API is working. You will see an error XML output like this: <ErrorResponse xmlns=""> <Error> <Type>Sender</Type> <Code>MissingAction</Code> <Message>MissingAction; see the SQS docs.</Message> <Detail/> </Error> <RequestId>00000000-0000-0000-0000-000000000000</RequestId> </ErrorResponse> Now, we are ready to add Celery to our Django project. Adding Celery to Django project Let's add the Celery package to requirements.txt and run pip install -r requirements.txt. Be sure you activated venv before. celery[sqs]==5.2.6 Then, create a new file django_aws/celery.py with the following content: import os from celery import Celery # Set the default Django settings module for the 'celery' program. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_aws.settings") app = Celery("django_aws") # Using a string here means the worker doesn't have to serialize # the configuration object to child processes. # - namespace='CELERY' means all celery-related configuration keys # should have a `CELERY_` prefix. app.config_from_object("django.conf:settings", namespace="CELERY") # Load task modules from all registered Django apps. app.autodiscover_tasks() and add to the django_aws/settings.py these lines: CELERY_BROKER_URL = env("CELERY_BROKER_URL", default="sqs://localhost:9324") CELERY_TASK_DEFAULT_QUEUE = env("CELERY_TASK_DEFAULT_QUEUE", default="default") CELERY_BROKER_TRANSPORT_OPTIONS = { "region": env("AWS_REGION", default="us-east-1") } Here we initialized the Celery app in django_aws/celery.py. We will use this app to specify and schedule tasks for Celery. Also, we provided connection parameters in django_aws/settings.py. As default values, we set our local setup. For production, we can pass parameters via environment variables. Now, we are ready to create and run our first task. Let's create django_aws/tasks.py with the following code: import logging import time from django_aws import celery @celery.app.task() def web_task() -> None: logging.info("Starting web task...") time.sleep(10) logging.info("Done web task.") The web_task will run for 10 seconds and put messages in the log stream at the start and the end of execution. Now, we need to add a way to add this task to the queue. Let's create a django_aws/views.py with the following view: from django.http import HttpResponse from django_aws.tasks import web_task def create_web_task(request): web_task.delay() return HttpResponse("Task added") Add this view to urls.py: ... from django_aws import views urlpatterns = [ ... path('create-task', views.create_web_task), ] ... Now, if we hit URL, the create_web_task view will add a new task to the local SQS. Start the local web server with python manage.py runserver, hit this URL several times, and look at the SQS admin page. So, we successfully add tasks to the queue. Now, let's execute them with celery. Run celery -A django_aws worker --loglevel info to start the worker process. The worker will immediately pick tasks from the queue and execute them: Stop the celery process. If you run into the problem ImportError: The curl client requires the pycurl library, check out my post on StackOverflow Also, we need to add some libraries to Dockerfile for compiling the pycurl in the docker image. Replace Dockerfile with the next one: FROM python:3.10-slim-buster EXPOSE 8000 ENV PYTHONUNBUFFERED 1 ENV PYTHONDONTWRITEBYTECODE 1 ENV DEBIAN_FRONTEND noninteractive RUN apt-get update \ && apt-get --no-install-recommends install -y \ build-essential \ libssl-dev \ libcurl4-openssl-dev \ && rm -rf /var/lib/apt/lists/* RUN pip install --no-cache-dir --upgrade pip RUN pip install gunicorn==20.1.0 COPY requirements.txt / RUN pip install --no-cache-dir -r /requirements.txt WORKDIR /app COPY . /app RUN ./manage.py collectstatic --noinput Adding Celery beat Now, let's create a periodic task using Celery Beat. We will add a simple task like create_web_task and schedule it for execution once a minute. For this, let's add beat_task to tasks.py: @celery.app.task() def beat_task() -> None: logging.info("Starting beat task...") time.sleep(10) logging.info("Done beat task.") Then, add the CELERY_BEAT_SCHEDULE setting in settings.py: from datetime import timedelta ... CELERY_BEAT_SCHEDULE = { "beat_task": { "task": "django_aws.tasks.beat_task", "schedule": timedelta(minutes=1), }, } and run the beat process celery -A django_aws beat --loglevel info. Every minute beat process adds a new task to SQS. Check to see them. Wait for several tasks in queue, stop the beat process and run the worker again celery -A django_aws worker --loglevel info. The worker will process beat_task tasks, and you will see the logs: [2022-08-04 11:13:59,088: INFO/MainProcess] Task django_aws.tasks.beat_task[4189aa07-b75e-4743-94e0-2a0c3b84443a] received [2022-08-04 11:13:59,089: INFO/MainProcess] Task django_aws.tasks.beat_task[0de67363-2e2a-421c-9630-1c6c7c685382] received [2022-08-04 11:13:59,095: INFO/ForkPoolWorker-1] Starting beat task... [2022-08-04 11:13:59,095: INFO/ForkPoolWorker-8] Starting beat task... [2022-08-04 11:14:09,096: INFO/ForkPoolWorker-1] Done beat task. [2022-08-04 11:14:09,096: INFO/ForkPoolWorker-8] Done beat task. [2022-08-04 11:14:09,097: INFO/ForkPoolWorker-1] Task django_aws.tasks.beat_task[0de67363-2e2a-421c-9630-1c6c7c685382] succeeded in 10.002475121000316s: None [2022-08-04 11:14:09,097: INFO/ForkPoolWorker-8] Task django_aws.tasks.beat_task[4189aa07-b75e-4743-94e0-2a0c3b84443a] succeeded in 10.002584206999018s: None So, we successfully run Celery worker and beat processes using local SQS. Let's add the celerybeat-schedule file to .gitignore, commit and push our changes. Ensure that CI/CD passed successfully. We are done with Django part, let's move to the AWS. Deploying to AWS Creating AWS SQS instance and user Move to the django-aws-infrastructure folder, create a sqs.tf file with the following content, and run terraform apply. resource "aws_sqs_queue" "prod" { name = "prod-queue" receive_wait_time_seconds = 10 tags = { Environment = "production" } } resource "aws_iam_user" "prod_sqs" { name = "prod-sqs-user" } resource "aws_iam_user_policy" "prod_sqs" { user = aws_iam_user.prod_sqs.name policy = jsonencode({ Version = "2012-10-17" Statement = [ { Action = [ "sqs:*", ] Effect = "Allow" Resource = "arn:aws:sqs:*:*:*" }, ] }) } resource "aws_iam_access_key" "prod_sqs" { user = aws_iam_user.prod_sqs.name } Here we've created a new SQS instance, a new IAM user, granted access to this SQS instance to this user, and created an IAM Access Key to give access to SQS from Django application. Let's look at the new instance in AWS console: Activating a region Now, let's create an ECS for the Celery worker and beat. First, let's "activate" our region on AWS. For some reason, AWS doesn't allow you to create more than 2 ECS containers in the region. You need to create an EC2 instance in this region to remove this limit. Let's do it manually in EC2 Console. Be sure that you use your AWS region. - Click "Launch Instance" - Pick any name for your instance. I'll go with Test Server - Scroll down to the "Key pair" card and pick "Proceed without a key pair". We won't connect to this server, so we don't need one. Then click "Launch Instance" to create a new instance in your region. AWS will soon create an instance. Go to the Instances tab in EC2 Console and verify that you have 1 "Running" instance. After that, you can terminate the instance because we don't need it. Pick the instance, click the "Instance state", then "Terminate instance", and confirm termination. AWS will permanently remove your EC2 instance. So, now we can create more than two ECS containers. Let's continue creating Celery ECS. Running a Celery via ECS Now, let's define our Celery ECS service. First, add new variables in ecs.tf: locals { container_vars = { ... sqs_access_key = aws_iam_access_key.prod_sqs.id sqs_secret_key = aws_iam_access_key.prod_sqs.secret sqs_name = aws_sqs_queue.prod.name } } and pass it to containers in backend_container.json.tpl: [ { ... "environment": [ ... { "name": "AWS_REGION", "value": "${region}" }, { "name": "CELERY_BROKER_URL", "value": "sqs://${urlencode(sqs_access_key)}:${urlencode(sqs_secret_key)}@" }, { "name": "CELERY_TASK_DEFAULT_QUEUE", "value": "${sqs_name}" } ], ... } ] So, we passed SQS credentials to ECS services. Then, add the following content in ecs.tf and run terraform apply: ... # Cloudwatch Logs ... resource "aws_cloudwatch_log_stream" "prod_backend_worker" { name = "prod-backend-worker" log_group_name = aws_cloudwatch_log_group.prod_backend.name } resource "aws_cloudwatch_log_stream" "prod_backend_beat" { name = "prod-backend-worker" log_group_name = aws_cloudwatch_log_group.prod_backend.name } ... # Worker resource "aws_ecs_task_definition" "prod_backend_worker" { network_mode = "awsvpc" requires_compatibilities = ["FARGATE"] cpu = 256 memory = 512 family = "backend-worker" container_definitions = templatefile( "templates/backend_container.json.tpl", merge( local.container_vars, { name = "prod-backend-worker" command = ["celery", "-A", "django_aws", "worker", "--loglevel", "info"] log_stream = aws_cloudwatch_log_stream.prod_backend_worker_worker" { name = "prod-backend-worker" cluster = aws_ecs_cluster.prod.id task_definition = aws_ecs_task_definition.prod_backend_worker.arn desired_count = } } # Beat resource "aws_ecs_task_definition" "prod_backend_beat" { network_mode = "awsvpc" requires_compatibilities = ["FARGATE"] cpu = 256 memory = 512 family = "backend-beat" container_definitions = templatefile( "templates/backend_container.json.tpl", merge( local.container_vars, { name = "prod-backend-beat" command = ["celery", "-A", "django_aws", "beat", "--loglevel", "info"] log_stream = aws_cloudwatch_log_stream.prod_backend_beat_beat" { name = "prod-backend-beat" cluster = aws_ecs_cluster.prod.id task_definition = aws_ecs_task_definition.prod_backend_beat.arn desired_count = } } Here we created: - Cloudwatch Logs streams for worker and beat. - Worker ECS task definition and ECS service. We specified desired_count=2to show how multiple workers can run for the same queue. In the future we will scale worker ECS depending on CPU load. - Beat ECS task definition and ECS service. Here we specified desired_count=1because we don't want to schedule duplicates for periodic tasks. Let's check our services in the ECS console. Here are our worker and beat service: Here are worker and beat tasks. You can see that ECS creates two tasks for the worker service and only one task for the beat service: Here are worker logs. For now, we see only beat tasks in logs: Let's add a new task from the web. Hit URL (replace a domain with your one). You should see a 'Task added' message in response. Then, return to ECS worker logs, and pick the '30s' interval to see the most recent log events. You should see 'Starting web task' and 'Done web task' messages in the logs. So, we successfully run ECS for worker and beat processes and ensure that both web and beat Celery tasks are executed successfully. We are done with the infrastructure repo so that you can commit and push the changes. Updating deploy There is still one more task. To ensure that we will update our ECS services with every deployment, we need to modify our ./scripts/deploy.sh. Let's add the same instruction as for the web service: ... echo "Updating web..." aws ecs update-service --cluster prod --service prod-backend-web --force-new-deployment --query "service.serviceName" --output json echo "Updating worker..." aws ecs update-service --cluster prod --service prod-backend-worker --force-new-deployment --query "service.serviceName" --output json echo "Updating beat..." aws ecs update-service --cluster prod --service prod-backend-beat --force-new-deployment --query "service.serviceName" --output json echo "Done!" So, we will force a new deployment for the worker and beat services on ECS with every push. Commit and push changes. Wait for CI/CD and check your services in ECS Console. After some time, new tasks will arise: You can schedule more web tasks and see them in logs to ensure that things work as expected. The end Congratulations! We've successfully created an AWS SQS instance and added Celery worker + beat services to ECS. Our Django application can run long-living tasks in the background worker process. You can find the source code of backend and infrastructure projects here and here. If you need technical consulting on your project, check out our website or connect with me directly on LinkedIn. Top comments (1)
https://practicaldev-herokuapp-com.global.ssl.fastly.net/daiquiri_team/deploying-django-application-on-aws-with-terraform-setting-up-celery-and-sqs-38ik
CC-MAIN-2022-40
refinedweb
2,225
52.15
In this Python data visualization tutorial, we will work with Pandas scatter_matrix method to explore trends in data. Previously, we have learned how to create scatter plots with Seaborn and histograms with Pandas, for instance. In this post, we’ll focus on scatter matrices (pair plots) using Pandas. Now, Pandas is using Matplotlib to make the scatter matrix. A scatter matrix (pairs plot) compactly plots all the numeric variables we have in a dataset against each other one. In Python, this data visualization technique can be carried out with many libraries but if we are using Pandas to load the data, we can use the base scatter_matrix method to visualize the dataset. Prerequisites Now, this Python data visualization tutorial will require that we have Pandas and its dependencies installed. It’s very easy to install Pandas. Either we use pip to install Python packages, such as Pandas, or we install a Python distribution (e.g., Anaconda, ActivePython). Here’s how to install Pandas with pip: pip install pandas. Note, if a message that there’s a newer version of pip available check the post about how to upgrade pip. Pandas scatter_matrix Syntax In general, to create a scatter plot matrix with Pandas using the following syntax: pandas.plotting.scatter_matrix(dataframe) Now, there are, of course, a number of parameters we can use (see image below). In this Pandas scatter matrix tutorial, we are going to use hist_kwds, diagonal, and marker to create pair plots in Python. In the first example, however, we use the simple syntax of the scatter_matrix method (as above). Data Simulation using Numpy In this Pandas scatter matrix tutorial, we are going to create fake data to visualize. Here we will use NumPy to create 3 variables (x1, x2, and x3). Specifically, we use the normal method from random: import numpy as np import pandas as pd np.random.seed(134) N = 1000 x1 = np.random.normal(0, 1, N) x2 = x1 + np.random.normal(0, 3, N) x3 = 2 * x1 - x2 + np.random.normal(0, 2, N) Next step, before visualizing the data we create a Pandas dataframe from a dictionary. df = pd.DataFrame({'x1':x1, 'x2':x2, 'x3':x3}) df.head() Now, you can see that we have variables x1, x2, and x3 as columns. Normally, we would import data using Pandas read_csv or Pandas read_excel methods, for instance. See the summary, or the linked blog post, on how to do this. Pandas scatter_matrix (pair plot) Example 1: In the first Pandas scatter_matrix example, we will only use the created dataframe as input. Now, this will create the following pair plot: pd.plotting.scatter_matrix(df) As evident in the scatter matrix above, we are able to produce a relatively complex matrix of scatterplots and histograms using only one single line of code. Now, what does this pairs plot actually contain? - The diagonal shows the distribution of the three numeric variables of our example data. - In the other cells of the plot matrix, we have the scatterplots (i.e. correlation plot) of each variable combination of our dataframe. In the middle graphic in the first row we can see the correlation between x1 & x2. Furthermore, in the right graph in the first row we can see the correlation between x1 & x3; and finally, in the left cell in the second row, we can see the correlation between x1 & x2. In this first example, we just went through the most basic usage of Pandas scatter_matrix method. It’s also possible to do a correlation matrix in Python to examine the correlation coefficients for the variables in a dataset. In the following examples, we are going to modify the pair plot (scatter matrix) a bit… Pandas scatter_matrix (pair plot) Example 2: In the second example, on how to use Pandas scatter_matrix method to create a pair plot, we will use the hist_kwd parameter. Now, this parameter takes a Python dictionary as input. For instance, we can change the number of bins, in the histogram, by adding this to the code: pd.plotting.scatter_matrix(df, hist_kwds={'bins':30}) Refer to the documentation of Pandas hist method for more information about keywords that can be used or check the post about how to make a Pandas histogram in Python. Pandas scatter_matrix (pair plot) Example 3: Now, in the third Pandas scatter matrix example, we are going to plot a density plot instead of a histogram. This is, also, very easy to accomplish. In the code chunk below, we added the diagonal parameter: pd.plotting.scatter_matrix(df, diagonal='kde') As evident, running that code produced a nice scatter matrix (pair plot) with density plots on the diagonal instead of a histogram. Note, that the diagonal parameter takes either “hist” or “kde” as an argument. Thus, if we wanted to have both density and histograms in our scatter matrix, we cannot. Pandas scatter_matrix (pair plot) Example 4: In the fourth Pandas scatter_matrix example, we are going to change the marker. This is accomplished by using the marker parameter: pd.plotting.scatter_matrix(df, marker='+') Scatter Matrix (pair plot) using other Python Packages Now, there are some limitations to Pandas scatter_method. One limitation, for instance, is that we cannot plot both a histogram and the density of our data in the same plot. Another limitation is that we cannot group the data. Furthermore, we cannot plot the regression line in the scatter plot. However, if we use the Seaborn and the pairplot() method we can have more control over the scatter matrix. For instance, we can, using Seaborn pairplot() group the data, among other things. Another option is to use Plotly, to create the scatter matrix. Summary: 3 Simple Steps to Create a Scatter Matrix with Pandas In this post, we have learned how to create a scatter matrix (pair plot) with Pandas. It was super simple and here are three simple steps to use Pandas scatter_matrix method to create a pair plot: Step 1: Load the Needed Libraries In the first step, we will load pandas: import pandas as pd Step 2: Import the Data to Visualize In the second step, we will import data from a CSV file using Pandas read_csv method: csv_file = '' df_s = pd.read_csv(csv_file, index_col=0) df_s.head() Step 3: Use Pandas scatter_matrix Method to Create the Pair Plot In the final step, we create the pair plot using Pandas scatter_matrix method. Note, however, that we use Pandas iloc to select certain columns. pd.plotting.scatter_matrix(df_s.iloc[:, 1:9]) Note, that in the pair plot above, Pandas scatter_matrix only chose the columns that have numerical values (from the ones we selected, of course). Here’s a Jupyter Notebook with all the code in this blog post.
https://www.marsja.se/pandas-scatter-matrix-pair-plot/
CC-MAIN-2020-24
refinedweb
1,118
54.32
). Whenever Python encouters a bug in your code, it will print a list of error messages. This printed statement is known as a traceback. A traceback might look scary to the untrained eye, but it is actually a very useful debugging tool! A sample traceback looks like this: Traceback (most recent call last): File "bug1.py", line 22, in func g = bug() File "bug2.py", line 3, in bug buggy = buggy + 1 NameError: name 'buggy' is not defined A traceback displays all the function calls that led up to the error. You can think of this in terms of an environment diagram where the traceback displays all of the frames that we have created up to this point that have not returned a value. Notice that the message tells you that the "most recent call" is displayed "last", at the bottom of the message. We can think of this "last" call as being the current frame that we are in. You may have noticed that the traceback is organized in "couplets." Each couplet is composed of two lines: the location; and the actual code The location is the first line in the couplet: File "file name", line number, in function name This line provides you with three bits of information: From this line alone, you should be able to locate the line where the error occurs, in case you need reference it in more detail. The second line in the couplet is the code line: line of code here This line allows you to see the piece of code that triggered the error just by looking at the traceback. That way, you can quickly reference the code and guess why the error occured. The very last line in a traceback is the error type: Error type: Error message The error type is usually named to be descriptive (such as SyntaxError or IndexError). The error message is a more detailed (but still brief) description of the error. Now that you know how to read a traceback, you are well-equipped to handle any bugs that come your way. The following are some common bugs that occur frequently (many of you might have seen them before). Try to debug the code! You can copy the starter code (for the debugging and list portions of the lab) into your current directory to produce the traceback. cp ~cs61a/lib/lab/lab04/lab4.py . Feel free to do so, but copying and pasting from a webpage doesn't always yield the results you would expect! def one(mississippi): """ >>> one(1) 1 >>> one(2) 4 >>> one(3) 6 """ if mississippi == 1: return misssissippi elif mississippi == 2: return 2 + mississippi elif mississippi = 3: return 3 + mississippi def two(two): """ >>> two(5) 15 >>> two(6) 18 """ one = two two = three three = one return three + two + one def three(num): """ >>> three(5) 15 >>> three(6) 21 """ i, sum = 0, 0 while num > i: sum += num return sum def four(num): """ >>> four(5) 16 >>> four(6) 32 """ if num == 1: return num return four(num - 1) + four(num) Finally, you should almost always run the doctests we provide you from the terminal, instead of copying and pasting the tests into an interpreter. This avoids typing mistakes, is a lot faster, and achieves the same result. For this example, we are going to be debugging some code that has been given to us, as well as writing some test cases to make sure that the function is doing what we want it to do. Copy the template for this file by running the following from your terminal: cp ~cs61a/lib/lab/lab04/anagrams.py . Let's open the file in your favorite text editor (probably Emacs if you're on the lab machines) and try to understand the code. You do not have to understand how the function remove(letter, word) works; we will learn that later, but you should try to understand what the rest of the functions are doing based off of the docstrings. We're given several functions that will help us find out whether two words are anagrams of one another, that is, we want to know if we can use all the original letters of w1 exactly once to form w2 and vice versa. We can assume that all of the functions written below contains work as described and that they work correctly. Our job is to figure out if the contains function works correctly, and if it does not, fix it so that it does. Let's open our file in an interactive Python session by running: python3 -i anagrams.py Play around with the functions that we gave you and verify that they do indeed work. It also might be a good idea to run our doctests using the command: python3 -m doctest anagrams.py. ********************************************************************** File "./anagrams_bad.py", line 60, in anagrams_bad.anagrams Failed example: anagrams("domo", "doom") # but for the record, Domo is awesome. Expected: True Got: False ********************************************************************** File "./anagrams_bad.py", line 4, in anagrams_bad.contains Failed example: contains("cute", "computer") Expected: True Got: False ********************************************************************** File "./anagrams_bad.py", line 8, in anagrams_bad.contains Failed example: contains("car", "race") Expected: True Got: False ********************************************************************** File "./anagrams_bad.py", line 10, in anagrams_bad.contains Failed example: contains("hi", "high") Expected: True Got: False ********************************************************************** Whoa, we are failing 4 doctests, not good, not good at all. Let's take a closer look at why. In the three doctests for contains, we see that the contains is returning False when it is expecting True. Take a couple of minutes to think of additional test cases that would return False when we expect True and vice versa. Compare test cases with your neighbors to see if there are any that either of you missed. Now that we have found a set of test cases that are yielding incorrect results, we can start to figure out if we need to change existing base cases, add more base cases, or to alter our recursive case(s). Let's take a closer look at our base cases. Our function's base cases only seem to return False! That means that no matter what we input, this function will always return False. That's not what we want. Add a base case that might help alleviate this problem. Hopefully, we found an edge case in the previous exercise and now our function correctly returns the value that we want. However, all 4 of our doctests are still failing! We should take a look at our recursive cases. Remember in recursion, the idea is that we should always be working towards our base case. Otherwise, our function will continuously call itself with the same input causing our function to fall into what we call "infinite recursion". To avoid infinite recursion, always make sure that the input is working towards satisfying the base case. Right now, our function is continuously checking to see if the first letter of w1 is in w2. If it is, we are recursively calling contains while removing the first letter of w1 from w2. Walk through this process using the last doctest, contains("hi", "high"), as an example to see what exactly the code does. Writing out each function call on a piece of paper has been said to help. Are we recursively calling contains with the desired inputs? See if you can fix the recursive case. If you are having trouble, talk with your neighbors or lab assistants to see if they can point you in the right direction. Great, you fixed the recursive case! Let's run the doctests again to make sure everything is passing. Given the following functions first(word), second(word), and rest(word) see if you can define a recursive function count_hi(phrase) that takes in a string of any length and returns the number of times the phrase "hi" appears within. def first(word): return word[0] def second(word): return word[1] def rest(word): return word[1:] Here are some doctests to help you out: >>> count_hi("hihihihi") 4 >>> count_hi("hhjfdkfj") 0 >>> count_hi("") 0 >>> count_hi("hih") 1 Given a function is_vowel(char) that takes in a single character and returns a boolean stating whether or not it is a vowel or not, define a recursive function remove_vowels(word) that removes all vowels from the word. Feel free to use the functions first(word) or rest(word) from the previous problem. def is_vowel(char): return char == 'a' or char == 'e' or char == 'i' or char =='o' or char == 'u' Here are a few doctests to help you out, although, the functionality of this code should be somewhat obvious by the name... >>> remove_vowels("hi my name is mark") 'h my nm s mrk' >>> remove_vowels("aeiou") '' >>> remove_vowels("is y a vowel?") 's y vwl?' By now you're an expert on recursion right? Let's write a recursive function pair_star(phrase) that takes in a phrase and returns the same phrase where identical characters that are adjacent in the original phrase are separated with the character "*". Phrases without identical characters adjacent to one another should just return the original string. You can concatenate two strings together using the "+" operator. For example, "hello" + " " + "world" will yield the result 'hello world' >>> pair_star("hiihhi") 'hi*ih*hi' >>> pair_star("woodlands have squirrels") 'wo*odlands have squir*rels' >>> pair_star("h") 'h'
https://inst.eecs.berkeley.edu/~cs61a/sp13/labs/lab04/lab04.php
CC-MAIN-2018-05
refinedweb
1,550
69.11
This patch fixes a race condition in lseek. While it is expected that unpredictable behaviour may result while repositioning the offset of a file descriptor concurrently with reading/writing to the same file descriptor, this should not happen when merely *reading* the file descriptor's offset. Unfortunately, the only portable way in Unix to read a file descriptor's offset is lseek(fd, 0, SEEK_CUR); however executing this concurrently with read/write may mess up the position, as shown by the testcase below: #include <sys/types.h> #include <stdio.h> #include <pthread.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <pthread.h> void *loop(void *ptr) { fprintf(stderr, "Starting seek thread\n"); while(1) { if(lseek(0, 0LL, SEEK_CUR) < 0LL) perror("seek"); } } int main(int argc, char **argv) { long long l=0; int r; char buf[4096]; pthread_t thread; pthread_create(&thread, 0, loop, 0); for(r=0; 1 ; r++) { int n = read(0, buf, 4096); if(n == 0) break; if(n < 4096) { fprintf(stderr, "Short read %d %s\n", n, strerror(errno)); } l+= n; } fprintf(stderr, "Read %lld bytes\n", l); return 0; } Compile this and run it on a multi-processor machine as ./a.out <bigFile where bigFile is a 1 Gigabyte file. It should print 1073741824. However, on a buggy kernel, it usually produces a bigger number. The problem only happens on a multiprocessor machine. This is because an lseek(fd, 0, SEEK_CUR) running concurrently with a read() or write() will reset the position back to what it used to be when the read() started. This behavior was observed "in the wild" when using udpcast which uses lseek to monitor progress of reading/writing the uncompressed data. The patch below fixes the issue by "special-casing" the lseek(fd, 0, SEEK_CUR) pattern. Apparently, an attempt was already made to fix the issue by the following code: if (offset != file->f_pos) { file->f_pos = offset; file->f_version = 0; } However, this doesn't work if file->f_pos was changed (by read() or write()) between the time offset was computed, and the time where it considers writing it back. Signed-off-by: Alain Knaff <alain@knaff.lu> --- diff -pur kernel.orig/fs/read_write.c kernel/fs/read_write.c --- kernel.orig/fs/read_write.c 2008-10-11 14:12:07.000000000 +0200 +++ kernel/fs/read_write.c 2008-11-06 19:55:59.000000000 +0100 @@ -42,6 +42,8 @@ generic_file_llseek_unlocked(struct file offset += inode->i_size; break; case SEEK_CUR: + if(offset == 0) + return file->f_pos; offset += file->f_pos; } retval = -EINVAL; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email]majordomo@vger.kernel.org[/email] More majordomo info at [url][/url] Please read the FAQ at [url][/url]
http://fixunix.com/kernel/555399-%5Bpatch%5D-vfs-lseek-fd-0-seek_cur-race-condition-print.html
CC-MAIN-2014-41
refinedweb
455
57.16
17 May 2010 09:45 [Source: ICIS news] SINGAPORE (ICIS news)--German producer LANXESS signalled the start of construction of a new €400m ($494m) butyl rubber plant in Singapore, expected to start operations in the first quarter of 2013. The company broke ground at the 200,000 square-meter site in ?xml:namespace> "In terms of volume, this investment is the largest in our five-year history. It underlines our commitment to synthetic rubber as well as to our customers and to the future growth markets in Butyl rubber is used in tire tubes for cars, trucks, bikes, among others; and has special applications in the pharmaceuticals industry. “The neighbouring Shell refinery will ensure a long-term supply of isobutene, the main raw material for the production of synthetic rubber,” LANXESS said in a statement. Dutch energy giant Shell has a 400,000 bbl/day refinery in Pulau Bukom, south of LANXESS, which recently moved its global headquarters for butyl rubber in Its rubber plants
http://www.icis.com/Articles/2010/05/17/9359902/lanxess-starts-construction-of-400m-rubber-plant-in-singapore.html
CC-MAIN-2014-35
refinedweb
165
53.55